/* Upwey Junction Model Railway Group — shared stylesheet
   "Heritage modern": BR-era enamel-sign accents on a clean, modern layout.
   Each layout page sets its accent via <body class="theme-upwey|theme-coaley">. */

:root {
  --paper: #f6f1e5;
  --paper-2: #ece4d0;
  --card: #fffdf7;
  --ink: #1e2420;
  --ink-soft: #4d524c;
  --rule: #d8cdb3;
  --gold: #b0842a;          /* lining gold */
  --group: #24332d;         /* group colour: deep loco green-black */

  --upwey: #1f5a3e;         /* Southern Region green */
  --upwey-soft: #e3ece4;
  --coaley: #7b2333;        /* London Midland maroon */
  --coaley-soft: #f1e1e2;

  --accent: var(--group);
  --accent-soft: var(--paper-2);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Gill Sans", "Gill Sans MT", "Segoe UI", system-ui, sans-serif;

  --radius: 6px;
  --wrap: 1120px;
  --shadow: 0 1px 2px rgba(30, 36, 32, .06), 0 6px 20px rgba(30, 36, 32, .07);
}

.theme-upwey { --accent: var(--upwey); --accent-soft: var(--upwey-soft); }
.theme-coaley { --accent: var(--coaley); --accent-soft: var(--coaley-soft); }

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.section { padding: clamp(48px, 7vw, 88px) 0; scroll-margin-top: 80px; }
.section--alt { background: var(--paper-2); }
.section--accent { background: var(--accent); color: var(--paper); }
.section--accent a:not(.btn) { color: var(--paper); }
.section-head { max-width: 680px; margin-bottom: 32px; }
.eyebrow {
  display: block;
  font: 700 .78rem/1 var(--font-body);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.lead { font-size: 1.2rem; color: var(--ink-soft); }
.prose { max-width: 680px; }
.muted { color: var(--ink-soft); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--card); padding: 8px 12px; }

/* Lining: the thin double rule used on BR coaching stock */
.lined { border-top: 3px double var(--gold); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 241, 229, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header::after { content: ""; display: block; height: 3px; background: var(--accent); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand svg { width: 42px; height: 42px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.05; }
.brand-name small { display: block; font-family: var(--font-body); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; margin-top: 3px; }

.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  display: block; padding: 8px 12px; border-radius: var(--radius);
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .98rem;
}
.nav a:hover { background: var(--paper-2); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--paper); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: none; border: 1px solid var(--rule); border-radius: var(--radius);
    padding: 8px 12px; font: 600 .95rem var(--font-body); color: var(--ink); cursor: pointer;
  }
  .js .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 8px 16px 16px; box-shadow: var(--shadow); }
  .js .nav.open { display: block; }
  .js .nav ul { flex-direction: column; }
  .header-inner { position: relative; flex-wrap: wrap; }
  html:not(.js) .nav { width: 100%; padding-bottom: 8px; }
}

/* ---------- Enamel sign (layout name badge) ---------- */
.sign {
  display: inline-block;
  background: var(--sign, var(--accent));
  color: #fbf6ea;
  font: 700 .8rem/1 var(--font-body);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 7px 12px 6px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--sign, var(--accent)), inset 0 0 0 3px rgba(251, 246, 234, .75);
  white-space: nowrap;
}
.sign--upwey { --sign: var(--upwey); }
.sign--coaley { --sign: var(--coaley); }
.sign--lg { font-size: 1rem; padding: 10px 16px 9px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius);
  font: 700 1rem/1 var(--font-body); text-decoration: none;
  background: var(--accent); color: var(--paper); border: 2px solid var(--accent);
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { color: var(--paper); transform: translateY(-1px); filter: brightness(1.08); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent); }
.btn--light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn--light:hover { color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 6vw, 80px) 0; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.hero h1 { margin-top: 14px; }
.hero-media { position: relative; margin: 0; }
.hero-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); border: 6px solid var(--card); }
.hero-media figcaption { font-size: .85rem; color: var(--ink-soft); margin-top: 8px; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

/* Home hero: two photos, one per layout, given equal space */
.hero-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-pair a { position: relative; display: block; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-pair img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .4s ease; }
.hero-pair a:hover img { transform: scale(1.03); }
.hero-pair .sign { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); white-space: normal; }
@media (max-width: 480px) { .hero-pair .sign { font-size: .66rem; letter-spacing: .08em; padding: 6px 8px 5px; } }

