/* Geode demo page. Tokens first; everything else reads them. --accent and --glow follow the
 * light preset (the script sets them); --v is each chapter's visibility (0..1). */
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/dm-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
:root {
  --bg: #07060b; --ink: #f3eefa; --soft: #cfc6dc; --muted: #9d94ad; --line: rgba(255, 255, 255, .12);
  --accent: #c9a4ff; --glow: #a65cff;
  --display: "Space Grotesk", system-ui, sans-serif; --body: "DM Sans", system-ui, sans-serif;
  --pad: clamp(16px, 5vw, 72px);
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
::selection { background: var(--accent); color: #0b0612; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 20; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

/* ---------- the stage: poster first, WebGL fades in over it ---------- */
.stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.stage .poster, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .poster { object-fit: cover; object-position: 62% 50%; transition: opacity 1.2s var(--ease); }
.stage canvas { opacity: 0; transition: opacity 1.2s var(--ease); }
.g-live .stage canvas { opacity: 1; }
.g-live .stage .poster { opacity: 0; }
.g-nogl .stage canvas { display: none; }
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(6, 4, 12, .58) 0%, rgba(6, 4, 12, .26) 32%, rgba(6, 4, 12, 0) 52%); }
.g-hot, .g-hot body { cursor: pointer; }

/* ---------- header, rail, dock ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 28px; padding: 18px var(--pad); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 600 22px/1 var(--display); letter-spacing: -.02em; text-decoration: none; }
.brand svg { width: 22px; height: 22px; color: var(--accent); filter: drop-shadow(0 0 8px var(--glow)); }
.links { display: flex; gap: 26px; margin-left: auto; font: 500 15px var(--display); letter-spacing: .01em; }
.links a { text-decoration: none; color: var(--soft); padding: 12px 0; transition: color .3s; }
.links a:hover { color: var(--ink); }
.cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; font: 600 15px var(--display); text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); backdrop-filter: blur(12px); transition: background .3s, box-shadow .3s; }
.cta:hover { background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px var(--accent); }

.rail { position: fixed; right: var(--pad); top: 50%; transform: translateY(-50%); z-index: 9; display: flex; gap: 14px; }
.rail-track { position: relative; width: 1px; background: var(--line); }
.rail-track span { position: absolute; inset: 0; background: linear-gradient(var(--accent), var(--glow)); transform-origin: top; transform: scaleY(0); box-shadow: 0 0 10px var(--glow); }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rail a { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--muted); font: 500 13px/1 var(--display); letter-spacing: .04em; transition: color .4s; }
.rail a b { font-weight: 500; font-variant-numeric: tabular-nums; opacity: .7; }
.rail a span { opacity: 0; transform: translateX(-6px); transition: opacity .4s, transform .4s var(--ease); }
.rail:hover a span, .rail a:focus-visible span, .rail a[aria-current] span { opacity: 1; transform: none; }
.rail a[aria-current] { color: var(--ink); }
.rail a[aria-current] b { color: var(--accent); opacity: 1; }

.dock { position: fixed; right: var(--pad); bottom: 22px; z-index: 9; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 999px; background: rgba(12, 10, 18, .55); box-shadow: inset 0 0 0 1px var(--line); backdrop-filter: blur(14px); }
.dock { display: none; }
.g-js .dock { display: flex; }
.presets { display: flex; }
.presets button { width: 44px; height: 44px; border: 0; padding: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.presets button::before { content: ""; width: 16px; height: 16px; transform: rotate(45deg); border-radius: 3px; background: linear-gradient(135deg, #fff 0%, var(--c) 45%, #000 140%); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); transition: transform .4s var(--ease), box-shadow .4s; }
.presets button[aria-pressed="true"]::before { transform: rotate(45deg) scale(1.25); box-shadow: 0 0 0 2px var(--ink), 0 0 14px var(--c); }
.sound { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--soft); font: 500 14px var(--display); cursor: pointer; }
.sound svg { width: 20px; height: 20px; }
.sound .w { opacity: .25; transition: opacity .3s; }
.sound[aria-pressed="true"] { color: var(--ink); background: rgba(255, 255, 255, .12); }
.sound[aria-pressed="true"] .w { opacity: 1; }

/* ---------- chapters ---------- */
.journey { position: relative; z-index: 1; }
.ch { min-height: 175vh; display: flex; align-items: center; padding: 0 var(--pad); }
.ch-0 { min-height: 100vh; min-height: 100svh; }
.ch-in { position: relative; max-width: 35rem; text-shadow: 0 1px 24px rgba(4, 2, 10, .85), 0 0 2px rgba(4, 2, 10, .6); }
.ch-3, .ch-4 { padding-top: 44vh; }
.ch-3 h2, .ch-4 h2 { font-size: clamp(34px, 4.1vw, 62px); }
.g-js .ch-in { opacity: var(--v, 1); transform: translateY(calc((1 - var(--v, 1)) * 28px)); transition: opacity .25s linear; will-change: opacity, transform; }
.kicker { margin: 0 0 20px; display: flex; align-items: center; gap: 12px; font: 500 14px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.kicker b { font-weight: 500; letter-spacing: .04em; color: var(--ink); opacity: .55; }
.kicker::after { content: ""; width: 56px; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); }
h1, h2 { margin: 0 0 22px; font-family: var(--display); font-weight: 500; letter-spacing: -.035em; text-wrap: balance; }
h1 { font-size: clamp(42px, 6.4vw, 96px); line-height: .98; }
h2 { font-size: clamp(36px, 5vw, 76px); line-height: 1; }
.ch p { margin: 0 0 18px; color: var(--soft); font-size: clamp(17px, 1.35vw, 20px); max-width: 30rem; }
.ch .lede { font-size: clamp(19px, 1.6vw, 23px); color: var(--ink); }
.cue { display: flex; align-items: center; gap: 14px; margin-top: 44px !important; font: 500 13px var(--display) !important; letter-spacing: .18em; text-transform: uppercase; color: var(--muted) !important; }
.cue span { position: relative; width: 1px; height: 44px; background: var(--line); overflow: hidden; }
.cue span::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--accent); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { to { top: 100%; } }

