/* Bricolage Grotesque and Inter, both SIL Open Font License 1.1, latin subset,
   self-hosted so the page makes no third-party request. */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/assets/fonts/bricolage-grotesque.woff2') format('woff2-variations');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'InterVar';
  src: url('/assets/fonts/inter.woff2') format('woff2-variations');
  font-weight: 300 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;

  /* Warm paper rather than cold grey: this is a campaign, not a statistical annex. */
  --page:            #f6f2ea;
  --surface-1:       #fffdf9;
  --surface-2:       #efe9dd;
  --text-primary:    #1a1511;
  --text-secondary:  #574e45;
  --text-muted:      #8b8072;
  --gridline:        #e5ded1;
  --axis:            #cabfae;
  --border:          rgba(26, 21, 17, 0.13);
  --de-emphasis:     #cdc3b2;
  --ink:             #15110e;   /* the masthead / inverted ground */

  --series-1:        #2a78d6;   /* blue   */
  --series-2:        #eb6834;   /* orange */
  --series-3:        #1baf7a;   /* aqua   */

  --critical:        #d03b3b;
  --serious:         #ec835a;
  --good:            #0ca30c;

  /* Claret: chrome only, never used to encode data, and deliberately nowhere
     near the categorical blue/orange/aqua so it can never read as a series. */
  --accent:          #9c1c3c;
  --accent-ink:      #7d162f;
  --accent-soft:     rgba(156, 28, 60, 0.10);
  --accent-on-dark:  #f2607f;
  --shadow-1:        0 1px 2px rgba(26, 21, 17, .05), 0 2px 10px rgba(26, 21, 17, .05);
  --shadow-2:        0 2px 6px rgba(26, 21, 17, .07), 0 14px 36px rgba(26, 21, 17, .11);
  --ease:            cubic-bezier(.22, 1, .36, 1);

  --measure: 34rem;
  --radius: 10px;
  --sans: 'InterVar', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'InterVar', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:            #12100e;
    --surface-1:       #1c1815;
    --surface-2:       #262019;
    --text-primary:    #faf7f2;
    --text-secondary:  #c4b9aa;
    --text-muted:      #948a7c;
    --gridline:        #2d2721;
    --axis:            #3c352d;
    --border:          rgba(250, 247, 242, 0.13);
    --de-emphasis:     #4c443a;
    --ink:             #0c0a09;
    --series-1:        #3987e5;
    --series-2:        #d95926;
    --series-3:        #199e70;
    --accent:          #f2607f;
    --accent-ink:      #f2607f;
    --accent-soft:     rgba(242, 96, 127, 0.15);
    --accent-on-dark:  #f2607f;
    --shadow-1:        0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2:        0 2px 6px rgba(0, 0, 0, .35), 0 14px 36px rgba(0, 0, 0, .45);
    --critical:        #d03b3b;
    --serious:         #ec835a;
    --good:            #0ca30c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:            #12100e;
  --surface-1:       #1c1815;
  --surface-2:       #262019;
  --text-primary:    #faf7f2;
  --text-secondary:  #c4b9aa;
  --text-muted:      #948a7c;
  --gridline:        #2d2721;
  --axis:            #3c352d;
  --border:          rgba(250, 247, 242, 0.13);
  --de-emphasis:     #4c443a;
  --ink:             #0c0a09;
  --series-1:        #3987e5;
  --series-2:        #d95926;
  --series-3:        #199e70;
  --accent:          #f2607f;
  --accent-ink:      #f2607f;
  --accent-soft:     rgba(242, 96, 127, 0.15);
  --accent-on-dark:  #f2607f;
  --shadow-1:        0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2:        0 2px 6px rgba(0, 0, 0, .35), 0 14px 36px rgba(0, 0, 0, .45);
}

/* ------------------------------------------------------------------- base */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration-color: var(--series-1); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; border-radius: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; padding: .6rem 1rem;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; z-index: 100; }

