:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Source Serif 4', 'PT Serif', Georgia, serif;

  --bg: #F4F3F0;
  --card-bg: #FFFFFF;
  --card-border: rgba(0, 0, 0, 0.07);
  --row-border: rgba(0, 0, 0, 0.08);
  --text: #1A1A1A;
  --text-muted: #6B6B6B;
  --pill-bg: #EEEDEA;
  --pill-text: #5B5B5B;

  --bar-hot: #D6493C;
  --bar-cool: #2E86C1;

  --c-bakerloo: #B36305;
  --c-central: #E32017;
  --c-jubilee: #7A7E82;
  --c-northern: #1A1A1A;
  --c-piccadilly: #003688;
  --c-subsurface: #5E7A70;
  --c-victoria: #0098D4;
  --c-waterloo: #4FA98A;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --card-bg: #1B1B1D;
    --card-border: rgba(255, 255, 255, 0.08);
    --row-border: rgba(255, 255, 255, 0.09);
    --text: #EDEDED;
    --text-muted: #9A9A9A;
    --pill-bg: #2A2A2C;
    --pill-text: #B8B8B8;
    --c-northern: #D0D0D0;
    /* Official Piccadilly navy (#003688) measures 1.54:1 against the dark
       card background - badly fails WCAG AA even for large text (3:1
       minimum). This lighter blue measures 6.2:1, comfortably clearing the
       4.5:1 bar for normal-size text too, while staying recognisably blue. */
    --c-piccadilly: #6699FF;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* .page fills at least the full viewport height and lays its two groups
   (.hero, .below-fold) out top-to-bottom; .below-fold's auto top margin
   pushes it toward the bottom on tall screens instead of leaving a dead gap
   in the middle - the rest of the "use the real estate" work is .hero's
   viewport-height-aware gap below, which gives the card and legend more
   breathing room as a phone gets taller than the ~700px baseline. */
.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 40px;
}

@media (min-width: 700px) {
  .page { max-width: 560px; padding-top: 32px; }
}

.hero {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4dvh, 28px);
}

/* Every scaled size below follows the same shape:
     max( clamp(baseline, Xdvh, TALL_CAP), clamp(baseline, Yvw, WIDE_CAP) )
   i.e. two independently-capped growth curves, not one shared cap - a tall
   phone (Galaxy-S25-Ultra-class, ~1080-1120px) grows via the dvh branch up
   to the bigger TALL_CAP, while a wide desktop window grows via the vw
   branch up to its own smaller WIDE_CAP (matching the original desktop
   sizing). Sharing one cap between both was tried first and rejected: it let
   a plain wide-but-not-tall browser window hit the tall-phone maximum, which
   looked oversized for a desktop context that was never the target of this
   change. Below ~700px viewport height/500px width both branches sit at the
   floor, identical to the original fixed-px design - short phones are
   unaffected either way. */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.page-head-text {
  min-width: 0;
}

.page-head h1 {
  font-family: var(--font-sans);
  font-size: max(clamp(17px, 2.25dvh, 23px), clamp(17px, 2.8vw, 19px));
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0 0 2px;
}

.page-sub {
  margin: 0;
  font-size: max(clamp(12.5px, 1.66dvh, 17px), clamp(12.5px, 2vw, 14px));
  color: var(--text-muted);
}

/* Masthead-style date badge, top-right of the header: a large day number is
   the fastest way to answer "what day is this for" at a glance, with the
   month and last-updated time as smaller supporting text underneath. */
.date-badge {
  flex: none;
  text-align: right;
}

.date-badge-day {
  display: block;
  font-family: var(--font-serif);
  font-size: max(clamp(30px, 4.2dvh, 46px), clamp(30px, 6vw, 34px));
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}

