/* CAKE — the page moves from electron microscopy (structure, grey, still)
   to calcium imaging (activity, dark field, glowing). Colour is semantic:
   green activity · blue set point · magenta perturbation/error · amber history. */

:root {
  --field: #050807;
  --field-2: #0a100d;
  --ink: #e9efe8;
  --ink-2: rgba(233, 239, 232, 0.72);
  --ink-3: rgba(233, 239, 232, 0.42);
  --act: #93f2a6;
  --set: #7fb6ff;
  --err: #ff6f9a;
  --hist: #ffbd6b;
  --em: #d8d4ca;
  --em-ink: #191814;
  --serif: 'Spectral', 'Iowan Old Style', Georgia, serif;
  --display: 'Gloock', 'Didot', 'Bodoni 72', Georgia, serif;
  --mono: 'Martian Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --col-left: clamp(1.25rem, 13vw, 15rem);
  --measure: 35rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.04rem, 0.98rem + 0.3vw, 1.2rem);
  line-height: 1.66;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* sensor noise over the whole dark field */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.045;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(147, 242, 166, 0.3); }

a { color: var(--act); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
code {
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 400;
  padding: 0.05em 0.35em;
  border-radius: 0.4em 0.55em 0.45em 0.6em;
  background: rgba(233, 239, 232, 0.06);
  white-space: nowrap;
}
em { font-style: italic; color: #fff; font-weight: 400; }
b { font-weight: 600; }
.k-em { color: var(--em); }
.k-err { color: var(--err); }
.k-hist { color: var(--hist); }

/* ── Embryo: the electron micrograph ── */
.hero {
  position: relative;
  min-height: 100vh;
  background: var(--em);
  color: var(--em-ink);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(2rem, 6vh, 4.5rem) 0 0;
}
.em-field { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.5; }
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(70% 75% at 22% 30%, rgba(216, 212, 202, 0.92) 30%, rgba(216, 212, 202, 0.55) 60%, rgba(216, 212, 202, 0) 100%);
  z-index: 1;
}
.hero { isolation: isolate; }
.hero > * { z-index: 2; }
.hero > .em-field { z-index: 0; }
.hero-inner {
  position: relative;
  margin-left: var(--col-left);
  max-width: 44rem;
  padding-right: 1.5rem;
}
.meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  opacity: 0.7;
}
h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.6rem, 11vw, 10rem);
  line-height: 0.86;
  margin: 0 0 1.4rem -0.04em;
  letter-spacing: -0.02em;
}
h1 span { display: inline-block; animation: breathe 9s ease-in-out infinite; }
h1 .w2 { animation-delay: -4.2s; font-style: italic; }
@keyframes breathe {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-0.025em) scaleY(1.015); }
}
.hero-line {
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.85rem);
  line-height: 1.35;
  font-weight: 400;
  margin: 0 0 1rem;
  max-width: 34rem;
}
.hero-sub { max-width: 31rem; margin: 0; opacity: 0.78; }
.hero-worm { position: relative; align-self: stretch; min-height: 15rem; }
#connectome { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.hero-probe {
  position: absolute;
  right: clamp(1rem, 6vw, 6rem);
  bottom: 0.6rem;
  margin: 0;
  max-width: 21rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.6;
  text-align: right;
  opacity: 0.75;
}
.em-bar, .databar {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.em-bar {
  position: relative;
  margin: 0;
  padding: 0.55rem var(--col-left);
  background: #121110;
  color: #cfcabe;
}
.em-bar span:nth-child(2) { opacity: 0.5; }
.sb { text-transform: none; margin-left: auto; display: inline-flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.sb i { display: inline-block; width: 3.2rem; height: 0.32rem; border: 1px solid currentColor; border-top: 0; }

/* ── the aperture: EM gives way to fluorescence ── */
.aperture { position: relative; height: 230vh; background: var(--field); }
.aperture-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; }
#aperture { position: absolute; inset: 0; width: 100%; height: 100%; }
.aperture-text {
  position: absolute;
  left: 50%;
  width: min(30rem, 84vw);
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.65rem);
  line-height: 1.4;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s linear;
}
.a1 { top: 10vh; color: var(--em-ink); }
.a2 { bottom: 16vh; color: var(--ink); }

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.3rem, 1.5rem + 3.6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.012em;
  margin: 0;
  max-width: 14ch;
  color: #f4f8f2;
}
.prose { margin-left: var(--col-left); max-width: var(--measure); padding-right: 1.5rem; }
.prose p { margin: 0 0 1.15em; color: var(--ink-2); }
.prose p b { color: var(--ink); }
.turn {
  font-size: 1.28em;
  line-height: 1.4;
  color: var(--ink) !important;
  font-style: italic;
  margin-top: 1.8em !important;
}
.caveat {
  border-left: 1px solid var(--err);
  padding-left: 1rem;
  font-style: italic;
}

