/*
Theme Name: British Railways 1960 MTC
Theme URI: https://britishrailways1960.co.uk/
Author: Marketing the Change
Author URI: https://marketingthechange.com/
Description: Independent, sourced, illustrated line-and-station gazetteer of the British Railways nationalisation era (1948 to 1968). FSE block theme. BR livery palette, Fraunces + Inter + JetBrains Mono typography, editorial reference layout with locomotive class, line, station, region, preserved-railway, and memorabilia custom post types. Wikipedia legacy-URL redirect table baked in.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.6
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: britishrailways1960-mtc
Tags: full-site-editing, block-theme, blog, editorial, archive, heritage
*/

/* ---------------------------------------------------------------------------
 * British Railways 1960 supplemental styles.
 *
 * theme.json carries the design tokens and block defaults. This file adds:
 *   - Cream Frame + BR Maroon Wash + Brass Foil overlay treatments
 *   - Fact strip layout (5-cell horizontal on desktop, 2-col grid on mobile)
 *   - Region pill, status pill, constituent chip
 *   - Locomotive number mono chip with Brass underline
 *   - Sourced-claim citation superscript
 *   - RCTS reference footnote block
 *   - Editorial note callout (Brass left border, Vellum fill)
 *   - Skip link + focus outlines (WCAG 2.2 AA + 60+ audience)
 * ------------------------------------------------------------------------- */

:root {
    --br1960-focus: #F1C40F;
    --br1960-radius: 4px;
    --br1960-hairline: #3D2A1E;
    --br1960-brass: #B08028;
    --br1960-signal: #A72C2C;
}

/* ---------- Base + accessibility ---------- */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

body { text-rendering: optimizeLegibility; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--wp--preset--color--br-maroon);
    color: var(--wp--preset--color--cream);
    padding: 12px 16px;
    z-index: 1000;
    text-decoration: none;
}
.skip-link:focus { left: 8px; top: 8px; }

:focus-visible {
    outline: 2px solid var(--br1960-focus);
    outline-offset: 2px;
}

/* ---------- Cream Frame (station / preservation cards) ---------- */

.br-cream-frame img,
.br-cream-frame figure {
    background: var(--wp--preset--color--cream);
    padding: 12px;
    border: 1px solid var(--br1960-hairline);
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

/* ---------- BR Maroon Wash (hero photograph overlay) ---------- */

.br-maroon-wash {
    position: relative;
    isolation: isolate;
}
.br-maroon-wash::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(63,20,20,0.25) 0%, rgba(92,30,30,0.65) 100%);
    z-index: 0;
    pointer-events: none;
}
.br-maroon-wash > * { position: relative; z-index: 1; }

/* ---------- Brass Foil (rolling-stock hero accent) ---------- */

.br-brass-foil {
    border-top: 4px solid var(--br1960-brass);
    border-bottom: 4px solid var(--br1960-brass);
    background: var(--wp--preset--color--buttercream);
}

/* ---------- Station fact strip (5-cell horizontal) ---------- */

.br-fact-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border-top: 2px solid var(--br1960-hairline);
    border-bottom: 2px solid var(--br1960-hairline);
    background: var(--wp--preset--color--vellum);
    margin: 24px 0;
}
.br-fact-strip__cell {
    padding: 16px 20px;
    border-right: 1px solid var(--br1960-hairline);
}
.br-fact-strip__cell:last-child { border-right: 0; }
.br-fact-strip__label {
    display: block;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wp--preset--color--slate);
    margin-bottom: 4px;
}
.br-fact-strip__value {
    display: block;
    font-family: var(--wp--preset--font-family--mono);
    font-size: 15px;
    color: var(--wp--preset--color--ink);
}
@media (max-width: 720px) {
    .br-fact-strip { grid-template-columns: repeat(2, 1fr); }
    .br-fact-strip__cell:nth-child(2n) { border-right: 0; }
    .br-fact-strip__cell { border-bottom: 1px solid var(--br1960-hairline); }
    .br-fact-strip__cell:last-child { border-bottom: 0; }
}

/* ---------- Region pill ---------- */