.date-badge-month {
  display: block;
  font-size: max(clamp(11px, 1.48dvh, 14.5px), clamp(11px, 1.9vw, 12.5px));
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.date-badge-updated {
  display: block;
  font-size: max(clamp(10.5px, 1.36dvh, 13px), clamp(10.5px, 1.7vw, 11.5px));
  color: var(--text-muted);
  margin-top: 5px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 4px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  column-gap: 10px;
  align-items: center;
}

/* Each <li> hands its children straight to the .rows grid, so every row
   shares the same three column tracks - this is what keeps the AC bar, the
   pill, and the temperature aligned in straight vertical lines down the
   card, instead of each row sizing its own columns independently. */
.row {
  display: contents;
}

.row-name,
.pill,
.temp-group {
  padding: max(clamp(10px, 1.42dvh, 16px), clamp(10px, 1.7vw, 11.5px)) 0;
  border-bottom: 1px solid var(--row-border);
}

.row:last-child .row-name,
.row:last-child .pill,
.row:last-child .temp-group {
  border-bottom: none;
}

.row-name {
  min-width: 0;
}

.row-name .name {
  display: block;
  font-size: max(clamp(15px, 2.07dvh, 20px), clamp(15px, 2.6vw, 17px));
  font-weight: 500;
  color: var(--line-color, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-name .row-caption {
  display: block;
  font-size: max(clamp(10.5px, 1.42dvh, 13.5px), clamp(10.5px, 1.8vw, 12px));
  line-height: 1.3;
  color: var(--text-muted);
  margin-top: 1px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 3px;
  min-width: max(clamp(46px, 6.16dvh, 59px), clamp(46px, 8vw, 52px));
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: max(clamp(11px, 1.48dvh, 14.5px), clamp(11px, 1.9vw, 12.5px));
  font-weight: 500;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.pill svg {
  width: max(clamp(9px, 1.22dvh, 11.5px), clamp(9px, 1.5vw, 10.2px));
  height: max(clamp(9px, 1.22dvh, 11.5px), clamp(9px, 1.5vw, 10.2px));
  flex: none;
}

.temp-group {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  white-space: nowrap;
}

.ac-bar {
  width: 2px;
  height: max(clamp(16px, 2.25dvh, 22px), clamp(16px, 2.7vw, 18px));
  border-radius: 1px;
  flex: none;
  background: var(--bar-hot);
}

.ac-bar[data-ac="full"] {
  background: var(--bar-cool);
}

.ac-bar[data-ac="transitioning"] {
  background: linear-gradient(to bottom, var(--bar-hot) 0% 50%, var(--bar-cool) 50% 100%);
}

.temp {
  font-family: var(--font-serif);
  font-size: max(clamp(25px, 3.79dvh, 42px), clamp(25px, 5.6vw, 28px));
  font-weight: 500;
  color: var(--line-color, var(--text));
  line-height: 1;
}

.temp .deg {
  font-size: 0.58em;
  vertical-align: 0.5em;
  margin-left: 1px;
}

.legend {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: max(clamp(11px, 1.48dvh, 14.5px), clamp(11px, 1.9vw, 12.5px));
  color: var(--text-muted);
  white-space: nowrap;
}

.legend-bar {
  width: 2px;
  height: max(clamp(9px, 1.22dvh, 11.5px), clamp(9px, 1.5vw, 10.2px));
  border-radius: 1px;
  flex: none;
}

.legend-bar--red { background: var(--bar-hot); }
.legend-bar--blue { background: var(--bar-cool); }

.legend-icon {
  width: max(clamp(10px, 1.36dvh, 13px), clamp(10px, 1.7vw, 11.3px));
  height: max(clamp(10px, 1.36dvh, 13px), clamp(10px, 1.7vw, 11.3px));
  color: var(--text-muted);
  flex: none;
}

.below-fold {
  margin-top: auto;
  padding-top: clamp(24px, 6dvh, 56px);
}

.sub-surface-note {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.sub-surface-note a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--card-border);
  text-underline-offset: 2px;
}

.explainer {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.disclaimer {
  margin: 0 0 6px;
  font-size: 12.5px;
}

.disclaimer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--card-border);
  text-underline-offset: 2px;
}

.footer-links {
  margin: 0;
  font-size: 11.5px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.state-message {
  padding: 24px 4px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* /methodology and /terms - same shell, fonts and colour variables as the
   main page (loaded via the same /style.css), just a document layout
   instead of the card. */
.doc-page {
  max-width: 640px;
}

.back-link {
  margin: 0 0 22px;
  font-size: 13px;
}

.back-link a {
  color: var(--text-muted);
  text-decoration: none;
}

.back-link a:hover,
.back-link a:focus-visible {
  color: var(--text);
}

.doc h1 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 5vw, 28px);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 20px;
}

.doc h2 {
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  margin: 30px 0 8px;
}

.doc h3 {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 6px;
}

.doc p,
.doc li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
}

.doc p { margin: 0 0 14px; }

.doc ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.doc li { margin-bottom: 5px; }

.doc strong {
  color: var(--text);
  font-weight: 600;
}