blockquote { margin: 2.2rem 0; padding: 0; }
.hstar {
  position: relative;
  padding: 1.6rem 0 1.6rem 1.6rem;
  margin-left: -1.6rem;
}
.hstar::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(var(--set), var(--act), var(--set));
  border-radius: 2px;
  animation: pulse-line 4s ease-in-out infinite;
}
@keyframes pulse-line { 50% { opacity: 0.35; } }
.hstar p {
  font-family: var(--display);
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.3;
  color: #fff !important;
  margin: 0 !important;
}
.hs { color: var(--set); margin-right: 0.35em; }
.plain p {
  font-family: var(--display);
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.8rem);
  line-height: 1.3;
  color: var(--act) !important;
  margin: 0 !important;
}

/* ── specimens: explorables framed like microscope fields ── */
.specimen {
  position: relative;
  margin: 3.2rem auto 3.4rem var(--col-left);
  width: min(66rem, calc(100vw - var(--col-left) - 2.5rem));
}
.stage {
  position: relative;
  height: clamp(18rem, 44vh, 26rem);
  border-radius: 2.2rem 1.6rem 2.6rem 1.9rem / 1.8rem 2.4rem 1.7rem 2.2rem;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(147, 242, 166, 0.035), transparent 70%),
    var(--field-2);
  box-shadow: inset 0 0 0 1px rgba(233, 239, 232, 0.06), inset 0 0 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.stage.tall { height: clamp(20rem, 52vh, 30rem); }
.stage.wide { height: clamp(19rem, 48vh, 27rem); }
.stage.square { height: min(36rem, 72vh, calc(100vw - var(--col-left) - 2.5rem)); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* reticle corners */
.specimen::before, .specimen::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--ink-3);
  pointer-events: none;
}
.specimen::before { left: -8px; top: -8px; border-right: 0; border-bottom: 0; }
.specimen::after { right: -8px; top: -8px; border-left: 0; border-bottom: 0; }
.specimen.bare .stage { background: transparent; box-shadow: none; }

.databar {
  color: var(--ink-3);
  padding: 0.75rem 0.4rem 0;
  flex-wrap: wrap;
  row-gap: 0.3rem;
  text-transform: none;
  letter-spacing: 0.03em;
}
.databar span:first-child { color: var(--hist); letter-spacing: 0.12em; }
.databar sub { font-size: 0.8em; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.5rem;
  padding: 1rem 0.4rem 0;
}
.hint {
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.6;
  color: var(--ink-3);
  max-width: 30rem;
}
.hint.lead { color: var(--ink-2); }

/* membrane-like buttons */
.blob {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--act);
  background: color-mix(in srgb, var(--act) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--act) 60%, transparent);
  padding: 0.6rem 1.15rem;
  border-radius: 46% 54% 42% 58% / 58% 44% 56% 42%;
  cursor: pointer;
  transition: border-radius 1.1s cubic-bezier(.16,1,.3,1), background 0.3s, box-shadow 0.4s;
}
.blob:hover {
  border-radius: 58% 42% 55% 45% / 42% 58% 44% 56%;
  background: color-mix(in srgb, var(--act) 14%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--act) 28%, transparent);
}
.blob:active { transform: scale(0.97); }
.blob.ghost { color: var(--ink-2); border-color: var(--ink-3); background: transparent; }
.blob.ghost:hover { box-shadow: 0 0 18px rgba(233, 239, 232, 0.12); }
.blob.warm { color: var(--err); border-color: rgba(255, 111, 154, 0.6); background: rgba(255, 111, 154, 0.07); }
.blob.warm:hover { background: rgba(255, 111, 154, 0.14); box-shadow: 0 0 22px rgba(255, 111, 154, 0.3); }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 1px dashed var(--hist); outline-offset: 4px; }

.seg { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.seg-b {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--ink-3);
  background: none;
  border: 0;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  border-radius: 1rem 0.7rem 1.1rem 0.8rem;
  transition: color 0.3s, background 0.3s;
}
.seg-b:hover { color: var(--ink); }
.seg-b.on { color: var(--field); background: var(--act); }
.seg.small .seg-b { font-size: 0.62rem; }

.knob {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.knob output { color: var(--act); min-width: 3.4em; }
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 8.5rem;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 1px;
  background: linear-gradient(90deg, var(--ink-3), rgba(233,239,232,0.15));
}
input[type=range]::-moz-range-track { height: 1px; background: var(--ink-3); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 13px;
  margin-top: -6px;
  border-radius: 55% 45% 50% 50% / 50% 55% 45% 50%;
  background: radial-gradient(circle at 50% 50%, var(--field) 0 2px, var(--act) 2.5px);
  box-shadow: 0 0 10px color-mix(in srgb, var(--act) 60%, transparent);
}
input[type=range]::-moz-range-thumb {
  width: 15px; height: 13px; border: 0;
  border-radius: 55% 45% 50% 50% / 50% 55% 45% 50%;
  background: radial-gradient(circle at 50% 50%, var(--field) 0 2px, var(--act) 2.5px);
  box-shadow: 0 0 10px color-mix(in srgb, var(--act) 60%, transparent);
}

