@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-normal-latin.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-italic-latin.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-italic-latin-ext.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson"; src: url("fonts/AtkinsonHyperlegibleNext.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --bg: #f3eee6; --surface: #fffaf2; --ink: #17131c; --muted: #463f4c; --line: #d8ccbb; --accent: #7a2e12; --accent-ui: #b0461c;
  --scrim: rgba(243, 238, 230, 0.9);
  --r-a: #2d2620; --r-b: #b8284f; --r-nea: #a65300; --r-den: #00766a; --r-super: #6a3db8; --r-arch: #8a5a2a; --r-ghost: #3552b8;
  --r-hu: #9a1b1b; --r-bg: #f3eee6; --r-ink: #17131c; --r-muted: #4f4857; --r-dark: 0;
  --serif: "Fraunces", Georgia, "Times New Roman", serif; --sans: "Atkinson", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bar: 3.1rem; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #070a14; --surface: #10142a; --ink: #f2ead8; --muted: #cdc5d6; --line: #262b48; --accent: #ffc68a; --accent-ui: #ffab5e;
  --scrim: rgba(7, 10, 20, 0.82);
  --r-a: #f4e6c8; --r-b: #ff8fa8; --r-nea: #ffb040; --r-den: #3fd9c6; --r-super: #b99bff; --r-arch: #e8a86a; --r-ghost: #9fb6ff;
  --r-hu: #ff6b5a; --r-bg: #070a14; --r-ink: #f2ead8; --r-muted: #aea8bd; --r-dark: 1; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070a14; --surface: #10142a; --ink: #f2ead8; --muted: #cdc5d6; --line: #262b48; --accent: #ffc68a; --accent-ui: #ffab5e;
    --scrim: rgba(7, 10, 20, 0.82);
    --r-a: #f4e6c8; --r-b: #ff8fa8; --r-nea: #ffb040; --r-den: #3fd9c6; --r-super: #b99bff; --r-arch: #e8a86a; --r-ghost: #9fb6ff;
    --r-hu: #ff6b5a; --r-bg: #070a14; --r-ink: #f2ead8; --r-muted: #aea8bd; --r-dark: 1; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.075rem/1.62 var(--sans); overflow-wrap: break-word; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent-ui); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.08; letter-spacing: -0.01em; margin: 0; }
