/* 1930s railway poster, brought up to date: flat lithograph inks on buff paper,
   Gill Sans for reading, a condensed display face for poster lettering. */

:root {
  --paper: #E9D8B4;
  --sheet: #F1E4C6;
  --ink: #1E2F4A;
  --ink-soft: #4A5568;
  --red: #B5302A;
  --ochre: #D9A23A;
  --green: #3E7A6C;
  --rule: #1E2F4A;
  --late: #B5302A;
  --warn-bg: #F3D9A0;
  --display: "Big Shoulders Display", "Gill Sans", "Gill Sans MT", Impact, sans-serif;
  --text: "Gill Sans", "Gill Sans MT", "Jost", "Trebuchet MS", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16223A;
    --sheet: #1E2F4A;
    --ink: #EFE2C2;
    --ink-soft: #B9B29C;
    --red: #D2483E;
    --ochre: #E2AE4A;
    --green: #6FAE9C;
    --rule: #EFE2C2;
    --late: #F08A7E;
    --warn-bg: #4A3A1A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Paper grain over everything, like printed stock. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  opacity: .14; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* The illustration sits fixed behind the page; the sheet scrolls up over it. */
#poster {
  position: fixed; top: 0; left: 0;
  width: 100%; height: calc(36vh + 12px);
  z-index: 0;
  display: block;
}

.bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  overflow: hidden;
}
/* Title as an enamel plaque, with streamline speed lines trailing behind it. */
.bar h1 {
  position: relative;
  margin: 0;
  padding: 9px 18px 8px 22px;
  font: 800 1.75rem/1 var(--display);
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #F6EBD0;
  background: #B5302A;
  outline: 1.5px solid #F6EBD0; outline-offset: -5px;
  box-shadow: 3px 3px 0 #1E2F4A;
}
.bar h1::before, .bar h1::after {
  content: "";
  position: absolute; top: 50%;
  width: 50vw; height: 16px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(to bottom, #F6EBD0 0 3px, transparent 3px 6.5px);
}
.bar h1::before {
  right: calc(100% + 8px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 60%);
  mask-image: linear-gradient(to right, transparent, #000 60%);
}
.bar h1::after {
  left: calc(100% + 8px);
  -webkit-mask-image: linear-gradient(to left, transparent, #000 60%);
  mask-image: linear-gradient(to left, transparent, #000 60%);
}

/* The printed part of the poster: a lettering band, then the text sheet. */
main {
  position: relative; z-index: 1;
  margin-top: 36vh;
  min-height: 70vh;
  background: var(--paper);
  border-top: 6px solid var(--ink);
}
.caption {
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px 16px;
  text-align: center;
}
.caption .stations {
  margin: 0;
  font: 800 clamp(1.9rem, 9vw, 3rem)/.92 var(--display);
  letter-spacing: .02em;
  text-transform: uppercase;
  text-wrap: balance;
}
.caption .via {
  display: block;
  margin: 6px 0 4px;
  font: italic 400 1rem/1 var(--text);
  text-transform: none;
  letter-spacing: .04em;
  color: var(--ochre);
}
@media (prefers-color-scheme: dark) {
  .caption { background: #0F1828; color: #EFE2C2; }
}

.sheet { max-width: 640px; margin: 0 auto; padding: 18px 16px 28px; }

h2 { font: 700 1.5rem/1.1 var(--display); letter-spacing: .02em; margin: 22px 0 10px; }

label { display: block; margin-bottom: 14px; font-weight: 600; }
input {
  width: 100%; font: 400 1.05rem var(--text); padding: 12px 14px; margin-top: 6px;
  border: 2px solid var(--rule); border-radius: 2px;
  background: var(--sheet); color: var(--ink);
}
input:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--ochre); outline-offset: 2px;
}

button {
  font: 600 1rem var(--text); cursor: pointer;
  border-radius: 2px; padding: 10px 14px;
  border: 2px solid var(--rule); background: transparent; color: var(--ink);
}
button.primary {
  width: 100%; padding: 14px;
  background: var(--red); border-color: var(--red); color: #F6EBD0;
  font: 700 1.4rem/1 var(--display); letter-spacing: .04em;
}
button.big { font-size: 1.7rem; padding: 18px; }
button.ghost { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
button.small { padding: 6px 10px; font-size: .9rem; }
button:disabled { opacity: .5; }

.row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.row.spread { justify-content: space-between; }
.row > .station-field { flex: 1; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }
.msg { padding: 10px 12px; border-left: 4px solid var(--red); background: var(--warn-bg); color: var(--ink); }

.station-field { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  list-style: none; margin: 0; padding: 4px;
  background: var(--sheet); border: 2px solid var(--rule);
  max-height: 50vh; overflow: auto;
}
.suggest li button { width: 100%; text-align: left; border: 0; padding: 10px; font-weight: 400; text-decoration: none; }
.suggest li button span { color: var(--ink-soft); float: right; }

/* Cards: a sheet with a double printed rule. */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.list > li > button, .card {
  display: block; width: 100%; text-align: left;
  background: var(--sheet);
  border: 2px solid var(--rule);
  outline: 1px solid var(--rule); outline-offset: -6px;
  border-radius: 2px;
  padding: 14px 16px;
  text-decoration: none;
}
.card.mine { margin: 14px 0 4px; }
.card.best { border-color: var(--green); outline-color: var(--green); }
.top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.line { margin-top: 4px; }
.delta { font-variant-numeric: tabular-nums; white-space: nowrap; }
.card.best .delta { color: var(--green); }
.time { font-variant-numeric: tabular-nums; font-weight: 700; }
s { color: var(--ink-soft); font-weight: 400; }
.chip { display: inline-block; padding: 0 8px; border: 1.5px solid var(--rule); font-size: .82rem; margin-left: 6px; border-radius: 2px; }
.chip.warn { background: var(--ochre); border-color: var(--ochre); color: #1E2F4A; }
.chip.now { background: var(--green); border-color: var(--green); color: #F6EBD0; }
.plat { font-weight: 700; }
.late { color: var(--late); }

/* The answer: navy placard with a platform roundel. */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  background: var(--ink); color: var(--paper);
  border: 0; outline: 2px solid var(--ochre); outline-offset: -8px;
  padding: 20px 20px 22px;
  margin-bottom: 14px;
}
.hero .verdict { font: 800 2rem/1 var(--display); letter-spacing: .01em; }
.hero .detail { margin-top: 8px; font-size: 1.05rem; }
.hero .saving { margin-top: 10px; color: var(--ochre); font-weight: 700; }
.hero .searching { grid-column: 1 / -1; text-align: center; padding: 18px 0; font: 700 1.5rem var(--display); }
.hero .primary { margin-top: 12px; }
.roundel {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--ochre); color: #1E2F4A;
  display: grid; place-content: center; text-align: center;
  box-shadow: inset 0 0 0 4px var(--ochre), inset 0 0 0 6px #1E2F4A;
}
.roundel small { font: 600 .72rem/1 var(--text); letter-spacing: .04em; }
.roundel b { font: 800 3rem/.9 var(--display); }
@media (prefers-color-scheme: dark) {
  .hero { background: #0F1828; color: #EFE2C2; }
}

.stops { margin: 8px 0 0; padding-left: 22px; }
.stops li { padding: 3px 0; }
.stops li.passed { color: var(--ink-soft); }
.stops li.here { font-weight: 700; }

.seg { flex-shrink: 0; display: inline-flex; border: 2px solid var(--rule); }
.seg button { border: 0; border-radius: 0; padding: 6px 10px; font-size: .9rem; text-decoration: none; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

details { margin-top: 18px; }
summary { cursor: pointer; font-weight: 600; }
.foot { margin-top: 18px; }
#optimise-again { margin-top: 14px; }
#manual { margin-top: 28px; }
#manual form { margin-top: 12px; }
#guess { margin: 6px 0; }
.alts { margin: 10px 0; }
.alts button { padding: 10px 12px; font-size: .95rem; }

.credit { margin-top: 40px; font-size: .8rem; color: var(--ink-soft); }
a { color: var(--ink); }

/* Home tabs: printed ticket-style switch. */
.tabs { display: flex; margin: 0 0 18px; border: 2px solid var(--rule); }
.tabs [role="tab"] {
  flex: 1; border: 0; border-radius: 0; padding: 10px 8px;
  font: 700 1.15rem/1 var(--display); letter-spacing: .03em; text-decoration: none;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--paper); }

/* Tracking: status placard, then the route as a timetable. */
.track-hero { display: block; }
.track-hero .verdict { margin: 4px 0 2px; }
.route { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule); }
.route .stop {
  display: grid; grid-template-columns: 1fr auto 3.2em 3.2em 2.6em; gap: 6px; align-items: baseline;
  padding: 7px 2px; border-bottom: 1px solid color-mix(in srgb, var(--rule) 25%, transparent);
}
.route .stop.head { font-size: .78rem; color: var(--ink-soft); padding: 4px 2px; }
.route .stop .where { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
.route .stop .time { text-align: right; font-variant-numeric: tabular-nums; }
.route .stop .now { font-weight: 700; }
.route .call .name { font-weight: 700; }
.route .pass { font-size: .88rem; color: var(--ink-soft); }
.route .pass .now { font-weight: 400; }
.route .kind { font-size: .75rem; font-style: italic; }
.route .passed { opacity: .55; }
.route .yours .name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.route .cancelled .now { color: var(--late); }
.late-chip { justify-self: end; font-size: .78rem; font-weight: 700; padding: 0 5px; border-radius: 2px; }
.late-chip.ok { color: var(--green); }
.late-chip.warn { background: var(--ochre); color: #1E2F4A; }
.late-chip.bad { background: var(--red); color: #F6EBD0; }
.here-marker {
  list-style: none; padding: 8px 10px; margin: 2px 0;
  background: var(--ink); color: var(--paper); font-weight: 700;
}
.toggle { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 600; }
.toggle input { width: auto; margin: 0; }

.hero .reason { font-style: italic; color: var(--ochre); }

/* Checkboxes: a printed square in the ink colour, not the platform's blue. */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 1.15em; height: 1.15em; margin: 0; padding: 0; flex: none;
  border: 2px solid var(--rule); border-radius: 2px; background: var(--sheet);
  display: inline-grid; place-content: center; cursor: pointer;
}
input[type="checkbox"]::after {
  content: ""; width: .55em; height: .3em; margin-top: -.15em;
  border: solid var(--paper); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg);
  visibility: hidden;
}
input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:checked::after { visibility: visible; }

/* Title is the way home. */
.bar h1 a { color: inherit; text-decoration: none; }
.bar h1 a:focus-visible { outline: 3px solid var(--ochre); outline-offset: 4px; }

/* Inline icons sit on the text line and take its colour. */
.icon { width: 1.6em; height: 1.2em; fill: currentColor; vertical-align: -0.2em; margin-right: .25em; overflow: visible; }

/* Rail replacement buses: marked in ochre, like the bus stop flags of the period. */
.chip.bus { background: var(--ochre); border-color: var(--ochre); color: #1E2F4A; }
.roundel.bus b { font-size: 2rem; letter-spacing: .04em; }