.wrap { width: min(72rem, 100% - 2.5rem); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose p { color: var(--text-secondary); }
.prose p strong { color: var(--text-primary); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }

/* ----------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 56px; }
.brand { font-weight: 640; font-size: .95rem; letter-spacing: -0.01em; text-decoration: none; }
.brand span { color: var(--text-muted); font-weight: 450; }
.site-nav { margin-left: auto; display: flex; gap: .4rem; align-items: center; min-width: 0; }
/* Only the links scroll; the theme toggle stays pinned so it can never be clipped. */
.nav-links {
  display: flex; gap: .1rem; align-items: center;
  min-width: 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.site-nav a { white-space: nowrap; flex: none; }
.theme-toggle { flex: none; }
.site-nav a {
  font-size: .78rem; color: var(--text-secondary); text-decoration: none;
  padding: .28rem .46rem; border-radius: 6px;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text-primary); }
/* Between ~860 and ~1120 the full set of links overflows and reads as a typo
   where it clips, so the secondary ones drop out before that happens. */
@media (max-width: 1120px) { .site-nav a.optional { display: none; } }
@media (max-width: 560px) { .nav-links { display: none; } }

.theme-toggle {
  font: inherit; font-size: .82rem; cursor: pointer;
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 6px; padding: .25rem .55rem;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text-primary); }

/* ------------------------------------------------------------------- hero */
.hero { padding: 4rem 0 2.5rem; }
.eyebrow {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-muted); font-weight: 600; margin: 0 0 1rem;
}
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 680; max-width: 20ch; }
.hero .lede { font-size: 1.12rem; color: var(--text-secondary); max-width: var(--measure); margin-top: 1.1rem; }
.hero-figure { font-size: clamp(3rem, 9vw, 5rem); font-weight: 680; line-height: 1; letter-spacing: -0.03em; margin: 0; }
.hero-figure-note { color: var(--text-secondary); max-width: 26rem; margin: .75rem 0 0; }
.hero-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.45fr 1fr; align-items: end; } }

/* -------------------------------------------------------------- stat tiles */
.kpi-row {
  display: grid; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 620px)  { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .kpi-row { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface-1); padding: 1.05rem 1.15rem 1.15rem; }
.stat .label { font-size: .78rem; color: var(--text-secondary); line-height: 1.35; display: block; }
.stat .value { font-size: 1.85rem; font-weight: 660; letter-spacing: -0.02em; display: block; margin-top: .35rem; }
.stat .delta { font-size: .78rem; color: var(--text-muted); display: block; margin-top: .15rem; }
.stat .delta.bad { color: var(--critical); }
.stat .delta.good { color: var(--good); }

/* ---------------------------------------------------------------- sections */
section.band { padding: 3.5rem 0; border-top: 1px solid var(--border); }
section.band > .wrap > header { max-width: var(--measure); margin-bottom: 1.75rem; }
section.band h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); font-weight: 660; }
section.band h2 .num {
  display: block; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-bottom: .5rem;
}
section.band > .wrap > header p { color: var(--text-secondary); margin-bottom: 0; }

.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
/* Grid items default to min-width:auto, which would let a wide chart push the
   whole page sideways instead of scrolling inside its own card. */
