/* ============================================================
   AVA — "THE VEIN OF LIGHT" · site stylesheet (theme.css)
   Built 100% on tokens.css custom properties so BOTH themes —
   PORCELAIN (:root, light) + OBSIDIAN ([data-theme="dark"]) —
   work automatically. No hardcoded hex except the three brand
   stops inside shaders (those live in hero3d.js, not here).
   Load order: tokens.css FIRST, then this file.
   ============================================================ */

/* ============================================================
   0 · BASE / RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* ============================================================
   ACCENT PALETTE — tasteful companions to the pink→purple brand,
   readable in BOTH themes. Used sparingly on cards / connectors /
   icon glows / the scroll-driven orb colour-shift.
   ============================================================ */
:root {
  --acc-iris: #6d5efc;   /* indigo-violet */
  --acc-cyan: #22b8cf;   /* teal */
  --acc-gold: #f0a93b;   /* warm gold */
  --acc-rose: #ff5d8f;   /* hot rose */
  --grad-iris:    linear-gradient(135deg, #6d5efc 0%, #a8279a 100%);
  --grad-cyan:    linear-gradient(135deg, #22b8cf 0%, #7e2ea6 100%);
  --grad-sunrise: linear-gradient(135deg, #d6217f 0%, #f0a93b 100%);
  --grad-aurora:  linear-gradient(120deg, #d6217f 0%, #6d5efc 50%, #22b8cf 100%);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Lenis owns smooth scroll; no native scroll-behavior:smooth (it fights Lenis). */
}

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  position: relative;
  /* night<->day melt: CSS cross-fades while hero3d lerps uTheme */
  transition: background-color .4s var(--ease-out), color .4s var(--ease-out);
}

img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
p { margin: 0 0 1em; color: var(--ink-soft); }
p:last-child { margin-bottom: 0; }

::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-radius: var(--r-sub);
}

/* layered content sits above the ambient / orb / filament / grain layers */
.curtain         { z-index: 90; }
.site-nav        { z-index: 60; }
.cursor, .cursor-dot { z-index: 80; }
main, .site-footer { position: relative; z-index: 4; }
.grain           { z-index: 3; }
.filament-layer  { z-index: 2; }
.ava-stage       { z-index: 1; }   /* the full-page WebGL voice presence */
.aurora          { z-index: 0; }

/* ----- the full-page, fixed WebGL voice presence (hero3d.js) -----
   One canvas threads the whole page so the 3D never "stops" at the hero.
   Sits behind all content; content (z4) + filament (z2) draw over it. */
.ava-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* a soft top/bottom vignette so the parked corner orb never fights text */
  -webkit-mask-image: radial-gradient(120% 90% at 50% 38%, #000 60%, rgba(0,0,0,.86) 100%);
          mask-image: radial-gradient(120% 90% at 50% 38%, #000 60%, rgba(0,0,0,.86) 100%);
}
/* WebGL up: hide every CSS .orb fallback site-wide. WebGL down: hide the canvas. */
html.webgl-on .orb       { display: none; }
html.no-webgl .ava-stage { display: none; }

/* ============================================================
   1 · AMBIENT LAYERS — aurora mesh + film grain (theme-aware)
   ============================================================ */
.aurora {
  position: fixed;
  inset: -25vmax;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42vmax 42vmax at 16% 10%, var(--glow), transparent 60%),
    radial-gradient(48vmax 48vmax at 84% 26%, var(--accent-soft), transparent 62%),
    radial-gradient(52vmax 52vmax at 50% 98%, var(--accent-soft), transparent 60%);
  filter: blur(40px) saturate(1.04);
  opacity: 1;
  animation: ava-aurora-drift var(--ambient-loop, 22s) ease-in-out infinite alternate;
  transition: opacity .6s var(--ease-out);
}
/* Porcelain: a RICH but airy daytime aurora — pink/magenta/iris pastel glows so
   the light theme has the same atmospheric gradient depth as Obsidian (just lighter). */
:root:not([data-theme="dark"]) .aurora {
  filter: blur(58px) saturate(1.08);
  opacity: .95;
  background:
    radial-gradient(44vmax 44vmax at 14% 6%,  rgba(214,33,127,.26), transparent 60%),
    radial-gradient(48vmax 48vmax at 88% 16%, rgba(126,46,166,.22), transparent 62%),
    radial-gradient(46vmax 46vmax at 60% 98%, rgba(109,94,252,.20), transparent 60%),
    radial-gradient(38vmax 38vmax at 24% 82%, rgba(214,33,127,.16), transparent 60%);
}
/* a soft vertical wash on the page itself so the bg is never flat near-white */
:root:not([data-theme="dark"]) body {
  background-image: radial-gradient(130vmax 90vmax at 50% -12%, #f9eefb 0%, rgba(249,238,251,0) 55%);
}

@keyframes ava-aurora-drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1.02); }
  100% { transform: translate3d(2%,  2%, 0) scale(1.09); }
}

/* film grain — fixed SVG fractal-noise; heavier in Obsidian (.04) than Porcelain (.02) */
.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
:root:not([data-theme="dark"]) .grain { opacity: .02; mix-blend-mode: multiply; }

/* ----- filament: fixed full-height SVG spine (scroll-progress) ----- */
.filament-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
svg.filament, svg.vein-pulse { position: absolute; inset: 0; width: 100%; height: 100%; }
svg.filament path {
  fill: none;
  stroke: url(#ava-filament-grad);
  stroke-width: 2.4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px var(--glow));
  opacity: .92;
}
:root:not([data-theme="dark"]) svg.filament path { opacity: .8; }

