/* Heating on yet? — styles
 *
 * Two data colours with a meaning: EMBER is "heating on", ICE is "holding out".
 * Both pairs were run through the dataviz palette validator (colour-blind
 * separation, lightness band, 3:1 contrast) in light AND dark mode. Text never
 * wears a data colour; it always uses the ink tokens.
 */

:root {
  --bg: #eaf1f6;
  --bg-top: #d7e6f1;
  --surface: #ffffff;
  --surface-2: #f3f7fa;
  --ink: #0d1f2d;
  --ink-2: #33495a;
  --muted: #536879;
  --line: #d0dde7;
  --grid: #e2ebf1;
  --frost: rgba(255, 255, 255, 0.85);
  --ember: #c2410c;
  --ice: #2b7bb9;
  --ember-wash: rgba(194, 65, 12, 0.10);
  --btn: #0d3b5e;
  --btn-ink: #ffffff;
  --go: #1b7a43;
  --go-ink: #ffffff;
  --focus: #0b62a8;
  --err: #a8281b;
  --tile-on: #fff3ec;
  --tile-off: #ecf5fc;
  --banner: #fff4d6;
  --banner-ink: #4d3800;
  --shadow: 0 1px 2px rgba(13, 31, 45, 0.06), 0 8px 24px rgba(13, 31, 45, 0.06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a141d;
    --bg-top: #102232;
    --surface: #13212f;
    --surface-2: #182a3a;
    --ink: #e8f1f8;
    --ink-2: #bcccd8;
    --muted: #97acbc;
    --line: #283c4e;
    --grid: #1f3242;
    --frost: rgba(160, 205, 235, 0.10);
    --ember: #e06a2c;
    --ice: #3a93d0;
    --ember-wash: rgba(224, 106, 44, 0.12);
    --btn: #9fd3f5;
    --btn-ink: #06121b;
    --go: #4cc38a;
    --go-ink: #06121b;
    --focus: #8ccdf5;
    --err: #ff9b8a;
    --tile-on: #2a1f1a;
    --tile-off: #16283a;
    --banner: #3a2f10;
    --banner-ink: #ffe7a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a141d;
  --bg-top: #102232;
  --surface: #13212f;
  --surface-2: #182a3a;
  --ink: #e8f1f8;
  --ink-2: #bcccd8;
  --muted: #97acbc;
  --line: #283c4e;
  --grid: #1f3242;
  --frost: rgba(160, 205, 235, 0.10);
  --ember: #e06a2c;
  --ice: #3a93d0;
  --ember-wash: rgba(224, 106, 44, 0.12);
  --btn: #9fd3f5;
  --btn-ink: #06121b;
  --go: #4cc38a;
  --go-ink: #06121b;
  --focus: #8ccdf5;
  --err: #ff9b8a;
  --tile-on: #2a1f1a;
  --tile-off: #16283a;
  --banner: #3a2f10;
  --banner-ink: #ffe7a3;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 ui-rounded, "SF Pro Rounded", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 420px at 50% -120px, var(--bg-top), transparent 70%);
  background-repeat: no-repeat;
  overflow-x: hidden;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; font-weight: 800; }
h3 { font-size: 1.125rem; font-weight: 700; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--btn); color: var(--btn-ink); padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 8px; }

/* ── Top bar ── */
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 1.05rem; }
.brand .flake { width: 22px; height: 22px; color: var(--ice); }
.theme-toggle { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 50%; cursor: pointer; }
.theme-toggle svg { width: 20px; height: 20px; }

/* ── Preview banner ── */
.preview-banner { background: var(--banner); color: var(--banner-ink); border-block: 1px solid color-mix(in srgb, var(--banner-ink) 20%, transparent); }
.preview-banner .wrap { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding-top: 10px; padding-bottom: 10px; font-size: 0.9375rem; }
.preview-banner strong { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8125rem; }
.preview-banner a { font-weight: 700; }