.grid-2 > * { min-width: 0; }
@media (min-width: 940px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------- chart cards */
.chart-card {
  margin: 0 0 1.25rem; padding: 1.25rem 1.35rem 1rem;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.chart-card figcaption h3 { font-size: 1.02rem; font-weight: 620; }
.chart-sub { margin: .35rem 0 0; font-size: .87rem; color: var(--text-secondary); max-width: 52ch; }
.chart-note { margin: .6rem 0 0; font-size: .82rem; color: var(--text-secondary); }
.chart-source { margin: .9rem 0 0; font-size: .74rem; color: var(--text-muted); }
.chart-source a { color: inherit; }

.plot { position: relative; margin-top: .9rem; }
.plot-scroll { overflow: visible; }
.chart { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }

/* Each chart ships at two geometries; show exactly one. Nothing scrolls
   sideways, so the right hand end of a time series is never hidden. */
.chart--sm { display: none; }
@media (max-width: 760px) {
  .chart--lg { display: none; }
  .chart--sm { display: block; }
  .chart-card { padding: 1rem 1rem .85rem; }
  /* The phone viewBox is roughly half the width, so user-unit type has to grow
     to land at the same rendered size. */
  .chart--sm .tick { font-size: 15px; }
  .chart--sm .tick-cat { font-size: 15px; }
  .chart--sm .end-label,
  .chart--sm .bar-label { font-size: 16px; }
  .chart--sm .reference-label { font-size: 14px; }
}

.gridline { stroke: var(--gridline); stroke-width: 1; }
.axis { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--text-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tick-y { text-anchor: end; }
.tick-x { text-anchor: middle; }
.tick-cat { text-anchor: end; fill: var(--text-secondary); font-size: 12px; }
/* Mobile horizontal bars caption each group from the left, above the bars. */
.tick-cat-above { text-anchor: start; fill: var(--text-primary); font-weight: 600; }
.end-label, .bar-label { fill: var(--text-primary); font-size: 12px; font-weight: 600; }
.bar-label { text-anchor: middle; }
.bar-label-end { text-anchor: start; }
.end-dot { stroke: var(--surface-1); stroke-width: 2; }
.reference-line { stroke: var(--text-secondary); stroke-width: 1.5; stroke-dasharray: 5 4; }
.reference-label { fill: var(--text-secondary); font-size: 11.5px; font-weight: 600; }
.crosshair-line { stroke: var(--axis); stroke-width: 1; }
.bar { transition: opacity .12s ease; }
.chart.is-hovering .bar:not(.is-hit) { opacity: .55; }

.legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem;
  margin: .85rem 0 0; padding: 0; font-size: .82rem; color: var(--text-secondary);
}
.legend li { display: flex; align-items: center; gap: .45rem; }
.legend-key { width: 14px; height: 3px; border-radius: 2px; background: var(--key); flex: none; }

/* ------------------------------------------------------------------ tooltip */
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 9rem;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14);
  padding: .5rem .65rem; font-size: .8rem; line-height: 1.45;
  transform: translate(-50%, -112%);
}
.tooltip[hidden] { display: none; }
.tooltip .tt-head { color: var(--text-secondary); font-size: .74rem; margin-bottom: .25rem; }
.tooltip .tt-row { display: flex; align-items: baseline; gap: .45rem; }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 2px; background: var(--key); flex: none; transform: translateY(-3px); }
.tooltip .tt-val { font-weight: 660; font-variant-numeric: tabular-nums; }
.tooltip .tt-name { color: var(--text-secondary); font-size: .76rem; }