/* a bright light-pulse that travels down the same vein, always alive.
   (its own SVG class so core.js's scroll-draw never touches it) */
svg.vein-pulse path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 46 6000;
  filter: drop-shadow(0 0 8px var(--glow));
  opacity: .95;
  animation: ava-vein-pulse 7.5s linear infinite;
}
svg.vein-pulse path.lag { animation-duration: 11s; animation-delay: -3.4s; opacity: .6; }
@keyframes ava-vein-pulse { from { stroke-dashoffset: 6046; } to { stroke-dashoffset: 0; } }

/* CSS-only filament fallback (when no SVG path / spine survival w/o WebGL) */
.filament-fallback {
  position: fixed;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--accent) 12%, var(--accent-strong) 88%, transparent);
  opacity: .35;
  filter: blur(.4px) drop-shadow(0 0 8px var(--glow));
}

/* lead spark divs lerped along the path by core.js */
.spark {
  position: fixed;
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--faint);
  box-shadow: 0 0 8px rgba(0,0,0,.001);
  z-index: 2;
  pointer-events: none;
  transition: background-color .5s linear, box-shadow .5s linear;
}
.spark.warm { background: var(--accent); box-shadow: 0 0 14px var(--glow); }

/* ============================================================
   2 · TYPOGRAPHY
   ============================================================ */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.0;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.deva { font-family: var(--font-deva); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.grad-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* keep visible if clip unsupported */
  -webkit-text-fill-color: transparent;
}
/* -webkit-background-clip:text only paints the gradient inside the line box, so a
   tight line-height (.display is 1.0) clips glyph descenders — the "g" in "ground"
   and the tail of "y" render transparent. Give gradient text descender room. */
.grad-text { line-height: 1.18; padding-bottom: .12em; }

.lead {
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 60ch;
}

h1.display, .h-hero {
  font-size: clamp(2.6rem, 7vw, 6.5rem);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.0;
}
h2.display, .h-section {
  font-size: clamp(2rem, 5vw, 4rem);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.04;
}

/* custom SplitText: core.js wraps graphemes in .char / words in .word */
.split .char, .split .word { display: inline-block; will-change: transform, opacity, filter; }
.split .char { white-space: pre; }

/* ============================================================
   3 · BUTTON SYSTEM — gradient primary (sheen) + glass ghost
   ============================================================ */
.btn {
  --btn-pad-y: 13px;
  --btn-pad-x: 26px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  min-height: var(--hit-min);
  border: 0;
  border-radius: var(--r-pill);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform .2s var(--ease-out), box-shadow .3s var(--ease-out),
              background-color .3s var(--ease-out), border-color .3s var(--ease-out);
}
.btn:active { transform: scale(var(--press-scale)); }

/* primary: brand gradient + animated sheen sweep */
.btn-primary {
  background: var(--grad-brand);
  color: var(--on-accent, #fff);
  box-shadow: var(--shadow-brand);
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,.45) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform .7s var(--ease-out);
}
.btn-primary:hover { box-shadow: var(--shadow-pop), var(--shadow-brand); transform: translateY(-1px); }
.btn-primary:hover::after { transform: translateX(120%); }

/* ghost: glass, token border, subtle hover lift */
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.btn-sm { --btn-pad-y: 9px; --btn-pad-x: 18px; font-size: 13px; min-height: 38px; }
.btn-lg { --btn-pad-y: 16px; --btn-pad-x: 34px; font-size: 16px; }

/* ============================================================
   4 · GLASS CARD
   ============================================================ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-pop); border-color: var(--border-strong); }
.card-2 { background: var(--surface-2); }
.card-3 { background: var(--surface-3); }

/* hairline gradient edge accent (subtle luxe) */
.card-accent::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-brand);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: .55;
  pointer-events: none;
}

/* the recurring icon node that "lights from the filament" */
.ic {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sub);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color .4s var(--ease-out), border-color .4s var(--ease-out), box-shadow .4s var(--ease-out);
}
.ic.lit { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 18px var(--glow); }

