/* ==========================================================================
   AEGIS · The Last Antibiotic
   Palette pulled from the artwork: deep river teal, AEGIS aqua glow,
   marigold gold and resistance magenta.
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #061412;
  --bg-2: #0b1f1c;
  --ink: #eef3ea;
  --muted: #a7b9b0;
  --aqua: #5ff3d6;
  --gold: #f6c56b;
  --magenta: #ff5fae;
  --line: rgba(215, 241, 220, .14);
  --glass: rgba(14, 38, 34, .55);
  --display: "Fraunces", Georgia, serif;
  --ui: "Space Grotesk", system-ui, sans-serif;
  --wrap: min(100% - 2 * clamp(1.1rem, 5vw, 6rem), 1400px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
/* Slow aurora behind everything: two blurred radial gradients drifting */
body::before { content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 35% at 20% 20%, rgba(95, 243, 214, .10), transparent 70%),
              radial-gradient(35% 30% at 80% 70%, rgba(255, 95, 174, .08), transparent 70%),
              radial-gradient(30% 30% at 60% 10%, rgba(246, 197, 107, .07), transparent 70%);
  animation: aurora 24s ease-in-out infinite alternate; }
@keyframes aurora { to { transform: translate3d(4%, -3%, 0) rotate(6deg); } }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }
.accent { color: var(--gold); }
.muted { color: var(--muted); }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 50; padding: .8rem 1rem; color: var(--bg); background: var(--gold); }
.skip-link:focus { top: 1rem; }
.kicker { margin: 0 0 .7rem; color: var(--aqua); font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }

/* ---------- Opening curtain (pure CSS, ~1.4s) ---------- */
.curtain { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--bg); pointer-events: none; animation: curtain 1.4s .5s var(--ease) forwards; }
.curtain span { font-size: 4rem; color: var(--aqua); text-shadow: 0 0 40px var(--aqua); animation: shield 1s var(--ease); }
@keyframes curtain { to { clip-path: circle(0% at 50% 50%); visibility: hidden; } }
@keyframes shield { from { transform: scale(.4); opacity: 0; } }

/* ---------- Header ---------- */
.site-header { position: fixed; inset: 0 0 auto; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3.5rem); background: linear-gradient(var(--bg), transparent); }
.references-page .site-header { position: relative; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 700; letter-spacing: .14em; }
.brand-mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 1px solid rgba(95, 243, 214, .5); border-radius: 50%; color: var(--aqua); box-shadow: 0 0 18px rgba(95, 243, 214, .35); }
.brand small { display: block; margin-top: .15rem; color: var(--muted); font-size: .55rem; letter-spacing: .18em; }
.site-nav { display: flex; align-items: center; gap: clamp(.8rem, 2.5vw, 2rem); font-size: .78rem; font-weight: 600; }
.site-nav a { padding: .6rem 0; text-decoration: none; color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); }
.sound-toggle { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 99px; background: var(--glass); color: var(--ink); font: inherit; cursor: pointer; backdrop-filter: blur(10px); }
.sound-toggle:hover { border-color: var(--aqua); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 2px; height: 3px; background: var(--aqua); border-radius: 2px; }
.sound-toggle[aria-pressed="true"] .eq i { animation: eq .9s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -.3s !important; } .eq i:nth-child(3) { animation-delay: -.6s !important; } .eq i:nth-child(4) { animation-delay: -.15s !important; }
@keyframes eq { to { height: 12px; } }