/* ── Hero: a frosted window ── */
.hero { padding-top: 18px; padding-bottom: 8px; }
.window {
  position: relative;
  background: var(--surface);
  border-radius: 22px;
  padding: 26px 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
/* Frost creeping in from the corners of the pane. */
.window::before, .window::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 260px; height: 260px; border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--frost) 0 30%, transparent 70%);
  filter: blur(2px);
}
.window::before { top: -150px; left: -130px; }
.window::after { bottom: -160px; right: -120px; }
.eyebrow { margin: 0 0 6px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.headline { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.big { font-size: clamp(4rem, 17vw, 7.5rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; }
.headline-text { font-size: clamp(1.125rem, 3.6vw, 1.5rem); font-weight: 600; color: var(--ink-2); max-width: 22ch; }
.meter { display: flex; gap: 2px; height: 14px; margin: 22px 0 10px; }
.meter span { display: block; height: 100%; transition: width 0.6s ease; min-width: 0; }
.meter-on { background: var(--ember); border-radius: 4px 0 0 4px; }
.meter-off { background: var(--ice); border-radius: 0 4px 4px 0; }
.meter-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9375rem; color: var(--ink-2); }
.meter-key b { color: var(--ink); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.sw-on { background: var(--ember); }
.sw-off { background: var(--ice); }
.hero-meta { margin: 14px 0 18px; color: var(--muted); font-size: 0.9375rem; }
.cta { display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; border-radius: 999px; background: var(--btn); color: var(--btn-ink); font-weight: 700; text-decoration: none; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; margin-top: 18px; }
.section-title { margin: 34px 0 0; }

/* ── Form ── */
.form { scroll-margin-top: 16px; }
.form-head { margin-bottom: 8px; }
.lede { margin: 6px 0 0; color: var(--ink-2); }
.q { border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
.q legend, .q-label { display: block; font-weight: 700; margin-bottom: 10px; padding: 0; font-size: 1.0625rem; }
.opt { font-weight: 500; color: var(--muted); font-size: 0.875rem; margin-left: 4px; }
.hint { margin: -4px 0 10px; color: var(--ink-2); font-size: 0.9375rem; }
.err { margin: 8px 0 0; color: var(--err); font-weight: 600; font-size: 0.9375rem; }

.big-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  position: relative; display: grid; justify-items: start; gap: 2px;
  padding: 16px 14px; border: 2px solid var(--line); border-radius: 14px;
  cursor: pointer; background: var(--surface-2); min-height: 112px;
}
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile svg { width: 28px; height: 28px; margin-bottom: 6px; }
.tile-on svg { color: var(--ember); }
.tile-off svg { color: var(--ice); }
.tile-title { font-weight: 800; font-size: 1.125rem; }
.tile-sub { color: var(--muted); font-size: 0.875rem; }
.tile:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile-on:has(input:checked) { border-color: var(--ember); background: var(--tile-on); }
.tile-off:has(input:checked) { border-color: var(--ice); background: var(--tile-off); }
.tile:has(input:checked)::after {
  content: "✓"; position: absolute; top: 10px; right: 12px; font-weight: 800; color: var(--ink);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface-2);
  cursor: pointer; font-weight: 600; font-size: 0.9375rem;
}
.chip input:checked + span { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.chip input:checked + span::before { content: "✓"; margin-right: 6px; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

input[type="text"], input[type="date"], input[type="number"] {
  font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--ink); background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: 10px; min-height: 48px; padding: 0 12px;
}
input[aria-invalid="true"] { border-color: var(--err); }
.postcode { width: 9ch; min-width: 130px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; }
.postcode::placeholder { text-transform: none; font-weight: 500; letter-spacing: 0; }
.date-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-btn { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 0.9375rem; cursor: pointer; }
.thermo-row { display: flex; align-items: center; gap: 8px; }
.thermo-row input { width: 110px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.captcha:not(:empty) { margin-top: 18px; }

.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 22px; }
.btn { min-height: 52px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--btn); color: var(--btn-ink); font: inherit; font-weight: 800; font-size: 1.0625rem; cursor: pointer; }
/* The one action on the page that matters: green, so it cannot be missed. */
#submitBtn { background: var(--go); color: var(--go-ink); min-width: 12rem; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn-quiet { min-height: 48px; font-size: 1rem; padding: 0 18px; }
.link-btn { background: none; border: 0; padding: 8px 0; color: var(--ink-2); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.status { margin: 12px 0 0; min-height: 1.5em; font-weight: 600; }
.status.ok { color: var(--ink); }
.status.bad { color: var(--err); }

/* ── Area ── */
.area-lookup { display: flex; gap: 8px; margin-top: 14px; }
.area-result { margin-top: 16px; display: grid; gap: 12px; }
.area-row { display: grid; grid-template-columns: 5.5rem 1fr; gap: 12px; align-items: center; }
.area-name { font-weight: 800; font-size: 1.25rem; }
.area-row p { margin: 0; color: var(--ink-2); }
.area-row p b { color: var(--ink); }
.area-empty { color: var(--ink-2); margin: 14px 0 0; }

/* ── Results ── */
.results { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
.chart-card h3 { margin-bottom: 4px; }
.sub { margin: 0 0 14px; color: var(--ink-2); font-size: 0.9375rem; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .future { fill: var(--surface-2); }
.chart .future-label { fill: var(--muted); font-size: 12px; }
.chart .area { fill: var(--ember-wash); }
.chart .line { fill: none; stroke: var(--ember); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--ember); stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--ink); font-size: 13px; font-weight: 700; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.empty { color: var(--muted); margin: 8px 0; }

.bars { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
/* Phones: label above its bar, so the bar gets the full width. */
.bar-row { display: grid; grid-template-columns: 1fr; gap: 4px; align-items: center; }
.bar-label small { display: inline; margin-left: 6px; }
@media (min-width: 1000px) {
  .bar-row { grid-template-columns: 9.5rem 1fr; gap: 12px; }
  .bar-label small { display: block; margin-left: 0; }
}
.bar-label { font-size: 0.9375rem; font-weight: 600; }
.bar-label small { display: block; color: var(--muted); font-weight: 500; font-size: 0.8125rem; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar { height: 14px; background: var(--ember); border-radius: 0 4px 4px 0; flex: none; min-width: 2px; }
.bar-val { font-weight: 700; font-size: 0.9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-val.few { color: var(--muted); font-weight: 500; }

.league { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.league th { text-align: left; font-size: 0.8125rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.league td { padding: 10px 8px; border-bottom: 1px solid var(--grid); }
.league td.num, .league th.num { text-align: right; }
.league .rank { color: var(--muted); width: 2rem; }
.league .dist { font-weight: 800; }
.league tr:last-child td { border-bottom: 0; }

.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; color: var(--ink-2); font-size: 0.9375rem; min-height: 44px; display: flex; align-items: center; gap: 6px; text-decoration: underline; text-underline-offset: 3px; list-style: none; }
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary::before { content: "▸"; text-decoration: none; display: inline-block; }
.table-view[open] summary::before { transform: rotate(90deg); }
.table-view table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { padding: 4px 8px; border-bottom: 1px solid var(--grid); text-align: left; }
.table-view td + td, .table-view th + th { text-align: right; }
.table-scroll { max-height: 320px; overflow: auto; }

.fine { color: var(--muted); font-size: 0.875rem; margin: 14px 2px 0; }

.tip {
  position: absolute; z-index: 20; pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: 8px;
  font-size: 0.8125rem; line-height: 1.35; box-shadow: var(--shadow); max-width: 220px;
}
.tip b { font-weight: 800; }

/* ── Privacy & footer ── */
.privacy ul { margin: 12px 0 0; padding-left: 1.1rem; display: grid; gap: 8px; color: var(--ink-2); }
.privacy b { color: var(--ink); }
.foot { color: var(--muted); font-size: 0.875rem; padding-top: 24px; padding-bottom: 40px; }

/* Preview marker on each chart, so a screenshot can't pass as real data. */
body.is-preview .chart-card { position: relative; }
body.is-preview .chart-card::after {
  content: "PREVIEW DATA"; position: absolute; top: 14px; right: 16px;
  font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.1em;
  color: var(--banner-ink); background: var(--banner); padding: 3px 7px; border-radius: 6px;
}
body.is-preview .chart-card h3 { padding-right: 7.5rem; }

@media (min-width: 760px) {
  .card { padding: 26px 26px; }
  .window { padding: 36px 36px 30px; }
  .results { grid-template-columns: 1fr 1fr; }
  .results .section-title, .results .wide, .results .fine { grid-column: 1 / -1; }
  .results .chart-card:nth-of-type(2) { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .meter-on, .bar { background: CanvasText; }
  .meter-off { background: GrayText; }
}

/* Inline "delete my report" link inside the privacy notice. */
.link-btn.inline { display: inline; min-height: 0; padding: 0; color: var(--ink); font-weight: 600; }
.privacy .status { display: block; margin-top: 6px; min-height: 0; }

/* ── Area facts ── */
.area-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 12px; }
.area-code { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; }
.area-place { font-size: 1.125rem; font-weight: 600; color: var(--ink-2); }
.area-loading { color: var(--muted); margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.tile-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 8px; display: grid; gap: 2px; align-content: start; }
.ts-label { font-size: 0.8125rem; color: var(--ink-2); font-weight: 600; line-height: 1.25; }
.ts-val { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.ts-sub { font-size: 0.75rem; color: var(--muted); }
.fact { margin: 0 0 12px; color: var(--ink-2); }
.fact b { color: var(--ink); }
.area-sub { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin: 6px 0 2px; }
.sources { margin: 14px 0 0; font-size: 0.8125rem; color: var(--muted); }
.sources a { color: inherit; }