/* ============================================================
   5 · STATUS CHIPS + TRUTH-LAMP
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-chip);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

/* grounded = good (green) */
.chip-grounded {
  color: var(--good);
  background: var(--good-bg);
  border-color: var(--good-line);
}
/* deferred = warn (amber) */
.chip-deferred {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.chip-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.chip-bad  { color: var(--bad);  background: var(--bad-bg);  border-color: var(--bad-line); }

/* trust chips row in the hero */
.trust-chips { display: flex; flex-wrap: wrap; gap: 10px; }

/* the truth-lamp — snaps on grounded (green), forks/dims amber on deferred */
.lamp {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--neutral-bg);
  border: 1px solid var(--neutral-line);
  transition: background-color .3s var(--ease-out), border-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.lamp::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--faint);
  transition: background-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.lamp[data-state="grounded"] {
  background: var(--good-bg);
  border-color: var(--good-line);
  box-shadow: 0 0 14px var(--good-line);
}
.lamp[data-state="grounded"]::after { background: var(--good); box-shadow: 0 0 8px var(--good); }
.lamp[data-state="deferred"] {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  box-shadow: 0 0 14px var(--warn-line);
}
.lamp[data-state="deferred"]::after { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

/* ============================================================
   6 · DEVICE FRAMES — browser frame + phone frame (+ .noimg)
   (matches §8.6 markup contract exactly)
   ============================================================ */

/* ---- desktop browser frame ---- */
.browser-frame {
  margin: 0;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  backdrop-filter: blur(var(--blur-bar));
  -webkit-backdrop-filter: blur(var(--blur-bar));
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
  will-change: transform;
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.browser-bar .dot {
  width: 11px;
  height: 11px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  flex: 0 0 auto;
}
.browser-bar .dot:nth-child(1) { background: var(--bad-line); }
.browser-bar .dot:nth-child(2) { background: var(--warn-line); }
.browser-bar .dot:nth-child(3) { background: var(--good-line); }
.browser-bar .url {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- phone frame (notched) ---- */
.phone-frame {
  position: relative;
  margin: 0;
  width: min(300px, 78vw);
  aspect-ratio: 9 / 19.5;
  border-radius: var(--r-frame);
  padding: 12px;
  background: var(--frame);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
  will-change: transform;
}
.phone-frame .notch {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 38%;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--frame);
  z-index: 3;
}
:root[data-theme="dark"] .phone-frame .notch { background: #080510; }

/* ---- shared .shot (image holder) + .noimg graceful caption ---- */
.shot {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}
.browser-frame .shot { aspect-ratio: 16 / 10; }
.phone-frame   .shot { height: 100%; border-radius: var(--r-screen); }

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* theme-aware screenshot: ship a .dark + .light pair; CSS shows the one matching
   the active data-theme toggle (NOT prefers-color-scheme, so it follows ☀/☾). */
.shot img.theme-img { display: none; }
:root:not([data-theme="dark"]) .shot img.theme-img.light { display: block; }
:root[data-theme="dark"] .shot img.theme-img.dark { display: block; }
/* BROWSER frames: show the FULL theme screenshot — the frame sizes to the image's
   own ratio instead of the fixed 16:10 cover-crop, so nothing is cut off.
   (Phone frames keep object-fit:cover so the screen fills the device.) */
.browser-frame .shot:has(img.theme-img) { aspect-ratio: auto; }
.browser-frame .shot:has(img.theme-img) img.theme-img { width: 100%; height: auto; object-fit: contain; }

/* caption hidden by default; shown over a soft-gradient tile only when .noimg */
.noimg-cap {
  display: none;
  position: absolute;
  inset: 0;
  padding: clamp(18px, 4vw, 28px);
  align-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--grad-soft), var(--surface-2);
  border: 1px dashed var(--border-strong);
}
.shot.noimg img { display: none; }
.shot.noimg .noimg-cap { display: grid; }

/* ============================================================
   7 · THEME-TOGGLE BUTTON
   ============================================================ */
#theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  cursor: pointer;
  backdrop-filter: blur(var(--blur-card));
  -webkit-backdrop-filter: blur(var(--blur-card));
  transition: color .3s var(--ease-out), border-color .3s var(--ease-out), box-shadow .3s var(--ease-out), transform .2s var(--ease-out);
}
#theme-toggle:hover { color: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
#theme-toggle:active { transform: scale(var(--press-scale)); }
#theme-toggle svg { width: 18px; height: 18px; }
/* show the right glyph per theme (markup carries both, CSS reveals one) */
#theme-toggle .glyph-dark  { display: none; }
#theme-toggle .glyph-light { display: block; }
:root[data-theme="dark"] #theme-toggle .glyph-dark  { display: block; }
:root[data-theme="dark"] #theme-toggle .glyph-light { display: none; }

/* ============================================================
   8 · CUSTOM CURSOR (magnetic, mix-blend) — desktop only
   ============================================================ */
.cursor, .cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  border-radius: var(--r-pill);
  mix-blend-mode: difference;
  will-change: transform;
}
.cursor {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1.5px solid #fff;
  transition: width .25s var(--ease-out), height .25s var(--ease-out), margin .25s var(--ease-out), background-color .25s var(--ease-out);
}
.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: #fff;
}
.cursor.is-hover { width: 56px; height: 56px; margin: -28px 0 0 -28px; background: rgba(255,255,255,.12); }
.cursor.is-down  { transform: scale(.8); }

/* hide system cursor only where the custom one runs */
body.has-cursor { cursor: none; }
body.has-cursor a, body.has-cursor button, body.has-cursor [data-magnetic] { cursor: none; }

@media (hover: none), (pointer: coarse) {
  .cursor, .cursor-dot { display: none !important; }
  body.has-cursor { cursor: auto; }
}

/* ============================================================
   9 · REVEAL SYSTEM — [data-reveal] hidden -> .in (static-safe)
   visible-but-shifted at rest; lands final on .in. NEVER pure
   opacity:0 with no failsafe (core.js force-adds .in @ 1800ms).
   ============================================================ */
[data-reveal] {
  opacity: .001;            /* near-zero, not 0 — survives even if observer never fires after failsafe forces .in */
  transform: translate3d(0, var(--enter-rise, 18px), 0);
  transition:
    opacity .7s var(--ease-out),
    transform .8s var(--ease-out),
    filter .8s var(--ease-out);
  filter: blur(6px);
  will-change: opacity, transform, filter;
}
[data-reveal].in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0);
}
[data-reveal][data-reveal-delay="1"].in { transition-delay: .08s; }
[data-reveal][data-reveal-delay="2"].in { transition-delay: .16s; }
[data-reveal][data-reveal-delay="3"].in { transition-delay: .24s; }
[data-reveal][data-reveal-delay="4"].in { transition-delay: .32s; }

