/* ---------- London, in Thirty-Three Parts ---------- */
:root {
  --paper: #f1eadb;
  --paper-deep: #e6dcc6;
  --card: #f9f5ec;
  --ink: #1c2230;
  --ink-2: #454b59;
  --ink-3: #5f636c;
  --rule: rgba(28, 34, 48, .16);
  --land: #ede3cd;
  --land-dim: #e9e0cb;
  --water: #bcd2d3;
  --water-line: #7fa3aa;
  --accent: #b03320;
  --gold: #9c7630;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --body: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --rail-h: 46px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: var(--grain, none);
  color: var(--ink);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
em, i { font-style: italic; }
::selection { background: rgba(194, 59, 34, .22); }

/* ---------- Rail (the Borough Line progress bar) ---------- */
.rail {
  position: fixed; inset: 0 0 auto 0; height: var(--rail-h); z-index: 50;
  background: rgba(241, 234, 219, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  transform: translateY(-100%); transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.rail.show { transform: none; }
.rail-inner { height: 100%; display: flex; align-items: center; gap: 22px; padding: 0 24px; max-width: 1600px; margin: 0 auto; }
.rail-now { display: flex; align-items: baseline; gap: 10px; min-width: 240px; white-space: nowrap; }
.rail-num { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: .06em; }
.rail-title { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .005em; }
.rail-track { position: relative; flex: 1; height: 100%; }
.rail-track::before, .rail-fill {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px;
  background: rgba(28, 34, 48, .14);
}
.rail-fill { right: auto; width: 0; background: var(--accent); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.stn {
  position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; padding: 0;
  border-radius: 50%; border: 2px solid rgba(28, 34, 48, .35); background: var(--paper); cursor: pointer;
  transition: transform .25s, border-color .3s, background .3s;
}
.stn::after { content: ''; position: absolute; inset: -10px -4px; } /* larger hit area */
.stn.done { border-color: var(--accent); }
.stn.cur { border-color: var(--ink); background: var(--ink); transform: scale(1.45); }
.stn:hover, .stn:focus-visible { transform: scale(1.6); outline: none; border-color: var(--ink); }
.stn .stn-tip {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%) translateY(-4px);
  font-family: var(--mono); font-size: 11px; white-space: nowrap; background: var(--ink); color: var(--paper);
  padding: 3px 7px; border-radius: 3px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.stn:hover .stn-tip, .stn:focus-visible .stn-tip { opacity: 1; transform: translateX(-50%) translateY(0) scale(.62); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; justify-items: end;
  padding: 5vh 5vw;
}
.neatline {
  position: absolute; inset: 18px; border: 1px solid rgba(28, 34, 48, .45); pointer-events: none;
  animation: neat 1.4s cubic-bezier(.2,.7,.2,1) both;
}
.neatline::before { content: ''; position: absolute; inset: 5px; border: 3px double rgba(28, 34, 48, .25); }
.coord { position: absolute; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--ink-3); background: var(--paper); padding: 0 8px; }
.coord.c1 { top: -8px; left: 60px; }
.coord.c2 { bottom: -8px; right: 60px; }
@keyframes neat { from { opacity: 0; clip-path: inset(0 50% 0 50%); } to { opacity: 1; clip-path: inset(0 0 0 0); } }

.hero-text { position: relative; z-index: 2; width: min(40vw, 620px); }
.kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2);
  margin: 0 0 28px; animation: rise 1s .2s both;
}
.kicker span:first-child { color: var(--accent); }
h1 {
  font-family: var(--display); font-weight: 800; margin: 0; line-height: .86; letter-spacing: -.025em;
  font-size: clamp(60px, 8.2vw, 140px); font-variation-settings: 'SOFT' 30, 'WONK' 0;
}
h1 span { display: block; }
h1 .l1 { animation: rise 1.1s .35s both; }
h1 .l2 {
  font-style: italic; font-weight: 400; color: var(--accent); font-size: .62em; letter-spacing: -.01em;
  font-variation-settings: 'SOFT' 100, 'WONK' 1; margin: .12em 0 .02em .06em; animation: rise 1.1s .6s both;
}
h1 .l3 { animation: rise 1.1s .85s both; }
.dek { font-size: clamp(17px, 1.35vw, 21px); color: var(--ink-2); max-width: 32em; margin: 34px 0 34px; animation: rise 1.1s 1.1s both; }
.begin {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none;
  font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  padding: 14px 22px 14px 24px; border-radius: 999px; background: var(--ink); color: var(--paper);
  animation: rise 1.1s 1.35s both; transition: background .25s, transform .25s;
}
.begin:hover { background: var(--accent); transform: translateY(-2px); }
.begin .arrow { display: inline-block; animation: bob 2.2s 3s infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: none; } 50% { transform: translateY(4px); } }

