/* Experience homepage. One fixed WebGL canvas (the particles) behind a column of scrolling chapters.
   Each chapter is a glass panel floating over the swarm. Dark by design: additive-blended light on near-black. */
:root {
  --bg: #05070c;
  --ink: #eef1f7;
  --ink-2: #a9b1c3;
  --ink-3: #79839a;
  --line: rgb(255 255 255 / 0.1);
  --panel: rgb(8 11 18 / 0.66);
  --accent: #8c98ff;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 5vw, 72px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.125rem/1.6 var(--f-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration-color: rgb(255 255 255 / 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -0.035em; }
p { margin: 0; }
.mono { font-family: var(--f-mono); }
.skip { position: fixed; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ---------- the stage ---------- */
#stage { position: fixed; inset: 0; z-index: 0; background: radial-gradient(120% 90% at 65% 40%, #0b1020 0%, #05070c 60%); }
#gl { width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(110% 90% at 50% 45%, transparent 55%, rgb(0 0 0 / 0.55) 100%); }
#grain { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
#progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; pointer-events: none; }
#progress i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: background-color .6s ease; }
#loading { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--bg); transition: opacity .8s ease, visibility .8s; }
#loading p { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
#loading.done { opacity: 0; visibility: hidden; }
.no-js #loading, .no-gl #loading { display: none; }
.no-gl #stage { background: radial-gradient(90% 70% at 70% 30%, #16204a 0%, #05070c 70%); }
.no-gl #gl, .no-gl #rail, .no-gl #hud { display: none; }

/* ---------- chrome ---------- */
#topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  padding: 18px var(--gutter); background: linear-gradient(180deg, rgb(5 7 12 / 0.95) 0%, rgb(5 7 12 / 0.8) 55%, transparent); pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { font: 700 1.05rem/1 var(--f-display); letter-spacing: -0.02em; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.brand i { width: 11px; height: 11px; background: var(--accent); border-radius: 3px; transform: rotate(45deg); transition: background-color .6s ease; }
#topbar nav { display: flex; gap: 6px 22px; flex-wrap: wrap; font: 500 0.78rem/1 var(--f-mono); letter-spacing: 0.02em; }
#topbar nav a { text-decoration: none; color: var(--ink-2); padding: 6px 0; }
#topbar nav a:hover { color: var(--ink); }
#topbar nav a.quiet { color: var(--ink-3); border-left: 1px solid var(--line); padding-left: 18px; }
#rail { position: fixed; right: clamp(10px, 2vw, 26px); top: 50%; transform: translateY(-50%); z-index: 20; display: flex; flex-direction: column; gap: 12px; }
#rail button { position: relative; width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 1.5px solid rgb(255 255 255 / 0.4); background: transparent; cursor: pointer; transition: transform .25s ease, background-color .25s ease, border-color .25s ease; }
#rail button:hover { transform: scale(1.35); border-color: var(--ink); }
#rail button.on { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }
#rail button span { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 500 0.7rem/1 var(--f-mono); letter-spacing: 0.04em; color: var(--ink); background: rgb(8 11 18 / 0.85); padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
#rail button:hover span, #rail button:focus-visible span { opacity: 1; }
#hud { position: fixed; left: var(--gutter); bottom: 22px; z-index: 20; display: flex; gap: 14px; align-items: baseline; font: 500 0.72rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); pointer-events: none; }
#hud #hudNum { color: var(--accent); transition: color .6s ease; }

/* ---------- chapters ---------- */
main { position: relative; z-index: 5; }
.chapter { min-height: 108vh; display: flex; align-items: center; padding: 14vh var(--gutter) 12vh; }
.chapter:first-child { min-height: 100vh; }
.chapter:last-child { min-height: 100vh; }
.panel { width: min(36rem, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: clamp(22px, 3.2vw, 44px);
  backdrop-filter: blur(14px) saturate(1.25); -webkit-backdrop-filter: blur(14px) saturate(1.25); box-shadow: 0 30px 80px rgb(0 0 0 / 0.35); display: flex; flex-direction: column; gap: 20px; }
.panel.hero { width: min(44rem, 100%); background: linear-gradient(180deg, rgb(8 11 18 / 0.5), rgb(8 11 18 / 0.35)); }
.tag { margin: 0; font: 500 0.72rem/1.4 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 10px; }
.tag i { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); flex: none; box-shadow: 0 0 12px var(--accent); transition: background-color .6s ease, box-shadow .6s ease; }
h1 { font-size: clamp(2.7rem, 7.4vw, 5.6rem); line-height: 0.94; font-weight: 750; }
h1 em { font-style: normal; color: transparent; background: linear-gradient(100deg, #8c98ff, #ff7a45); -webkit-background-clip: text; background-clip: text; }
h2 { font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1; font-weight: 700; }
.lede { font-size: clamp(1.1rem, 1.7vw, 1.3rem); line-height: 1.55; color: var(--ink-2); }
.lede strong { color: var(--ink); font-weight: 500; }
.sub { color: var(--ink-2); }
.panel > p:not(.tag):not(.lede):not(.sub):not(.cue):not(.foot) { color: var(--ink-2); font-size: 1.06rem; }
.cta, .links { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 0.92rem/1 var(--f-display); padding: 14px 20px; border-radius: 999px; border: 1.5px solid rgb(255 255 255 / 0.55); color: var(--ink); text-decoration: none; transition: transform .2s ease, background-color .2s ease, border-color .2s ease; }
.btn:hover { transform: translateY(-2px); border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #05070c; transition: background-color .6s ease, transform .2s ease; }
.cue { font-size: 0.72rem; letter-spacing: 0.06em; color: var(--ink-3); line-height: 1.7; }
.cue b { color: var(--accent); display: inline-block; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }
.show-touch { display: none; }
@media (hover: none) { .hide-touch { display: none; } .show-touch { display: inline; } }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font: 500 0.7rem/1 var(--f-mono); padding: 8px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: rgb(255 255 255 / 0.03); }
.links a { font: 600 0.95rem/1.3 var(--f-display); color: var(--accent); text-decoration: none; transition: color .6s ease; }
.links a:not(.btn):hover { text-decoration: underline; }
.essays { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.essays li { border-bottom: 1px solid var(--line); }
.essays a { display: grid; gap: 5px; padding: 18px 0; text-decoration: none; transition: transform .25s ease; }
.essays a:hover { transform: translateX(6px); }
.essays .meta { font: 500 0.68rem/1 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.essays b { font: 650 1.3rem/1.15 var(--f-display); letter-spacing: -0.02em; transition: color .2s ease; }
.essays a:hover b { color: var(--accent); }
.essays .dek { color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; }
.topics { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.topics li { background: rgb(8 11 18 / 0.85); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.topics b { font: 650 0.98rem/1.25 var(--f-display); }
.topics span { font-size: 0.9rem; line-height: 1.4; color: var(--ink-2); }
.foot { font-size: 0.7rem; line-height: 1.6; color: var(--ink-3); letter-spacing: 0.03em; }

/* reveal: only when JS is running, so the page is fully readable without it */
.js .panel > * { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.js .chapter.in .panel > * { opacity: 1; transform: none; }
.js .chapter.in .panel > *:nth-child(2) { transition-delay: .08s; }
.js .chapter.in .panel > *:nth-child(3) { transition-delay: .16s; }
.js .chapter.in .panel > *:nth-child(4) { transition-delay: .24s; }
.js .chapter.in .panel > *:nth-child(5) { transition-delay: .32s; }
.js .chapter.in .panel > *:nth-child(n+6) { transition-delay: .4s; }
.js .chapter.gone .panel > * { opacity: 0.0; transform: translateY(-16px); }

@media (max-width: 860px) {
  #rail { display: none; }
  .chapter { align-items: flex-end; padding-top: 30vh; padding-bottom: 8vh; min-height: 105vh; }
  .chapter:first-child { align-items: flex-end; padding-top: 30vh; padding-bottom: 6vh; }
  .panel { background: rgb(8 11 18 / 0.78); }
  #hud { display: none; }
  .topics { grid-template-columns: 1fr; }
  #topbar nav a:not(.quiet) { display: none; }
  #topbar nav a.quiet { border: 0; padding-left: 0; }
}
@media (max-height: 640px) { #hud { display: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .panel > * { transition: none; opacity: 1; transform: none; }
  .cue b { animation: none; }
}