p { margin: 0 0 1em; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--surface); color: var(--ink); padding: 0.6rem 1rem; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: var(--bar); display: flex; align-items: center; gap: 0.9rem; padding: 0 max(1rem, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); font-size: 0.92rem; }
.topbar a { color: var(--ink); text-decoration: none; }
.home { font-weight: 700; white-space: nowrap; }
.topnav { display: flex; gap: 1.1rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 0 1 auto; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { white-space: nowrap; padding: 0.7rem 0; border-bottom: 2px solid transparent; }
.topnav a[aria-current] { border-bottom-color: var(--accent-ui); }
.spacer { flex: 1 1 0; }
.chip { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.75rem; min-height: 2.2rem; display: inline-flex; align-items: center; }
.icon-btn { width: 2.75rem; height: 2.75rem; flex: none; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
@media (max-width: 560px) { .home { display: none; } .topbar { gap: 0.7rem; } }

/* ---------- reading rail ---------- */
.rail { position: fixed; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 30; display: none; flex-direction: column; gap: 0.35rem; }
.rail a { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; text-decoration: none; color: var(--muted); font-size: 0.8rem; min-height: 1.6rem; }
.rail a span { opacity: 0; transition: opacity 0.2s; background: var(--surface); padding: 0.1rem 0.45rem; border-radius: 4px; color: var(--ink); }
.rail a:hover span, .rail a:focus-visible span { opacity: 1; }
.rail i { width: 0.55rem; height: 0.55rem; border-radius: 50%; border: 1.5px solid var(--muted); background: var(--bg); }
.rail a[aria-current] i { background: var(--accent-ui); border-color: var(--accent-ui); }
@media (min-width: 1180px) { .rail { display: flex; } }
.theatre:hover ~ .rail { opacity: 1; }

/* ---------- the stage: the sky behind the story ---------- */
.theatre { position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh; z-index: 0; overflow: hidden; background: var(--r-bg); }
.stage canvas { display: block; width: 100%; height: 100%; }
html:not(.js) .needs-js, .no-canvas .needs-js { display: none !important; }
.stage .fallback { position: absolute; inset: 0; margin: 0; }
.stage .fallback img { width: 100%; height: 100%; object-fit: cover; display: block; }
html.sky-ready .stage .fallback { display: none; }
.hud { position: absolute; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 3; display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.btn { font: 600 0.95rem/1 var(--sans); min-height: 2.75rem; padding: 0 1.05rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.btn:hover { border-color: var(--accent-ui); }
.btn.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn svg { width: 1rem; height: 1rem; flex: none; }
.hud .btn { background: var(--scrim); color: var(--ink); border-color: var(--line); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pp .i-play { display: none; }
.pp.paused .i-play { display: block; }
.pp.paused .i-pause { display: none; }

/* ---------- hero ---------- */
.hero { position: relative; z-index: 1; min-height: 100vh; min-height: 100svh; padding: calc(var(--bar) + 6vh) max(1.25rem, 6vw) 6rem; color: var(--ink); pointer-events: none; }
.hero > * { pointer-events: auto; }
.kicker { font: 600 0.8rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.hero h1 { font-size: clamp(2.5rem, 7.2vw, 5.6rem); max-width: 11.5em; font-weight: 500; font-variation-settings: "opsz" 144, "SOFT" 50; text-wrap: balance; }
.hero h1 em { font-style: italic; font-weight: 400; }
.deck { font-size: clamp(1.1rem, 1.8vw, 1.32rem); max-width: 34rem; margin-top: 1.3rem; color: var(--ink); text-wrap: pretty; }
.byline { font-size: 0.9rem; color: var(--muted); margin-top: 1rem; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.1rem; }
.share .btn { background: var(--scrim); color: var(--ink); border-color: var(--line); }
.share [role="status"] { font-size: 0.9rem; color: var(--muted); min-height: 1.2em; }
#share-field { width: 100%; max-width: 28rem; font: inherit; font-size: 0.9rem; padding: 0.5rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.cue { position: absolute; right: 16rem; left: max(1.25rem, 6vw); bottom: 1.4rem; font-size: 0.9rem; color: var(--muted); margin: 0; }

/* ---------- story steps over the sky ---------- */
.story { position: relative; z-index: 1; pointer-events: none; }
.step { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 12vh max(1.25rem, 6vw); }
.card { pointer-events: auto; max-width: 27rem; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 14px; padding: 1.4rem 1.5rem 1.2rem; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22); }
.card h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 0.7rem; text-wrap: balance; }
.card p:last-child { margin-bottom: 0; }
.card .btn { margin-top: 0.2rem; }
.card .src { font-size: 0.86rem; color: var(--muted); }
.step.right { justify-content: flex-end; }
@media (max-width: 700px) {
  .step { align-items: flex-end; padding: 50vh 0.75rem 5.5rem; min-height: 115svh; }
  .step.right { justify-content: flex-start; }
  .card { max-width: none; padding: 1.1rem 1.15rem 1rem; }
  .hero { padding-top: calc(var(--bar) + 1.2rem); }
  .cue { display: none; }
}

/* ---------- ordinary reading blocks ---------- */
.after { position: relative; z-index: 2; background: var(--bg); }
.block { max-width: 70rem; margin: 0 auto; padding: 5.5rem max(1.25rem, 5vw) 1rem; }
section[id], .step[id] { scroll-margin-top: calc(var(--bar) + 0.5rem); }
.block h2 { font-size: clamp(1.9rem, 3.8vw, 3rem); max-width: 18em; margin-bottom: 1.1rem; text-wrap: balance; }
.block h3 { font-size: 1.35rem; margin: 1.6rem 0 0.5rem; }
.prose { max-width: 38rem; }
.anchor { color: inherit; text-decoration: none; }
.anchor:hover, .anchor:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }
.lede { font-size: 1.2rem; max-width: 38rem; }

/* photographs */
.photos { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; margin: 2rem 0; }
.photos figure { margin: 0; grid-column: span 6; min-width: 0; }
.photos figure.wide { grid-column: span 12; }
.photos figure.third { grid-column: span 4; }
.photos img { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--line); }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }
figcaption .cr { display: block; font-size: 0.8rem; margin-top: 0.2rem; }
@media (max-width: 700px) { .photos figure, .photos figure.third { grid-column: span 12; } }

/* the list of reasons and places */
.reasons { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.4rem 2rem; margin: 1.6rem 0; padding: 0; list-style: none; }
.reasons li h3 { margin-top: 0; font-size: 1.2rem; }
.reasons .verdict { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.55rem; margin-bottom: 0.4rem; }
.places { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1.4rem 0; padding: 0; list-style: none; }
.places li { border-top: 2px solid var(--ink); padding-top: 0.6rem; }
.places b { display: block; font-family: var(--serif); font-size: 1.2rem; }
.tips { border-left: 3px solid var(--accent-ui); padding: 0.2rem 0 0.2rem 1rem; max-width: 38rem; }

/* sources */
.srcs { padding-left: 1.1rem; font-size: 0.95rem; max-width: 50rem; }
.srcs li { margin-bottom: 0.45rem; }
.method { max-width: 44rem; color: var(--muted); }
.foot { position: relative; z-index: 2; background: var(--bg); border-top: 1px solid var(--line); padding: 2rem max(1.25rem, 5vw) 3rem; font-size: 0.92rem; color: var(--muted); }
.foot p { margin: 0.2rem 0; }
.foot a { color: var(--ink); }
body.nf main { max-width: 40rem; margin: 20vh auto; padding: 0 1.25rem; }

/* ---------- river-specific ---------- */
.stage { background: var(--r-bg); }
.hero { color: var(--ink); }
.hero-in { max-width: 40rem; background: radial-gradient(ellipse at 30% 40%, var(--scrim) 40%, transparent 72%); padding: 1rem 1.5rem 1.5rem 0; margin-left: -0.5rem; padding-left: 0.5rem; }
.hero .kicker, .hero .byline, .hero .scale, .hero .cue { color: var(--muted); }
.hero .deck { color: var(--ink); }
.hero h1 { max-width: 13em; }
.hero h1 em { color: var(--accent); }
.scale { font-size: 0.88rem; color: var(--muted); }
.share .btn, .hud .btn { background: var(--surface); color: var(--ink); border-color: var(--line); backdrop-filter: none; }
.share [role="status"] { color: var(--muted); }
.clock { position: absolute; left: max(1rem, env(safe-area-inset-left)); top: calc(var(--bar) + 0.8rem); z-index: 2; margin: 0; font: 500 clamp(1.3rem, 2.6vw, 2.1rem)/1.1 var(--serif); color: var(--ink); background: var(--scrim); padding: 0.25rem 0.6rem; border-radius: 8px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.82rem; color: var(--ink); }
.stage .legend { position: absolute; left: max(1rem, env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 2; max-width: min(34rem, calc(100% - 9rem)); background: var(--scrim); padding: 0.4rem 0.7rem; border-radius: 8px; }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.sw { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; flex: none; }
.sw-a { background: var(--r-a); } .sw-b { background: var(--r-b); } .sw-nea { background: var(--r-nea); } .sw-den { background: var(--r-den); }
.sw-ghost { background: var(--r-ghost); } .sw-super { background: var(--r-super); }
html.river-ready .stage .fallback { display: none; }
.card .src { margin-top: 0.4rem; }
.card b { font-weight: 700; }
@media (max-width: 700px) {
  .stage .legend { font-size: 0.74rem; gap: 0.15rem 0.6rem; max-width: calc(100% - 7.5rem); }
  .clock { top: calc(var(--bar) + 0.5rem); }
  .hero-in { background: none; padding: 0; margin: 0; }
  .hero { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 2rem; background: linear-gradient(to top, var(--bg) 45%, transparent 62%); }
  .stage .legend { display: none; }
  .hud { bottom: auto; top: calc(var(--bar) + 0.5rem); }
}

/* your genome */
.gwrap { display: grid; grid-template-columns: minmax(14rem, 18rem) 1fr; gap: 2rem; align-items: start; margin-top: 1.5rem; }
.regions { border: 0; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.regions legend { font-weight: 700; margin-bottom: 0.6rem; padding: 0; }
.opt { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.opt input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent-ui); margin: 0; flex: none; }
.opt:has(input:checked) { border-color: var(--accent-ui); box-shadow: inset 0 0 0 1px var(--accent-ui); }
.gpanel { min-width: 0; }
#grid { display: block; width: 100%; height: auto; aspect-ratio: 5 / 4; --r-bg: transparent; }
.gpanel .legend { margin-top: 0.8rem; }
.gsum { font-family: var(--serif); font-size: 1.2rem; margin-top: 0.9rem; min-height: 3em; }
.gmixed { margin-top: 0.9rem; max-width: 38rem; }
.notes { font-size: 0.92rem; color: var(--muted); max-width: 44rem; margin-top: 1.4rem; padding-left: 1.1rem; }
.notes li { margin-bottom: 0.3rem; }
@media (max-width: 760px) { .gwrap { grid-template-columns: 1fr; gap: 1.2rem; } }
#close .prose p:first-child { font-size: 1.15rem; }
#close .share .btn { background: var(--surface); }

/* layered genome and evidence labels */
.layer { margin-bottom: 1.8rem; }
.layer h3 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.layer p { max-width: 38rem; }
.deep { display: block; width: 100%; height: 1.4rem; border-radius: 6px; overflow: hidden; }
.deep-a { fill: var(--r-a); opacity: 0.55; }
.deep-b { fill: var(--r-b); }
.deep-lab { display: flex; justify-content: space-between; font-size: 0.88rem; margin-top: 0.35rem; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; max-width: 40rem; }
.how li { display: block; }
.how .sw { margin-right: 0.45rem; }
.ev { display: inline-block; font: 700 0.72rem/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; border-radius: 999px; padding: 0.22rem 0.6rem; margin: 0 0 0.6rem; border: 1px solid var(--line); color: var(--ink); }
.ev-dna { border-style: solid; border-color: var(--ink); }
.ev-model { border-style: dashed; border-color: var(--ink); }
.ev-disputed { border-style: dotted; border-width: 2px; border-color: var(--r-hu); }
.legend .dash { width: 1.3rem; height: 0; border-top: 2px dashed var(--ink); border-radius: 0; }
