/* Styling for the static, server-rendered content pages (about / how-it-works /
   faq / lines). Self-contained + lightweight so crawlers and humans both get a
   fast, readable page with real HTML — the app itself stays a JS app. */
:root {
  --bg: #0A0F15; --surface: #121A24; --text: #E9EDF2; --muted: #93A0AE;
  --border: #243040; --accent: #22C58B; --accent-ink: #06131C;
  --maxw: 760px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.7 "Overpass", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: rgba(10,15,21,0.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand img { width: 26px; height: 26px; display: block; }
.site-nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; font-size: 15px; }
.site-nav a { color: var(--muted); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text); }

/* hero + content */
main { padding: 40px 0 8px; }
h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; }
.lede { font-size: 20px; color: var(--muted); margin: 0 0 28px; }
h2 { font-size: 24px; letter-spacing: -0.01em; margin: 40px 0 12px; }
h3 { font-size: 19px; margin: 26px 0 8px; }
p, li { color: #D7DEE6; }
ul, ol { padding-left: 22px; }
li { margin: 6px 0; }
strong { color: var(--text); }
.muted { color: var(--muted); }
hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

/* call-to-action button */
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
  padding: 14px 24px; border-radius: 12px; margin: 8px 0; }
.cta:hover { filter: brightness(1.08); text-decoration: none; }

/* line cards (lines page) */
.lines { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 12px; }
/* Each card is a link target (the app's homepage links every line here), so it
   has to clear the 60px sticky header when jumped to. */
.line-card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; scroll-margin-top: 76px; }
.line-card:target { border-color: var(--accent); }
/* The swatch shows the line's real colour, so it keeps it; the ring is what guarantees
   the shape is visible when the fill isn't (HC 1.21:1, SWS 1.96:1 on --surface). */
.line-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; box-shadow: 0 0 0 1px var(--text); }
.line-card h3 { margin: 0 0 4px; font-size: 18px; }
.line-card p { margin: 0; font-size: 15px; color: var(--muted); }
.line-card .route { color: var(--text); font-weight: 600; }

/* faq */
.faq dt { font-weight: 700; font-size: 18px; margin: 24px 0 6px; }
.faq dd { margin: 0 0 6px; color: #D7DEE6; }

/* footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-direction: column; gap: 10px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.disclaimer { font-size: 13px; line-height: 1.6; }

/* ---- generated line pages (docs/lines/*.html, built by ingest/pages.js) ---- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.small { font-size: 13px; }

.facts { display: grid; gap: 1px; margin: 20px 0 8px; background: var(--border); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.facts > div { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; background: var(--surface); padding: 11px 16px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-weight: 600; font-size: 14px; text-align: right; }
.facts dd .muted { font-weight: 400; }

.stations { width: 100%; border-collapse: collapse; margin: 16px 0 8px; font-size: 14px; }
.stations th, .stations td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.stations thead th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stations tbody th { font-weight: 600; color: var(--text); }
.stations td { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stations tbody tr:last-child th, .stations tbody tr:last-child td { border-bottom: none; }
@media (max-width: 420px) {
  .stations th, .stations td { padding: 8px 6px; font-size: 13px; }
  .facts > div { flex-direction: column; gap: 2px; }
  .facts dd { text-align: left; }
}

/* ---- live departure board (docs/board.js, on the generated station pages) ----
   Before board.js runs, #live-board holds the plain app link the generator wrote,
   so this block must style a card *and* leave that fallback looking deliberate. */
#live-board { margin: 0 0 28px; }
#live-board > p:only-child { margin: 0; }        /* the un-hydrated fallback CTA */
.board.on {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 18px 14px;
}
.bd-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.bd-kicker {
  display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.bd-route { display: block; font-size: 17px; font-weight: 700; line-height: 1.3; margin-top: 3px; }
.bd-arrow { color: var(--accent); }
.bd-live {
  flex-shrink: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 2px 9px;
}
.bd-live.off { color: var(--muted); }

.bd-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 2px; }
.bd-tab {
  --bd-line: var(--accent);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px;
}
.bd-tab:hover { color: var(--text); }
/* --bd-ink is emitted per line by board.js: --accent-ink is tuned for --accent, and the
   fill is swapped out from under it. The fallback keeps the no-colour case correct. */
.bd-tab.on { color: var(--bd-ink, var(--accent-ink)); background: var(--bd-line); border-color: var(--bd-line); }

.bd-list { list-style: none; margin: 12px 0 0; padding: 0; }
.bd-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: baseline;
  padding: 11px 0; border-top: 1px solid var(--border); margin: 0;
}
.bd-row:first-child { border-top: none; padding-top: 4px; }
.bd-time { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-was { color: var(--muted); font-weight: 400; font-size: 14px; }
.bd-meta { font-size: 13px; color: var(--muted); min-width: 0; }
.bd-dot { color: var(--accent); font-size: 9px; vertical-align: middle; }
.bd-right { text-align: right; white-space: nowrap; }
.bd-cd { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bd-late, .bd-early { display: block; font-size: 12px; font-weight: 600; }
.bd-late { color: #F0A33A; }
.bd-early { color: var(--muted); }
.bd-cx { color: #FF6B62; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.bd-row.cx .bd-time, .bd-row.cx .bd-meta { color: var(--muted); }

.bd-note, .bd-alert {
  margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.5;
  background: rgba(240,163,58,0.10); border: 1px solid rgba(240,163,58,0.28); color: #F3C486;
}
.bd-empty { margin: 14px 0 2px; color: var(--muted); font-size: 14.5px; }
.bd-updated { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

.bd-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.bd-swap {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 12px;
}
.bd-swap:hover { border-color: var(--accent); color: var(--accent); }
.bd-open { font-size: 14px; font-weight: 700; margin-left: auto; }

/* Narrow: the three columns can't hold "Local · Train 1249 · arrives 8:31 AM"
   and a countdown on one line, so the departure and its countdown keep the top
   row — the two things you're actually reading — and the detail drops beneath. */
@media (max-width: 460px) {
  .board.on { padding: 14px 14px 12px; }
  .bd-route { font-size: 15.5px; }
  .bd-row { grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 0; }
  .bd-time { grid-area: 1 / 1; }
  .bd-right { grid-area: 1 / 2; }
  .bd-meta { grid-area: 2 / 1 / 3 / 3; }
  .bd-late, .bd-early { display: inline; margin-left: 8px; }
  .bd-open { margin-left: 0; }
}

/* On a phone the five nav links can't share a 60px row with the wordmark — they
   wrap into it and shove "Chicagoland Rail" onto two lines. Give the nav its own
   row instead. */
@media (max-width: 560px) {
  .site-header .wrap { height: auto; flex-wrap: wrap; gap: 4px 14px; padding-top: 11px; padding-bottom: 11px; }
  .brand { font-size: 16px; }
  .site-nav { margin-left: 0; width: 100%; gap: 14px; font-size: 14px; }
}
