:root {
  --text: #1c2733;
  --muted: #3f4a54;
  --accent: #2f6fed;
  --clear: #157a42;
  --approaching: #8f5a15;
  --down: #a52f2f;
  --glass: rgba(255,255,255,0.42);
  --glass-strong: rgba(255,255,255,0.52);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
}
.backdrop.bg-morning { background-image: url('/img/backgrounds/pumpkin-patch.jpeg'); }
.backdrop.bg-afternoon { background-image: url('/img/backgrounds/wheat-field.jpg'); }
.backdrop.bg-evening { background-image: url('/img/backgrounds/golden-hour.jpg'); }
.backdrop.bg-night { background-image: url('/img/backgrounds/ayscoughfee-night.jpg'); }

/* Soft gradient instead of cards — gives the hero text (title, weather,
   clock) enough contrast to sit directly on the photo, the way Coningsby's
   clock does, without wrapping every element in its own box. */
.vignette-top {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(8,12,18,0.55) 0%, rgba(8,12,18,0.22) 32%, rgba(8,12,18,0) 58%);
  pointer-events: none;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 32px 28px 40px;
}

.on-photo {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 6px 20px rgba(0,0,0,0.3);
}

/* Static "liquid glass" surface: a stronger blur/saturate than a plain
   frosted card, plus a mild SVG refraction (feDisplacementMap) so the
   photo bends slightly behind the glass instead of just blurring flat,
   and a specular highlight along the top edge like light catching curved
   glass. No motion — just the material. */
.glass {
  position: relative;
  background: var(--glass);
  backdrop-filter: url(#liquid-glass-distort) blur(14px) saturate(70%) brightness(1.5) contrast(0.92);
  -webkit-backdrop-filter: blur(16px) saturate(70%) brightness(1.5) contrast(0.92);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow:
    0 20px 60px rgba(15,25,40,0.25),
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -1px 0 rgba(255,255,255,0.06);
}
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 32%);
}
.glass.glass-strong { background: var(--glass-strong); }
.glass.glass-warn {
  background: rgba(210,150,50,0.55);
  border-color: rgba(255,255,255,0.5);
}

/* The night photo is mostly black sky, so light glass + dark text reads
   as near-invisible over it (glass borrows its contrast from whatever is
   behind it). Swap to dark glass + light text specifically for the night
   background. */
body.is-night {
  --text: #f2f5f8;
  --muted: #b7c2cc;
  --clear: #4fd888;
  --approaching: #eab04e;
  --down: #f07a7a;
}
body.is-night .glass {
  background: rgba(18,22,28,0.4);
  border-color: rgba(255,255,255,0.16);
}
body.is-night .glass.glass-strong { background: rgba(18,22,28,0.5); }
body.is-night .glass::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 32%);
}
body.is-night .data-col,
body.is-night .train-row,
body.is-night .event-row {
  border-color: rgba(255,255,255,0.16) !important;
}
body.is-night .pill { background: rgba(31,157,85,0.3); border-color: rgba(79,216,136,0.4); }
body.is-night .pill.approaching { background: rgba(179,114,27,0.32); border-color: rgba(234,176,78,0.4); }
body.is-night .pill.down { background: rgba(194,59,59,0.32); border-color: rgba(240,122,122,0.4); }

.night-flying-banner {
  align-self: center;
  margin-bottom: 22px;
  padding: 10px 22px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.location .eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 700;
  margin-bottom: 4px;
}
.location a.built-by {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.5);
  opacity: 0.9;
}
.location a.built-by:hover { text-decoration-color: currentColor; }

.location h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.weather-inline {
  text-align: right;
  min-width: 300px;
  color: var(--text);
  border-radius: 22px;
  padding: 13px 20px;
}
.weather-now { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
.weather-now .icon { font-size: 1.3rem; }
.weather-now .temp { font-size: 1.6rem; font-weight: 800; }
.weather-now .cond { font-size: 0.95rem; color: var(--muted); }
.weather-meta { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }

.forecast-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.45);
}
.forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.forecast-item .hour { font-size: 0.64rem; color: var(--muted); text-transform: uppercase; }
.forecast-item .icon { font-size: 1.15rem; }
.forecast-item .temp { font-size: 0.78rem; font-weight: 700; }