.tog {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}
.tog input {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px;
  margin: 0;
  border-radius: 50%;
  border: 1px solid var(--c, var(--act));
  transition: background 0.3s, box-shadow 0.3s;
  cursor: pointer;
}
.tog input:checked { background: var(--c, var(--act)); box-shadow: 0 0 10px var(--c, var(--act)); }
.tog small { color: var(--ink-3); font-size: 0.9em; }
.lens { padding: 0.25rem 0; }

.count-read {
  position: absolute;
  left: 1.4rem; top: 1.2rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.7;
  color: var(--ink-2);
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(10, 16, 13, 0.92), rgba(10, 16, 13, 0.6) 70%, transparent);
  padding: 0.6rem 1.4rem 0.8rem 0.6rem;
  margin: -0.6rem;
  z-index: 1;
}
.count-read b { display: block; font-family: var(--display); font-weight: 400; font-size: 2.2rem; line-height: 1.1; color: var(--ink); }

.tests, .asks {
  margin: 1.6rem 0 1.4rem;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.95em;
}
.tests li, .asks li { padding: 0.55rem 0 0.55rem 3rem; position: relative; }
.tests li b {
  position: absolute; left: 0; top: 0.62rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--set);
}
.asks { counter-reset: ask; }
.asks li::before {
  counter-increment: ask;
  content: counter(ask);
  position: absolute; left: 0.35rem; top: 0.5rem;
  width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--hist);
  border: 1px solid rgba(255, 189, 107, 0.5);
  border-radius: 48% 52% 45% 55% / 55% 46% 54% 45%;
}

/* status cells: things that exist glow; things that don't yet are outlines */
.status {
  margin: 2.5rem 1.5rem 3rem var(--col-left);
  max-width: 62rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
}
.cell {
  flex: 1 1 22rem;
  padding: 1.5rem 1.6rem 1.2rem;
  border-radius: 2.4rem 1.6rem 2.1rem 1.8rem / 1.7rem 2.3rem 1.6rem 2.4rem;
  position: relative;
}
.cell h3 { font-family: var(--mono); font-weight: 400; font-size: 0.72rem; letter-spacing: 0.05em; margin: 0 0 0.8rem; }
.cell p { margin: 0 0 0.8rem; font-size: 0.93em; color: var(--ink-2); }
.cell .sc { font-family: var(--mono); font-size: 0.6rem; color: var(--ink-3); margin: 0; }
.cell.done {
  background: radial-gradient(130% 120% at 15% 0%, rgba(147, 242, 166, 0.11), rgba(147, 242, 166, 0.02) 60%);
  box-shadow: inset 0 0 0 1px rgba(147, 242, 166, 0.25);
}
.cell.done h3 { color: var(--act); }
.cell.open { box-shadow: inset 0 0 0 1px rgba(233, 239, 232, 0.12); }
.cell.open h3 { color: var(--ink-2); }
.cell.open::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 1px dashed rgba(255, 189, 107, 0.25);
  pointer-events: none;
}

.closing { padding-bottom: 7rem; }
#yours-text { color: var(--ink) !important; font-size: 1.12em; }
.links { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin-top: 2.4rem !important; }
.links a { font-family: var(--mono); font-size: 0.7rem; text-decoration: none; border-bottom: 1px solid rgba(147,242,166,0.3); padding-bottom: 0.15rem; }
.links a:hover { border-bottom-color: var(--act); }

@media (max-width: 860px) {
  :root { --col-left: 1.25rem; }
  .specimen { width: calc(100vw - 2.5rem); }
  .hstar { margin-left: 0; }
  .hero-probe { left: 1.25rem; right: auto; text-align: left; }
  #fig-ladder .stage { height: 38rem; }
  #fig-verdict .stage { height: 24rem; }
}


/* ═══════════════════════════ WORLDS ═══════════════════════════
   Each era of the story lives in its own world. A world sets a palette;
   shared components (buttons, sliders, captions) read it through
   --act / --ink / --field, so they re-skin themselves. */

.world {
  position: relative;
  display: flow-root;
  padding-bottom: 3rem;
  background: var(--bg);
  color: var(--ink);
  --field: var(--bg);
  --act: var(--a1);
}
.world .prose p { color: var(--ink-2); }
.world .prose p b, .world .prose em { color: var(--ink); }

