/* Linka 011: a printed timetable by day, a departure board by night. Follows the system theme. */

@font-face {
  font-family: "Barlow Condensed";
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Condensed";
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Onest";
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/onest-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest";
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/onest-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, sans-serif;

  /* Paper, ink and a signal yellow. Neutrals lean warm, towards the yellow. */
  --bg: oklch(96.4% 0.014 88);
  --bg-2: oklch(93.2% 0.018 86);
  --ink: oklch(23% 0.028 255);
  --ink-2: oklch(42% 0.025 250);
  --line: oklch(84% 0.02 85);
  --rule: oklch(30% 0.03 255);
  --signal: oklch(85% 0.165 88);
  --signal-ink: oklch(24% 0.05 80);
  --mark: oklch(88% 0.15 92 / 0.85);
  /* Direction colours: the two ends of the line, told apart by arrows and words as well. */
  --c-left: oklch(52% 0.14 245);
  --c-right: oklch(62% 0.16 50);
  --c-unknown: oklch(70% 0.02 250);
  --c-honk: oklch(55% 0.2 15);
  --c-ok: oklch(52% 0.12 155);
  --c-late: oklch(58% 0.17 35);
  --late-ink: oklch(48% 0.17 35);
  --honk-ink: oklch(50% 0.2 15);
  --ty-pendolino: oklch(55% 0.15 20);
  --ty-cityelefant: oklch(52% 0.13 245);
  --ty-loco_coaches: oklch(45% 0.08 160);
  --ty-local_unit: oklch(70% 0.14 85);
  --ty-non_passenger: oklch(40% 0.03 60);
  --ty-other: oklch(62% 0.1 300);
  --ty-pooled: oklch(62% 0.1 300);
  --ty-untyped: oklch(84% 0.015 85);
  --hatch: repeating-linear-gradient(135deg, oklch(80% 0.02 85 / 0.9) 0 2px, transparent 2px 7px);
  --live: oklch(52% 0.2 25);
  --radius: 4px;
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(18.5% 0.022 252);
    --bg-2: oklch(22.5% 0.025 252);
    --ink: oklch(93% 0.016 88);
    --ink-2: oklch(74% 0.02 250);
    --line: oklch(32% 0.025 252);
    --rule: oklch(80% 0.03 88);
    --signal: oklch(84% 0.16 88);
    --signal-ink: oklch(20% 0.04 80);
    --mark: oklch(84% 0.16 88 / 0.22);
    --c-left: oklch(72% 0.13 240);
    --c-right: oklch(76% 0.14 55);
    --c-unknown: oklch(55% 0.02 250);
    --c-honk: oklch(70% 0.18 10);
    --c-ok: oklch(72% 0.13 155);
    --c-late: oklch(72% 0.15 40);
    --late-ink: oklch(78% 0.14 40);
    --honk-ink: oklch(76% 0.16 10);
    --ty-pendolino: oklch(68% 0.16 20);
    --ty-cityelefant: oklch(70% 0.13 240);
    --ty-loco_coaches: oklch(66% 0.1 160);
    --ty-local_unit: oklch(82% 0.14 88);
    --ty-non_passenger: oklch(55% 0.03 60);
    --ty-other: oklch(70% 0.11 300);
    --ty-pooled: oklch(70% 0.11 300);
    --ty-untyped: oklch(36% 0.02 252);
    --hatch: repeating-linear-gradient(135deg, oklch(36% 0.025 252) 0 2px, transparent 2px 7px);
    --live: oklch(52% 0.2 25);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  font-feature-settings: "ss01";
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.02;
  margin: 0;
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.25rem;
}

p {
  margin: 0;
}

.tnum,
.fig,
.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-2);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--signal);
  color: var(--signal-ink);
  padding: 8px 12px;
  z-index: 10;
}

.skip:focus {
  top: 8px;
}

svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.16em;
  flex: none;
}

/* ---- top ---- */

.top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px var(--gutter) 16px;
  max-width: 1320px;
  margin: 0 auto;
}