/* ------------------------------------------------------------- table views */
.table-view { margin-top: .9rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.table-view summary {
  cursor: pointer; font-size: .78rem; color: var(--text-secondary); list-style: none;
  display: inline-flex; align-items: center; gap: .4rem;
}
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary::before { content: "▸"; font-size: .7em; color: var(--text-muted); }
.table-view[open] summary::before { content: "▾"; }
.table-scroll { overflow-x: auto; margin-top: .6rem; max-height: 22rem; }
.table-view table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.table-view caption { text-align: left; color: var(--text-muted); font-size: .74rem; padding-bottom: .4rem; }
.table-view th, .table-view td { padding: .3rem .6rem; border-bottom: 1px solid var(--border); text-align: left; }
.table-view thead th { position: sticky; top: 0; background: var(--surface-1); color: var(--text-secondary); font-weight: 600; }
.table-view .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-view tbody th { font-weight: 500; color: var(--text-secondary); }

/* ------------------------------------------------------------------ pieces */
.callout {
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 3px solid var(--series-2); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; margin: 1.5rem 0;
}
.callout p { margin: 0; color: var(--text-secondary); }
.callout p + p { margin-top: .6rem; }
.callout cite { display: block; margin-top: .7rem; font-size: .78rem; color: var(--text-muted); font-style: normal; }

.sub-head {
  font-size: 1.15rem; font-weight: 640; margin: 2.75rem 0 .5rem; max-width: var(--measure);
}
.sub-head + .prose, .sub-head + p { margin-top: 0; }

blockquote.pull {
  margin: 1.75rem 0; padding: 0 0 0 1.25rem; border-left: 3px solid var(--series-2);
  font-size: 1.12rem; line-height: 1.5; color: var(--text-primary); max-width: var(--measure);
}
blockquote.pull cite { display: block; margin-top: .7rem; font-size: .78rem; color: var(--text-muted); font-style: normal; }

.fact-list { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .8rem; }
.fact-list li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1.1rem; align-items: baseline; }
.fact-list b { font-size: 1.25rem; font-weight: 660; letter-spacing: -0.02em; }
.fact-list span { color: var(--text-secondary); font-size: .92rem; }

.shortfall-wrap { overflow-x: auto; margin-top: 1rem; }
.shortfall-table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: .9rem; }
.shortfall-table th, .shortfall-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); text-align: right; }
.shortfall-table th:first-child, .shortfall-table td:first-child { text-align: left; }
.shortfall-table thead th { color: var(--text-secondary); font-weight: 600; font-size: .78rem; }
.shortfall-table td { font-variant-numeric: tabular-nums; }
.shortfall-table .gap { color: var(--critical); font-weight: 640; }
/* On a phone there is no room for the intermediate columns; the paid rate and the
   yearly shortfall are the two that carry the point. */
@media (max-width: 620px) {
  .shortfall-table { min-width: 0; font-size: .82rem; }
  .shortfall-table th:nth-child(3), .shortfall-table td:nth-child(3),
  .shortfall-table th:nth-child(4), .shortfall-table td:nth-child(4) { display: none; }
}

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--border); padding: 3rem 0 4rem; color: var(--text-secondary); font-size: .9rem; }
.site-footer h2 { font-size: 1.2rem; color: var(--text-primary); margin-bottom: 1rem; }
.source-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.source-list li { padding-bottom: .85rem; border-bottom: 1px solid var(--border); }
.source-list .src-title { color: var(--text-primary); font-weight: 560; }
.source-list .src-meta { font-size: .8rem; color: var(--text-muted); }

@media print {
  .site-header, .theme-toggle, .table-view summary { display: none; }
  .table-view[open] .table-scroll, .table-view .table-scroll { max-height: none; }
  body { background: #fff; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.footnote { font-size: .82rem; color: var(--text-muted); margin-top: 1rem; }


/* ==========================================================================
   Presentation layer
   --------------------------------------------------------------------------
   Everything below is decoration or motion. The page is complete without it:
   reveal and draw-in states are scoped under `.js-anim`, which app.js only
   sets when scripting is available AND the reader has not asked for reduced
   motion. With either absent, every rule here is inert and the page renders
   in its finished state.
   ========================================================================== */

/* ---------------------------------------------------- scroll progress bar */
.progress {
  position: fixed; inset: 0 auto auto 0; height: 2px; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: var(--accent); z-index: 40; pointer-events: none;
}
.js-anim .progress { transition: transform .08s linear; }

/* ------------------------------------------------------------ active nav */
.site-nav a { position: relative; transition: color .18s ease, background-color .18s ease; }
.site-nav a[aria-current="true"] { color: var(--text-primary); background: var(--accent-soft); }

/* ------------------------------------------------------------------ hero */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; z-index: -1;
  inset: -40% -10% auto 30%; aspect-ratio: 1; 
  background: radial-gradient(circle, var(--accent-soft), transparent 62%);
  pointer-events: none;
}
.hero h1 { letter-spacing: -0.028em; }
.hero-figure {
  background: linear-gradient(170deg, var(--text-primary) 55%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: proportional-nums; font-feature-settings: "tnum" 0;
}
.hero-figure-note { position: relative; padding-top: .9rem; }
.hero-figure-note::before {
  content: ""; position: absolute; top: 0; left: 0; width: 2.5rem; height: 2px;
  background: var(--accent); border-radius: 2px;
}

/* ------------------------------------------------------------ stat tiles */
.stat { position: relative; transition: background-color .2s ease; }
.stat::after {
  content: ""; position: absolute; inset: auto auto 0 0; height: 2px; width: 0;
  background: var(--accent); transition: width .4s var(--ease);
}
.stat:hover { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface-1)); }
.stat:hover::after { width: 100%; }
.stat .value { font-variant-numeric: proportional-nums; }