.world-ink {
  --bg: #efe5cf; --ink: #2b2117; --ink-2: rgba(43, 33, 23, 0.78); --ink-3: rgba(43, 33, 23, 0.46);
  --a1: #7a3b1d; --a2: #34446a; --a3: #b08a4a; --a4: #1d1712;
  --deco:
    radial-gradient(120% 60% at 20% 8%, rgba(255, 250, 235, 0.7), transparent 60%),
    radial-gradient(90% 50% at 90% 92%, rgba(160, 120, 60, 0.12), transparent 70%);
}
.world-phosphor {
  --bg: #040806; --ink: #d8ffe6; --ink-2: rgba(216, 255, 230, 0.72); --ink-3: rgba(216, 255, 230, 0.4);
  --a1: #7dffb0; --a2: #ffb347; --a3: #6fc3ff; --a4: #ff6f6f;
}
.world-agar {
  --bg: #e4d6b4; --ink: #2a2215; --ink-2: rgba(42, 34, 21, 0.78); --ink-3: rgba(42, 34, 21, 0.45);
  --a1: #b5482a; --a2: #2f6f9f; --a3: #6b5a2e; --a4: #1f1a10;
  --deco: radial-gradient(70% 50% at 70% 20%, rgba(255, 246, 220, 0.55), transparent 70%);
}
.world-em {
  --bg: #cfcbc1; --ink: #191814; --ink-2: rgba(25, 24, 20, 0.78); --ink-3: rgba(25, 24, 20, 0.45);
  --a1: #191814; --a2: #8a5a12; --a3: #5d5a52; --a4: #000;
}
.world-sea {
  --bg: #041520; --ink: #dff6f8; --ink-2: rgba(223, 246, 248, 0.74); --ink-3: rgba(223, 246, 248, 0.42);
  --a1: #66eaf5; --a2: #ff8f7a; --a3: #f6d77a; --a4: #b59bff;
  background: linear-gradient(#062130, #041520 40%, #020b12);
  --deco: radial-gradient(80% 40% at 30% 10%, rgba(102, 234, 245, 0.08), transparent 70%);
}
.world-live {
  --bg: #050807; --ink: #e9efe8; --ink-2: rgba(233, 239, 232, 0.72); --ink-3: rgba(233, 239, 232, 0.42);
  --a1: #93f2a6; --a2: #7fb6ff; --a3: #ff6f9a; --a4: #ffbd6b;
}
.world-nebula {
  --bg: #08070f; --ink: #ece8ff; --ink-2: rgba(236, 232, 255, 0.74); --ink-3: rgba(236, 232, 255, 0.42);
  --a1: #a98bff; --a2: #6bd5ff; --a3: #ff6b9d; --a4: #f5e663;
  --deco:
    radial-gradient(60% 40% at 80% 30%, rgba(169, 139, 255, 0.08), transparent 70%),
    radial-gradient(50% 40% at 10% 80%, rgba(107, 213, 255, 0.06), transparent 70%);
}
.world-terrain {
  --bg: #0c1312; --ink: #e6ede6; --ink-2: rgba(230, 237, 230, 0.74); --ink-3: rgba(230, 237, 230, 0.42);
  --a1: #ffbd6b; --a2: #7fb6ff; --a3: #ff6f9a; --a4: #8fa79c;
}
.world-dawn {
  --bg: #0d0b16; --ink: #f3ece6; --ink-2: rgba(243, 236, 230, 0.74); --ink-3: rgba(243, 236, 230, 0.42);
  --a1: #ffd59a; --a2: #ff9fb2; --a3: #9fc8ff; --a4: #b8f2c8;
  background: linear-gradient(#0d0b16, #160f22 45%, #2a1626 80%, #3a1f24);
}

/* seams: soft gradients between worlds */
.seam {
  height: clamp(10rem, 30vh, 18rem);
  margin: -1px 0;
  position: relative;
  z-index: 1;
  background: linear-gradient(in oklab, var(--from) 0%,
    color-mix(in oklab, var(--from) 94%, var(--to)) 12%,
    color-mix(in oklab, var(--from) 78%, var(--to)) 26%,
    color-mix(in oklab, var(--from) 50%, var(--to)) 50%,
    color-mix(in oklab, var(--from) 22%, var(--to)) 74%,
    color-mix(in oklab, var(--from) 6%, var(--to)) 88%,
    var(--to) 100%);
}

/* ── era heads: each world announces itself differently ── */
.era-head { margin-left: var(--col-left); padding: clamp(5rem, 14vh, 9rem) 1.5rem 2rem 0; max-width: 52rem; }
.era-no { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--a1); margin: 0 0 0.9rem; }
.era-head h2 { max-width: 16ch; color: var(--ink); }
.era-span { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); margin: 1rem 0 0; letter-spacing: 0.06em; }
.era-lede { font-size: 1.22em; line-height: 1.5; color: var(--ink-2); max-width: 34rem; margin: 1.6rem 0 0; }

