/* ──────────────────────────────────────────────────────────────────────────
   innerpulse · carbon glass
   Shared by www.innerpulse.net and the portfolio at /portfolio/ (which links this file at /assets/css/glass.css),
   after tokens.css. Two things live here and nowhere else:

   1. The ambient layer: what the glass has behind it. Slow fog in the ground's tones with one family accent
      (--accent), and a reading of the portfolio drawn across the ground: one mirrored bar per project, its height
      the project's commits, the tallest in the middle of the run. glass.js draws it and passes the beat through it as light; the bars themselves never
      move. Ember stays out of it (innerpulse-brand, references/atmosphere.md).
   2. Frost: every pane of glass blurs what is behind it (--frost) under the sheen, the lip and the shade.

   Everything here stops under prefers-reduced-motion: the fog holds still and the reading is drawn once, unlit.
────────────────────────────────────────────────────────────────────────── */

.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }
.ambient-fog { position: absolute; inset: 0; transform: scale(1.4); } /* 1.4: the fog runs 20% past every edge; a transform, not a negative inset, so it never counts as a layout shift */
.ambient-fog i { position: absolute; border-radius: 50%; will-change: transform; }
.ambient-fog i:nth-child(1) { left: 46%; top: 2%; width: 58%; height: 70%; background: radial-gradient(closest-side, var(--fog-1), transparent); animation: fog-a 46s ease-in-out infinite alternate; }
.ambient-fog i:nth-child(2) { left: 8%; top: 38%; width: 50%; height: 62%; background: radial-gradient(closest-side, var(--fog-2), transparent); animation: fog-b 54s ease-in-out infinite alternate; }
/* the one family accent, faint */
.ambient-fog i:nth-child(3) { left: 58%; top: 34%; width: 40%; height: 52%; background: radial-gradient(closest-side, var(--accent), transparent); opacity: .16; animation: fog-c 40s ease-in-out infinite alternate; transition: background 1.2s; }
@keyframes fog-a { to { transform: translate3d(-9%, 6%, 0) scale(1.12); } }
@keyframes fog-b { to { transform: translate3d(12%, -8%, 0) scale(.92); } }
@keyframes fog-c { to { transform: translate3d(-14%, -10%, 0) scale(1.18); } }
/* the reading. glass.js reads its two colors from here: `color` is a bar at rest, `outline-color` a lit one */
/* grain over the fog: a soft radial step lands on whole 8-bit levels and draws faint rings (banding), plainest on
   paper. A still, mid-gray grain blended in overlay dithers them away: it lifts and lowers by a level or two and
   leaves the ground's own color where it was. It sits after the ambient layer, under the page */
body:has(> .ambient)::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 180px 180px; mix-blend-mode: overlay; opacity: .8; }
.ambient-reading { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--amb-bar); outline: 0 solid var(--amb-lit); opacity: 0; transition: opacity 1.6s ease-out; }
.ambient-reading.on { opacity: 1; }
.ip-paused .ambient-fog i { animation-play-state: paused; }

/* frost: glass blurs what is behind it. Browsers without backdrop-filter get the denser fill instead */
.glass, .frost { -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass-bg: var(--glass-bg-solid); }
}

/* a soft light under the pointer on a pane (glass.js sets --mx / --my on [data-glow]) */
[data-glow] { position: relative; }
[data-glow]::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--sheen-top), transparent 65%); }
[data-glow]:hover::after { opacity: 1; }
[data-glow] > * { position: relative; z-index: 1; } /* a pane's content sits above its light */

/* a pane that leans toward the pointer (glass.js sets --rx / --ry on [data-tilt]) */
[data-tilt] { transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s cubic-bezier(.16, 1, .3, 1); transform-style: preserve-3d; }

@media (prefers-reduced-motion: reduce) {
  .ambient-fog i { animation: none; }
  .ambient-reading { transition: none; }
  [data-tilt] { transform: none; }
}
@media print { .ambient, body:has(> .ambient)::after { display: none; } }