/* -------------------------------------------------------- section header */
/* The section number as a large outlined numeral, in the flow so it cannot be
   clipped by the page gutter at any width. */
section.band > .wrap > header { position: relative; }
section.band h2 .num {
  display: block; margin: 0 0 .3rem;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1;
  font-weight: 700; letter-spacing: -0.04em; text-transform: none;
  color: transparent; -webkit-text-stroke: 1.5px var(--border);
  pointer-events: none; user-select: none;
  transition: -webkit-text-stroke-color .3s ease;
}
section.band:hover h2 .num {
  -webkit-text-stroke-color: color-mix(in srgb, var(--accent) 38%, var(--border));
}

/* ------------------------------------------------------------ chart card */
.chart-card {
  box-shadow: var(--shadow-1);
  transition: box-shadow .28s var(--ease), transform .28s var(--ease), border-color .28s ease;
}
.chart-card:hover {
  box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
}
.js-anim .chart-card:hover { transform: translateY(-2px); }

.callout { box-shadow: var(--shadow-1); }

/* --------------------------------------------------------- the fact list */
.fact-list li {
  padding-left: 1rem; border-left: 2px solid var(--border);
  transition: border-color .2s ease;
}
.fact-list li:hover { border-left-color: var(--accent); }
.fact-list b { color: var(--text-primary); }

/* ===================================== motion (only under .js-anim) ====== */