.world-ink .era-head h2 { font-family: var(--serif); font-style: italic; font-weight: 300; letter-spacing: -0.02em; }
.world-ink .era-no::after { content: ' ❦'; letter-spacing: 0; }
.world-phosphor .era-head h2 { font-family: var(--mono); font-weight: 300; font-size: clamp(1.9rem, 1.2rem + 3vw, 3.6rem); letter-spacing: -0.03em; text-shadow: 0 0 18px rgba(125, 255, 176, 0.45); color: var(--a1); line-height: 1.05; }
.world-agar .era-head h2 { color: #2a2215; }
.world-sea .era-head h2 { letter-spacing: 0.01em; text-shadow: 0 0 30px rgba(102, 234, 245, 0.35); }
.world-nebula .era-head h2 { color: #f3efff; text-shadow: -0.04em 0 0 rgba(255, 107, 157, 0.55), 0.04em 0 0 rgba(107, 213, 255, 0.55), 0 0 36px rgba(169, 139, 255, 0.35); }
.world-terrain .era-head h2 { font-family: var(--serif); font-variant: small-caps; font-weight: 400; letter-spacing: 0.04em; }
.world-dawn .era-head h2 { text-shadow: 0 0 40px rgba(255, 213, 154, 0.35); }

/* ── events on the timeline ── */
.event { position: relative; margin: 0 0 2.6rem; }
.event .yr {
  position: absolute;
  right: calc(100% + 1.2rem);
  top: -0.15rem;
  font-family: var(--display);
  font-size: clamp(1.3rem, 0.9rem + 1vw, 1.9rem);
  line-height: 1;
  color: var(--a1);
  white-space: nowrap;
}
.event .yr small { display: block; font-family: var(--mono); font-size: 0.55rem; color: var(--ink-3); letter-spacing: 0.08em; margin-top: 0.35rem; text-align: right; }
.event h3 { font-family: var(--mono); font-weight: 400; font-size: 0.72rem; letter-spacing: 0.06em; margin: 0 0 0.45rem; color: var(--ink); }
.event p { margin: 0 0 0.8em; }
.world-ink .event .yr { font-family: var(--serif); font-style: italic; font-weight: 300; }
.world-ink .event h3 { font-family: var(--serif); font-variant: small-caps; font-size: 1rem; letter-spacing: 0.06em; }
.world-phosphor .event .yr { font-family: var(--mono); font-weight: 300; text-shadow: 0 0 12px rgba(125, 255, 176, 0.5); }
.world-sea .event .yr { color: var(--a1); text-shadow: 0 0 16px rgba(102, 234, 245, 0.4); }
.world-nebula .event:nth-of-type(6n+1) .yr { color: #ff6b9d; }
.world-nebula .event:nth-of-type(6n+2) .yr { color: #ffb86b; }
.world-nebula .event:nth-of-type(6n+3) .yr { color: #f5e663; }
.world-nebula .event:nth-of-type(6n+4) .yr { color: #7cf29a; }
.world-nebula .event:nth-of-type(6n+5) .yr { color: #6bd5ff; }
.world-nebula .event:nth-of-type(6n) .yr { color: #a98bff; }
.event.future .yr { color: transparent; -webkit-text-stroke: 1px var(--a1); }
@media (max-width: 860px) {
  .event .yr { position: static; display: block; margin-bottom: 0.4rem; }
  .event .yr small { display: inline; margin-left: 0.6rem; }
}

/* ── figures built by era modules ── */
.fig {
  position: relative;
  margin: 3rem auto 3.6rem var(--col-left);
  width: min(66rem, calc(100vw - var(--col-left) - 2.5rem));
}
.fig .stage { height: clamp(20rem, 50vh, 30rem); border-radius: 0; background: transparent; box-shadow: none; }
.fig .databar { color: var(--ink-3); }
.fig .databar span:first-child { color: var(--a1); }
.fig .hint { color: var(--ink-3); }
.fig .knob { color: var(--ink-2); }
.fig .knob output { color: var(--a1); }
.fig .tog { color: var(--ink-2); }
.fig .seg-b { color: var(--ink-3); }
.fig .seg-b:hover { color: var(--ink); }
.fig .seg-b.on { color: var(--bg); background: var(--a1); }
.fig .blob.ghost { color: var(--ink-2); border-color: var(--ink-3); }
.fig.wide { width: calc(100vw - var(--col-left) - 1.5rem); }

.world-ink .fig .databar { font-family: var(--serif); font-style: italic; font-size: 0.9rem; letter-spacing: 0; text-transform: none; justify-content: center; }
.world-ink .fig .databar span:first-child { font-variant: small-caps; font-style: normal; }
.world-ink .fig .databar .sb { display: none; }
.world-ink input[type=range]::-webkit-slider-runnable-track { background: var(--ink-3); }

.world-phosphor .fig .stage {
  border-radius: 26px / 30px;
  background: radial-gradient(120% 100% at 50% 50%, #07150d, #020503 80%);
  box-shadow: inset 0 0 0 1px rgba(125, 255, 176, 0.14), inset 0 0 90px rgba(0, 0, 0, 0.9), 0 0 50px rgba(125, 255, 176, 0.05);
}
.world-phosphor .fig .stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, 0.22) 2px 3px);
}
.world-phosphor .fig .databar { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.12em; }

.world-sea .fig .stage {
  background: radial-gradient(70% 60% at 50% 40%, rgba(102, 234, 245, 0.06), transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 78% at 50% 50%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 78% at 50% 50%, #000 62%, transparent 100%);
}
.world-terrain .fig .stage {
  background: #0e1716;
  box-shadow: inset 0 0 0 1px rgba(230, 237, 230, 0.25), 0 0 0 5px var(--bg), 0 0 0 6px rgba(230, 237, 230, 0.18);
}
.world-agar .fig .databar, .world-em .fig .databar { color: var(--ink-3); }

/* ── side-by-side passages ── */
.duo { display: flex; flex-wrap: wrap; gap: 1rem 3rem; align-items: flex-start; margin-left: var(--col-left); padding-right: 1.5rem; }
.duo > .prose { margin-left: 0; flex: 1 1 22rem; }
.duo > .fig { margin: 0 0 2rem; flex: 1 1 26rem; width: auto; }

/* ── the timeline spine and the year in the corner ── */
#spine { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.now {
  position: fixed; right: 1.2rem; top: 0.9rem; z-index: 45; text-align: right;
  font-family: var(--display); font-size: 1.5rem; line-height: 1;
  pointer-events: none; transition: color 0.6s;
}
.now small { display: block; font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 0.35rem; opacity: 0.7; }
@media (max-width: 860px) { .now { font-size: 1.1rem; } }

.em-inset { padding: 4.5rem 0 3rem; margin-top: 3rem; }
.em-inset::before {
  content: ''; position: absolute; left: 0; right: 0; top: -6rem; height: 6rem;
  background: linear-gradient(transparent, var(--bg));
}
.chapter-now .ch-head { margin-top: 5rem; }
.chapter-now .ch-head h2 { font-size: clamp(2rem, 1.3rem + 3vw, 3.8rem); }
.world-dawn .specimen .stage { background: rgba(255, 213, 154, 0.03); box-shadow: inset 0 0 0 1px rgba(255, 213, 154, 0.1); }
.world-phosphor .fig .stage canvas { border-radius: inherit; }
@media (max-width: 860px) {
  .now small { display: none; }
  .now { font-size: 0.95rem; opacity: 0.85; }
  .hero::before { background: radial-gradient(120% 70% at 30% 30%, rgba(216, 212, 202, 0.94) 40%, rgba(216, 212, 202, 0.6) 75%, rgba(216, 212, 202, 0.2) 100%); }
}


/* ═══════════════════════ LAYOUT, SECOND PASS ═══════════════════════ */

/* Decorative light lives in a layer that fades out at the top and bottom
   of each world, so it never draws a hard edge against a seam. */
.world[style*="--deco"], .world-ink, .world-agar, .world-sea, .world-nebula { isolation: isolate; }
.world-ink::before, .world-agar::before, .world-sea::before, .world-nebula::before {
  content: '';
  position: absolute; inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--deco);
  -webkit-mask-image: linear-gradient(transparent, #000 18rem, #000 calc(100% - 18rem), transparent);
  mask-image: linear-gradient(transparent, #000 18rem, #000 calc(100% - 18rem), transparent);
}
/* the agar world ends inside its EM inset: no strip of agar below it */
.world-agar { padding-bottom: 0; }
.em-inset { padding: 3rem 0 6rem; margin-top: 4rem; }
.em-inset::before {
  top: -10rem; height: 10rem;
  background: linear-gradient(in oklab, rgba(207, 203, 193, 0), rgba(207, 203, 193, 0.35) 40%, rgba(207, 203, 193, 0.8) 75%, #cfcbc1);
}

.skip { position: absolute; left: -9999px; top: 0; z-index: 99; background: #000; color: #fff; padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.7rem; }
.skip:focus { left: 1rem; top: 1rem; }

.kicker {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--a1);
  margin: 0 0 0.9rem;
}

/* event titles: name, then what they found, on its own line */
.event h3 span { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.12rem; letter-spacing: 0; text-transform: none; color: var(--ink-2); margin-top: 0.15rem; }
.world-ink .event h3 span { font-variant: normal; font-size: 1.05rem; }

/* era heads with an illustration beside them */
.era-head.with-illus { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem 3rem; align-items: end; max-width: 72rem; }
.era-head.with-illus .illus { justify-self: end; }
.era-head.small { padding-top: 2rem; }
.era-head.small h2 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem); }
@media (max-width: 860px) {
  .era-head.with-illus { grid-template-columns: 1fr; }
  .era-head.with-illus .illus { justify-self: start; order: -1; max-width: 70vw; }
}

/* prose beside a figure; .sticky keeps the figure in view while events scroll */
.duo { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr); gap: 2rem clamp(2rem, 4vw, 4.5rem); align-items: start; margin-left: var(--col-left); padding-right: 1.5rem; margin-top: 2rem; margin-bottom: 2rem; max-width: 80rem; }
.duo > .prose { margin: 0; padding: 0; max-width: none; }
.duo > .fig, .duo > .specimen { margin: 0; width: auto; }
.duo.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 28rem); }
.duo.flip > .prose { order: 2; }
.duo.wide-fig { grid-template-columns: minmax(0, 1.25fr) minmax(0, 24rem); }
.duo.sticky > .fig { position: sticky; top: max(2rem, calc(50vh - 22rem)); }
.duo > .illus { align-self: center; justify-self: center; }
@media (max-width: 1100px) {
  .duo, .duo.flip, .duo.wide-fig { grid-template-columns: 1fr; }
  .duo.flip > .prose { order: 0; }
  .duo.sticky > .fig { position: relative; top: 0; }
}

/* two events side by side: years sit on top, not in the margin */
.prose.two-up { max-width: 64rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0 3rem; }
.prose.two-up .event .yr, .strip .event .yr { position: static; display: block; margin-bottom: 0.5rem; font-size: clamp(1.8rem, 1.2rem + 1.6vw, 2.6rem); }
.prose.two-up .event .yr small, .strip .event .yr small { display: inline; margin-left: 0.7rem; text-align: left; }

/* a strip of events read left to right */
.strip {
  list-style: none;
  margin: 1rem 1.5rem 2rem var(--col-left);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.4rem;
  max-width: 76rem;
  counter-reset: s;
}
.strip .event { margin: 0; padding-top: 1.4rem; border-top: 1px solid color-mix(in srgb, var(--a1) 35%, transparent); position: relative; }
.strip .event::before { content: ''; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--a1); box-shadow: 0 0 12px var(--a1); }
.strip .event p { color: var(--ink-2); margin: 0; }
@media (max-width: 860px) {
  .strip { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory; margin-right: 0; padding-right: 1.25rem; padding-bottom: 1rem; scrollbar-width: none; }
  .strip .event { scroll-snap-align: start; }
}

/* ── the finish line ── */
.world-goal {
  --bg: #0e0b15;
  background:
    radial-gradient(70% 55% at 75% 100%, rgba(255, 159, 178, 0.10), transparent 70%),
    radial-gradient(60% 50% at 15% 85%, rgba(255, 213, 154, 0.08), transparent 70%),
    linear-gradient(#121110, #0e0b15 22%, #110d1a);
  padding-bottom: 2rem;
}
.goal-head { margin-left: var(--col-left); padding: clamp(4rem, 12vh, 7rem) 1.5rem 0 0; max-width: 70rem; }
.goal-head h2 { max-width: 18ch; font-size: clamp(2.2rem, 1.3rem + 3.6vw, 4.4rem); }
.goal-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0 3rem; margin-top: 2rem; }
.goal-cols p { color: var(--ink-2); margin: 0 0 1em; }
.goal-foot { margin: 0 1.5rem 0 var(--col-left); padding: 1rem 0 2rem; max-width: 34rem; font-size: 1.25em; line-height: 1.4; font-style: italic; color: var(--ink); }

/* ── the route: the whole page on one line ── */
.route {
  --bg: #110d1a; --ink: #f3ece6; --ink-2: rgba(243, 236, 230, 0.7); --ink-3: rgba(243, 236, 230, 0.4); --a1: #ffd59a;
  background: #110d1a;
  color: var(--ink);
  padding: 2rem 0 0;
  position: relative;
}
.route .kicker { margin-left: var(--col-left); }
.route ol {
  list-style: none;
  margin: 0;
  padding: 1.6rem var(--col-left) 2.6rem;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
}
.route ol::-webkit-scrollbar { display: none; }
.route li { flex: 1 0 8.5rem; position: relative; padding-top: 1.6rem; }
.route li::before {
  content: '';
  position: absolute; top: 0.42rem; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c), color-mix(in oklab, var(--c) 40%, transparent));
  border-radius: 2px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='2'%3E%3Crect width='40' height='2' rx='1'/%3E%3C/svg%3E");
}
.route li::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 0.95rem; height: 0.95rem;
  border-radius: 46% 54% 42% 58% / 58% 44% 56% 42%;
  background: var(--c);
  box-shadow: 0 0 0 4px #110d1a, 0 0 18px var(--c);
}
.route li:nth-child(n+7)::before { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 10px); opacity: 0.7; }
.route li:nth-child(n+8)::after { background: #110d1a; box-shadow: 0 0 0 4px #110d1a, inset 0 0 0 1.5px var(--c); }
.route a { display: block; padding-right: 1rem; color: var(--ink-2); text-decoration: none; font-size: 0.95rem; line-height: 1.3; transition: color 0.3s; }
.route a b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.5rem; color: var(--c); margin-bottom: 0.2rem; }
.route a:hover { color: var(--ink); }