/* sideways variants */
[data-reveal="left"]  { transform: translate3d(calc(-1 * var(--enter-rise, 18px)), 0, 0); }
[data-reveal="right"] { transform: translate3d(var(--enter-rise, 18px), 0, 0); }
[data-reveal="left"].in, [data-reveal="right"].in { transform: translate3d(0, 0, 0); }

/* ============================================================
   10 · NAV
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(22px, 6vw, 90px);
  transition: background-color .35s var(--ease-out), border-color .35s var(--ease-out), padding .35s var(--ease-out), backdrop-filter .35s var(--ease-out);
  border-bottom: 1px solid transparent;
}
/* frosts on first scroll (core.js toggles .scrolled) */
.site-nav.scrolled {
  background: var(--surface);
  border-bottom-color: var(--border);
  backdrop-filter: blur(var(--blur-bar)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--blur-bar)) saturate(1.1);
  padding-top: 12px;
  padding-bottom: 12px;
}

.nav-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; font-size: 19px; }
/* Eduvy droplet mark — a mini-echo of the core */
.nav-brand .droplet {
  width: 22px;
  height: 22px;
  border-radius: 60% 60% 60% 0;
  transform: rotate(45deg);
  background: var(--grad-brand);
  box-shadow: 0 0 12px var(--glow);
}
:root[data-theme="dark"] .nav-brand .droplet { animation: ava-pulse var(--ambient-loop, 22s) ease-in-out infinite; }
@keyframes ava-pulse { 0%,100% { box-shadow: 0 0 8px var(--glow); } 50% { box-shadow: 0 0 18px var(--glow); } }

.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-size: 14px; color: var(--ink-soft); transition: color .25s var(--ease-out); position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -5px; height: 1.5px; width: 0; background: var(--grad-brand); transition: width .3s var(--ease-out); }
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 12px; }

/* hairline scroll-progress fill on the top edge */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--grad-brand);
  z-index: 61;
  pointer-events: none;
}
/* mono section readout, bottom corner (e.g. 02 / 12) */
.scroll-readout {
  position: fixed;
  right: clamp(16px, 4vw, 40px);
  bottom: 20px;
  z-index: 50;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--muted);
  pointer-events: none;
}

@media (max-width: 860px) {
  .nav-links { display: none; }
}

/* ============================================================
   10b · MOBILE NAV — hamburger menu + stacked brand (≤860px)
   ============================================================ */
.nav-burger { display: none; }
.nav-links .nav-menu-cta { display: none; }   /* CTA clone shows only inside the mobile panel */

@media (max-width: 860px) {
  /* the burger replaces the inline "Book a demo" once JS wires the menu */
  .site-nav.nav-js .nav-actions .btn-primary { display: none; }
  .site-nav.nav-js .nav-burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 11px; flex: 0 0 auto;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
    cursor: pointer; transition: border-color .25s var(--ease-out);
  }
  .site-nav.nav-js .nav-burger span {
    display: block; width: 100%; height: 2px; border-radius: 2px; background: var(--ink);
    transition: transform .25s var(--ease-out), opacity .2s var(--ease-out);
  }
  .site-nav.nav-js.menu-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-nav.nav-js.menu-open .nav-burger span:nth-child(2) { opacity: 0; }
  .site-nav.nav-js.menu-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* dropdown panel — stays closed by default even against the base .nav-links flex */
  .site-nav .nav-links { display: none; }
  .site-nav.menu-open .nav-links {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    padding: 6px clamp(20px, 6vw, 90px) 18px;
    background: var(--surface); border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border); box-shadow: var(--shadow-pop);
  }
  .site-nav.menu-open .nav-links a {
    padding: 14px 2px; font-size: 17px; color: var(--ink-soft);
    border-bottom: 1px solid var(--border);
  }
  .site-nav.menu-open .nav-links a:hover { color: var(--ink); }
  .site-nav.menu-open .nav-links .nav-menu-cta {
    display: inline-flex; justify-content: center; align-items: center;
    margin-top: 14px; padding: 13px 20px; border-bottom: 0;
    color: #fff; -webkit-text-fill-color: #fff; font-size: 15px;
  }

  /* brand: drop "by Eduvy" below AVA, smaller, capitalised ("By Eduvy") */
  .site-nav .nav-brand, .site-nav .brand { flex-wrap: wrap; row-gap: 0; line-height: 1.04; }
  .site-nav .nav-brand small, .site-nav .brand small {
    flex-basis: 100%; margin-left: 32px; margin-top: 1px;
    font-size: 10px; letter-spacing: .06em; text-transform: capitalize;
  }
}

/* remove the decorative vein / "stream" line on touch (mobile) */
@media (pointer: coarse) {
  .filament-layer { display: none !important; }
  .stream-spine, .flow-dot { display: none !important; }
}

/* ============================================================
   11 · SECTION LAYOUT UTILITIES (blueprint-referenced)
   ============================================================ */
section {
  position: relative;
  padding: clamp(80px, 13vh, 160px) clamp(22px, 6vw, 90px);
}
.wrap { max-width: 1280px; margin-inline: auto; }
.wrap-narrow { max-width: 880px; margin-inline: auto; }

.section-head { max-width: 64ch; margin-bottom: clamp(40px, 6vh, 72px); }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.04;
  font-size: clamp(2rem, 5vw, 4rem);
  margin: 18px 0 22px;
}

/* hero stage — holds the WebGL canvas + the .orb CSS fallback */
.hero-stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.hero-content { position: relative; z-index: 2; text-align: center; padding-inline: clamp(22px, 6vw, 90px); }
/* legacy in-hero canvas (if any page still ships it) — neutralised; the live
   canvas is the fixed full-page .ava-stage now. */