.br-region-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #F4EDD9;
}
.br-region-pill--wr { background: #5B3A1E; }  /* Livery Chocolate for Western Region */
.br-region-pill--sr { background: #1F4426; }  /* BR Green for Southern Region */
.br-region-pill--lmr { background: #5C1E1E; } /* BR Maroon for London Midland */
.br-region-pill--er { background: #294F72; }  /* Route Blue for Eastern */
.br-region-pill--ner { background: #B85820; } /* Tangerine for North Eastern */
.br-region-pill--scr { background: #003884; } /* BR Blue for Scottish */

/* ---------- Status pill ---------- */

.br-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.br-status-pill--open { background: #1F4426; color: #F4EDD9; }
.br-status-pill--closed { background: #A72C2C; color: #F4EDD9; }
.br-status-pill--preserved { background: #B08028; color: #1E1B17; }
.br-status-pill--freight { background: #5A5348; color: #F4EDD9; }
.br-status-pill--reopened { background: #294F72; color: #F4EDD9; }

/* ---------- Constituent chip (cabside-plate serif) ---------- */

.br-constituent-chip {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid var(--br1960-brass);
    background: var(--wp--preset--color--buttercream);
    color: var(--wp--preset--color--ink);
    font-family: var(--wp--preset--font-family--fraunces);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.05em;
    border-radius: 2px;
}

/* ---------- Locomotive running-number chip ---------- */

.br-loco-number {
    font-family: var(--wp--preset--font-family--mono);
    font-weight: 500;
    color: var(--wp--preset--color--ink);
    border-bottom: 2px solid var(--br1960-brass);
    padding-bottom: 1px;
    white-space: nowrap;
}

/* ---------- Sourced-claim inline citation (superscript) ---------- */

.br-cite {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
    color: var(--br1960-brass);
    font-weight: 600;
    text-decoration: none;
    margin: 0 1px;
}
.br-cite:hover { color: var(--br1960-signal); }

/* ---------- RCTS reference footnote block ---------- */

.br-rcts-reference {
    background: var(--wp--preset--color--vellum);
    border-left: 4px solid var(--br1960-brass);
    padding: 20px 24px;
    margin: 32px 0;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 15px;
    line-height: 1.55;
}
.br-rcts-reference__label {
    display: block;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wp--preset--color--slate);
    margin-bottom: 8px;
}
.br-rcts-reference__cite {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 13px;
    color: var(--wp--preset--color--slate);
    margin-top: 8px;
}

/* ---------- Editorial note callout ---------- */

.br-editorial-note {
    background: var(--wp--preset--color--vellum);
    border-left: 4px solid var(--br1960-brass);
    padding: 20px 24px;
    margin: 24px 0;
}
.br-editorial-note__label {
    display: block;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wp--preset--color--slate);
    margin-bottom: 8px;
}

/* ---------- Station-fact strip variant ---------- */

.br-station-fact-strip {
    background: var(--wp--preset--color--buttercream);
    padding: 20px 24px;
    border: 1px solid var(--br1960-hairline);
    margin: 24px 0;
}

/* ---------- Nameboard hero (BR station-name totem style) ---------- */

.br-nameboard {
    background: var(--wp--preset--color--br-maroon);
    color: var(--wp--preset--color--cream);
    padding: 32px 40px;
    border-top: 6px solid var(--wp--preset--color--brass);
    border-bottom: 6px solid var(--wp--preset--color--brass);
    text-align: center;
    font-family: var(--wp--preset--font-family--fraunces);
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ---------- Closure band (Beeching context) ---------- */

.br-closure-band {
    background: var(--wp--preset--color--vellum);
    border-top: 3px solid var(--br1960-signal);
    border-bottom: 3px solid var(--br1960-signal);
    padding: 32px 24px;
    margin: 32px 0;
}
.br-closure-band__label {
    display: block;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--br1960-signal);
    margin-bottom: 12px;
}

/* ---------- Line timeline strip ---------- */

.br-line-timeline {
    border-left: 3px solid var(--br1960-brass);
    padding: 8px 0 8px 24px;
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.br-line-timeline__event {
    position: relative;
}
.br-line-timeline__event::before {
    content: "";
    position: absolute;
    left: -30px;
    top: 8px;
    width: 10px;
    height: 10px;
    background: var(--br1960-brass);
    border-radius: 50%;
}
.br-line-timeline__date {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 13px;
    color: var(--wp--preset--color--slate);
    display: block;
    margin-bottom: 4px;
}

/* ---------- Loco card ---------- */

.br-loco-card {
    background: var(--wp--preset--color--cream);
    border: 1px solid var(--br1960-hairline);
    padding: 24px;
}
.br-loco-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
}

/* ---------- Preserved-railway card ---------- */

.br-preserved-card {
    background: var(--wp--preset--color--buttercream);
    border: 1px solid var(--br1960-hairline);
    padding: 24px;
}

/* ---------- Memorabilia card ---------- */

.br-memorabilia-card {
    background: var(--wp--preset--color--vellum);
    border: 1px solid var(--br1960-hairline);
    padding: 20px;
}

/* ---------- Affiliate disclosure ---------- */

.br-affiliate-disclosure {
    background: var(--wp--preset--color--buttercream);
    border-top: 4px solid var(--br1960-brass);
    padding: 20px 24px;
    font-size: 15px;
    color: var(--wp--preset--color--ink);
    margin: 24px 0;
}

/* ---------- Photograph credit block ---------- */

.br-photo-credit {
    font-family: var(--wp--preset--font-family--inter);
    font-size: 13px;
    color: var(--wp--preset--color--slate);
    padding: 8px 0;
    border-top: 1px solid var(--br1960-hairline);
    margin-top: 4px;
}

/* ---------- Footer source list ---------- */

.br-source-list {
    font-family: var(--wp--preset--font-family--inter);
    font-size: 13px;
    color: var(--wp--preset--color--cream);
    opacity: 0.85;
    line-height: 1.6;
}

/* ---------- Link contrast on dark surfaces ----------
 * theme.json sets the default link colour to BR Maroon, which is unreadable
 * on the deep-maroon footer and other dark section backgrounds. Force a
 * legible cream link with a brass underline on any dark maroon/green surface.
 */

.has-deep-maroon-background-color a:not(.wp-element-button),
.has-br-maroon-background-color a:not(.wp-element-button),
.has-deep-green-background-color a:not(.wp-element-button),
.has-br-dark-green-background-color a:not(.wp-element-button),
.has-loco-black-background-color a:not(.wp-element-button),
.br-nameboard a:not(.wp-element-button) {
    color: var(--wp--preset--color--buffer-buff);
    text-decoration: underline;
    text-decoration-color: var(--wp--preset--color--brass);
    text-underline-offset: 3px;
}

.has-deep-maroon-background-color a:not(.wp-element-button):hover,
.has-br-maroon-background-color a:not(.wp-element-button):hover,
.has-deep-green-background-color a:not(.wp-element-button):hover,
.has-br-dark-green-background-color a:not(.wp-element-button):hover,
.br-nameboard a:not(.wp-element-button):hover {
    color: var(--wp--preset--color--cream);
    text-decoration-color: var(--wp--preset--color--warning-yellow);
}

/* Footer column heading links + list links inherit the cream treatment */
footer.wp-block-group a:not(.wp-element-button) {
    color: var(--wp--preset--color--buffer-buff);
}
footer.wp-block-group a:not(.wp-element-button):hover {
    color: var(--wp--preset--color--cream);
}

/* ---------- Restored archive track-schedule tables ----------
 * Legacy britishrailways1960.co.uk pages are track and signalling schedules.
 * The original per-region column styling is not reproduced; this gives a clean,
 * readable reference table that scrolls horizontally on narrow screens.
 */

.br-archive-table {
    overflow-x: auto;
    margin: 28px calc(50% - 50vw);
    width: 100vw;
    max-width: 100vw;
    padding: 0 24px;
    box-sizing: border-box;
    border-top: 1px solid #d8ccae;
    border-bottom: 1px solid #d8ccae;
    background: var(--wp--preset--color--steam-white, #F7F4EC);
    -webkit-overflow-scrolling: touch;
}
.br-archive-table table {
    border-collapse: collapse;
    width: 100%;
    background: transparent;
    font-family: var(--wp--preset--font-family--inter);
    font-size: 14px;
    line-height: 1.5;
    color: var(--wp--preset--color--ink, #1E1B17);
    table-layout: auto;
}
.br-archive-table th,
.br-archive-table td {
    border: 1px solid #e6dcbe;
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}
.br-archive-table thead th,
.br-archive-table tr:first-child th {
    background: var(--wp--preset--color--br-maroon, #5C1E1E);
    color: var(--wp--preset--color--cream, #F3E7C9);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-color: var(--wp--preset--color--deep-maroon, #3F1414);
    padding: 12px;
}
.br-archive-table tbody tr:nth-child(even) td,
.br-archive-table tr:nth-child(even) td {
    background: rgba(201, 169, 97, 0.08);
}
.br-archive-table tr:hover td {
    background: rgba(176, 128, 40, 0.12);
}

/* Row number */
.br-archive-table .column1a {
    width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--wp--preset--color--slate, #5A5348);
    font-size: 12px;
    font-weight: 600;
}
/* Junction glyph column (legacy images may be broken; keep column compact) */
.br-archive-table .column2 {
    width: 56px;
    text-align: center;
}
.br-archive-table .column2 img {
    max-height: 22px;
    width: auto;
    vertical-align: middle;
}
/* Directional arrow columns — the ↑ / ↓ glyphs */
.br-archive-table .column3c,
.br-archive-table .column3d {
    width: 42px;
    text-align: center;
    font-size: 18px;
    line-height: 1;
    color: var(--wp--preset--color--brass, #B08028);
    font-weight: 700;
    letter-spacing: -2px;
    white-space: nowrap;
}
/* Dim the "-" placeholder (used in every empty arrow / distance cell) */
.br-archive-table .column3c,
.br-archive-table .column3d,
.br-archive-table .column6 {
    text-align: center;
}
.br-archive-table td.column3c,
.br-archive-table td.column3d,
.br-archive-table td.column6 {
    position: relative;
}
.br-archive-table td.column3c:empty::after,
.br-archive-table td.column3d:empty::after,
.br-archive-table td.column6:empty::after { content: none; }
/* Style the literal "-" placeholder cells: use :is + dim colour via em wrap not possible in pure CSS,
   so instead we lighten every column3c/3d/6 dash by treating short single-char cells specially. */
.br-archive-table .column3c,
.br-archive-table .column3d {
    color: var(--wp--preset--color--brass, #B08028);
}
/* Distance column — mile / yard values */
.br-archive-table .column6 {
    width: 110px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--wp--preset--color--slate, #5A5348);
    font-size: 13px;
}
/* Station / signal-box column — the main label */
.br-archive-table .column5 {
    font-weight: 600;
    color: var(--wp--preset--color--ink, #1E1B17);
}
/* Loops & Refuge column */
.br-archive-table .column7 {
    font-size: 12px;
    color: var(--wp--preset--color--slate, #5A5348);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.br-archive-table .column8 {
    font-size: 12px;
    color: var(--wp--preset--color--slate, #5A5348);
}

/* Editorial note above the table */
.br-editorial-note + .wp-block-html .br-archive-table,
.br-editorial-note + p + .wp-block-html .br-archive-table {
    margin-top: 20px;
}

/* Mobile: hint that the table scrolls */
@media (max-width: 640px) {
    .br-archive-table { font-size: 13px; }
    .br-archive-table::after {
        content: "← scroll →";
        display: block;
        text-align: center;
        font-size: 11px;
        color: var(--wp--preset--color--slate, #5A5348);
        padding: 4px 0 6px;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }
}

/* ---------- Long-form article body ---------- */

.entry-content p { max-width: 66ch; }
.entry-content h2 { margin-top: 48px; }
.entry-content h3 { margin-top: 32px; }
.entry-content a {
    color: var(--wp--preset--color--br-maroon);
    text-decoration: underline;
    text-decoration-color: var(--br1960-brass);
    text-underline-offset: 3px;
}
.entry-content a:hover { color: var(--br1960-signal); }