.school-run {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255,255,255,0.45);
}
.school-run-label {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.school-run-slots { display: flex; gap: 18px; }
.school-run-slot { display: flex; align-items: center; gap: 7px; }
.school-run-slot .label { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.school-run-slot .icon { font-size: 1rem; }
.school-run-slot .temp { font-size: 0.78rem; font-weight: 700; }

.clock-block { margin-top: 48px; }
.clock-block .time {
  font-family: 'Oswald', -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(3.6rem, 12vw, 8rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.clock-block .date {
  margin-top: 10px;
  font-size: 1.05rem;
  opacity: 0.9;
}

/* Each row of the data-dense lower section is its own floating glass
   card, with real space between them, rather than one continuous sheet
   with faint internal dividers — makes the groupings (Traffic / In The
   Know) actually read as distinct. */
.data-surface {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  color: var(--text);
}

.data-section {
  border-radius: 28px;
  padding: 26px 30px;
}
.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 14px;
  text-shadow: 0 1px 3px rgba(255,255,255,0.5);
}
body.is-night .section-label { text-shadow: 0 1px 3px rgba(0,0,0,0.4); }

.closure-alert {
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  color: #fff;
}
.closure-row {
  font-size: 0.82rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  padding-left: 10px;
  border-left: 3px solid rgba(255,255,255,0.5);
}
/* Unplanned (incident, no roadworks tag, usually open-ended) reuses the
   app's existing "down"/urgent red so it reads as the same severity level
   as barriers-down or heavy-traffic elsewhere on the page. Planned
   roadworks closures stay a calmer amber — noteworthy, not urgent. */
.closure-row.unplanned { border-left-color: #f07a7a; }
.closure-row.planned { border-left-color: #eab04e; }
.closure-row + .closure-row {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.3);
}

.data-grid {
  display: grid;
}
.data-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.data-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
/* What's On (today + tomorrow) is the harder-to-find-elsewhere info, so it
   gets two full columns; Local News is easy to get from Spalding Today,
   so it's deliberately narrower and smaller. */
.data-grid.cols-know { grid-template-columns: 1.2fr 1.2fr 0.8fr; }
.data-col {
  padding: 0 18px;
  border-left: 1px solid rgba(28,39,51,0.14);
}
.data-col:first-child { padding-left: 0; border-left: none; }

.col-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.col-title .eyebrow {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(255,255,255,0.5);
}
body.is-night .col-title .eyebrow { text-shadow: 0 1px 3px rgba(0,0,0,0.4); }

.pill[hidden] { display: none; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: rgba(31,157,85,0.2);
  border: 1px solid rgba(31,157,85,0.32);
  color: var(--clear);
  box-shadow: 0 1px 2px rgba(15,25,40,0.08), inset 0 1px 0 rgba(255,255,255,0.45);
}
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.pill.approaching { background: rgba(179,114,27,0.22); border-color: rgba(179,114,27,0.35); color: var(--approaching); }
.pill.down { background: rgba(194,59,59,0.22); border-color: rgba(194,59,59,0.35); color: var(--down); }

.headline { font-size: 0.94rem; font-weight: 700; margin-bottom: 8px; }
.exercise-note { font-size: 0.78rem; color: var(--muted); margin: -4px 0 8px; }

.train-row, .event-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 0;
  border-top: 1px solid rgba(28,39,51,0.11);
}
.train-row:first-of-type, .event-row:first-of-type { border-top: none; }
.train-row .time, .event-row .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.freight-tag, .note-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(63,74,84,0.12);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
  vertical-align: middle;
}
body.is-night .freight-tag, body.is-night .note-tag { background: rgba(255,255,255,0.14); }
.event-row .name { font-weight: 600; font-size: 0.88rem; }
.event-row .name a { color: inherit; text-decoration: none; }
.event-row .name a:hover { text-decoration: underline; }

.traffic-body { display: flex; flex-direction: column; gap: 10px; }
.traffic-tile {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(28,39,51,0.14);
  background: #dfe6ec;
}
.traffic-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.traffic-tile .tile-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.95);
  background: rgba(20,30,45,0.45);
  padding: 3px 0;
}
body.is-night .traffic-tile { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16); }
.traffic-info .headline { font-size: 0.88rem; margin-bottom: 2px; }

.col-date { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }

.data-col-news .headline,
.data-col-news .event-row .name { font-size: 0.8rem; }
.data-col-news .event-row .when { font-size: 0.7rem; }
.more-note {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  padding-top: 4px;
  text-decoration: underline;
  text-decoration-color: rgba(120,130,140,0.4);
}
.more-note:hover { text-decoration-color: currentColor; }
.empty-note { font-size: 0.82rem; color: var(--muted); padding: 6px 0; }

.credits {
  align-self: center;
  margin-top: 4px;
  padding: 9px 18px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
}
.credits a { color: inherit; text-decoration: underline; text-decoration-color: rgba(120,130,140,0.4); }
.credits a:hover { text-decoration-color: currentColor; }

@media (max-width: 760px) {
  .hero-top { flex-direction: column; }
  /* Desktop puts weather on the left / Spalding on the right via source
     order, but on mobile (stacked) Spalding should still appear first. */
  .hero-top .location { order: -1; }
  .weather-inline { text-align: left; min-width: 0; }
  .weather-now { justify-content: flex-start; }
  .forecast-row { justify-content: space-between; }
  .data-grid.cols-2, .data-grid.cols-3, .data-grid.cols-know { grid-template-columns: 1fr; row-gap: 20px; }
  .data-col {
    border-left: none !important;
    padding: 20px 0 0 !important;
    border-top: 1px solid rgba(28,39,51,0.14);
  }
  .data-col:first-child { border-top: none; padding-top: 0 !important; }
}