#ava-hero-canvas { display: none; }

/* ---- CSS fallback core (.orb) — beautiful, never a black hole ---- */
.orb {
  position: absolute;
  top: 50%; left: 50%;
  width: clamp(220px, 34vw, 460px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: var(--r-pill);
  z-index: 0;                 /* sits behind canvas; canvas covers it when WebGL ok */
  background:
    radial-gradient(circle at 36% 32%, rgba(255,255,255,.85), transparent 38%),
    conic-gradient(from 210deg, var(--pink), var(--magenta), var(--purple), var(--pink));
  box-shadow: 0 0 90px var(--glow), inset 0 0 60px rgba(255,255,255,.12);
  animation: ava-orb-breathe 8s var(--ease-out) infinite alternate, ava-orb-spin var(--ambient-loop, 22s) linear infinite;
  will-change: transform, filter;
}
.orb::before {
  content: "";
  position: absolute;
  inset: -14%;
  border-radius: inherit;
  background: var(--grad-brand);
  filter: blur(48px);
  opacity: .55;
  z-index: -1;
}
.orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.06) 0 6deg, transparent 6deg 12deg);
  mix-blend-mode: overlay;
  opacity: .5;
}
:root:not([data-theme="dark"]) .orb { filter: saturate(.85); }
@keyframes ava-orb-breathe { 0% { transform: translate(-50%,-50%) scale(1); } 100% { transform: translate(-50%,-50%) scale(1.06); } }
@keyframes ava-orb-spin    { to  { rotate: 360deg; } }

/* horizontal-scroll track (platform pipeline, language marquee, galleries) */
.h-track {
  display: flex;
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
  will-change: transform;
}
.pin-stage { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; }

/* sticky-stacking cards (Meet AVA) */
.stack { position: relative; }
.stack .card { position: sticky; top: 14vh; }

/* marquee (languages) */
.marquee { display: flex; gap: clamp(24px, 4vw, 64px); white-space: nowrap; will-change: transform; }
.marquee .lang { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 3.4rem); color: var(--ink); opacity: .35; transition: opacity .3s var(--ease-out); }
.marquee .lang.lit { opacity: 1; background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }

/* waveform (the live grounded call) */
.waveform { display: flex; align-items: center; gap: 4px; height: 120px; }
.waveform .bar { flex: 0 0 auto; width: 5px; border-radius: var(--r-pill); background: var(--grad-brand); transform-origin: 50% 50%; }

/* transcript bubbles */
.bubble { max-width: 60ch; padding: 14px 18px; border-radius: var(--r-card); background: var(--surface-2); border: 1px solid var(--border); }
.bubble.student { border-bottom-left-radius: var(--r-chip); }
.bubble.ava { border-bottom-right-radius: var(--r-chip); margin-left: auto; }

/* hero stat / big mono counters (outcomes) */
.stat-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(3rem, 9vw, 7rem); line-height: 1; color: var(--ink); }
.stat-num.grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }

/* CTA demo form on glass */
.form-field {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-sub);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font: inherit;
  transition: border-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.form-field::placeholder { color: var(--faint); }
.form-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ============================================================
   12 · PAGE-TRANSITION CURTAIN
   ============================================================ */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--grad-brand);
  transform: translateY(0);          /* covers on load; core.js wipes it away */
  pointer-events: none;
  will-change: transform;
}
/* default resting (post-intro) state = wiped away upward */
.curtain.cleared { transform: translateY(-100%); }
/* out-transition floods up from the bottom before navigation */
.curtain.flooding { transform: translateY(0); transition: transform .55s var(--ease-out); }

/* ============================================================
   13 · FOOTER — instrument baseplate
   ============================================================ */
.site-footer {
  position: relative;
  z-index: 6;                         /* paints cleanly OVER the fixed orb canvas + vein */
  padding: clamp(56px, 9vh, 110px) clamp(22px, 6vw, 90px) 48px;
  border-top: 1px solid var(--border);
  /* OPAQUE baseplate: an opaque base + the surface tint. No backdrop-filter —
     blurring the constantly-repainting fixed WebGL canvas/vein behind it made
     the footer flicker/glitch on scroll. Opaque = nothing composites through. */
  background-color: var(--bg);
  background-image: linear-gradient(var(--surface-2), var(--surface-2));
  isolation: isolate;
}
.footer-grid { display: flex; flex-wrap: wrap; gap: 32px 64px; justify-content: space-between; max-width: 1280px; margin-inline: auto; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.footer-links a { font-size: 14px; color: var(--muted); transition: color .25s var(--ease-out); }
.footer-links a:hover { color: var(--ink); }
.footer-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.footer-meta {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: .04em;
  max-width: 1280px;
  margin-inline: auto;
}
/* filament terminates as a single resting dot */
.footer-dot { width: 10px; height: 10px; border-radius: var(--r-pill); background: var(--grad-brand); box-shadow: 0 0 14px var(--glow); display: inline-block; }

/* ---- platform / counsellor footer + nav-brand (these pages use .foot-* /
   .brand* class names that were never styled — the broken footer fix) ---- */
.site-footer .foot-brand {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--ink);
}
.foot-brand small { font-family: var(--font-mono); font-size: 13px; color: var(--faint); font-weight: 400; }
.foot-tag {
  width: 100%; margin: 14px 0 0;
  font-family: var(--font-display); font-weight: 500; color: var(--ink-soft);
  font-size: clamp(1.5rem, 3.4vw, 2.4rem); letter-spacing: -.01em;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 30px 0 0; }