/* ---------- Layout cards (home) ---------- */
.layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .layouts { grid-template-columns: 1fr; } }
.layout-card {
  display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border-top: 6px solid var(--accent);
}
.layout-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.layout-card-body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.layout-card h3 { font-size: 1.6rem; margin: 12px 0 4px; }
.layout-card .meta { font-size: .92rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 12px; }
.layout-card .btn { margin-top: auto; align-self: flex-start; }

/* ---------- Facts ---------- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 0; }
.facts div { padding: 18px 20px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.facts dt { font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.facts dd { margin: 4px 0 0; font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr 1fr; } }
.tbc { color: var(--ink-soft); font-style: italic; font-weight: 400 !important; }

/* ---------- Two-column text ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.gallery button { all: unset; display: block; cursor: zoom-in; width: 100%; }
.gallery button:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.gallery img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform .35s ease; }
.gallery button:hover img { transform: scale(1.04); }
.gallery figcaption { padding: 10px 14px; font-weight: 600; font-size: .95rem; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1200px, 94vw); }
.lightbox::backdrop { background: rgba(20, 24, 22, .88); }
.lightbox img { max-height: 82vh; width: auto; margin: 0 auto; border-radius: 4px; }
.lightbox p { color: #f6f1e5; text-align: center; margin: 12px 0 0; font-weight: 600; }
.lightbox .lb-close {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 1.5rem; cursor: pointer;
}

/* ---------- Video ---------- */
.videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.videos > .video:only-child { max-width: 760px; }
.video { margin: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video .frame { position: relative; aspect-ratio: 16 / 9; background: #111; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; }
.video .placeholder img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.video .placeholder span { position: relative; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .9rem; padding: 8px 14px; border: 2px solid #fff; border-radius: 4px; }
.video figcaption { padding: 14px 18px; font-weight: 600; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 10px 0 10px 34px; border-bottom: 1px solid var(--rule); position: relative; }
.checklist li::before {
  content: ""; position: absolute; left: 4px; top: 15px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); box-shadow: inset 0 0 0 4px var(--card);
  outline: 2px solid var(--accent);
}
.panel { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }

/* ---------- Shows ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filters button {
  font: 600 .95rem var(--font-body); padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.show-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.show {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 20px; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow);
  border-left: 6px solid var(--show-accent, var(--group));
}
.show--upwey { --show-accent: var(--upwey); }
.show--coaley { --show-accent: var(--coaley); }
.show-date { text-align: center; line-height: 1.05; border-right: 1px solid var(--rule); padding-right: 16px; }
.show-date .d { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; display: block; }
.show-date .m { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.show h3 { margin: 0 0 2px; font-size: 1.25rem; }
.show .when { color: var(--ink-soft); font-size: .95rem; }
.show--past { opacity: .7; }
@media (max-width: 600px) {
  .show { grid-template-columns: 70px 1fr; gap: 14px; }
  .show .sign { grid-column: 2; justify-self: start; }
}
.year-head { font-family: var(--font-display); font-size: 1.5rem; margin: 32px 0 12px; }
.year-head:first-child { margin-top: 0; }

/* ---------- News ---------- */
.news-item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: 1fr 1.2fr; }
.news-item img { width: 100%; height: 100%; object-fit: cover; min-height: 240px; }
.news-item .body { padding: clamp(20px, 4vw, 36px); }
.news-item time { font-size: .85rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
@media (max-width: 760px) { .news-item { grid-template-columns: 1fr; } }

/* ---------- Compare table (contact page) ---------- */
.compare { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.compare th, .compare td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.compare thead th { background: var(--paper-2); }
.compare tbody th { font-weight: 600; color: var(--ink-soft); width: 30%; }
.table-scroll { overflow-x: auto; }

.contact-card { display: grid; gap: 14px; }
.contact-card a { font-weight: 700; font-size: 1.15rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--group); color: #d9d3c3; padding: 48px 0 32px; font-size: .95rem; }
.site-footer a { color: #f6f1e5; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-grid h2 { font-size: 1.1rem; color: #f6f1e5; margin-bottom: 10px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-base { border-top: 3px double var(--gold); margin-top: 32px; padding-top: 16px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .85rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

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

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.video .credit { display: block; font-weight: 400; font-size: .9rem; color: var(--ink-soft); margin-top: 2px; }
