/* ── Base ─────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', Arial, sans-serif;
    background-color: #0d1b2a;
    color: #e0e8f0;
    line-height: 1.6;
}

/* ── Skip link ───────────────────────────────────────────────────────────── */

.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #f5c518;
    color: #0d1b2a;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 1000;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.header {
    background: linear-gradient(135deg, #0d1b2a 0%, #1a3352 100%);
    border-bottom: 3px solid #f5c518;
    padding: 40px 24px 32px;
    text-align: center;
}

h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.header p {
    color: #a0b8cc;
    font-size: 0.95rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */

.nav {
    background-color: #111f2e;
    border-bottom: 1px solid #1e3a52;
    padding: 0;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 4px;
}

.nav a {
    display: inline-block;
    padding: 12px 24px;
    color: #a0b8cc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav a:hover,
.nav a:focus {
    color: #f5c518;
    border-bottom-color: #f5c518;
    background-color: transparent;
    text-decoration: none;
    outline: 2px solid #f5c518;
    outline-offset: -2px;
}

.nav a.active {
    color: #f5c518;
    border-bottom-color: #f5c518;
}

/* ── Page layout ─────────────────────────────────────────────────────────── */

.centred {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    text-align: center;
}

/* The last .centred block inside main (Disclaimer) is immediately followed by the
   footer's own .centred, whose padding doesn't collapse with it - stacking 48px+24px
   of padding on top of the next hr's own 40px margin (112px total) before the footer's
   first heading, far more than the ~40px gap around every other hr on the page. Zeroing
   both sides at just this boundary leaves only the hr's own margin, matching everywhere
   else. */
main > .centred:last-of-type {
    padding-bottom: 0;
}

footer.centred {
    padding-top: 0;
}

.section-header {
    color: #c8d8e8;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 40px 0 16px;
}

summary {
    cursor: pointer;
}

summary:focus {
    outline: 2px solid #f5c518;
    outline-offset: 2px;
}

hr {
    border: none;
    height: 1px;
    background-color: #1e3a52;
    margin: 40px 0;
}

/* ── Current status banner ───────────────────────────────────────────────── */

.current-status {
    width: 100%;
    padding: 48px 24px;
    margin-top: 24px;
    text-align: center;
}

.status-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #ffffff;
    text-transform: uppercase;
}

.status-until {
    font-size: 1.6rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 1px;
}

.status-countdown {
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.status-prediction-note {
    font-size: 0.9rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.open {
    background-color: #1e6b37;
    border-top: 3px solid #f5c518;
    border-bottom: 3px solid #f5c518;
}

.closed {
    background-color: #7a1a1a;
    border-top: 3px solid #f5c518;
    border-bottom: 3px solid #f5c518;
    animation: banner-pulse 2s ease-in-out infinite;
}

/* "Due to close" (PLAN.md 2026-11-04): a closure's predicted close has passed but its crossing
   sequence bit has not risen, so the barriers may still be up. Amber, between open and closed;
   white text on #9a5200 is 5.86:1 (WCAG AA). Deliberately not pulsing like .closed, so it needs
   no prefers-reduced-motion entry. */
.due {
    background-color: #9a5200;
    border-top: 3px solid #f5c518;
    border-bottom: 3px solid #f5c518;
}

@keyframes banner-pulse {
    0%, 100% { background-color: #7a1a1a; }
    50%       { background-color: #8f2020; }
}

/* ── Last updated / date note ────────────────────────────────────────────── */

.last-updated {
    color: #f5c518;
    font-weight: 600;
}

.last-updated-ago {
    color: #7590a6;
    font-size: 0.85rem;
    margin-left: 6px;
}

.last-updated-ago:empty {
    margin-left: 0;
}

.date-note {
    color: #7590a6;
    font-size: 0.85rem;
    margin-top: 4px;
}

.forecast-note {
    color: #7590a6;
    font-size: 0.85rem;
    margin-top: 4px;
}

.row-legend {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    color: #a0b8cc;
    font-size: 0.85rem;
    margin-top: 10px;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.legend-swatch--pass {
    background-color: #0d2240;
    border: 1px solid #90b8e0;
}

.legend-swatch--hybrid {
    background-color: #2d1145;
    border: 1px solid #c9a0e8;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrapper {
    overflow-x: auto;
    margin: 0 0 24px;
}

table {
    border-collapse: collapse;
    margin: 0 auto;
    width: 100%;
    font-size: 0.9rem;
}

th {
    background-color: #0d2035;
    color: #a0b8cc;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #1e3a52;
}

td {
    background-color: #112233;
    color: #e0e8f0;
    padding: 12px 16px;
    border-bottom: 1px solid #1a3050;
    text-align: left;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #162840;
}

.active-closure td {
    background-color: #2a1400;
    color: #ffcc44;
    font-weight: 600;
    border-bottom: 1px solid #7a3f00;
    animation: row-pulse 2s ease-in-out infinite;
}

@keyframes row-pulse {
    0%, 100% { background-color: #2a1400; }
    50%       { background-color: #3a1c00; }
}

.pass-service td {
    background-color: #0d2240;
    color: #90b8e0;
    font-style: italic;
}

/* STOP/PASS hybrid (e.g. Davenport PASS / Woodsmoor STOP) — a distinct category from plain
   PASS-PASS: it's still on the flat pre.closure.seconds default, not yet calibrated like
   STOP-STOP or PASS-interpolated (see FUTURE.md's "STOP-only towardsManchester" entry), so it
   gets its own colour rather than sharing .pass-service's, which would visually imply it's the
   same well-calibrated category. Contrast ratio #2d1145/#c9a0e8 ≈ 7.6:1, WCAG AAA. */
.hybrid-service td {
    background-color: #2d1145;
    color: #c9a0e8;
    font-style: italic;
}

.td-fixed-centred {
    width: 100px;
    text-align: center;
    font-weight: 600;
    color: #f5c518;
}

/* Self-contained pill (own background + text color) so it stays legible regardless of
   which row/table-cell background it sits on (normal td, active-closure td, hover, or
   extra-rows). Reuses the same background/text combination as the "Closed" status banner
   (.closed / .status-label) for visual consistency with the site's existing danger/alert
   colour, rather than introducing a new one. */
.overdue-note {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background-color: #7a1a1a;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* ── Tab bar (service log) ───────────────────────────────────────────────── */

.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 24px auto 0;
    border-bottom: 2px solid #1e3a52;
    padding-bottom: 0;
}

.tab-btn {
    background-color: #111f2e;
    color: #a0b8cc;
    border: 1px solid #1e3a52;
    border-bottom: none;
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: -2px;
    transition: background-color 0.15s, color 0.15s;
    font-family: inherit;
}

.tab-btn.active {
    background-color: #112233;
    color: #f5c518;
    border-color: #1e3a52;
    border-bottom: 2px solid #112233;
    font-weight: 600;
}

.tab-btn:hover:not(.active) {
    background-color: #1a3352;
    color: #e0e8f0;
}

.tab-btn:focus {
    outline: 2px solid #f5c518;
    outline-offset: 2px;
}

.tab-panel {
    border: 1px solid #1e3a52;
    border-top: none;
    padding: 16px 8px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-panel--hidden {
    display: none;
}

/* ── Info sections ───────────────────────────────────────────────────────── */

.info-section {
    text-align: left;
    max-width: 700px;
    margin: 0 auto;
    color: #a0b8cc;
    font-size: 0.95rem;
    line-height: 1.8;
}

.info-section p {
    margin-bottom: 12px;
}

.safety-warning {
    color: #ff5252;
}

.six-hundred-wide {
    max-width: 600px;
    margin: 16px auto 0;
}

/* Support note - the first thing in the crossing page's footer (PLAN.md 2026-11-01). Text
   #e0e8f0 and link #f5c518 (hover #ffd84d) on #1a3352: 10.4:1 and 7.9:1 (9.3:1). */
.support-note {
    max-width: 600px;
    margin: 40px auto 0;
    padding: 20px 24px;
    background-color: #1a3352;
    border: 2px solid #f5c518;
    border-radius: 8px;
    font-size: 1.05rem;
    color: #e0e8f0;
}

.support-note a:link,
.support-note a:visited {
    font-weight: 700;
    text-decoration: underline;
}

.footer-links {
    font-size: 0.85rem;
    color: #7590a6;
    margin-top: 16px;
}

.chart-wrapper {
    overflow-x: auto;
    margin: 0 0 24px;
    display: flex;
    justify-content: center;
}

.chart-wrapper svg {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 1200px;
    height: auto;
}

/* ── Links ───────────────────────────────────────────────────────────────── */

a:link, a:visited {
    color: #f5c518;
    text-decoration: none;
}

a:hover {
    color: #ffd84d;
    text-decoration: underline;
}

a:focus {
    outline: 2px solid #f5c518;
    outline-offset: 2px;
}

a:active {
    color: #e6b800;
}

/* ── Auto-refresh toggle ─────────────────────────────────────────────────── */

.refresh-toggle {
    background: none;
    border: 1px solid #1e3a52;
    color: #7590a6;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    margin-left: 8px;
    vertical-align: middle;
}

.refresh-toggle:hover {
    color: #a0b8cc;
    border-color: #a0b8cc;
}

.refresh-toggle:focus {
    outline: 2px solid #f5c518;
    outline-offset: 2px;
}

/* ── Show more ───────────────────────────────────────────────────────────── */

.show-more-btn {
    display: block;
    margin: 12px auto 0;
    background: #f5c518;
    border: none;
    color: #0d1b2a;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
}

.show-more-btn:hover {
    background: #dcae00;
}

.show-more-btn:focus {
    outline: 2px solid #f5c518;
    outline-offset: 2px;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.last-updated-line {
    margin-top: 16px;
}

.nre-logo {
    width: 240px;
    height: auto;
    border-radius: 8px;
    margin-top: 16px;
}

.info-section details {
    margin-top: 16px;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .closed,
    .active-closure td {
        animation: none;
    }
}

@media (max-width: 600px) {
    h1 { font-size: 1.4rem; }
    .status-label { font-size: 2.5rem; }
    .status-until { font-size: 1.1rem; }
    .status-countdown { font-size: 0.95rem; }
    .status-prediction-note { font-size: 0.8rem; }
    .status-indicator { padding: 16px 28px; }
    th, td { padding: 10px 10px; }
    .tab-btn { padding: 6px 12px; font-size: 0.8rem; }

    /* Service log: hide Davenport Actual, Davenport Type, Woodsmoor Actual,
       Woodsmoor Type, Carriages — leaving Train, Direction, Davenport Sched,
       Woodsmoor Sched, Train Type */
    .tab-panel table th:nth-child(4),
    .tab-panel table td:nth-child(4),
    .tab-panel table th:nth-child(5),
    .tab-panel table td:nth-child(5),
    .tab-panel table th:nth-child(7),
    .tab-panel table td:nth-child(7),
    .tab-panel table th:nth-child(8),
    .tab-panel table td:nth-child(8),
    .tab-panel table th:nth-child(10),
    .tab-panel table td:nth-child(10) {
        display: none;
    }
}

/* ── Accuracy page ───────────────────────────────────────────────────────── */

.accuracy-details {
    margin: 24px 0;
}

.accuracy-details > summary {
    color: #c8d8e8;
    font-weight: 600;
    padding: 8px 0;
}