.foot-links a { font-size: 14px; color: var(--muted); transition: color .25s var(--ease-out); }
.foot-links a:hover { color: var(--ink); }
.foot-meta {
  margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px; color: var(--faint); letter-spacing: .04em;
}

/* nav-brand alias used on platform/counsellor (.brand / .brand-droplet) */
.site-nav .brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.01em; color: var(--ink); }
.brand small { font-family: var(--font-mono); font-size: 12px; color: var(--faint); font-weight: 400; }
.brand-droplet { width: 22px; height: 22px; border-radius: 60% 60% 60% 0; transform: rotate(45deg); background: var(--grad-brand); box-shadow: 0 0 12px var(--glow); display: inline-block; flex: 0 0 auto; }
:root[data-theme="dark"] .brand-droplet { animation: ava-pulse var(--ambient-loop, 22s) ease-in-out infinite; }

/* theme-toggle glyphs on platform/counsellor use .i-sun/.i-moon (no .glyph-*) */
#theme-toggle .i-moon { display: none; }
#theme-toggle .i-sun  { display: block; }
:root[data-theme="dark"] #theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] #theme-toggle .i-sun  { display: none; }

/* ============================================================
   14 · REDUCED-MOTION + NOSCRIPT FAILSAFES (mandatory)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  /* land every reveal final, no shift/blur */
  [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
  .aurora, .orb, .nav-brand .droplet { animation: none !important; }
  .cursor, .cursor-dot { display: none !important; }
  /* curtain never traps */
  .curtain { transform: translateY(-100%) !important; }
}

/* JS-off: <noscript> in each page injects this class on <html> via a
   sibling <style>, but we also harden here so content is fully visible. */
.no-js [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; }
.no-js .curtain { display: none !important; }
.no-js .aurora { animation: none; }

/* ============================================================
   15 · SMALL UTILITIES
   ============================================================ */
.center { text-align: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.flex { display: flex; }
.col { flex-direction: column; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.wrap-flex { flex-wrap: wrap; }
.grid { display: grid; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid[class*="cols-"] { gap: clamp(16px, 2.4vw, 28px); }
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.hidden { display: none; }

@media (max-width: 920px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   16 · ACCENT MAPPING — [data-accent] sets a local accent + gradient
   so any component can tint itself from the companion palette.
   ============================================================ */
[data-accent="cyan"]  { --ac: var(--acc-cyan);  --acg: var(--grad-cyan);    --ac-soft: rgba(34,184,207,.18); }
[data-accent="gold"]  { --ac: var(--acc-gold);  --acg: var(--grad-sunrise); --ac-soft: rgba(240,169,59,.18); }
[data-accent="rose"]  { --ac: var(--acc-rose);  --acg: var(--grad-brand);   --ac-soft: rgba(255,93,143,.18); }
[data-accent="iris"]  { --ac: var(--acc-iris);  --acg: var(--grad-iris);    --ac-soft: rgba(109,94,252,.18); }
[data-accent="brand"] { --ac: var(--accent);    --acg: var(--grad-brand);   --ac-soft: var(--accent-soft); }

/* a reusable accented icon node (replaces the flat .ic where we want colour) */
.glow-ic {
  display: inline-grid; place-items: center;
  width: 50px; height: 50px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--ac, var(--accent)); font-size: 21px;
  box-shadow: 0 0 0 4px var(--ac-soft, var(--accent-soft)), 0 0 22px var(--ac-soft, var(--glow));
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out);
}
.card:hover .glow-ic { transform: translateY(-2px); box-shadow: 0 0 0 5px var(--ac-soft, var(--accent-soft)), 0 0 30px var(--ac, var(--glow)); }

/* a thin accent edge across the top of a card. Shown by default; when the card
   is also a [data-reveal], it stays hidden and DRAWS across when the card lands. */
.accent-edge { position: relative; overflow: hidden; }
.accent-edge::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--acg, var(--grad-brand)); transform: scaleX(1); transform-origin: 0 50%;
  transition: transform .8s var(--ease-out) .1s;
}
[data-reveal].accent-edge::before { transform: scaleX(0); }
[data-reveal].accent-edge.in::before { transform: scaleX(1); }

/* ============================================================
   17 · STREAM-FLOW — a vertical "vein" that literally connects content
   nodes (used on home command-center + the platform pipeline restructure).
   ============================================================ */
.stream-flow { position: relative; margin-top: clamp(36px, 6vh, 72px); }
.stream-spine {
  position: absolute; left: 50%; top: 8px; bottom: 8px; width: 3px;
  transform: translateX(-50%); border-radius: 3px; background: var(--border); overflow: hidden;
}
.stream-spine-fill {
  position: absolute; inset: 0; border-radius: inherit;
  background: var(--grad-aurora); transform: scaleY(0); transform-origin: 50% 0;
  box-shadow: 0 0 12px var(--glow);
}
.flow-node { position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: center; margin: clamp(16px, 3vh, 30px) 0; }
.flow-card { grid-column: 1; margin-right: clamp(34px, 5vw, 80px); }
.flow-node.right .flow-card { grid-column: 2; margin-right: 0; margin-left: clamp(34px, 5vw, 80px); }
.flow-dot {
  position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--surface); border: 2px solid var(--ac, var(--accent));
  box-shadow: 0 0 0 5px var(--ac-soft, var(--accent-soft)), 0 0 16px var(--ac, var(--accent));
  z-index: 2; transition: transform .5s var(--ease-out);
}
.flow-dot.in { transform: translate(-50%, -50%) scale(1); }

