/* Railways pages (railways.php /railways, traintracker.php /train-tracker), 2026-11-20.
   The site is dark (header.php: html bg-gray-900, body text-white); these colours are checked against it:
   board text #ffd35c on #050505 = 14.3:1, green #8ef0ad = 14.8:1, red #ffaaa5 = 11.2:1, muted #c9cdd4 on #111827 = 11.1:1;
   on the tracker cards (#111827 / #0b1220) every text colour is 10.3:1 or more; the accent button #0b1205 on #84cc16 = 9.6:1.
   Sizes are in rem so they follow the browser's text size. Colour is never the only signal: every status has its word. */
.rw { --rw-board: #050505; --rw-board-edge: #2b2f36; --rw-amber: #ffd35c; --rw-green: #8ef0ad; --rw-red: #ffaaa5;
      --rw-card: #111827; --rw-card-edge: #374151; --rw-muted: #c9cdd4; --rw-accent: #84cc16; --rw-line: #9ca3af;
      font-size: 1.0625rem; line-height: 1.55; }
.rw h2 { font-family: "Bricolage Grotesque", Georgia, serif; }
.rw :focus-visible { outline: 3px solid var(--rw-accent); outline-offset: 3px; border-radius: 6px; }
.rw .rw-muted { color: var(--rw-muted); }