.route li.here a b::after { font-family: var(--mono); font-size: 0.6rem; vertical-align: middle; color: var(--ink-3); content: ' we are here'; letter-spacing: 0.1em; text-transform: uppercase; }

/* ── what we do next: numbered steps ── */
.era-head.part h2 { font-size: clamp(2.6rem, 1.4rem + 5vw, 6rem); max-width: 12ch; }
.steps-nav {
  list-style: none;
  margin: 1.5rem 1.5rem 1rem var(--col-left);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.5rem 1.5rem;
  max-width: 64rem;
}
.steps-nav a { display: flex; gap: 0.8rem; align-items: baseline; color: var(--ink-2); text-decoration: none; padding: 0.45rem 0; border-bottom: 1px solid rgba(233, 239, 232, 0.08); font-size: 0.98rem; transition: color 0.3s, border-color 0.3s; }
.steps-nav a b { font-family: var(--display); font-weight: 400; color: var(--act); font-size: 1.2rem; min-width: 1.1rem; }
.steps-nav a:hover { color: var(--ink); border-bottom-color: var(--act); }

.step-head {
  margin: clamp(5rem, 14vh, 8rem) 1.5rem 1.6rem var(--col-left);
  display: flex;
  align-items: flex-end;
  gap: clamp(1rem, 2.5vw, 2rem);
  scroll-margin-top: 3rem;
}
.step-no {
  font-family: var(--display);
  font-size: clamp(5rem, 3rem + 7vw, 9.5rem);
  line-height: 0.75;
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--act) 70%, transparent);
  text-shadow: 0 0 40px color-mix(in srgb, var(--act) 18%, transparent);
}
.step-head h2 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem); max-width: 16ch; padding-bottom: 0.3rem; }
/* each step has its own accent */
#step-2 .step-no, #step-5 .step-no { -webkit-text-stroke-color: var(--set); text-shadow: 0 0 40px rgba(127, 182, 255, 0.2); }
#step-3 .step-no, #step-6 .step-no { -webkit-text-stroke-color: var(--err); text-shadow: 0 0 40px rgba(255, 111, 154, 0.2); }
#step-4 .step-no, #step-7 .step-no { -webkit-text-stroke-color: var(--hist); text-shadow: 0 0 40px rgba(255, 189, 107, 0.2); }