.flow-card { position: relative; overflow: hidden; }
.flow-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--acg, var(--grad-brand)); opacity: .95; }
.flow-ic {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ac, var(--accent));
  font-size: 21px; margin-bottom: 14px; box-shadow: 0 0 0 4px var(--ac-soft, var(--accent-soft));
}
.flow-title { font-size: clamp(1.2rem, 2.3vw, 1.6rem); margin-bottom: 10px; }
.flow-card p { color: var(--ink-soft); }
.flow-card p:last-child { margin-bottom: 0; }
.flow-meta { margin-top: 14px; font-size: 12px; color: var(--muted); letter-spacing: .02em; }

/* LEFT-RAIL variant — full-width content cards on a left spine (platform pipeline) */
.stream-flow.left-rail .stream-spine { left: 22px; transform: none; }
.stream-flow.left-rail .flow-node { grid-template-columns: 1fr; }
.stream-flow.left-rail .flow-card,
.stream-flow.left-rail .flow-node.right .flow-card { grid-column: 1; margin: 0 0 0 clamp(46px, 6vw, 68px); }
.stream-flow.left-rail .flow-dot { left: 22px; top: 40px; }
.stream-flow.left-rail .flow-card .eyebrow { margin-bottom: 14px; }
.stream-flow.left-rail .flow-title { font-size: clamp(1.45rem, 2.8vw, 2.3rem); margin-bottom: 16px; }
.stream-flow.left-rail .flow-card > p { font-size: 15.5px; }
.station-keep { margin-top: 22px; }

/* content "surface" cards (platform — the four extra surfaces, no screenshots) */
.surfaces-grid { align-items: stretch; }
.surface { display: flex; flex-direction: column; }
.surface .glow-ic { margin-bottom: 14px; }
.surface .tile-h { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 10px; }
.surface .tile-meta { margin-top: auto; padding-top: 14px; font-size: 12px; line-height: 1.6; }

/* the kept command-center dashboard */
.command-shot { max-width: 900px; margin: clamp(28px, 5vh, 52px) auto 0; }
.command-cta { margin-top: clamp(34px, 6vh, 60px); }

/* horizontal "gate" connector behind the grounding 4-step (draws L->R) */
.gate-track { position: relative; }
.gate-beam {
  position: absolute; left: 8%; right: 8%; top: 46px; height: 3px;
  background: var(--border); border-radius: 3px; overflow: hidden; z-index: 0;
}
.gate-beam-fill {
  position: absolute; inset: 0; border-radius: inherit;
  background: var(--grad-aurora); transform: scaleX(0); transform-origin: 0 50%;
  box-shadow: 0 0 12px var(--glow);
}
.gate-track .grounding-steps { position: relative; z-index: 1; }
@media (max-width: 920px) { .gate-beam { display: none; } }

@media (max-width: 780px) {
  .stream-spine { left: 14px; }
  .flow-node { grid-template-columns: 1fr; }
  .flow-card, .flow-node.right .flow-card { grid-column: 1; margin: 0 0 0 42px; }
  .flow-dot { left: 14px; top: 30px; }
}

/* ============================================================
   18 · ADAPTIVE TEXT CONTRAST — words flip to white + a dark halo
   where the bright orb passes behind them (adaptive.js toggles
   .ink-over per word). Readable over any part of the orb, both themes.
   ============================================================ */
.aw { display: inline; }
.aw, .split-char { transition: color .14s linear, text-shadow .14s linear; }
.aw.ink-over, .split-char.ink-over {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;   /* override any gradient/clipped fill */
  /* crisper + stronger halo: a tight dark outline plus a soft drop, so white reads
     over bright magenta AND over the pale-pink glow at the orb's edge */
  text-shadow:
    0 0 1px rgba(0,0,0,.92),
    0 0 4px rgba(0,0,0,.72),
    0 1px 3px rgba(0,0,0,.6);
}
/* Light theme HEADLINE: big display glyphs settle to a deep plum ink with a
   bright halo — they keep the dark-on-light reading of the light theme and still
   cut cleanly across the saturated orb. Body text is handled separately below. */
:root:not([data-theme="dark"]) .split-char.ink-over {
  color: #2c0f44 !important;
  -webkit-text-fill-color: #2c0f44 !important;
  text-shadow:
    0 0 1px rgba(255,255,255,.96),
    0 0 6px rgba(255,255,255,.9),
    0 1px 3px rgba(255,255,255,.72);
}
/* Light theme BODY: small running text turns muddy with the soft-halo plum, so
   running words over the orb get a crisp caption-style treatment instead — kept
   between sentinels so it can be tuned independently of the headline. */
/* --- ADAPTIVE-BODY-LIGHT START --- */
/* Trial: white body ink with a black halo — the white strokes carry the figure
     while a tight dark outline rings them so they stay legible across both the
     saturated orb core and the pale-pink orb edge. */
:root:not([data-theme="dark"]) .aw.ink-over {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-shadow: 0 0 1px rgba(0,0,0,.96), 0 0 4px rgba(0,0,0,.9), 0 1px 3px rgba(0,0,0,.72);
}
/* --- ADAPTIVE-BODY-LIGHT END --- */

/* ============================================================
   19 · MOBILE OPTIMISATION (≤600px) — tighten the vertical rhythm so
   phones don't scroll forever, while keeping the premium spacing feel.
   Scoped ENTIRELY to ≤600px; desktop/tablet (>600px) is untouched.
   ============================================================ */