/* Sections, cards and blocks rise into place once. */
.js-anim .reveal {
  opacity: 0; transform: translateY(14px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
  transition-delay: calc(var(--d, 0) * 70ms);
}
.js-anim .reveal.is-revealed { opacity: 1; transform: none; }

/* Lines draw themselves along their own length. */
.js-anim .anim-line {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.15s var(--ease);
  transition-delay: calc(var(--i, 0) * 140ms);
}
.js-anim .is-revealed .anim-line { stroke-dashoffset: 0; }

/* Columns grow out of the baseline; horizontal bars out of the axis. */
.js-anim .anim-bar, .js-anim .anim-col {
  transform: scaleY(0); transform-box: fill-box; transform-origin: 50% 100%;
  transition: transform .62s var(--ease);
  transition-delay: calc(var(--i, 0) * 22ms);
}
.js-anim .anim-hbar {
  transform: scaleX(0); transform-box: fill-box; transform-origin: 0% 50%;
  transition: transform .62s var(--ease);
  transition-delay: calc(var(--i, 0) * 55ms);
}
.js-anim .is-revealed .anim-bar,
.js-anim .is-revealed .anim-col { transform: scaleY(1); }
.js-anim .is-revealed .anim-hbar { transform: scaleX(1); }

/* Dots, direct labels and reference lines arrive after their mark. */
.js-anim .anim-fade {
  opacity: 0;
  transition: opacity .45s ease;
  transition-delay: calc(620ms + var(--i, 0) * 55ms);
}
.js-anim .is-revealed .anim-fade { opacity: 1; }

/* A number that counts up must not reflow the layout as it goes. */
.counting { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .js-anim .reveal, .js-anim .anim-line, .js-anim .anim-bar, .js-anim .anim-col,
  .js-anim .anim-hbar, .js-anim .anim-fade {
    opacity: 1 !important; transform: none !important;
    stroke-dashoffset: 0 !important; transition: none !important;
  }
  .progress { transition: none; }
}


/* ==========================================================================
   Identity
   ========================================================================== */

/* Display face on headings and the masthead; every numeral stays in the UI
   sans, including the hero figure - a display face on a number reads as
   decoration and breaks the tie with the chart labels. */
h1, h2, h3, .brand, .eyebrow, .sub-head, blockquote.pull, section.band h2 .num {
  font-family: var(--display);
  font-optical-sizing: auto;
}
h1, h2 { font-weight: 760; letter-spacing: -0.035em; }
h3 { font-weight: 680; letter-spacing: -0.02em; }

.hero-figure, .stat .value, .fact-list b, .tick, .end-label, .bar-label,
.reference-label, .tt-val { font-family: var(--sans); }

/* -------------------------------------- the inverted ground (hero, answer) */
.band--invert {
  --page:           var(--ink);
  --surface-1:      #211b16;
  --surface-2:      #2b241c;
  --text-primary:   #faf7f2;
  --text-secondary: #c9bdac;
  --text-muted:     #9a8f7f;
  --gridline:       #332b23;
  --axis:           #453c31;
  --border:         rgba(250, 247, 242, 0.14);
  --de-emphasis:    #534839;
  --accent:         var(--accent-on-dark);
  --accent-soft:    rgba(242, 96, 127, 0.16);
  --series-1:       #3987e5;
  --series-2:       #d95926;
  --series-3:       #199e70;
  --shadow-1:       0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2:       0 2px 8px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
  background: var(--ink);
  color: var(--text-primary);
  border-top: 0;
  position: relative;
}
/* A little tooth, so the dark grounds do not read as flat slabs. */
.band--invert::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}
.band--invert > * { position: relative; z-index: 1; }