.ch-head .kicker { margin-bottom: 0.6rem; }
.world .ch-head { margin-top: clamp(4rem, 10vh, 6rem); }

/* ── progress thread for small screens (the spine is hidden there) ── */
.thread { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 46; pointer-events: none; display: none; }
.thread i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: var(--tc, #93f2a6); box-shadow: 0 0 10px var(--tc, #93f2a6); border-radius: 0 3px 3px 0; transition: background 0.6s; }
@media (max-width: 860px) { .thread { display: block; } }

/* ── small screens ── */
@media (max-width: 860px) {
  body::after { display: none; }
  .fig, .fig.wide { width: calc(100vw - 2.5rem); }
  .hero-inner { padding-right: 1.25rem; }
  .era-head { padding-top: clamp(3.5rem, 10vh, 6rem); }
  .step-head { margin-top: 4rem; }
  .route li { flex-basis: 9.5rem; }
  .goal-foot { margin-right: 1.25rem; }
  .controls { gap: 0.7rem 1rem; }
  input[type=range] { width: 7rem; }
  .blob, .seg-b { min-height: 40px; }
}
@media (max-width: 420px) {
  body { font-size: 1rem; }
  .era-lede { font-size: 1.1em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.ch-head { margin-left: var(--col-left); padding-right: 1.5rem; margin-bottom: 2rem; }
/* the deep sea fades into the micrograph instead of meeting it at a line */
.aperture::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0;
  height: 60vh;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(in oklab, #020b12, rgba(2, 11, 18, 0.85) 25%, rgba(2, 11, 18, 0.4) 60%, rgba(2, 11, 18, 0));
}
@media (max-width: 860px) { .now { display: none; } }
/* the hero ends exactly at its scale bar */
.hero.world { padding-bottom: 0; }
@media (max-width: 860px) {
  .count-read { background: radial-gradient(closest-side, rgba(10, 16, 13, 0.95), rgba(10, 16, 13, 0.75) 70%, transparent); }
  .seg.small .seg-b { min-height: 34px; padding: 0.35rem 0.6rem; border-radius: 1rem; }
}
.duo > * { min-width: 0; }
@media (max-width: 860px) { .sb { white-space: normal; } }