.brand {
  text-decoration: none;
}

/* The project's mark, as in the admin and on the Twitch channel. */
.logo {
  display: block;
  width: 48px;
  height: 48px;
}

.logo-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .logo {
    display: none;
  }
  .logo-dark {
    display: block;
  }
}

.titles h1 {
  font-size: clamp(1.45rem, 1.1rem + 1.8vw, 2.4rem);
  text-transform: uppercase;
}

/* The name and the logo both lead home; the logo is the same link, left out for keyboards and screen readers. */
.home {
  text-decoration: none;
}

.home:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.where {
  color: var(--ink-2);
  font-size: 0.95rem;
}

.lang {
  font: 700 1rem/1 var(--display);
  letter-spacing: 0.08em;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 9px 11px;
  min-width: 44px;
  text-align: center;
}

.lang:hover {
  background: var(--ink);
  color: var(--bg);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* The way to the letter, in the signal's yellow so it is the first thing after the name. */
.about-link {
  font: 700 1rem/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--signal-ink);
  background: var(--signal);
  border: 1.5px solid var(--signal);
  border-radius: var(--radius);
  padding: 9px 12px;
}

.about-link:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

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

/* ---- stage ---- */

.stage {
  display: grid;
  gap: 0;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}

@media (min-width: 960px) {
  .stage {
    grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr);
  }
}

.player {
  container-type: inline-size;
  background: oklch(14% 0.02 252);
}

.frame {
  height: calc(100cqi * 9 / 16);
}

/* Twitch autoplays only a player of at least 400 × 300; narrower screens can't reach it. */
@media (min-width: 440px) {
  .frame {
    height: max(300px, calc(100cqi * 9 / 16));
  }
}

.frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.badge-slot:empty {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 700 0.95rem/1 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 10px 6px;
  border-radius: 3px;
  background: oklch(20% 0.02 252 / 0.85);
  color: oklch(96% 0.01 88);
}

.badge[data-live="live"] {
  background: var(--live);
  color: oklch(99% 0.005 90);
}

.badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.badge[data-live="live"] .badge-dot {
  background: currentColor;
  animation: pulse 2s ease-out infinite;
}

.badge-viewers {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.9;
  padding-left: 7px;
  border-left: 1px solid currentColor;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 oklch(99% 0 0 / 0.7); }
  70%, 100% { box-shadow: 0 0 0 7px oklch(99% 0 0 / 0); }
}

/* One column: 8px inside a group, 14px either side of a dashed rule. Times and "Today" share
   the --key column, so counts and train names start on one line. */
.now {
  --key: 4rem;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border-top: 1.5px solid var(--rule);
}

@media (min-width: 960px) {
  .now {
    border-top: 0;
    border-left: 1.5px solid var(--rule);
    /* The video sets the stage's height, not the list of trains beside it. */
    contain: size;
  }
}

/* Switching the period: the old numbers fade only if the new ones take a moment. */
.data.htmx-request {
  opacity: 0.55;
  transition: opacity 0.15s 0.1s;
}

/* The refresh swaps this in whole; its children stay items of .now's column. */
.now-live {
  display: contents;
}

.watch {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-weight: 500;
  font-size: 0.95rem;
  text-wrap: pretty;
}

.watch svg {
  margin-top: 0.18em;
}

.watch[data-state="watching"] svg {
  color: var(--c-ok);
}

.watch[data-state="stale"] svg,
.watch[data-state="paused"] svg {
  color: var(--late-ink);
}

