/* ShortestWait. Plain CSS, no framework. Light and dark themes from the same tokens. */
:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6b6a66;
  --border: #e3e2dd;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-soft: #e7f0fb;
  --s1: #2a78d6;
  --ref: #8d8c86;
  --grid: #ebeae6;
  --good: #0a7a0a;
  --bad: #b3261e;
  --nhs-bg: #e7f0fb;
  --nhs-ink: #184f95;
  --is-bg: #f3ece0;
  --is-ink: #7a4a00;
  --radius: 10px;
  --wrap: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #a3a29b;
    --border: #33322f;
    --accent: #86b6ef;
    --accent-ink: #0b0b0b;
    --accent-soft: #1d2b3d;
    --s1: #3987e5;
    --ref: #8f8e88;
    --grid: #2c2b28;
    --good: #5fcf5f;
    --bad: #ff8a80;
    --nhs-bg: #1d2b3d;
    --nhs-ink: #b7d3f6;
    --is-bg: #33291a;
    --is-ink: #f0c98a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --text: #f0efec; --text-2: #c3c2b7; --muted: #a3a29b;
  --border: #33322f; --accent: #86b6ef; --accent-ink: #0b0b0b; --accent-soft: #1d2b3d; --s1: #3987e5; --ref: #8f8e88;
  --grid: #2c2b28; --good: #5fcf5f; --bad: #ff8a80; --nhs-bg: #1d2b3d; --nhs-ink: #b7d3f6; --is-bg: #33291a; --is-ink: #f0c98a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.55 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin: 0.6em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 2em 0 0.6em; }
p, ul { max-width: 68ch; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.lead { font-size: 1.12rem; color: var(--text-2); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.strong { font-weight: 600; }
.unit { color: var(--muted); font-size: 0.85em; font-weight: 400; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header and footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.brand-name span { color: var(--accent); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent) url("favicon.svg") center/cover; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-nav a { color: var(--text-2); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 14px 0 0; margin: 0; font-size: 0.9rem; color: var(--muted); max-width: none; }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--muted); }
.crumbs a { color: var(--text-2); }
main { padding-bottom: 48px; }
.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--text-2); font-size: 0.95rem; }
.footer-inner { padding-top: 24px; padding-bottom: 32px; }
.footer-lead { color: var(--text); }
.footer-links a { color: var(--text-2); }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; padding: 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile dt { font-size: 0.88rem; color: var(--text-2); }
.tile dd { margin: 4px 0 0; font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; }

/* Home */
.hero { padding: 8px 0 4px; }
.spec-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-width: none; }
.spec-card { display: block; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); }
.spec-card:hover { border-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.spec-name { display: block; font-weight: 600; color: var(--accent); }
.spec-meta { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.more { font-weight: 600; }
.explainer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 20px 12px; margin-top: 32px; }
.explainer h2 { margin-top: 0.9em; font-size: 1.15rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 0.82rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rank { color: var(--muted); width: 2.5em; }
.total-row { background: var(--surface-2); }
.sub { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.badge { display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; line-height: 1.5; }
.badge-nhs { background: var(--nhs-bg); color: var(--nhs-ink); }
.badge-is { background: var(--is-bg); color: var(--is-ink); }
.change { font-size: 0.88rem; }
.chg-down { color: var(--good); }
.chg-up { color: var(--bad); }
.chg-same { color: var(--muted); }
@media (max-width: 720px) { .hide-md { display: none; } }
@media (max-width: 540px) { .hide-sm { display: none; } th, td { padding: 8px 9px; } }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin: 0 0 14px; }
.filters label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--text-2); gap: 4px; }
.filters select, .filters button { font: inherit; font-size: 0.95rem; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.filters button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; cursor: pointer; }