/* the notices: polite "updated" line and the failure alert (stays until the next good read) */
.rw-status { font-size: 1rem; color: var(--rw-muted); }
.rw-alert { border: 2px solid #f59e0b; background: #2a1d05; color: #fde68a; border-radius: 10px; padding: .85rem 1rem; font-weight: 600; }
.rw-alert[hidden], .rw-stale[hidden] { display: none; }
.rw-stale { border: 2px solid #f59e0b; background: #2a1d05; color: #fde68a; border-radius: 10px; padding: .6rem .9rem; margin-bottom: 1rem; }

/* pickers: big, labelled buttons (no tiny tabs) */
.rw-pick { display: flex; flex-wrap: wrap; gap: .5rem; }
.rw-pick button { min-height: 48px; padding: .55rem 1rem; border-radius: 10px; border: 2px solid var(--rw-card-edge); background: var(--rw-card);
                  color: #fff; font-weight: 600; font-size: 1.0625rem; cursor: pointer; }
.rw-pick button:hover { border-color: var(--rw-accent); }
.rw-pick button[aria-pressed="true"] { background: var(--rw-accent); border-color: var(--rw-accent); color: #0b1205; }

/* the station board: black with amber lettering, like a real departures board */
.rw-board { background: var(--rw-board); border: 3px solid var(--rw-board-edge); border-radius: 14px; padding: 1rem 1rem 1.25rem;
            color: var(--rw-amber); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.rw-board h3 { font-size: 1.35rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin-bottom: .6rem;
               display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.rw-board h3 .rw-clock { font-variant-numeric: tabular-nums; }
.rw-board table { width: 100%; border-collapse: collapse; font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace; }
.rw-board th { text-align: left; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--rw-muted);
               border-bottom: 1px solid var(--rw-board-edge); padding: .35rem .4rem; font-weight: 700; }
.rw-board td { padding: .55rem .4rem; border-bottom: 1px dashed #24272d; vertical-align: top; font-size: 1.125rem; font-weight: 700; }
.rw-board td.rw-t { font-variant-numeric: tabular-nums; white-space: nowrap; width: 4.5rem; }
.rw-board td.rw-p { white-space: nowrap; text-align: center; width: 4rem; }
.rw-board td.rw-s { white-space: nowrap; text-align: right; }
.rw-board .rw-calls { display: block; font-size: .95rem; font-weight: 500; color: #f3e3b0; margin-top: .2rem; white-space: normal; }
.rw-board .rw-train { display: block; font-size: .9rem; font-weight: 500; color: var(--rw-muted); }
.rw-board .rw-empty { font-family: inherit; font-weight: 600; color: #f3e3b0; padding: .75rem .2rem; }
.rw-board button.rw-more { margin-top: .75rem; min-height: 44px; padding: .45rem .9rem; border-radius: 8px; border: 2px solid var(--rw-amber);
                           background: transparent; color: var(--rw-amber); font-weight: 700; cursor: pointer; }
.rw-ok { color: var(--rw-green); }
.rw-late { color: var(--rw-amber); }
.rw-bad { color: var(--rw-red); }
.rw-ok::before { content: "\2713\00a0"; }       /* tick */
.rw-late::before { content: "\25B2\00a0"; }     /* triangle */
.rw-bad::before { content: "\2715\00a0"; }      /* cross */

/* the full timetable: a table on wide screens, one card a service on a phone */
.rw-tt { width: 100%; border-collapse: collapse; }
.rw-tt th { text-align: left; font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--rw-muted);
            border-bottom: 2px solid var(--rw-card-edge); padding: .5rem; }
.rw-tt td { padding: .65rem .5rem; border-bottom: 1px solid var(--rw-card-edge); vertical-align: top; }
.rw-tt td.rw-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 720px) {
  .rw-tt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rw-tt, .rw-tt tbody, .rw-tt tr, .rw-tt td { display: block; width: 100%; }
  .rw-tt tr { background: var(--rw-card); border: 1px solid var(--rw-card-edge); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .75rem; }
  .rw-tt td { border: 0; padding: .25rem 0; }
  .rw-tt td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--rw-muted); }
  .rw-tt td:first-child::before { content: ""; }
  .rw-tt td:first-child { font-size: 1.2rem; font-weight: 800; }
  /* a phone: each board row is time + destination, then the platform and the status under the destination */
  .rw-board { padding: .85rem .75rem 1rem; }
  .rw-board thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rw-board table, .rw-board tbody { display: block; }
  .rw-board tr { display: grid; grid-template-columns: 3.6rem 1fr; column-gap: .6rem; padding: .6rem 0; border-bottom: 1px dashed #24272d; }
  .rw-board td, .rw-board td.rw-t, .rw-board td.rw-p, .rw-board td.rw-s { display: block; border: 0; padding: 0; width: auto; font-size: 1.05rem;
                                                                          text-align: left; white-space: normal; }
  .rw-board td.rw-p, .rw-board td.rw-s { grid-column: 2; margin-top: .25rem; }
  .rw-board td.rw-p::before { content: "Platform "; }
  .rw-board td.rw-p:empty { display: none; }
}

/* the tracker's line diagram: stations top to bottom on a line, the trains beside them */
.rw-route { background: var(--rw-card); border: 1px solid var(--rw-card-edge); border-radius: 14px; padding: 1rem 1.1rem 1.1rem; }
.rw-route h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: .25rem; }
.rw-line { list-style: none; margin: .75rem 0 0; padding: 0; }
.rw-line > li { position: relative; padding: 0 0 1.1rem 2.1rem; min-height: 2.4rem; }
.rw-line > li::before { content: ""; position: absolute; left: .7rem; top: .35rem; bottom: -.35rem; width: 4px; background: var(--rw-line); border-radius: 2px; }
.rw-line > li:last-child::before { display: none; }
.rw-line > li.rw-gap::before { background: repeating-linear-gradient(to bottom, var(--rw-line) 0 8px, transparent 8px 14px); }
.rw-dot { position: absolute; left: .2rem; top: .2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--rw-card);
          border: 4px solid #fff; }
.rw-line > li.rw-gap .rw-dot { display: none; }
.rw-stn { font-weight: 800; font-size: 1.1rem; }
.rw-gaplabel { font-size: .95rem; color: var(--rw-muted); font-style: italic; }
.rw-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.rw-chip { text-align: left; min-height: 48px; border-radius: 12px; border: 2px solid var(--rw-card-edge); background: #0b1220; color: #fff;
           padding: .45rem .75rem; cursor: pointer; max-width: 100%; }
.rw-chip:hover { border-color: var(--rw-accent); }
.rw-chip strong { display: block; font-size: 1.05rem; }
.rw-chip span { display: block; font-size: .95rem; color: var(--rw-muted); }
.rw-chip .rw-ok, .rw-chip .rw-late, .rw-chip .rw-bad { font-weight: 700; }
.rw-chip .rw-ok { color: var(--rw-green); } .rw-chip .rw-late { color: var(--rw-amber); } .rw-chip .rw-bad { color: var(--rw-red); }
.rw-chip.rw-moving { border-color: #60a5fa; }

/* the train's details: a native modal dialog (focus kept inside, Escape closes, focus back to the train on close) */
dialog.rw-dlg { background: #0f172a; color: #fff; border: 2px solid var(--rw-card-edge); border-radius: 16px; padding: 0;
                width: min(40rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
dialog.rw-dlg::backdrop { background: rgba(0,0,0,.65); }
.rw-dlg .rw-dlg-in { padding: 1.25rem 1.25rem 1.4rem; }
.rw-dlg h2 { font-size: 1.6rem; font-weight: 800; }
.rw-dlg dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 1rem 0; }
.rw-dlg dt { color: var(--rw-muted); font-weight: 700; }
.rw-dlg ol.rw-calling { list-style: none; padding: 0; margin: .5rem 0 0; border-left: 4px solid var(--rw-line); }
.rw-dlg ol.rw-calling li { padding: .35rem 0 .35rem 1rem; display: flex; justify-content: space-between; gap: 1rem; }
.rw-dlg ol.rw-calling li span:last-child { font-variant-numeric: tabular-nums; color: var(--rw-muted); text-align: right; }
.rw-dlg .rw-close { min-height: 48px; padding: .55rem 1.2rem; border-radius: 10px; background: var(--rw-accent); color: #0b1205;
                    font-weight: 800; border: 0; cursor: pointer; }

@media (forced-colors: active) {
  .rw-pick button[aria-pressed="true"] { outline: 3px solid CanvasText; }
  .rw-line > li::before { background: CanvasText; }
}
@media (prefers-reduced-motion: reduce) { .rw * { transition: none !important; animation: none !important; } }