/* ----------------------------------------------------------- the masthead */
.site-header {
  background: var(--ink);
  border-bottom: 1px solid rgba(250, 247, 242, .12);
  backdrop-filter: none;
}
.site-header .brand { color: #faf7f2; font-weight: 700; letter-spacing: -0.02em; }
.site-header .brand span { color: #9a8f7f; font-weight: 400; }
.site-nav a { color: #b9ae9e; }
.site-nav a:hover { background: rgba(250, 247, 242, .09); color: #faf7f2; }
.site-nav a[aria-current="true"] {
  color: #faf7f2; background: transparent; box-shadow: inset 0 -2px 0 var(--accent-on-dark);
  border-radius: 0;
}
.theme-toggle { color: #b9ae9e; border-color: rgba(250, 247, 242, .2); }
.theme-toggle:hover { background: rgba(250, 247, 242, .09); color: #faf7f2; }
.progress { background: var(--accent-on-dark); height: 3px; }

/* ---------------------------------------------------------------- the hero */
.hero { padding: 4.5rem 0 4rem; }
.hero::before { display: none; }
.hero h1 { font-size: clamp(2.4rem, 6.4vw, 4.25rem); font-weight: 800; letter-spacing: -0.042em; }
.hero .lede { font-size: 1.16rem; }
.hero .lede a { color: var(--accent-on-dark); text-decoration-color: currentColor; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--accent-on-dark); letter-spacing: .14em; font-weight: 700;
}
.eyebrow::before {
  content: ""; width: 1.75rem; height: 2px; background: currentColor; border-radius: 2px;
}
.hero-figure {
  background: none; -webkit-text-fill-color: currentColor; color: #fffdf9;
  font-size: clamp(3.6rem, 11vw, 6.5rem); font-weight: 800; letter-spacing: -0.045em;
}
.hero-figure-note::before { background: var(--accent-on-dark); width: 3rem; height: 3px; }

/* KPI tiles sit on the dark ground as a single inset panel. */
.hero .kpi-row { border-color: rgba(250, 247, 242, .14); background: rgba(250, 247, 242, .14); }
.hero .stat { background: #211b16; }
.hero .stat:hover { background: #2b241c; }
.hero .stat .value { color: #fffdf9; }

/* -------------------------------------------------------- section headings */
section.band { padding: 4.25rem 0; }
section.band h2 { font-size: clamp(1.75rem, 3.6vw, 2.4rem); }
/* A kicker above the heading rather than inline with it: headings here run to
   two and three lines, and an inline number collides with the second one. */
section.band h2 .num {
  -webkit-text-stroke: 0; color: var(--accent); opacity: .9;
  font-size: .74rem; letter-spacing: .16em; font-weight: 700;
  font-family: var(--sans); margin: 0 0 .85rem;
  display: flex; align-items: center; gap: .6rem;
}
section.band h2 .num::after {
  content: ""; flex: 0 0 2.75rem; height: 2px; background: currentColor; opacity: .5;
}
section.band:hover h2 .num { -webkit-text-stroke: 0; }
section.band > .wrap > header p { font-size: 1.04rem; }

/* ------------------------------------------------------------------ pieces */
.chart-card { border-radius: 14px; }
.chart-card figcaption h3 { font-size: 1.1rem; }
.kpi-row { border-radius: 14px; }
.stat .value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.stat::after { background: var(--accent); }

.callout { border-left-width: 4px; border-left-color: var(--accent); border-radius: 12px; }

blockquote.pull {
  border-left: 0; padding: 0; font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  font-weight: 620; letter-spacing: -0.02em; line-height: 1.32; max-width: 24ch;
}
blockquote.pull::before {
  content: ""; display: block; width: 3rem; height: 3px;
  background: var(--accent); border-radius: 2px; margin-bottom: 1.1rem;
}
blockquote.pull cite { font-family: var(--sans); }

.fact-list li { border-left-width: 3px; }
.fact-list b { font-size: 1.45rem; font-weight: 720; letter-spacing: -0.025em; }

.sub-head { font-size: 1.3rem; }
.sub-head::before {
  content: ""; display: block; width: 2rem; height: 2px;
  background: var(--accent); border-radius: 2px; margin-bottom: .7rem; opacity: .8;
}

a { text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); }
a:hover { text-decoration-color: var(--accent); }

.shortfall-table .gap { color: var(--accent); }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); }
.site-footer h2 { font-family: var(--display); }

.hero-foot {
  margin: 2rem 0 0; max-width: 46rem; color: var(--text-secondary);
  font-size: .95rem; line-height: 1.6;
}
.hero-foot strong { color: var(--text-primary); }
.hero-foot cite {
  display: block; margin-top: .5rem; font-size: .76rem;
  color: var(--text-muted); font-style: normal;
}

/* Election imprint. Legally required on every page and required to be legible,
   so it gets its own bar at the foot of the document rather than trailing the
   end of a 51-item source list, and keeps body-text contrast rather than
   dropping to muted. */
.imprint-bar {
  background: var(--ink);
  color: #c9bdac;
  border-top: 1px solid rgba(250, 247, 242, .14);
  padding: 1.35rem 0;
}
.imprint-bar p {
  margin: 0; font-size: .85rem; line-height: 1.5;
}

/* Byline. Who is saying this matters here: it is a sitting councillor writing
   about his own authority, and saying so plainly is part of the argument. */
.byline {
  margin: 1.5rem 0 0; padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .9rem; font-weight: 560; color: var(--text-primary);
  letter-spacing: -0.005em;
}