/* Provider pages */
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--text-2); font-size: 0.92rem; margin-top: -4px; }
.answer { font-size: 1.15rem; background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; max-width: 72ch; }
.notice { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: var(--radius); }
.near-list, .provider-list, .locations { padding-left: 0; list-style: none; max-width: none; }
.near-list li, .provider-list li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.locations { columns: 2 18rem; column-gap: 32px; }
.locations li { padding: 3px 0; break-inside: avoid; }
.jump { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 16px 0; }
.count { color: var(--muted); font-weight: 400; font-size: 0.85em; }

/* Charts: colours from tokens, marks per the data-viz spec */
.chart { margin: 8px 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.chart-box { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .endlabel { fill: var(--text-2); font-size: 12px; font-weight: 600; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--s1); }
.chart .line.ref { stroke: var(--ref); }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.s1 { fill: var(--s1); }
.chart .dot.ref { fill: var(--ref); }
.chart .bar.s1 { fill: var(--s1); }
.chart .hit { fill: transparent; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart .bar-row:focus { outline: none; }
.chart .bar-row:focus .hit, .chart .bar-row:hover .hit { fill: var(--surface-2); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0; margin: 0 0 8px; font-size: 0.88rem; color: var(--text-2); max-width: none; }
.legend .key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend .key.s1 { background: var(--s1); }
.legend .key.ref { background: var(--ref); }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); font-size: 0.82rem; line-height: 1.35; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 2; }
.tip strong { display: block; }
.chart-table { margin-top: 8px; font-size: 0.9rem; }
.chart-table summary { cursor: pointer; color: var(--accent); }
.chart-table .table-wrap { margin-top: 8px; max-height: 22rem; overflow: auto; }
@media (forced-colors: active) {
  .chart .line, .chart .bar { forced-color-adjust: none; }
}

/* ---- Week 4: search, near, areas, months, compare, embed ---- */
:root { --s2: #eb6834; --s3: #1baf7a; --error-bg: #fdecea; --error-ink: #8a1c13; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s2: #d95926; --s3: #199e70; --error-bg: #3a1d1a; --error-ink: #ffb4a9; } }
:root[data-theme="dark"] { --s2: #d95926; --s3: #199e70; --error-bg: #3a1d1a; --error-ink: #ffb4a9; }
.chart .line.s2 { stroke: var(--s2); } .chart .dot.s2 { fill: var(--s2); } .legend .key.s2 { background: var(--s2); }
.chart .line.s3 { stroke: var(--s3); } .chart .dot.s3 { fill: var(--s3); } .legend .key.s3 { background: var(--s3); }

.search-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 18px 6px; margin: 20px 0; }
.search-h { font-size: 1.1rem; margin: 0.8em 0 0.5em; }
.search-form, .compare-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.search-form label, .compare-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-2); min-width: 0; }
.search-form select, .search-form input, .search-form button, .compare-form select, .compare-form button {
  font: inherit; font-size: 1rem; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 100%;
}
.search-form input { width: 9.5em; text-transform: uppercase; }
.search-form input::placeholder { text-transform: none; }
.compare-form select { width: min(22rem, 100%); }
.search-form button, .compare-form button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; cursor: pointer; }
.search-note { margin: 6px 0 10px; }
.notice.error { background: var(--error-bg); color: var(--error-ink); border-color: transparent; }

.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 18px 0; }
.pair .tile p { margin: 0; }
.tile-label { font-size: 0.88rem; color: var(--text-2); }
.tile-big { font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; margin: 2px 0 4px !important; }
.tile.highlight { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.options { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 10px 0 14px; font-size: 0.95rem; color: var(--text-2); }
.options .sep { margin-left: 10px; }
.options strong { color: var(--text); }

.pager { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: -4px 0 12px; font-size: 0.95rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 32px; }
.two-col h3 { font-size: 1.02rem; margin: 0.6em 0 0.3em; }
.movers { padding-left: 1.4em; margin: 0; }
.movers li { padding: 4px 0; }
.plain { padding-left: 1.1em; }
.plain li { padding: 2px 0; }
td.best { font-weight: 700; }

.embed { margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; }
.embed summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.embed textarea { width: 100%; font: 0.85rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); resize: vertical; }
