:root {
  color-scheme: dark;
  --night: #0b1a33;
  --night-2: #0f2142;
  --panel: #12254a;
  --panel-2: #183060;
  --rule: #24406f;
  --ink: #eef2fa;
  --ink-2: #a8b6cf;
  --ink-3: #7c8db0;
  --signal: #f2c230;          /* buttons, focus, the hero line */
  --s-sncb: #4a86e0;
  --s-app: #b98000;
  --s-oracle: #8a74e0;
  --late-1: #e0a33a;
  --late-2: #e06a4a;
  --late-3: #c23b3b;
  /* delay bands, on time to badly late; every band is labelled beside it */
  --band-0: #2e9b66; --band-1: #7cc48f; --band-2: #e3c14d;
  --band-3: #e6953b; --band-4: #e0643f; --band-5: #c8334a;
  --display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 85% -10%, #1d3a70 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 40%, #132c58 0%, transparent 60%),
    var(--night);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* A faint dot grid over the blue, like a draughtsman's sheet: cheap to paint,
   unlike a noise filter, which froze scrolling. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(168, 182, 207, .09) 1px, transparent 1.5px);
  background-size: 22px 22px;
  z-index: 0;
}

/* The network drawn behind everything. */
.rails {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.rail-lines path { fill: none; stroke: #2a4a80; stroke-width: 2; opacity: .55;
  stroke-dasharray: 1 1; stroke-dashoffset: 1; transition: stroke-dashoffset .5s ease-out; }
.rail-lines .hero-line { stroke: var(--signal); opacity: .35; stroke-width: 2.5; }
.rail-stops circle { fill: var(--night); stroke: #3a5c96; stroke-width: 2; opacity: 0;
  transform-box: fill-box; transform-origin: center; transform: scale(.4);
  transition: opacity .4s ease-out, transform .4s ease-out; }
.rail-stops circle.on { opacity: .8; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rail-lines path { stroke-dashoffset: 0 !important; transition: none; }
  .rail-stops circle { opacity: .8; transform: none; transition: none; }
}

header, main, footer { position: relative; z-index: 1; }

.top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 20px var(--gutter);
  max-width: 1240px;
  margin: 0 auto;
}
.top { gap: 10px; }
.langs { display: flex; gap: 4px; }
.share {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 1px solid var(--rule); color: var(--ink);
  font: 700 .85rem/1 var(--body); padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.share:hover { background: var(--panel-2); }
.share svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.share--trip { padding: 10px 16px; font-size: .92rem; border-color: var(--signal); }
.trip-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--night); font: 700 .92rem/1.3 var(--body);
  padding: 10px 16px; border-radius: 999px; max-width: calc(100vw - 32px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.langs button {
  background: none; border: 1px solid transparent; color: var(--ink-3);
  font: 700 .85rem/1 var(--body); padding: 7px 9px; border-radius: 6px; cursor: pointer;
}
.langs button[aria-pressed="true"] { color: var(--ink); border-color: var(--rule); }

main { max-width: 1240px; margin: 0 auto; padding: 0 var(--gutter); }

:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------------ hero */
.hero { padding: clamp(40px, 9vw, 120px) 0 clamp(36px, 6vw, 72px); max-width: 980px; }
.hero h1 {
  font: 800 clamp(2.4rem, 6.4vw, 5.2rem)/0.98 var(--display);
  letter-spacing: -0.025em;
  margin: 0 0 .45em;
  text-wrap: balance;
}
.lede {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  color: var(--ink-2);
  max-width: 38em;
  margin: 0;
  text-wrap: pretty;
}

/* --------------------------------------------------------------- sections */
section { padding: clamp(36px, 6vw, 72px) 0; }
.section-head {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  justify-content: space-between; align-items: end;
}
h2 { font: 800 clamp(1.7rem, 3.4vw, 2.6rem)/1.05 var(--display); letter-spacing: -0.02em; margin: 0; }
h3 { font: 600 1.05rem/1.25 var(--display); margin: 0; }
.section-sub { color: var(--ink-2); max-width: 46em; margin: 10px 0 0; }
.period-line { color: var(--ink-3); margin: 8px 0 0; font-size: .95rem; }

.periods { display: flex; background: var(--night-2); border: 1px solid var(--rule); border-radius: 999px; padding: 3px; }
.periods button {
  background: none; border: 0; color: var(--ink-2); font: 700 .9rem/1 var(--body);
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
}
.periods button[aria-pressed="true"] { background: var(--ink); color: var(--night); }

/* ------------------------------------------------------- departure board */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  margin-top: 28px;
  background: #050d1c;
  border: 2px solid #050d1c;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);
}
@media (max-width: 960px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .board { grid-template-columns: 1fr; } }