.progress-track { position: fixed; z-index: 40; top: 0; width: 100%; height: 3px; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--aqua), var(--gold), var(--magenta)); box-shadow: 0 0 12px var(--aqua); }
.chapter-nav { position: fixed; z-index: 20; right: clamp(.5rem, 1.6vw, 1.6rem); top: 50%; display: flex; flex-direction: column; gap: .7rem; transform: translateY(-50%); }
.chapter-nav a { position: relative; width: 22px; height: 14px; display: grid; place-items: center; text-decoration: none; }
.chapter-nav a::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #6d8a7f; transition: .3s var(--ease); }
.chapter-nav a:hover::after, .chapter-nav a.active::after { background: var(--aqua); transform: scale(2); box-shadow: 0 0 10px var(--aqua); }
.chapter-nav span { position: absolute; right: 28px; opacity: 0; font-size: .7rem; color: var(--aqua); transition: opacity .2s; }
.chapter-nav a:hover span, .chapter-nav a:focus-visible span, .chapter-nav a.active span { opacity: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .95rem 1.4rem; border: 1px solid var(--line); border-radius: 99px; font: 600 .95rem var(--ui); color: var(--ink); background: var(--glass); text-decoration: none; cursor: pointer; backdrop-filter: blur(10px); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.btn:hover { transform: translateY(-2px); border-color: var(--aqua); box-shadow: 0 10px 30px -10px rgba(95, 243, 214, .6); }
.btn-primary { color: #04110f; background: linear-gradient(120deg, var(--aqua), #b6f7a8); border-color: transparent; }
.btn-danger { color: #fff; background: linear-gradient(120deg, #d43c87, var(--magenta)); border-color: transparent; }
.btn-danger:hover { box-shadow: 0 10px 30px -10px var(--magenta); }
.btn[disabled] { opacity: .5; cursor: wait; transform: none; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: grid; align-items: center; padding: 7rem clamp(1.1rem, 6vw, 6rem) 4rem; overflow: hidden; isolation: isolate; }
.hero-canvas, .finale-canvas { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(70% 60% at 30% 50%, transparent, var(--bg) 95%); pointer-events: none; }
.hero-inner { max-width: 1100px; }
.eyebrow { color: var(--aqua); font-size: .78rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.eyebrow span { color: var(--muted); margin: 0 .5rem; }
.hero-title { margin: .2em 0 .25em; font: 300 clamp(3.4rem, 12vw, 10.5rem)/.88 var(--display); letter-spacing: -.035em; }
.hero-title .accent { display: block; font-style: italic; font-weight: 500; background: linear-gradient(100deg, var(--gold), #ffe6b0 40%, var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(246, 197, 107, .25)); }
.hero-title.split-done .accent { background: none; color: var(--gold); }
.split .char { display: inline-block; opacity: 0; transform: translateY(.6em) rotate(6deg); filter: blur(8px); animation: char .9s var(--ease) forwards; }
@keyframes char { to { opacity: 1; transform: none; filter: none; } }
.hero-sub { max-width: 40ch; margin: 0 0 1rem; font: 300 clamp(1.3rem, 2.6vw, 2rem)/1.3 var(--display); color: #dfe8e0; }
.hero-sub em { color: var(--aqua); }
.hero-place { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-size: .9rem; letter-spacing: .08em; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 0 0 var(--magenta); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(255, 95, 174, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 95, 174, 0); } }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.6rem, 2vw, 1.4rem); max-width: 860px; margin: 2.4rem 0; }
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 18px; background: var(--glass); backdrop-filter: blur(12px); }
.stat dd { margin: 0; font: 500 clamp(2.4rem, 6vw, 4.4rem)/1 var(--display); color: var(--gold); font-variant-numeric: tabular-nums; }
.stat dt { margin-top: .5rem; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.stat.danger dd { color: var(--magenta); text-shadow: 0 0 24px rgba(255, 95, 174, .5); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.doomsday { position: absolute; right: clamp(1rem, 6vw, 7rem); bottom: clamp(2rem, 10vh, 7rem); width: clamp(110px, 15vw, 200px); text-align: center; color: var(--magenta); font: 600 .8rem var(--ui); letter-spacing: .2em; opacity: .85; }
.doomsday svg { width: 100%; overflow: visible; filter: drop-shadow(0 0 14px rgba(255, 95, 174, .45)); }
.doomsday circle { fill: rgba(6, 20, 18, .6); stroke: var(--magenta); stroke-width: 1.5; }
.doomsday .ticks line { stroke: rgba(255, 95, 174, .6); stroke-width: 1.2; }
.doomsday line { stroke-linecap: round; transform-origin: 60px 60px; }
.hand-h { stroke: var(--ink); stroke-width: 3; transform: rotate(-1deg); }
.hand-s { stroke: var(--magenta); stroke-width: 1.4; transition: transform .25s cubic-bezier(.4, 2.3, .6, 1); }

.paradox { width: var(--wrap); max-width: 1100px; margin: 0 auto; padding: clamp(5rem, 12vw, 11rem) 0; text-align: center; }
.paradox p { margin: 0 auto; font: 300 clamp(1.8rem, 4.4vw, 3.8rem)/1.15 var(--display); }
.paradox strong { font-weight: 500; color: var(--magenta); font-style: italic; }
.paradox-small { margin-top: 2rem !important; max-width: 46ch; font-size: clamp(1.1rem, 1.8vw, 1.45rem) !important; color: var(--muted); font-family: var(--ui) !important; line-height: 1.6 !important; }

/* ---------- Chapters ---------- */
.chapter { width: var(--wrap); margin: 0 auto; padding: clamp(4rem, 9vw, 8rem) 0 clamp(2rem, 5vw, 4rem); scroll-margin-top: 4rem; }
.chapter-head { display: flex; align-items: flex-end; gap: clamp(1rem, 3vw, 2.5rem); margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.chapter-num { font: 200 clamp(4.5rem, 13vw, 11rem)/.75 var(--display); color: transparent; -webkit-text-stroke: 1px rgba(95, 243, 214, .55); }
.chapter-title { margin: 0; font: 400 clamp(2rem, 5vw, 4.4rem)/1 var(--display); letter-spacing: -.02em; }
.chapter-art, .interlude { position: relative; margin: 0 0 clamp(2.5rem, 5vw, 4.5rem); overflow: hidden; border-radius: clamp(14px, 2vw, 28px); background: var(--bg-2); box-shadow: 0 40px 120px -40px rgba(0, 0, 0, .9), 0 0 0 1px var(--line); clip-path: inset(8% 8% 8% 8% round 28px); transition: clip-path 1.2s var(--ease); }
.chapter-art.in, .interlude.in { clip-path: inset(0 0 0 0 round 28px); }
.chapter-art img, .interlude img { display: block; width: 100%; height: auto; transform: scale(1.12); transition: transform 1.6s var(--ease); }
.chapter-art.in img, .interlude.in img { transform: scale(1); animation: kenburns 22s 1.6s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.06) translate(-1%, -1%); } }
/* Light sweep across artwork as it arrives */
.chapter-art::after, .interlude::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, .18) 50%, transparent 60%); transform: translateX(-100%); pointer-events: none; }
.chapter-art.in::after, .interlude.in::after { animation: sweep 1.8s .5s var(--ease); }
@keyframes sweep { to { transform: translateX(100%); } }
.interlude { width: var(--wrap); margin: 0 auto clamp(3rem, 6vw, 6rem); }
.script { max-width: 760px; margin: 0 auto; color: #d3dfd7; font-size: clamp(1.12rem, 1.6vw, 1.4rem); line-height: 1.7; }
.script p { margin: 0 0 1.1em; transition: color .4s, opacity .9s var(--ease), transform .9s var(--ease); }
.script p:first-child { font: 400 clamp(1.8rem, 3.2vw, 2.8rem)/1.2 var(--display); color: #f6f3e7; }
.script strong { color: var(--gold); font: 500 clamp(1.6rem, 3vw, 2.4rem)/1.25 var(--display); }
.script em { color: var(--muted); }
.script p.speaking { color: var(--aqua); text-shadow: 0 0 22px rgba(95, 243, 214, .35); }
.js .script p.pending { opacity: 0; transform: translateY(22px); }

/* Generic scroll reveal */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Interactive modules ---------- */
.module { width: var(--wrap); margin: clamp(2rem, 6vw, 5rem) auto clamp(4rem, 8vw, 7rem); padding: clamp(1.4rem, 4vw, 3.5rem); border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(160deg, rgba(95, 243, 214, .06), rgba(255, 95, 174, .04)), var(--glass); backdrop-filter: blur(14px); }
.module-head { max-width: 760px; margin-bottom: 2rem; }
.module-head h2 { margin: 0 0 .6rem; font: 400 clamp(1.8rem, 3.6vw, 3rem)/1.08 var(--display); }
.module-head p:not(.kicker) { margin: 0; color: var(--muted); line-height: 1.6; }
.fineprint { margin: 1.4rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }

.sim { display: grid; gap: 1.2rem; }
.sim-canvas { width: 100%; height: auto; aspect-ratio: 900 / 380; border-radius: 18px; background: radial-gradient(circle at 50% 50%, #0f3a38, #071a18); box-shadow: inset 0 0 60px rgba(0, 0, 0, .6); }
.sim-controls, .pipe-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.sim-readout, .pipe-status { margin: 0 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.sim-readout strong { color: var(--magenta); font-size: 1.3rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.card { position: relative; padding: 1.5rem; border: 1px solid var(--line); border-radius: 20px; background: rgba(6, 20, 18, .55); overflow: hidden; transition: transform .35s var(--ease), border-color .35s; }
.card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(95, 243, 214, .18), transparent 60%); opacity: 0; transition: opacity .3s; }
.card:hover, .card:focus-visible { transform: translateY(-6px); border-color: rgba(95, 243, 214, .5); }
.card:hover::before, .card:focus-visible::before { opacity: 1; }
.card-icon { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 14px; background: rgba(95, 243, 214, .12); color: var(--aqua); font-size: 1.4rem; }
.card h3 { margin: 1rem 0 .4rem; font: 500 1.25rem var(--display); }
.card p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }

.pipeline { display: grid; gap: 1.6rem; }
.pipe-track { position: relative; height: 14px; border-radius: 99px; background: linear-gradient(90deg, rgba(95, 243, 214, .15), rgba(246, 197, 107, .15)); overflow: visible; }
.molecule { position: absolute; top: 50%; left: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); background: var(--magenta); box-shadow: 0 0 20px var(--magenta); transition: left 1s var(--ease), background .5s, transform .5s; }
.molecule.clean { background: var(--aqua); }
.molecule.fail { transform: translateY(40px) scale(.8); }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.stage { padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(6, 20, 18, .5); transition: border-color .4s, box-shadow .4s, transform .4s var(--ease); }
.stage.active { border-color: var(--aqua); box-shadow: 0 0 30px -6px rgba(95, 243, 214, .6); transform: translateY(-4px); }
.stage.failed { border-color: var(--magenta); box-shadow: 0 0 30px -6px var(--magenta); }
.stage-n { display: block; color: var(--gold); font: 500 .8rem var(--ui); letter-spacing: .15em; }
.stage strong { display: block; margin: .4rem 0 .3rem; font: 500 1.3rem var(--display); }
.stage small { color: var(--muted); line-height: 1.4; }

.gate { display: grid; grid-template-columns: 1fr minmax(160px, 220px) 1fr; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; }
.checks { margin: 0; padding: 0; list-style: none; display: grid; gap: .6rem; }
.checks li { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(6, 20, 18, .5); }
.checks em { margin-left: auto; font-style: normal; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.check-dot { width: 10px; height: 10px; border-radius: 50%; background: #476058; }
.checks li.running .check-dot { background: var(--gold); animation: pulse 1s infinite; }
.checks li.pass .check-dot { background: var(--aqua); box-shadow: 0 0 10px var(--aqua); }
.checks li.pass em { color: var(--aqua); }
.checks li.unsure .check-dot { background: var(--magenta); }
.checks li.unsure em { color: var(--magenta); }
.gate-visual { position: relative; height: 220px; border: 2px solid var(--line); border-radius: 18px 18px 6px 6px; overflow: hidden; background: linear-gradient(#0a2a27, #04100f); }
.gate-door { position: absolute; top: 0; bottom: 0; width: 50%; background: repeating-linear-gradient(90deg, #17332e 0 10px, #10241f 10px 20px); border: 1px solid rgba(255, 95, 174, .4); transition: transform 1.2s var(--ease); }
.gate-door.left { left: 0; } .gate-door.right { right: 0; }
.gate.open .gate-door.left { transform: translateX(-100%); } .gate.open .gate-door.right { transform: translateX(100%); }
.gate.open .gate-visual { border-color: var(--aqua); box-shadow: 0 0 40px -6px var(--aqua), inset 0 0 60px rgba(95, 243, 214, .3); }
.gate-label { position: absolute; inset: auto 0 .7rem; text-align: center; font: 700 .75rem var(--ui); letter-spacing: .3em; color: var(--magenta); }
.gate.open .gate-label { color: var(--aqua); }
.passport { min-height: 180px; padding: 1.2rem; border: 1px dashed rgba(246, 197, 107, .45); border-radius: 16px; background: rgba(246, 197, 107, .05); font-size: .9rem; line-height: 1.6; color: var(--muted); }
.passport b { color: var(--ink); }
.passport .ok { color: var(--aqua); } .passport .hold { color: var(--magenta); }

.water { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.water-inputs { display: grid; gap: .6rem; }
.water-inputs label { color: var(--muted); font-size: .95rem; }
.water-inputs label:not(:first-child) { margin-top: 1rem; }
.water-inputs output { color: var(--gold); font: 500 1.6rem var(--display); }
input[type="range"] { width: 100%; accent-color: var(--aqua); height: 28px; }
.water-result { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tank { position: relative; height: 260px; display: flex; align-items: flex-end; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(6, 20, 18, .55); }
.tank-fill { position: absolute; inset: auto 0 0; height: 0; transition: height .8s var(--ease); }
.tank-fill::before { content: ""; position: absolute; top: -10px; left: -50%; width: 200%; height: 20px; border-radius: 40%; background: inherit; animation: wave 4s linear infinite; }
@keyframes wave { to { transform: translateX(25%); } }
.recovered { background: linear-gradient(rgba(95, 243, 214, .75), rgba(95, 243, 214, .3)); }
.concentrate { background: linear-gradient(rgba(255, 95, 174, .9), rgba(255, 95, 174, .45)); }
.tank span { position: relative; z-index: 1; padding: 1rem; font-size: .82rem; line-height: 1.35; color: var(--ink); text-shadow: 0 1px 6px #000; }
.tank strong { display: block; font: 500 clamp(1.6rem, 3vw, 2.4rem) var(--display); }

.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; position: relative; }
.timeline::before { content: ""; position: absolute; top: .5rem; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--aqua), var(--gold), var(--magenta)); }
.timeline li { position: relative; padding-top: 2rem; }
.timeline li::before { content: ""; position: absolute; top: 0; left: 0; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold); box-shadow: 0 0 14px var(--gold); }
.timeline span { color: var(--gold); font-size: .75rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.timeline strong { display: block; margin: .4rem 0; font: 500 1.35rem var(--display); }
.timeline p { margin: 0; color: var(--muted); line-height: 1.5; }

/* ---------- Finale ---------- */
.finale { position: relative; isolation: isolate; min-height: 100svh; display: grid; place-content: center; justify-items: center; padding: 6rem 1.2rem; text-align: center; overflow: hidden; }
.finale-title { margin: 0 0 1.5rem; font: 300 clamp(2.8rem, 9vw, 8rem)/.95 var(--display); letter-spacing: -.03em; }
.finale-title span { display: block; }
.finale-title .accent { font-style: italic; font-weight: 500; background: linear-gradient(100deg, var(--aqua), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.finale-line { max-width: 34ch; margin: 0 0 2.5rem; font: 400 clamp(1.2rem, 2.4vw, 1.8rem)/1.35 var(--display); color: #dfe8e0; }

/* ---------- Narrator bar ---------- */
.narrator { position: fixed; z-index: 35; left: 50%; bottom: 1.2rem; display: flex; align-items: center; gap: .6rem; width: min(94vw, 820px); padding: .6rem .8rem; border: 1px solid rgba(95, 243, 214, .35); border-radius: 99px; background: rgba(6, 20, 18, .85); backdrop-filter: blur(16px); transform: translateX(-50%); box-shadow: 0 20px 60px -20px #000; }
.narrator[hidden] { display: none; }
.narrator button { flex: none; width: 2.4rem; height: 2.4rem; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--aqua); font-size: .8rem; cursor: pointer; }
.narrator button:hover { border-color: var(--aqua); }
.caption { margin: 0 .6rem; font-size: .92rem; line-height: 1.35; color: var(--ink); }

/* ---------- Footer & references ---------- */
.site-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem 2rem; width: var(--wrap); margin: auto; padding: 2.5rem 0 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .12em; }
.footer-link { color: var(--ink); font-size: .85rem; letter-spacing: .02em; text-decoration: none; }
.footer-link:hover { color: var(--gold); }
.references-page main { width: min(100% - 2 * clamp(1.25rem, 5vw, 6rem), 850px); min-height: 70vh; margin: auto; padding: clamp(3rem, 7vw, 7rem) 0; color: #c8d8ce; font-size: 1.05rem; line-height: 1.8; }
.references-page h1, .references-page h2 { color: #f1f5ea; font-family: var(--display); font-weight: 400; line-height: 1.1; }
.references-page h1 { margin: 0 0 2rem; font-size: clamp(3rem, 8vw, 6rem); }
.references-page h2 { margin: 3.5rem 0 1.2rem; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.references-page main a { color: var(--gold); text-underline-offset: .2em; overflow-wrap: anywhere; }
.references-page li { margin-bottom: 1rem; }
.references-page strong { color: #f1f5ea; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stages, .timeline { grid-template-columns: 1fr 1fr; }
  .timeline::before { display: none; }
  .gate, .water { grid-template-columns: 1fr; }
  .gate-visual { height: 140px; }
  .doomsday { display: none; }
}
@media (max-width: 640px) {
  .brand small { display: none; }
  /* visually hidden but still read by screen readers */
  .sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .site-nav { font-size: .72rem; }
  .chapter-nav { display: none; }
  .stats { grid-template-columns: 1fr; }
  .stat { flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 1rem; padding: .8rem 1rem; }
  .stat dt { margin: 0; }
  .stages { grid-template-columns: 1fr; }
  .chapter-head { align-items: flex-start; flex-direction: column; gap: .4rem; }
  .sim-readout, .pipe-status { margin-left: 0; }
  .narrator { border-radius: 20px; }
}

/* Respect users who prefer less motion: everything still works, just calmly */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .curtain { display: none; }
  .hero-title.split-done .accent { background: none; color: var(--gold); }
.split .char { opacity: 1; transform: none; filter: none; }
  .chapter-art, .interlude { clip-path: none; }
  .chapter-art img, .interlude img { transform: none; }
}
