/* trainrage, design B "Tabloid". Tokens first; dark mode via data-theme or the OS setting. */
:root {
  --bg: #F4EFE4; --paper: #FFFDF7; --ink: #111111; --muted: #4F4A42; --red: #C8102E;
  --dim: #D9D1C0; --rule: #C9C0AE; --stale: #5E584F; --yellow: #FFD400; --on-yellow: #111111; --green: #3DB86B;
  --mast: var(--red); --mast-ink: #FFFFFF; --mast-muted: #FFE8EA;
  --display: Anton, Impact, "Arial Narrow", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312; --paper: #1E1C1A; --ink: #F4EFE4; --muted: #ABA497; --red: #E0233F;
    --dim: #34312C; --rule: #3A3732; --stale: #A39C90; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141312; --paper: #1E1C1A; --ink: #F4EFE4; --muted: #ABA497; --red: #E0233F;
  --dim: #34312C; --rule: #3A3732; --stale: #A39C90; color-scheme: dark;
}
/* Serious incidents: the brand in black. */
body.serious { --mast: #111111; --mast-muted: #BDB8AE; }
:root[data-theme="dark"] body.serious { --mast: #000000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.serious { --mast: #000000; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 17px/1.4 var(--serif);
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Masthead */
.mast { background: var(--mast); color: var(--mast-ink); }
.mast.serious { border-bottom: 1px solid var(--rule); }
.mast .bar { display: flex; align-items: center; gap: 2px; padding: 4px 4px; min-height: 52px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--mast-ink); background: transparent; border: 0; text-decoration: none; flex: none;
}
.brand { font-family: var(--display); font-size: 24px; color: var(--mast-ink); text-decoration: none; letter-spacing: 0.3px; }
.brand .wtf { color: var(--yellow); }
.mast .updated { margin-left: auto; font: 500 11px var(--mono); color: var(--mast-muted); white-space: nowrap; }
.mast .updated + .icon-btn, .mast .brand + .icon-btn.menu { margin-left: auto; }
.mast .updated ~ .icon-btn.menu { margin-left: 0; }
.mast.front .bar { padding: 14px 10px 0 20px; align-items: baseline; }
.mast.front .brand { font-size: 44px; line-height: 1; }
.mast.front .tagline { padding: 4px 20px 10px; font: 500 11px var(--mono); letter-spacing: 1px; color: var(--mast-muted); }
.mast.front .icon-btn.menu { margin-left: auto; align-self: center; }

main { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 18px 20px 16px; }
.kicker { font: 500 13px var(--mono); letter-spacing: 0.5px; color: var(--red); text-transform: uppercase; }
body.serious .kicker { color: var(--muted); }
h1.head {
  margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(48px, 15vw, 66px);
  line-height: 0.93; text-transform: uppercase; overflow-wrap: anywhere;
}
h1.head .accent { color: var(--red); }
h1.head.axed { font-size: clamp(72px, 24vw, 92px); color: var(--red); line-height: 0.9; }
h1.head.plain { font-size: clamp(40px, 13vw, 58px); line-height: 0.95; }
.sub-head { font-family: var(--display); font-size: 30px; line-height: 1; text-transform: uppercase; }
.standfirst { margin: 0; font-size: 18px; line-height: 1.4; }
.standfirst.ruled { border-top: 4px solid var(--ink); padding-top: 12px; }

.label {
  font-family: var(--display); letter-spacing: 0.5px; font-size: 18px; line-height: 1.1;
  display: inline-block; padding: 6px 10px; align-self: flex-start;
}
.label.yellow { background: var(--yellow); color: var(--on-yellow); }
.label.red { background: var(--red); color: #FFFFFF; }
.label.green { background: var(--green); color: #111111; }
.label.black { background: var(--ink); color: var(--bg); }
.label.outline { border: 2px solid var(--ink); padding: 4px 8px; }
.label.dashed { border: 2px dashed var(--muted); color: var(--muted); padding: 4px 8px; }

/* Rage-o-meter */
.meter { display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--ink); padding-top: 10px; }
.meter .top { display: flex; justify-content: space-between; align-items: baseline; }
.meter .title { font-family: var(--display); font-size: 20px; }
.meter .note { font: 500 11px var(--mono); color: var(--muted); }
.meter .cells, .meter .names { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.meter .cell { height: 22px; background: var(--dim); }
.meter .cell.on { background: var(--red); }
.meter .cell.zen { background: var(--ink); }
.meter .cell.none { background: transparent; border: 2px dashed var(--muted); }
.meter .names { font: 500 10px var(--mono); color: var(--muted); }
.meter .names .now { color: var(--red); font-weight: 700; }
.meter .names .now.zen { color: var(--ink); }

/* Platform */
.platform { display: flex; align-items: stretch; border: 3px solid var(--ink); background: var(--paper); }
.platform .num {
  display: flex; align-items: center; justify-content: center; min-width: 108px; padding: 8px 10px;
  background: var(--dim); color: var(--ink); font-family: var(--display); font-size: 76px; line-height: 1;
}
.platform .txt { flex: 1; padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.platform .big { font-family: var(--display); font-size: 26px; line-height: 1; text-transform: uppercase; }
.platform .small { font-size: 14px; line-height: 1.3; }
.platform.exclusive { background: var(--yellow); color: var(--on-yellow); }
.platform.exclusive .num { background: #111111; color: var(--yellow); }
.platform .tag { align-self: flex-start; padding: 2px 6px; background: #C8102E; color: #FFFFFF; font: 500 11px var(--mono); letter-spacing: 1px; }
.platform.stale { border-style: dashed; border-color: var(--stale); color: var(--stale); background: transparent; }
.platform.stale .num { background: var(--dim); color: var(--stale); }

/* Boxes */
.box { border: 2px solid var(--ink); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--paper); }
.box-title { font-family: var(--display); font-size: 16px; letter-spacing: 0.5px; text-transform: uppercase; }
blockquote.quote { margin: 0; font: 500 14px/1.5 var(--mono); }
.attrib { font-size: 13px; font-style: italic; color: var(--muted); }

.rows { display: flex; flex-direction: column; }
.rows .row {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-top: 1px solid var(--rule); font-size: 16px;
}
.rows .row:last-child { border-bottom: 1px solid var(--rule); }
.rows .row > :last-child { text-align: right; font-weight: 600; }
.rows .row .bad { color: var(--red); }

.next { display: flex; align-items: stretch; border: 3px solid var(--ink); text-decoration: none; }
.next .when { display: flex; flex-direction: column; justify-content: center; padding: 10px 14px; background: var(--ink); color: var(--bg); }
.next .when small { font: 500 11px var(--mono); letter-spacing: 1px; }
.next .when b { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; }
.next .what { flex: 1; padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 6px; background: var(--paper); font-size: 15px; }

.samaritans { border: 3px solid var(--ink); background: var(--paper); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.samaritans .title { font-family: var(--display); font-size: 22px; line-height: 1; }
.samaritans .btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.samaritans .call {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px;
  background: var(--ink); color: var(--bg); text-decoration: none;
}
.samaritans .call small { font: 500 11px var(--mono); letter-spacing: 1px; }
.samaritans .call b { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1; }
.samaritans .web {
  display: flex; align-items: center; justify-content: center; min-height: 56px; border: 2px solid var(--ink);
  font-family: var(--display); font-size: 18px; text-decoration: none;
}

/* Buttons and forms */
.cta {
  display: flex; align-items: center; justify-content: center; min-height: 56px; width: 100%;
  background: var(--yellow); color: var(--on-yellow); font-family: var(--display); font-size: 24px;
  letter-spacing: 1px; text-decoration: none; border: 2px solid var(--ink);
}
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font: 500 12px var(--mono); letter-spacing: 1px; color: var(--muted); position: relative; }
.field input {
  width: 100%; min-height: 52px; padding: 0 10px; border: 2px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink); font: 600 17px var(--serif); letter-spacing: 0;
}
.field input:focus { outline: 3px solid var(--yellow); outline-offset: 0; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 2px 0 0; padding: 0; list-style: none;
  background: var(--paper); border: 2px solid var(--ink); max-height: 260px; overflow-y: auto;
}
.suggest li button {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 8px 10px;
  background: transparent; border: 0; border-bottom: 1px solid var(--rule); text-align: left;
  font: 600 16px var(--serif); color: var(--ink); letter-spacing: 0;
}
.suggest li button[aria-selected="true"], .suggest li button:hover { background: var(--yellow); color: var(--on-yellow); }
.suggest li small { font: 500 12px var(--mono); color: inherit; opacity: 0.7; }
.error { color: var(--red); font-size: 15px; margin: 0; }

/* Picker */
.picker { display: flex; flex-direction: column; border-top: 4px solid var(--ink); }
.picker a {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule);
  text-decoration: none; min-height: 64px;
}
.picker .t { font-family: var(--display); font-size: 27px; line-height: 1; width: 62px; flex: none; }
.picker .t.axed { text-decoration: line-through; }
.picker.now { border-top: 0; }
.picker.now a { gap: 8px; }
.picker-head {
  display: flex; justify-content: flex-end; gap: 8px; padding-bottom: 6px; border-bottom: 4px solid var(--ink);
  font: 500 10px/1 var(--mono); letter-spacing: 0.5px;
}
.picker-head span:first-child { width: 80px; text-align: center; }
.picker-head span:last-child { width: 52px; text-align: center; }
.picker .plat {
  width: 52px; height: 44px; flex: none; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); font-family: var(--display); font-size: 22px; line-height: 1;
}
.picker .plat.hidden { border-style: dashed; }
.picker .plat.none { border: 2px dashed var(--muted); color: var(--muted); }
.picker .mid { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 0; }
.picker .mid .us { color: var(--muted); }
.picker .label { font-size: 15px; text-align: center; width: 84px; flex: none; padding: 5px 6px; align-self: center; }
.picker.now .label { width: 80px; box-sizing: border-box; min-height: 44px; display: flex; align-items: center; justify-content: center; line-height: 1.1; }
.picker .label.outline, .picker .label.dashed { padding: 3px 4px; }
.empty { font-size: 17px; }

/* Lists of journeys on the front page */
.section { border-top: 4px solid var(--ink); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.section-title { font-family: var(--display); font-size: 20px; letter-spacing: 0.5px; }
.journeys a { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; border-bottom: 1px solid var(--rule); font-size: 16px; }
.journeys a span:last-child { font-family: var(--display); color: var(--red); font-size: 20px; }
.journeys .row { display: flex; align-items: center; gap: 4px; }
.journeys .row a { flex: 1; }
.journeys .forget { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); }

/* Stop press */
.stop { background: #111111; color: var(--yellow); padding: 14px 20px; display: flex; flex-direction: column; gap: 6px; }
.stop b { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1; }
.stop span { font-size: 16px; color: #FFFFFF; }
body.stale main .standfirst, body.stale main h1.head, body.stale main .rows, body.stale main .box { color: var(--stale); }
body.stale main h1.head .accent { color: var(--stale); }

/* Menu */
.menu-panel { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; overflow-y: auto; }
.menu-panel[hidden] { display: none; }
.menu-panel nav { display: flex; flex-direction: column; border-top: 4px solid var(--ink); }
.menu-panel nav a {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--rule); text-decoration: none; font-family: var(--display); font-size: 30px; line-height: 1;
}
.menu-panel nav a span { color: var(--red); }
.theme { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 2px solid var(--ink); }
.theme button {
  min-height: 48px; border: 0; border-right: 2px solid var(--ink); background: transparent;
  font-family: var(--display); font-size: 17px; letter-spacing: 0.5px;
}
.theme button:last-child { border-right: 0; }
.theme button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.mono-label { font: 500 12px var(--mono); letter-spacing: 1px; color: var(--muted); }
.quiet { font-size: 14px; line-height: 1.4; color: var(--muted); margin: 0; }
.quiet a { color: var(--ink); font-weight: 600; }

/* Prose pages */
.prose h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 8px 0 0; text-transform: uppercase; }
.prose p, .prose li { margin: 0; font-size: 17px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

footer.legal { padding: 0 20px 18px; font: 500 10px/1.5 var(--mono); color: var(--muted); }
footer.legal a { color: inherit; }

.loading { font: 500 13px var(--mono); color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .loading::after { content: "…"; animation: dots 1.2s steps(3) infinite; }
}
@keyframes dots { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* Stale: everything that was live goes grey, so nothing old looks current (licence R4). */
body.stale main .meter, body.stale main .meter + *, body.stale main .label { filter: grayscale(1); opacity: 0.6; }
body.stale main .rows .row .bad { color: var(--stale); }
body.stale main .kicker { color: var(--stale); }