.kpi { background: var(--night-2); padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
/* A tile picks the spread shown under the board. */
.kpi { cursor: pointer; position: relative; transition: background .15s; }
.kpi:hover { background: #13284f; }
.kpi:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.kpi.is-selected { background: #13284f; box-shadow: inset 0 -3px 0 var(--signal); }
.spread-hint { color: var(--ink-3); font-size: .85rem; margin-top: 10px; }
.kpi--ours { background: #132750; }
.kpi .who { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .92rem; }
.kpi .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.kpi h3 { font-size: 1.15rem; }
.kpi-src { color: inherit; text-decoration: none; margin-left: 1px; vertical-align: super; font-size: .75em; }
.kpi-src:hover, .kpi-src:focus-visible { color: var(--ink); text-decoration: underline; }

/* Split-flap cells: each character on its own little flap. */
.flaps { display: flex; gap: 3px; align-items: stretch; min-height: 3.6rem; }
.flap {
  position: relative;
  font: 800 clamp(1.9rem, 3.2vw, 2.6rem)/1 var(--display);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(#1b2f57 0 50%, #172a4f 50% 100%);
  color: var(--ink);
  padding: .32em .16em .26em;
  min-width: .78em;
  text-align: center;
  border-radius: 5px;
}
.flap::after {               /* the hinge */
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: #050d1c; opacity: .9;
}
.flap--unit { background: none; color: var(--ink-2); font-size: 1.15rem; padding: 0 0 .5em 4px; align-self: end; min-width: 0; }
.flap--unit::after { display: none; }
/* One flick of the flap per character change; a softer settle on landing. */
.flap.tick { animation: flick .11s ease-out; }
.flap.tick.landed { animation: settle .3s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes flick {
  0% { transform: perspective(300px) rotateX(-70deg); filter: brightness(.7); }
  100% { transform: perspective(300px) rotateX(0); filter: none; }
}
@keyframes settle {
  0% { transform: perspective(300px) rotateX(-50deg); }
  100% { transform: perspective(300px) rotateX(0); }
}
@media (prefers-reduced-motion: reduce) { .flap.tick { animation: none; } }

.kpi .what { margin: 0; color: var(--ink-2); font-size: .95rem; line-height: 1.45; }
.kpi .vs { margin: auto 0 0; font-size: .9rem; color: var(--ink-3); }
.kpi .vs .chip { display: inline-block; font-weight: 700; color: var(--ink); background: #0b1a33; border: 1px solid var(--rule); border-radius: 999px; padding: 2px 9px; font-variant-numeric: tabular-nums; }
.kpi .vs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.kpi .vs .chip.up { color: #0b1a33; background: var(--band-1); border-color: var(--band-1); }
.kpi .vs .chip.down { color: #fff; background: var(--band-4); border-color: var(--band-4); }
.kpi .vs .verdict { font-weight: 700; }
.kpi .vs .verdict.up { color: var(--band-1); }
.kpi .vs .verdict.down { color: #f08a6c; }
.kpi .vs .verdict.flat { color: var(--ink-2); }
.kpi .empty { color: var(--ink-3); font-size: .95rem; }
/* While the numbers load: blank flaps turning over in a slow wave. */
.flaps.is-waiting .flap:not(.flap--unit) { animation: idle 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * .12s); }
.flaps.is-waiting .flap--unit { opacity: .5; }
@keyframes idle {
  0%, 72%, 100% { transform: perspective(300px) rotateX(0); filter: none; }
  80% { transform: perspective(300px) rotateX(-70deg); filter: brightness(.6); }
  88% { transform: perspective(300px) rotateX(0); filter: none; }
}
.kpi .vs-wait { display: block; width: 62%; height: 1.5em; border-radius: 999px; background: var(--rule); opacity: .5; }
@media (prefers-reduced-motion: reduce) { .flaps.is-waiting .flap { animation: none; } }

/* The commuter tile, opened up underneath the board. The notch points at
   that tile, the third of four, and follows it when the board wraps. */
.spread {
  position: relative;
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 20px 40px;
  align-items: center;
  background: #132750;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--spread-col);
  border-radius: 14px;
  padding: 26px clamp(18px, 3vw, 36px);
  /* The pointer and the top rule follow the tile whose spread is shown:
     its column among four, or among two once the tiles wrap. */
  --spread-col: var(--s-app); --at: 2; --at2: 0;
}
.spread[data-k="sncb"] { --spread-col: var(--s-sncb); --at: 0; --at2: 0; }
.spread[data-k="stop_ontime"] { --spread-col: var(--ink-3); --at: 1; --at2: 1; }
.spread[data-k="oracle"] { --spread-col: var(--s-oracle); --at: 3; --at2: 1; }
.spread::before {
  content: "";
  position: absolute;
  top: -12px;
  left: calc((var(--at) + .5) * 25% - 10px);
  border: 10px solid transparent;
  border-top: 0;
  border-bottom: 9px solid var(--spread-col);
  transition: left .2s;
}
.spread-text h3 { font: 800 clamp(1.3rem, 2.2vw, 1.7rem)/1.15 var(--display); letter-spacing: -0.01em; }
.spread-text p { color: var(--ink-2); margin: 12px 0 0; max-width: 32em; }
.spread-text .spread-one { color: var(--ink); font-weight: 700; }
.spread-chart svg { display: block; width: 100%; max-width: 440px; height: auto; }
.spread-leader { fill: none; stroke-width: 1.5; opacity: .6; }
.spread-pct { fill: var(--ink); font: 700 15px var(--body); font-variant-numeric: tabular-nums; }
.spread-label { fill: var(--ink-2); font: 400 15px var(--body); }
.spread-tail { fill: var(--ink-3); font-size: 13px; }
@media (max-width: 960px) { .spread::before { left: calc((var(--at2) + .5) * 50% - 10px); } }
@media (max-width: 760px) { .spread { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .spread::before { display: none; } }

.tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: #050d1c; color: var(--ink); border: 1px solid var(--rule);
  border-radius: 8px; padding: 9px 11px; font-size: .88rem; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); max-width: 260px;
}
.tip b { font-weight: 700; }
.tip .row { display: flex; align-items: center; gap: 7px; }
.tip .row i { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ------------------------------------------------------------ provinces */
.prov-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
@media (max-width: 900px) { .prov-grid { grid-template-columns: 1fr; } }
.map-wrap { background: rgba(15, 33, 66, .6); border: 1px solid var(--rule); border-radius: 14px; padding: 12px; }
.map { width: 100%; height: auto; display: block; }
/* Morning and evening, each a block of its own, the evening one mirrored.
   On a phone, one at a time behind two tabs. */
.legs { margin-top: 24px; }
.leg-block + .leg-block { margin-top: 56px; }
.leg-head h3 { font: 800 1.6rem/1.15 var(--display); letter-spacing: -0.01em; }
.leg-head p { color: var(--ink-2); margin: 4px 0 0; }
.leg-block .prov-grid { margin-top: 18px; }
@media (min-width: 901px) {
  .leg-block--flip .leg-head { text-align: right; }
  .leg-block--flip .prov-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .leg-block--flip .map-wrap { order: 2; }
}
.leg-tabs { display: none; }
@media (max-width: 900px) {
  .leg-tabs { display: flex; gap: 4px; margin-top: 20px; background: var(--night); border: 1px solid var(--rule);
    border-radius: 10px; padding: 4px; }
  .leg-tabs button { flex: 1; background: none; border: 0; color: var(--ink-2); font: 700 .95rem/1 var(--body);
    padding: 11px 12px; border-radius: 7px; cursor: pointer; }
  .leg-tabs button[aria-selected="true"] { background: var(--signal); color: #1a1405; }
  .legs { margin-top: 16px; }
  .legs[data-show="out"] .leg-block[data-leg="ret"],
  .legs[data-show="ret"] .leg-block[data-leg="out"] { display: none; }
  .leg-block + .leg-block { margin-top: 0; }
}

.map .province { stroke: var(--night); stroke-width: 1.4; cursor: pointer; transition: opacity .15s; }
.map .province:hover { opacity: .85; }
.map .province.sel { stroke: var(--ink); stroke-width: 3; }
.map .province.dest { stroke: var(--signal); stroke-width: 2.2; stroke-dasharray: 5 3; }
.map.has-sel .province:not(.sel):not(.dest) { opacity: .45; }
.map .flow { fill: none; stroke: var(--signal); stroke-linecap: round; opacity: .85; pointer-events: none; }
.map .hub { fill: var(--ink); pointer-events: none; }
.ramp { display: flex; align-items: center; gap: 10px; padding: 8px 6px 2px; font-size: .85rem; color: var(--ink-3); }
.ramp .steps { display: flex; gap: 2px; flex: 1; max-width: 260px; }
.ramp .steps span { flex: 1; height: 10px; }
.ramp .steps span:first-child { border-radius: 4px 0 0 4px; }
.ramp .steps span:last-child { border-radius: 0 4px 4px 0; }

.prov-panel { min-height: 280px; }
.prov-panel .hint { color: var(--ink-2); font-size: 1.05rem; border-left: 3px solid var(--signal); padding-left: 14px; }
.prov-panel h3 { font: 800 1.8rem/1.1 var(--display); letter-spacing: -0.015em; }
.prov-panel .big { font: 800 3.4rem/1 var(--display); margin: 14px 0 4px; font-variant-numeric: tabular-nums; }
.prov-panel .sub { color: var(--ink-2); margin: 0 0 22px; }
.prov-panel h4 { font: 600 1rem/1.3 var(--display); margin: 0 0 10px; color: var(--ink); }
.dests { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dests li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.dests .name { font-weight: 700; }
.dests .pct { color: var(--ink-2); font-size: .92rem; font-variant-numeric: tabular-nums; }
.dests .bar { grid-column: 1 / -1; height: 8px; background: #0b1a33; border-radius: 4px; overflow: hidden; }
.dests .bar span { display: block; height: 100%; background: var(--ink-3); border-radius: 0 4px 4px 0; }
.prov-panel .clear { margin-top: 18px; background: none; border: 1px solid var(--rule); color: var(--ink-2); border-radius: 8px; padding: 8px 12px; font: 700 .9rem var(--body); cursor: pointer; }

/* ---------------------------------------------------------------- trip */
.trip-form {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.4fr) minmax(0, .7fr) minmax(0, .8fr);
  gap: 14px 12px;
  align-items: end;
  background: rgba(15, 33, 66, .85);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 20px;
}
@media (max-width: 960px) {
  .trip-form { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .field--small { grid-column: span 1; }
}
@media (max-width: 560px) {
  .trip-form { grid-template-columns: 1fr; }
  .swap { justify-self: start; }
}
.field { display: flex; flex-direction: column; gap: 6px; position: relative; font-size: .92rem; color: var(--ink-2); }
.field input, .field select, .field textarea {
  font: 400 1.05rem/1.2 var(--body); color: var(--ink);
  background: var(--night); border: 1px solid var(--rule); border-radius: 10px;
  padding: 12px 12px; width: 100%;
}
.field textarea { resize: vertical; }
/* iOS Safari gives date and time inputs a native minimum width and their own
   height, so they spill out of a narrow column. */
.field { min-width: 0; }
.field input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%;
  min-height: 46px; display: block; }
.field input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.swap {
  background: var(--night); border: 1px solid var(--rule); color: var(--ink-2);
  width: 44px; height: 46px; border-radius: 10px; cursor: pointer; font-size: 1.2rem;
}
.toggle { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: .95rem; grid-column: 1 / span 3; }
@media (max-width: 560px) { .toggle { grid-column: auto; } }
.toggle input { width: 18px; height: 18px; accent-color: var(--signal); }
.go {
  background: var(--signal); color: #1a1405; border: 0; border-radius: 10px;
  font: 700 1.05rem/1 var(--body); padding: 15px 22px; cursor: pointer;
  grid-column: -3 / -1;
}
@media (max-width: 960px) { .go { grid-column: auto; } }
.go:disabled { opacity: .6; cursor: progress; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 4px 0 0; padding: 4px;
  list-style: none; background: #071228; border: 1px solid var(--rule); border-radius: 10px;
  max-height: 260px; overflow: auto; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.suggest li { padding: 9px 10px; border-radius: 7px; cursor: pointer; color: var(--ink); }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--panel-2); }
.form-error { color: #ff9a8a; margin: 12px 0 0; }

.trip-result { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px 32px; align-items: start; }
@media (max-width: 900px) { .trip-result { grid-template-columns: 1fr; } }
.trip-spread { background: var(--night-2); border: 1px solid var(--rule); border-radius: 14px; padding: 16px 18px 8px; }
.trip-spread h3 { font: 700 1rem/1.2 var(--display); color: var(--ink-2); }
.trip-spread svg { display: block; width: 100%; max-width: 420px; height: auto; }
.trip-route { font: 800 clamp(1.4rem, 2.6vw, 2rem)/1.15 var(--display); margin: 0 0 6px; letter-spacing: -0.01em; }
.trip-meta { color: var(--ink-2); margin: 0 0 18px; }
.trip-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: #050d1c; border-radius: 12px; overflow: hidden; }
.trip-figs div { background: var(--night-2); padding: 14px 12px; }
.trip-figs strong { display: block; font: 800 2rem/1 var(--display); font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.trip-figs span { color: var(--ink-2); font-size: .88rem; line-height: 1.35; display: block; }
.trip-note { color: var(--ink-3); font-size: .9rem; margin: 12px 0 0; }

.feedback { margin-top: 20px; }
.feedback-open {
  background: none; border: 1px solid var(--rule); color: var(--ink); border-radius: 10px;
  padding: 11px 16px; font: 700 .95rem var(--body); cursor: pointer;
}
.feedback-form { margin-top: 14px; display: grid; gap: 14px; max-width: 620px; background: rgba(15, 33, 66, .85); border: 1px solid var(--rule); border-radius: 14px; padding: 18px; }
.feedback-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.feedback-form legend { color: var(--ink-2); font-size: .92rem; margin-bottom: 8px; }
.feedback-form .go { justify-self: start; grid-column: auto; }
.feedback-done { color: var(--ink); border-left: 3px solid var(--signal); padding-left: 12px; }

.foot { max-width: 1240px; margin: 0 auto; padding: 40px var(--gutter) 60px; color: var(--ink-3); font-size: .9rem; }
.foot p { max-width: 60em; margin: 0; }

/* ------------------------------------------------------ best and worst */
.ranks { margin-top: clamp(40px, 6vw, 64px); }
.ranks > h3 { font: 800 clamp(1.3rem, 2.2vw, 1.7rem)/1.15 var(--display); letter-spacing: -0.01em; }
.ranks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 22px; }
@media (max-width: 860px) { .ranks-grid { grid-template-columns: 1fr; } }
.ranks-col { background: var(--night-2); border: 1px solid var(--rule); border-radius: 14px; padding: 18px 12px 10px; }
.ranks-col--best { border-top: 3px solid var(--band-0); }
.ranks-col--worst { border-top: 3px solid var(--band-4); }
.ranks-col h4 { font: 700 1.05rem/1.2 var(--display); margin: 0 8px 10px; }
.ranks-col ol { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranks-col li { counter-increment: rank; }
.ranks-col li + li { border-top: 1px solid rgba(36, 64, 111, .6); }
.rank {
  width: 100%;
  display: grid;
  grid-template-columns: 1.6em minmax(0, 1fr) 84px 7.2em;
  gap: 4px 12px;
  align-items: center;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  padding: 10px 8px;
  cursor: pointer;
}
.rank::before { content: counter(rank); color: var(--ink-3); font: 700 .95rem var(--display); font-variant-numeric: tabular-nums; }
.rank:hover { background: var(--panel-2); }
.rank:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.rank-route { display: flex; flex-direction: column; min-width: 0; }
.rank-route strong { font-weight: 700; font-size: .98rem; line-height: 1.3; }
.rank-meta { color: var(--ink-3); font-size: .84rem; }
.rank-strip { width: 84px; height: 14px; overflow: visible; }
.rank-track { stroke: var(--rule); stroke-width: 2; stroke-linecap: round; }
.rank-range { stroke-width: 4; stroke-linecap: round; }
.rank-dot { stroke: var(--night-2); stroke-width: 2; }
.rank-figure { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.rank-figure b { font: 800 1.05rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.rank-figure small { color: var(--ink-3); font-size: .78rem; white-space: nowrap; }
@media (max-width: 520px) {
  .rank { grid-template-columns: 1.4em minmax(0, 1fr) 6.6em; }
  .rank-strip { display: none; }
}

/* ------------------------------------------------------- research banner */
.banner {
  position: relative; z-index: 2; margin: 0;
  background: var(--signal); color: #0b1a33;
  font: 700 .88rem/1.4 var(--body); text-align: center;
  padding: 8px var(--gutter);
}
.banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------- why this indicator */
.why {
  margin-top: 18px;
  border-top: 3px solid var(--s-app);
  background: rgba(15, 33, 66, .78);
  border-radius: 0 0 12px 12px; padding: 18px 20px 16px;
}
.why h3 { font: 700 1.15rem/1.25 var(--display); }
.why .why-lead { margin: 6px 0 0; color: var(--ink-2); font-size: .95rem; max-width: 70ch; }
/* Three steps in order, numbered in the indicator's colour. */
.why-steps {
  list-style: none; margin: 16px 0 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.why-steps li {
  counter-increment: step; position: relative;
  background: var(--panel-2); border-radius: 10px; padding: 14px 16px 14px 52px;
}
.why-steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 13px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--s-app); color: var(--night);
  font: 800 .9rem/26px var(--display); text-align: center;
}
.why-steps h4 { margin: 0; font: 700 1rem/1.3 var(--display); color: var(--ink); }
.why-steps p { margin: 6px 0 0; color: var(--ink-2); font-size: .92rem; line-height: 1.45; }
.why .why-note { margin: 14px 0 0; color: var(--ink-3); font-size: .85rem; max-width: 80ch; }
@media (max-width: 860px) { .why-steps { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------- feedback */
.fb-card {
  margin-top: 16px; max-width: 660px;
  background: rgba(15, 33, 66, .85); border: 1px solid var(--rule);
  border-radius: 14px; padding: 16px 18px;
}
.fb-ask { margin: 0; font: 700 1.02rem/1.35 var(--display); }
.fb-yesno { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.fb-answer {
  background: var(--night-2); border: 1px solid var(--rule); color: var(--ink);
  font: 700 .92rem/1 var(--body); padding: 10px 16px; border-radius: 999px; cursor: pointer;
}
.fb-answer:hover { background: var(--panel-2); }
.fb-answer[aria-pressed="true"] { background: var(--ink); color: var(--night); border-color: var(--ink); }
.fb-card .feedback-form { background: none; border: 0; padding: 0; margin-top: 16px; }

/* --------------------------------------------------------------- about */
.foot h2 { font: 800 1.4rem/1.15 var(--display); margin: 0 0 10px; color: var(--ink); }
.foot p { max-width: 46em; }
.foot .mail { color: var(--signal); font-weight: 700; }
.foot .foot-data { margin-top: 18px; color: var(--ink-3); font-size: .85rem; }
.foot p + p { margin-top: 10px; }
.foot [data-t="aboutText"] { color: var(--ink-2); font-size: 1rem; }

/* While a trip is replayed: a train runs the line and each station lights
   as it passes, one day after another. */
.trip-loading { margin-top: 26px; display: grid; justify-items: start; gap: 10px; }
.trip-loading svg { width: min(100%, 420px); height: auto; overflow: visible; }
.trip-loading p { margin: 0; color: var(--ink-2); }
.loader-rail { stroke: var(--rule); stroke-width: 3; stroke-linecap: round; }
.loader-stops circle { fill: var(--night); stroke: var(--ink-3); stroke-width: 2;
  animation: lit 2.4s linear infinite; animation-delay: calc(var(--at) * 0.3s - 0.1s); }
.loader-train { fill: var(--signal); animation: run 2.4s linear infinite; }
@keyframes run { from { transform: translateX(16px); } to { transform: translateX(320px); } }
@keyframes lit {
  0%, 4% { fill: var(--night); stroke: var(--ink-3); }
  8%, 70% { fill: var(--signal); stroke: var(--signal); }
  100% { fill: var(--night); stroke: var(--ink-3); }
}
.trip-result.is-stale { opacity: .35; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) {
  .loader-train { animation: none; transform: translateX(168px); }
  .loader-stops circle { animation: none; }
}