.now-head {
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.today-row,
.coming-sec {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* "Today" and its count share a line, leaving the height to the trains coming up. */
.today-row {
  display: grid;
  grid-template-columns: var(--key) minmax(0, 1fr);
  align-items: baseline;
  row-gap: 4px;
}

.today-row > :not(.now-head) {
  grid-column: 2;
}

.coming-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.now h3 {
  margin: 0;
}

.today-count {
  font-size: 1.05rem;
}

.today-count .big {
  font: 700 2.6rem/0.9 var(--display);
  margin-right: 4px;
}

.today-count .sep {
  margin: 0 8px;
  color: var(--ink-2);
}

.yesterday {
  font-size: 0.95rem;
}

.honk-ink {
  color: var(--honk-ink);
}

.coming {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

/* One line a train, so the rows that fit beside the video are whole. */
.coming li {
  display: grid;
  grid-template-columns: var(--key) minmax(0, 1fr);
  line-height: 1.35;
  white-space: nowrap;
}

.coming li > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.coming .late {
  color: var(--late-ink);
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (min-width: 960px) {
  /* As many whole rows as fit: the rest wrap into a column out of sight. A column wraps only
     at a definite height, hence the list placed absolutely in a box that takes what is left. */
  .coming-sec {
    flex: 1 1 0;
    min-height: 0;
  }

  .coming-box {
    position: relative;
    flex: 1 1 0;
  }

  .coming {
    position: absolute;
    inset: 0;
    display: flex;
    flex-flow: column wrap;
    align-content: flex-start;
    column-gap: 40px;
    overflow: hidden;
  }

  .coming li {
    width: 100%;
  }
}

.dir {
  font-weight: 700;
}

.twitch-link {
  align-self: start;
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.intro {
  max-width: 62ch;
  font-size: 1.05rem;
  margin: 22px 0 6px;
  color: var(--ink-2);
}

/* ---- periods ---- */

.data {
  margin-top: 28px;
}

.periods {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  position: sticky;
  top: 8px;
  z-index: 5;
  background: var(--bg);
}

.periods a {
  font: 600 1.05rem/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 16px 11px;
  min-height: 44px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.periods a + a {
  border-left: 1.5px solid var(--rule);
}

.periods a:hover {
  background: var(--bg-2);
}

.periods a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}

/* ---- lede ---- */

.lede {
  margin: 26px 0 8px;
}

.lede-text {
  font: 600 clamp(1.7rem, 1.1rem + 2.6vw, 3.3rem)/1.08 var(--display);
  max-width: 24ch;
  text-wrap: pretty;
}

mark {
  background: linear-gradient(transparent 58%, var(--mark) 58%, var(--mark) 92%, transparent 92%);
  color: inherit;
  padding: 0 0.06em;
  font-variant-numeric: tabular-nums;
}

mark.m-honk {
  background: linear-gradient(transparent 58%, color-mix(in oklch, var(--c-honk) 35%, transparent) 58%, color-mix(in oklch, var(--c-honk) 35%, transparent) 92%, transparent 92%);
}

.figures,
.records {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0;
  margin: 26px 0 0;
  border-top: 1.5px solid var(--rule);
}

.figures > div,
.records > div {
  padding: 14px 18px 16px 0;
  border-bottom: 1px solid var(--line);
}

.figures dt,
.records dt {
  font: 600 0.95rem/1.2 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.figures dd,
.records dd {
  margin: 4px 0 0;
  display: grid;
  gap: 2px;
}

.fig {
  font: 700 2.2rem/1 var(--display);
}

.fig-note {
  color: var(--ink-2);
  font-size: 0.9rem;
}

/* ---- blocks ---- */

.block {
  padding: 46px 0 8px;
}

.block-head {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: baseline;
  padding-top: 14px;
  border-top: 4px solid var(--rule);
  margin-bottom: 20px;
}

.block-num {
  font: 700 1rem/1 var(--display);
  letter-spacing: 0.1em;
  color: var(--signal-ink);
  background: var(--signal);
  padding: 4px 6px 3px;
  border-radius: 2px;
  align-self: center;
}

.block-head h2 {
  font-size: clamp(2rem, 1.5rem + 2vw, 3.1rem);
  text-transform: uppercase;
}

.block-head .sub {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.sub {
  color: var(--ink-2);
  max-width: 68ch;
  font-size: 0.95rem;
}

.note {
  color: var(--ink-2);
  font-size: 0.9rem;
  max-width: 72ch;
  margin-top: 18px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.split {
  display: grid;
  gap: 36px 48px;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }
}

.split > div > h3:first-child,
.lead > h3:first-child {
  margin-top: 0;
}

/* The chart's hour ticks hang 12px below it. */
.split.lead {
  row-gap: 28px;
}

.lead + .split {
  margin-top: 28px;
}

.dirs {
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.dirs-say {
  margin-top: 14px;
}

/* ---- columns chart ---- */

.chart {
  --h: 200px;
  padding-top: 8px;
  margin-bottom: 2.2rem;
}

.chart-sm {
  --h: 120px;
}

.cols {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: clamp(2px, 0.6vw, 6px);
  align-items: end;
  border-bottom: 1.5px solid var(--rule);
}

.col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: calc(var(--h) + 1.3rem);
  outline-offset: 1px;
}

.col .bar {
  display: flex;
  flex-direction: column-reverse;
  height: calc(var(--h) * var(--v, 0));
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
}

.col .bar.hatch {
  height: var(--h);
  background: var(--hatch);
}

/* Later today: an empty slot waiting to fill, not a gap. */
.col[data-ahead] .bar.hatch,
.sw.ahead {
  background: none;
  outline: 1.5px dashed var(--line);
  outline-offset: -1.5px;
}

.col .colval {
  font: 600 0.8rem/1 var(--display);
  color: var(--ink-2);
  text-align: center;
  margin-bottom: 4px;
  white-space: nowrap;
}

.cols.dense .col .colval {
  font-size: clamp(0.62rem, 2.6vw, 0.8rem);
  letter-spacing: -0.02em;
}

.col[data-partial] .bar {
  opacity: 0.55;
}

.seg {
  display: block;
  flex: var(--s) 0 0;
}

.seg-left,
.sw.seg-left {
  background: var(--c-left);
}

.seg-right,
.sw.seg-right {
  background: var(--c-right);
}

.seg-unknown,
.sw.seg-unknown {
  background: var(--c-unknown);
}

.seg-honk {
  background: var(--c-honk);
}

.seg-ok {
  background: var(--c-ok);
}

.seg-late {
  background: var(--c-late);
}

.tick {
  position: absolute;
  bottom: -1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font: 600 0.85rem/1 var(--display);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .cols.dense .col:nth-child(even) .tick {
    visibility: hidden;
  }
}

.tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  translate: 0 4px;
  width: max-content;
  max-width: min(200px, 50vw);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 7px 9px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, translate 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 4;
}

.col:hover .tip,
.col:focus .tip {
  opacity: 1;
  translate: 0 0;
}

/* Tips open away from the nearer edge, so none reaches past the screen. */
.col.end .tip {
  left: auto;
  right: 0;
}

.col:hover .bar,
.col:focus-visible .bar {
  filter: brightness(1.08) saturate(1.1);
}

.legend {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex: none;
}

.sw.hatch {
  background: var(--hatch);
  outline: 1px solid var(--line);
}

/* ---- types ---- */

.stack {
  display: flex;
  height: 44px;
  border-radius: var(--radius);
  overflow: hidden;
  gap: 2px;
  background: var(--bg);
}

.ty {
  flex: var(--s) 0 0;
  min-width: 2px;
}

.ty-pendolino { background: var(--ty-pendolino); }
.ty-cityelefant { background: var(--ty-cityelefant); }
.ty-loco_coaches { background: var(--ty-loco_coaches); }
.ty-local_unit { background: var(--ty-local_unit); }
.ty-non_passenger { background: var(--ty-non_passenger); }
.ty-other { background: var(--ty-other); }
.ty-pooled { background: var(--ty-pooled); }
.ty-untyped { background: var(--hatch), var(--ty-untyped); }

.types,
.rows {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.types li {
  display: grid;
  grid-template-columns: 12px 1fr auto 4.5em;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.types .val {
  font: 700 1.2rem/1 var(--display);
}

.types .muted {
  text-align: right;
  font-size: 0.9rem;
}

.key {
  font-size: 0.85rem;
  color: var(--ink-2);
  margin-top: 10px;
}

.rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(70px, 34%) minmax(5.5em, auto);
  gap: 4px 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.rows .lbl {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

/* A colour key before the name; a wrapped name stays clear of it. */
.rows .keyed {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.rows .keyed .sw {
  margin-top: 0.3em;
}

.rows .val {
  text-align: right;
  font-weight: 600;
}

.rows .aux {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.hbar {
  display: block;
  height: 10px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}

.hbar i {
  display: block;
  height: 100%;
  width: calc(100% * var(--v));
  background: var(--ink-2);
}

.hbar.ok i {
  background: var(--c-ok);
}

.hbar.honk i {
  background: var(--c-honk);
}

/* ---- tables ---- */

.tbl {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.95rem;
}

.tbl th {
  text-align: left;
  font: 600 0.85rem/1.2 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0 8px 8px 0;
  border-bottom: 1.5px solid var(--rule);
}

.tbl td {
  padding: 9px 8px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

.tbl .num {
  text-align: right;
  white-space: nowrap;
}

.late {
  color: var(--late-ink);
  font-weight: 700;
}

.callout {
  display: grid;
  gap: 2px;
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--bg-2);
  border-radius: var(--radius);
}

.callout-label {
  font: 600 0.9rem/1.2 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---- records ---- */

.records {
  margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* ---- footer ---- */

.foot {
  max-width: 1320px;
  margin: 64px auto 0;
  padding: 0 var(--gutter) 48px;
  display: grid;
  gap: 10px;
  font-size: 0.92rem;
}

.foot p {
  max-width: 72ch;
}

/* A CityElefant on the rail, the one ornament on the page: app.js rolls it in with the scroll
   (--in from 0 to 1). Without the script, or with reduced motion, it is simply parked. */
.depot {
  container-type: inline-size;
  overflow: hidden;
  display: flex;
  justify-content: flex-end;
}

.train {
  flex: none;
  width: auto;
  height: 48px;
  stroke: none;
  --car: var(--ty-cityelefant);
}

.train .tb { fill: var(--car); }
.train .tw { fill: var(--bg); }
.train .td { fill: color-mix(in oklch, var(--car), var(--bg) 30%); }
.train .tl { fill: var(--signal); }
.train .ts { fill: none; stroke: var(--car); stroke-width: 1.4; }

.line {
  margin-bottom: 18px;
}

.track {
  height: 8px;
  background:
    linear-gradient(var(--rule), var(--rule)) 0 0 / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 12px, transparent 12px 20px) 0 3px / 100% 5px no-repeat;
}

.depot .train {
  transform: translateX(calc((var(--in, 1) - 1) * 100cqw));
}

.asof {
  color: var(--ink-2);
}

.lost {
  padding: 48px var(--gutter);
  display: grid;
  gap: 18px;
}

@media (max-width: 520px) {
  .top {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding-top: 14px;
  }
  /* The name keeps its line; the About button goes under it, the language stays in the corner. */
  .top-nav {
    display: contents;
  }
  .lang {
    grid-area: 1 / 3;
  }
  .about-link {
    grid-area: 2 / 2 / 3 / 4;
    justify-self: start;
    margin-top: -4px;
    padding: 8px 11px;
    font-size: 0.92rem;
  }
  .logo {
    width: 40px;
    height: 40px;
  }
  .where {
    font-size: 0.85rem;
  }
  .now {
    padding: 16px;
  }
  .periods {
    width: 100%;
  }
  .periods a {
    flex: 1;
    justify-content: center;
    padding: 12px 6px 11px;
    font-size: 0.98rem;
  }
  .fig {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- about ---- */

/* The letter is a postcard: the message on the left, a stamp, a postmark and the address on
   the right, a rule between them. */
.letter {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  padding: clamp(20px, 4vw, 48px);
  background: var(--bg-2);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
}

@media (min-width: 900px) {
  .letter {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    column-gap: 0;
  }
  .letter-body {
    order: -1;
    padding-right: clamp(28px, 4vw, 56px);
    border-right: 1.5px solid var(--line);
  }
  .letter-side {
    padding-left: clamp(28px, 4vw, 56px);
  }
}

.letter-side {
  display: grid;
  align-content: space-between;
  gap: 28px;
}

.stamp-wrap {
  position: relative;
  justify-self: end;
  margin-right: 8px;
}

/* Perforated: an opaque content box, and holes punched along the padding's edge. */
.stamp {
  margin: 0;
  width: clamp(92px, 10.5vw, 128px);
  aspect-ratio: 4 / 5;
  padding: 8px;
  /* Stamp paper stays light in the dark theme too. */
  background: oklch(96.4% 0.014 88);
  rotate: 2.5deg;
  filter: drop-shadow(0 1px 1px oklch(0% 0 0 / 0.18));
  mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle, #0000 3.6px, #000 4px) -6px -6px / 12px 12px round;
}

.stamp img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stamp .stamp-logo {
  object-fit: contain;
  padding: 22%;
  background: var(--signal);
}

.postmark {
  position: absolute;
  width: clamp(140px, 15vw, 184px);
  height: auto;
  left: -78%;
  bottom: -14%;
  rotate: -9deg;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  opacity: 0.62;
  pointer-events: none;
}

.postmark text {
  fill: var(--ink);
  stroke: none;
  font-family: var(--display);
  font-weight: 700;
}

.pm-ring {
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.pm-date {
  font-size: 15px;
}

/* The photo, a print clipped over the card's top edge; the letter flows round it. */
.snapshot {
  position: relative;
  float: right;
  margin: 18px 0 14px 18px;
  width: clamp(118px, 14vw, 180px);
  padding: 8px 8px 26px;
  background: oklch(97.5% 0.008 88);
  rotate: -3.5deg;
  box-shadow: 0 1px 2px oklch(0% 0 0 / 0.16), 0 6px 14px -6px oklch(0% 0 0 / 0.3);
}

.snapshot img {
  display: block;
  width: 100%;
  height: auto;
}

.clip {
  position: absolute;
  top: -30px;
  left: 22px;
  width: 22px;
  height: auto;
  rotate: 8deg;
  fill: none;
  stroke: oklch(62% 0.012 250);
  stroke-width: 2.4;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 0.5px oklch(0% 0 0 / 0.25));
}

/* Over the card's top edge once the letter, not the address, starts the card. */
@media (min-width: 900px) {
  .snapshot {
    margin: calc(-1 * clamp(20px, 4vw, 48px) - 14px) 0 14px 22px;
  }
}

.to {
  font-style: normal;
  display: grid;
  font: 600 clamp(1.15rem, 1rem + 0.5vw, 1.4rem)/1 var(--display);
  letter-spacing: 0.02em;
}

.to span {
  padding: 14px 0 6px;
  border-bottom: 1.5px solid var(--line);
}

.letter-body {
  max-width: 62ch;
}

.greeting {
  font: 700 clamp(2.2rem, 1.6rem + 2.6vw, 3.6rem)/1 var(--display);
  margin: 0 0 18px;
}

.letter-body p {
  margin: 0 0 14px;
  font-size: clamp(1.05rem, 1rem + 0.25vw, 1.18rem);
  line-height: 1.62;
  text-wrap: pretty;
}

.letter-body .closing {
  margin: 26px 0 4px;
  color: var(--ink-2);
}

.signature {
  display: block;
  height: clamp(64px, 7vw, 88px);
  width: auto;
  fill: var(--ink);
  stroke: none;
  rotate: -4deg;
  margin: 2px 0 0 -6px;
}

.letter-body .signed {
  margin: 0;
  font: 600 0.95rem/1 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.letter-body .ps {
  margin: 28px 0 0;
}

.about-back {
  margin: 40px 0 0;
}