@media (max-width: 600px) {
  /* kill horizontal scroll: the full-bleed FIXED decorative layers (aurora glow,
     WebGL canvas, filament, grain) are pinned to the viewport and overshoot it,
     and body's overflow-x doesn't contain fixed children — so clip at the root. */
  html { overflow-x: hidden; }

  /* the single biggest scroll-saver: section vertical padding ~110px -> ~44px */
  section { padding: 44px 20px; }

  /* let single-column grids shrink to the viewport (1fr = minmax(auto,1fr) would
     otherwise grow to a wide child's min-content and clip headings off-screen) */
  .flow-node { grid-template-columns: minmax(0, 1fr); }
  .flow-card { min-width: 0; }

  /* hero stays immersive but not a tall screen of mostly air; reserve clearance
     for the fixed nav (~62px) so the centred hero eyebrow/headline never rides up
     UNDER the header on phones */
  .hero-stage { min-height: 84vh; padding-top: 88px; }

  /* hero-stage's auto grid column grew to the HEADLINE's max-content and clipped
     it on phones — cap the column to the viewport (minmax(0,1fr)) and stretch the
     content to fill it so the headline wraps instead of being cut off. */
  .hero-stage { grid-template-columns: minmax(0, 1fr); }
  .hero-content { justify-self: stretch; width: 100%; max-width: 100%; }
  .hero-content h1, .h-hero { overflow-wrap: break-word; }
  .site-nav .btn { white-space: nowrap; }
  /* wide tracking overflows long eyebrows on narrow screens — tighten + allow wrap */
  .eyebrow { letter-spacing: .14em; flex-wrap: wrap; }

  /* section heads: less air + a touch smaller display type */
  .section-head { margin-bottom: 24px; }
  .section-head h2,
  h2.display, .h-section { font-size: clamp(1.7rem, 7.4vw, 2.15rem); }

  /* cards: trim padding and tighten the stacked-gap rhythm */
  .card { padding: 18px; }
  .grid, .grid[class*="cols-"] { gap: 14px; }

  /* lead paragraphs + transcript bubbles a little more compact */
  .lead { font-size: 16px; line-height: 1.5; }
  .bubble { font-size: 14px; padding: 12px 15px; }

  /* stream-flow: shrink gaps between steps + card padding */
  .stream-flow { margin-top: 26px; }
  .flow-node { margin: 13px 0; }
  .flow-card { padding: 16px; }
  .flow-title { font-size: 1.2rem; margin-bottom: 8px; }
  .stream-flow.left-rail .flow-title { font-size: 1.3rem; margin-bottom: 10px; }
  .stream-flow.left-rail .flow-card,
  .stream-flow.left-rail .flow-node.right .flow-card { margin-left: 40px; }

  /* big mono counters a touch smaller */
  .stat-num { font-size: clamp(2.4rem, 14vw, 3.2rem); }

  /* device mockups: smaller so a single screenshot doesn't eat a whole screen */
  .phone-frame { width: min(220px, 62vw); padding: 10px; }

  /* footer: tighter */
  .site-footer { padding: 44px 20px 32px; }
}

/* ============================================================
   20 · TOUCH-DEVICE PERFORMANCE (pointer: coarse) — phones/tablets only.
   backdrop-filter blur recomposited over the constantly-repainting fixed
   WebGL canvas every scroll frame is a top cause of mobile scroll-jank.
   Drop it on touch GPUs and lean on more-opaque surfaces instead. Desktop
   (fine pointer) keeps the full frosted-glass treatment unchanged.
   ============================================================ */
@media (pointer: coarse) {
  .card, .card-2, .card-3, .browser-frame, .browser-bar,
  .site-nav, .nav-inner, .how-step, .station, .tile, .mode-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* dark-theme surfaces are translucent and relied on the blur to frost the
     canvas behind them — make them more opaque so they stay clean without it */
  :root[data-theme="dark"] {
    --surface:   rgba(31,24,48,.88);
    --surface-2: rgba(41,32,61,.86);
    --surface-3: rgba(53,41,77,.84);
  }

  /* during the scroll gesture (core.js marks <html>.ava-scrolling) freeze the
     animated fixed/background layers so the compositor only moves static
     textures — this is what keeps native scroll buttery on phones */
  html.ava-scrolling svg.vein-pulse path,
  html.ava-scrolling .aurora,
  html.ava-scrolling .orb { animation-play-state: paused; }

  /* cut the idle paint/composite cost of the decorative layers on touch GPUs:
     filtered full-page SVGs, the orb's heavy blur/overlay, the aurora drift, and
     the grain's blend-mode read-back are the remaining per-frame mobile cost. */
  svg.filament path, svg.vein-pulse path { filter: none !important; }
  .orb::before { filter: blur(22px) !important; }
  .orb::after  { display: none !important; }
  .orb { will-change: auto !important; box-shadow: 0 0 50px var(--glow) !important; }
  .aurora { filter: blur(24px) saturate(1.04) !important; animation: none !important; }
  :root:not([data-theme="dark"]) .aurora { filter: blur(30px) saturate(1.08) !important; }
  .grain { mix-blend-mode: normal !important; opacity: .03 !important; }
  .browser-frame, .phone-frame, .how-step { will-change: auto !important; }
  /* hero3d.js no longer loads on touch, so the WebGL canvas is an unused empty
     fixed layer — drop it entirely; the CSS .orb fallback is the mobile hero. */
  .ava-stage { display: none !important; }
}