.facets { list-style: none; margin: 28px 0 26px; padding: 0; display: grid; gap: 2px; }
.facets li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 16px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--line); }
.facets h3 { margin: 0; font: 500 21px/1.2 var(--display); letter-spacing: -.01em; color: var(--ink); }
.facets p { margin: 0 !important; font-size: 17px !important; }
.try { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 15px !important; color: var(--muted) !important; }
.ring, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border-radius: 999px; border: 0; font: 600 16px var(--display); text-decoration: none; cursor: pointer; color: var(--ink); background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .24); backdrop-filter: blur(10px); transition: background .3s, box-shadow .3s, transform .3s var(--ease); text-shadow: none; }
.ring:hover, .btn:hover { background: rgba(255, 255, 255, .13); box-shadow: inset 0 0 0 1px var(--accent); transform: translateY(-1px); }
.btn.primary { color: #0c0714; background: linear-gradient(180deg, #fff, var(--accent)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5), 0 10px 40px -8px var(--glow); }
.btn.primary:hover { background: #fff; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px !important; }
.figures { display: flex; gap: 36px; margin: 30px 0 0; }
.figures div { border-top: 1px solid var(--line); padding-top: 12px; }
.figures dt { font: 500 13px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.figures dd { margin: 4px 0 0; font: 400 clamp(36px, 4vw, 54px)/1 var(--display); letter-spacing: -.04em; color: var(--ink); }

/* ---------- after the journey ---------- */
.faq { position: relative; z-index: 2; padding: 22vh var(--pad) 80px; background: linear-gradient(to bottom, transparent, var(--bg) 18vh); }
.faq h2 { max-width: 880px; margin-left: auto; margin-right: auto; }
.faq details { max-width: 880px; margin: 0 auto; border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; font: 500 clamp(18px, 1.6vw, 22px)/1.3 var(--display); letter-spacing: -.01em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 300 28px/1 var(--display); color: var(--accent); transition: transform .4s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 24px; max-width: 44rem; color: var(--soft); }
.foot { position: relative; z-index: 2; background: var(--bg); padding: 40px var(--pad) 120px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.foot p { margin: 0; }
.foot-brand { font: 600 18px var(--display); color: var(--ink); }
.foot-brand span { font: 400 15px var(--body); color: var(--muted); }
.foot a { color: var(--soft); text-underline-offset: 4px; display: inline-flex; align-items: center; min-height: 44px; }
.foot a:hover { color: var(--ink); }

@media (max-width: 1080px) {
  .links { display: none; }
  .cta { margin-left: auto; }
}
@media (max-width: 760px) {
  body { font-size: 17px; }
  .top { padding: 12px 16px; gap: 12px; }
  .cta { padding: 0 16px; font-size: 14px; }
  .rail { top: 0; right: 0; left: 0; transform: none; height: 2px; pointer-events: none; }
  .rail ol { display: none; }
  .rail-track { width: 100%; height: 2px; }
  .rail-track span { transform: scaleX(var(--g-p, 0)) !important; transform-origin: left; }
  .ch { min-height: 160vh; padding: 26vh 16px 0; }
  .ch-0 { min-height: 100svh; align-items: flex-end; padding: 0 16px 15vh; }
  .ch-3, .ch-4 { padding-top: 38vh; }
  .stage::after { background: linear-gradient(0deg, rgba(6, 4, 12, .78) 0%, rgba(6, 4, 12, .35) 42%, rgba(6, 4, 12, 0) 62%); }
  .ch-in { max-width: none; }
  h1 { font-size: clamp(38px, 11vw, 56px); }
  h2 { font-size: clamp(32px, 9.5vw, 48px); }
  .facets { margin: 18px 0 16px; }
  .facets li { grid-template-columns: 1fr; gap: 0; padding: 8px 0; }
  .facets p { font-size: 15px !important; }
  .figures { gap: 20px; }
  .dock { left: 16px; right: 16px; bottom: max(12px, env(safe-area-inset-bottom)); justify-content: space-between; }
  .foot { padding-bottom: 110px; }
  .stage .poster { object-position: 66% 40%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .g-js .ch-in { opacity: 1; transform: none; }
}