.hero-map { position: absolute; z-index: 1; left: 3vw; top: 7vh; bottom: 7vh; width: 52vw; will-change: transform; }
.hero-map svg { width: 100%; height: 100%; display: block; overflow: visible; }

.rose { position: absolute; right: 5vw; bottom: 7vh; width: 92px; height: 92px; z-index: 2; animation: spin-in 2.4s 1.5s cubic-bezier(.2,.7,.2,1) both; }
.rose-ring { fill: none; stroke: var(--ink); stroke-width: .8; opacity: .5; }
.rose-ring.thin { stroke-width: .4; }
.rose-star { fill: var(--paper); stroke: var(--ink); stroke-width: .8; stroke-linejoin: round; }
.rose-half { fill: var(--ink); }
.rose-n { font-family: var(--display); font-weight: 700; font-size: 11px; text-anchor: middle; fill: var(--ink); }
@keyframes spin-in { from { opacity: 0; transform: rotate(-120deg) scale(.6); } to { opacity: 1; transform: none; } }

/* ---------- Map (shared by hero + main) ---------- */
.grat path { fill: none; stroke: var(--ink); stroke-opacity: .07; stroke-width: .6; vector-effect: non-scaling-stroke; }
.river { fill: var(--water); }
.rip { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.rip.w2, .rip.w8, .rip.w14 { stroke: var(--water); }
.rip.w4 { stroke: var(--water-line); stroke-opacity: .85; }
.rip.w10 { stroke: var(--water-line); stroke-opacity: .5; }
.rip.w16 { stroke: var(--water-line); stroke-opacity: .28; }
.meridian path { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.meridian text { font-family: var(--mono); fill: var(--accent); letter-spacing: .08em; }
.b {
  fill: var(--land); stroke: var(--ink); stroke-width: .7; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill .7s ease, opacity .7s ease;
}
.lbl {
  font-family: var(--display); font-weight: 600; font-variation-settings: 'SOFT' 50;
  text-anchor: middle; fill: var(--ink); letter-spacing: .08em; text-transform: uppercase;
  paint-order: stroke; stroke: var(--land); stroke-linejoin: round;
  pointer-events: none; transition: opacity .4s;
}
.lbl.off { opacity: 0; }
.lbl.cur { fill: var(--ink); font-weight: 800; }

/* hero drawing sequence */
#hero-map .b { stroke-dasharray: 1 1; stroke-dashoffset: 1; fill-opacity: 0; stroke-width: .9;
  animation: draw 2s var(--d, 0s) cubic-bezier(.45,.05,.3,1) forwards, fillin 1.4s calc(var(--d, 0s) + 1.5s) ease forwards; }
#hero-map .water, #hero-map .grat, #hero-map .meridian { animation: fade 1.6s 2.1s both; }
#hero-map .lbl { animation: fade 1.2s calc(var(--d, 0s) + 2.2s) both; }
#hero-map .lbl.off { animation: none; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fillin { to { fill-opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#hero-map .b { cursor: pointer; }
#hero-map .meridian { opacity: .55; }
#hero-map .b:hover { fill: #e6d6b4; }

/* main map */
.scrolly { position: relative; display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(400px, .95fr); }
.figure { position: sticky; top: 0; height: 100vh; height: 100svh; padding: calc(var(--rail-h) + 14px) 0 18px 18px; }
.map-frame {
  position: relative; width: 100%; height: 100%;
  border: 1px solid rgba(28, 34, 48, .3); background: rgba(250, 246, 237, .42);
  box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 6px rgba(28, 34, 48, .12);
  overflow: hidden;
}
#map { width: 100%; height: 100%; display: block; }
#map .b { cursor: pointer; }
#map .b:hover { stroke-width: 1.6; }
.focus-halo { fill: none; stroke: var(--ink); stroke-opacity: .12; stroke-width: 9; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; transition: opacity .5s; }
.focus-line { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; transition: opacity .5s; }
.route path { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.route .ghost { stroke: var(--accent); stroke-opacity: .32; transition: opacity .6s; }
.route .seg { stroke: var(--accent); stroke-dasharray: 1 2; stroke-dashoffset: 1; transition: stroke-dashoffset .9s cubic-bezier(.4,.1,.2,1); }
.route .seg.on { stroke-dashoffset: 0; }
.stations path { opacity: 0; transition: opacity .4s; }
.stations path.on { opacity: 1; }
.stations .outer path { stroke: var(--ink); }
.stations .inner path { stroke: #fbf8f1; }
.cur-ring { fill: none; stroke: var(--accent); pointer-events: none; animation: pulse 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.cur-ring.hidden { animation: none; visibility: hidden; }
@keyframes pulse { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.8); } }
.marker text { font-family: var(--display); font-style: italic; font-weight: 500; fill: var(--accent); paint-order: stroke; stroke: var(--paper); stroke-linejoin: round; }
.marker circle { fill: var(--accent); }
.marker, .meridian, .route .ghost, .focus { transition: opacity .6s; }
.hidden { opacity: 0 !important; pointer-events: none; }

.dorling circle { stroke: var(--ink); stroke-width: .8; vector-effect: non-scaling-stroke; cursor: pointer; }
.dorling text { font-family: var(--mono); font-weight: 500; text-anchor: middle; dominant-baseline: central; fill: var(--ink); pointer-events: none; }
.dorling { transition: opacity .6s; }

.map-caption {
  position: absolute; left: 22px; bottom: 18px; max-width: 60%;
  font-family: var(--display); pointer-events: none;
  text-shadow: 0 0 3px var(--paper), 0 0 10px var(--paper), 0 0 18px var(--paper);
}
.map-caption .cap-num { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.map-caption .cap-name { display: block; font-size: clamp(26px, 3vw, 44px); font-weight: 700; line-height: 1; letter-spacing: -.01em; font-variation-settings: 'SOFT' 60; }
.map-caption .cap-name i { font-weight: 400; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.map-caption > * { animation: capin .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes capin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.map-legend {
  position: absolute; right: 16px; top: 16px; padding: 10px 14px; border: 1px solid var(--rule); background: rgba(249, 245, 236, .92);
  font-family: var(--mono); font-size: 12px; line-height: 1.9; transition: opacity .5s; min-width: 150px;
}
.map-legend:empty { opacity: 0; }
.map-legend .sw { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 8px; border: 1px solid rgba(28,34,48,.5); }
.map-legend .lg-title { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

.map-scale { position: absolute; right: 22px; bottom: 22px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; transition: opacity .4s; }
.scale-bar { height: 6px; border: 1px solid var(--ink); border-top: 0; background: linear-gradient(90deg, var(--ink) 0 50%, transparent 50%) bottom / 100% 3px no-repeat; transition: width .2s; }

.tooltip {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; opacity: 0;
  background: var(--ink); color: var(--paper); padding: 8px 12px 9px; border-radius: 4px; max-width: 260px;
  font-family: var(--body); font-size: 14px; line-height: 1.35; box-shadow: 0 8px 26px rgba(20, 20, 30, .2);
  transition: opacity .15s;
}
.tooltip.on { opacity: 1; }
.tooltip b { font-family: var(--display); font-size: 17px; font-weight: 600; display: block; }
.tooltip small { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }

/* ---------- Steps ---------- */
.steps { position: relative; padding: 0 clamp(20px, 3.4vw, 60px) 30vh clamp(24px, 3vw, 52px); }
.step { position: relative; padding: 22vh 0; }
.step:first-child { padding-top: 28vh; }
.step.chapter { padding: 16vh 0; }
.reveal > * { opacity: 0; transform: translateY(18px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in > * { opacity: 1; transform: none; }
.reveal.in > *:nth-child(2) { transition-delay: .07s; } .reveal.in > *:nth-child(3) { transition-delay: .14s; }
.reveal.in > *:nth-child(4) { transition-delay: .21s; } .reveal.in > *:nth-child(5) { transition-delay: .28s; }
.reveal.in > *:nth-child(6) { transition-delay: .35s; } .reveal.in > *:nth-child(7) { transition-delay: .42s; }
.reveal.in > *:nth-child(n+8) { transition-delay: .48s; }

/* prologue / interlude */
.era { max-width: 30em; }
.era .year {
  font-family: var(--display); font-weight: 300; font-size: clamp(64px, 7.5vw, 120px); line-height: .9; letter-spacing: -.03em;
  color: var(--accent); font-variation-settings: 'SOFT' 100, 'WONK' 1; font-style: italic; display: block; margin-bottom: 10px;
}
.era h2, .part h2, .names h2, .finale h2 {
  font-family: var(--display); font-weight: 700; font-size: clamp(32px, 3vw, 46px); line-height: 1.05; letter-spacing: -.012em; margin: 0 0 18px;
  font-variation-settings: 'SOFT' 40;
}
.era p, .part p, .names p, .finale p { margin: 0 0 1em; color: var(--ink-2); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }

.part { text-align: left; }
.part .part-num { font-family: var(--display); font-style: italic; font-weight: 300; font-size: clamp(22px, 2vw, 30px); color: var(--ink-3); font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.part h2 { font-size: clamp(54px, 5.6vw, 92px); line-height: .92; letter-spacing: -.03em; margin: 6px 0 24px; font-weight: 800; }
.part h2 em { font-weight: 300; color: var(--accent); font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.part .rule { width: 80px; height: 4px; background: var(--accent); border-radius: 2px; margin: 0 0 24px; }

/* chapter card */
.card {
  --c: var(--accent); --t: var(--land); --deep: var(--ink);
  position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  padding: 34px clamp(24px, 2.6vw, 44px) 30px;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -22px rgba(40, 32, 20, .32), 0 2px 6px -2px rgba(40, 32, 20, .12);
}
.card::before { content: ''; position: absolute; left: -1px; right: -1px; top: -1px; height: 7px; background: var(--c); border-radius: 3px 3px 0 0; }
.stop { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 6px 0 16px; }
.roundel {
  width: 38px; height: 38px; border-radius: 50%; border: 5px solid var(--c); display: grid; place-items: center;
  font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--ink); letter-spacing: 0; flex: none; background: var(--card);
}
.card h2 {
  font-family: var(--display); font-weight: 800; font-size: clamp(38px, 3.6vw, 58px); line-height: .98; letter-spacing: -.022em;
  margin: 0 0 10px; font-variation-settings: 'SOFT' 30;
}
.tagline { font-family: var(--display); font-style: italic; font-weight: 400; font-size: 21px; line-height: 1.35; color: var(--deep); margin: 0 0 22px; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.etym { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 0 14px; margin: 0 0 20px; display: grid; grid-template-columns: auto 1fr; gap: 2px 18px; align-items: baseline; }
.etym .lab { grid-column: 1 / -1; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.etym .oe { font-family: var(--display); font-style: italic; font-size: 26px; font-weight: 500; color: var(--deep); font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.etym .gloss { font-family: var(--display); font-size: 19px; }
.etym p { grid-column: 1 / -1; margin: 6px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 8px; }
.stats div { border-left: 3px solid var(--t); padding: 2px 0 2px 12px; }
.stats dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.stats dd { margin: 0; font-family: var(--display); font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.01em; }
.stats dd small { font-size: 14px; font-weight: 400; color: var(--ink-3); }
.formed { font-size: 14.5px; color: var(--ink-3); font-style: italic; margin: 0 0 22px; line-height: 1.45; }
.story p { margin: 0 0 1em; }
.story p:first-child::first-letter {
  font-family: var(--display); font-weight: 700; float: left; font-size: 4.1em; line-height: .78; padding: .07em .1em 0 0; color: var(--c);
  font-variation-settings: 'SOFT' 50;
}
.curios { margin: 26px 0 0; padding: 20px 22px 8px; background: var(--paper); background: color-mix(in oklab, var(--t) 55%, var(--card)); border-radius: 3px; }
.curios h3 { margin: 0 0 10px; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--deep); }
.curios ol { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.curios li { position: relative; padding: 0 0 12px 30px; font-size: 16.5px; line-height: 1.5; counter-increment: c; }
.curios li::before {
  content: counter(c, lower-roman) '.'; position: absolute; left: 0; top: 1px; font-family: var(--display); font-style: italic; color: var(--deep); font-size: 16px;
}
.motto { margin: 22px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 16px; color: var(--ink-2); }
.motto .lab { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.motto em { font-family: var(--display); font-size: 20px; color: var(--ink); font-variation-settings: 'SOFT' 100, 'WONK' 1; }

/* names interlude */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; }
.chip {
  font-family: var(--display); font-style: italic; font-size: 20px; font-weight: 500; font-variation-settings: 'SOFT' 100, 'WONK' 1;
  padding: 6px 16px 7px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer;
  transition: background .25s, color .25s, transform .2s;
}
.chip:hover { transform: translateY(-2px); }
.chip.on { background: var(--ink); color: var(--paper); }
.chip-detail { min-height: 250px; background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 18px 22px; box-shadow: 0 18px 40px -26px rgba(40, 32, 20, .35); }
.chip-detail .cd-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.chip-detail .cd-el { font-family: var(--display); font-size: 36px; font-weight: 700; font-style: italic; color: var(--accent); font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.chip-detail .cd-oe { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.chip-detail .cd-meaning { font-family: var(--display); font-size: 19px; margin: 0 0 12px; color: var(--ink); }
.chip-detail ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; }
.chip-detail li { break-inside: avoid; padding: 4px 0; font-size: 15.5px; line-height: 1.35; border-top: 1px dotted var(--rule); }
.chip-detail li b { font-family: var(--display); font-weight: 600; }
.chip-detail li span { color: var(--ink-3); font-style: italic; }
.chip-detail .cd-in { animation: capin .5s both; }

/* numbers */
.num-big { font-family: var(--display); font-weight: 800; font-size: clamp(48px, 4.8vw, 76px); line-height: 1; letter-spacing: -.02em; color: var(--accent); display: block; margin: 10px 0 12px; font-variant-numeric: lining-nums; }
.rank { list-style: none; padding: 0; margin: 18px 0 0; font-size: 15.5px; }
.rank li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 5px 0; border-top: 1px dotted var(--rule); align-items: baseline; }
.rank li span:first-child { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.rank li span:last-child { font-family: var(--mono); font-size: 13px; }

/* finale */
.finale blockquote { margin: 28px 0 26px; padding: 0 0 0 22px; border-left: 4px solid var(--accent); font-family: var(--display); font-style: italic; font-size: 25px; line-height: 1.35; font-variation-settings: 'SOFT' 100, 'WONK' 1; color: var(--ink); }
.finale cite { display: block; margin-top: 10px; font-family: var(--mono); font-style: normal; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.again { display: inline-flex; gap: 10px; align-items: center; border: 1.5px solid var(--ink); border-radius: 999px; padding: 10px 20px; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; transition: background .25s, color .25s; }
.again:hover { background: var(--ink); color: var(--paper); }
.index { display: flex; flex-wrap: wrap; gap: 6px 6px; margin: 26px 0 0; }
.index a { font-family: var(--mono); font-size: 11.5px; text-decoration: none; padding: 3px 9px; border-radius: 999px; background: var(--t); border: 1px solid rgba(28,34,48,.18); transition: background .2s, color .2s; }
.index a:hover { background: var(--ink); color: var(--paper); }

/* ---------- Colophon ---------- */
.colophon { position: relative; border-top: 1px solid var(--rule); background: var(--paper-deep); padding: 70px 24px 90px; }
.colophon-inner { max-width: 760px; margin: 0 auto; font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
.colophon h2 { font-family: var(--display); font-size: 30px; margin: 0 0 20px; color: var(--ink); }
.colophon strong { color: var(--ink); font-weight: 600; }
.colophon-foot { margin-top: 30px; font-family: var(--display); font-style: italic; font-size: 18px; color: var(--ink); }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  :root { --rail-h: 40px; }
  body { font-size: 17.5px; }
  .rail-inner { padding: 0 14px; gap: 12px; }
  .rail-now { min-width: 0; flex: none; max-width: 46%; overflow: hidden; }
  .rail-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .stn { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-width: 1.5px; }
  .stn .stn-tip { display: none; }

  .hero { grid-template-columns: 1fr; align-items: end; justify-items: stretch; padding: 6vh 22px 9vh; }
  .hero-map { position: absolute; inset: 4vh -8vw auto -8vw; width: auto; height: 36vh; opacity: .6; }
  .hero { min-height: 100svh; padding-top: 38vh; }
  h1 { font-size: clamp(54px, 15vw, 80px); }
  .hero-text { padding: 0; width: auto; }
  .kicker { font-size: 10.5px; margin-bottom: 18px; }
  .dek { margin: 20px 0 24px; font-size: 16.5px; }
  .rose { width: 64px; height: 64px; right: 26px; top: 30px; bottom: auto; }
  .coord { display: none; }
  .neatline { inset: 10px; }

  .scrolly { display: block; }
  .figure { height: 50vh; height: 50svh; padding: calc(var(--rail-h) + 6px) 8px 6px; z-index: 5; background: var(--paper); background-image: var(--grain, none); }
  .figure::after { content: ''; position: absolute; left: 0; right: 0; bottom: -28px; height: 28px; background: linear-gradient(var(--paper), rgba(241,234,219,0)); pointer-events: none; }
  .map-caption { left: 14px; bottom: 12px; max-width: 70%; }
  .map-caption .cap-name { font-size: 24px; }
  .map-legend { right: 8px; top: 8px; padding: 6px 10px; font-size: 10.5px; line-height: 1.7; min-width: 0; }
  .map-scale { display: none; }
  .map-caption .cap-num { font-size: 10px; }
  .steps { padding: 0 14px 40vh; }
  .step { padding: 20vh 0; }
  .step:first-child { padding-top: 12vh; }
  .step.chapter { padding: 10vh 0; }
  .card { padding: 26px 20px 20px; }
  .tagline { font-size: 19px; }
  .stats dd { font-size: 20px; }
  .etym .oe { font-size: 22px; }
  .chip-detail ul { columns: 1; }
  .chip-detail { min-height: 300px; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
  #hero-map .b { stroke-dashoffset: 0; fill-opacity: 1; }
}

/* ---------- House bar additions ---------- */
.rail .home { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--ink-3); text-decoration: none; white-space: nowrap; flex: none; }
.rail .home:hover { color: var(--ink); }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
.noscript { max-width: 40em; margin: 0 auto; padding: 20vh 24px; }
.noscript h2 { font-family: var(--display); font-size: 32px; margin: 0 0 16px; }
.noscript p { color: var(--ink-2); }
.colophon-home { margin-top: 24px; font-family: var(--mono); font-size: 13px; letter-spacing: .02em; }
.colophon-home a { color: var(--ink-3); }
.colophon-home a:hover { color: var(--ink); }
@media (max-width: 900px) { .rail .home { display: none; } }

/* ---------- Night atlas (dark theme) ---------- */
[data-theme="dark"] {
  --paper: #14161d;
  --paper-deep: #0e1015;
  --card: #1d2029;
  --ink: #ece4d0;
  --ink-2: #c2b9a3;
  --ink-3: #8e8776;
  --rule: rgba(236, 228, 208, .16);
  --land: #242a36;
  --land-dim: #1e232d;
  --water: #23444b;
  --water-line: #5b8b94;
  --accent: #e0603f;
  --gold: #c09a52;
  color-scheme: dark;
}
[data-theme="dark"] .rail { background: rgba(20, 22, 29, .92); }
[data-theme="dark"] .stn { border-color: rgba(236, 228, 208, .4); }
[data-theme="dark"] .neatline { border-color: rgba(236, 228, 208, .45); }
[data-theme="dark"] .neatline::before { border-color: rgba(236, 228, 208, .25); }
[data-theme="dark"] #hero-map .b:hover { fill: #39404f; }
[data-theme="dark"] .map-frame { border-color: rgba(236, 228, 208, .3); background: rgba(29, 32, 41, .5); box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 6px rgba(236, 228, 208, .12); }
[data-theme="dark"] .stations .inner path { stroke: #14161d; }
[data-theme="dark"] .map-legend { background: rgba(29, 32, 41, .92); }
[data-theme="dark"] .map-legend .sw { border-color: rgba(236, 228, 208, .5); }
[data-theme="dark"] .card { box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 18px 40px -22px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .5); }
[data-theme="dark"] .chip-detail { box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .7); }
[data-theme="dark"] .index a { border-color: rgba(236, 228, 208, .2); }
@media (max-width: 900px) {
  [data-theme="dark"] .figure::after { background: linear-gradient(var(--paper), color-mix(in srgb, var(--paper) 0%, transparent)); }
}
