/* ══ Type: one family, Roboto, every role ══════════════════════════════════
   Self-hosted, subsetted, no third-party request. This is a
   .gov.in-adjacent site: it once pulled Ranade from Fontshare's CDN and four
   Google-hosted families on every page load, which is a third-party
   dependency in the critical path and a visitor-log leak to two companies.
   ONE woff2, 42.7 KB, built by tools/build_fonts.py.

   This replaced a three-family system (Instrument Serif for display, IBM
   Plex Mono for numeric readouts, IBM Plex Sans for everything else — six
   static files, 102 KB). The three --font-* tokens below all point at Roboto
   now, so the ~47 rules that reference a role still read as roles and a
   future display face is a one-line change rather than a sweep.

   Two consequences of collapsing to one family, both deliberate:
     - The display steps (--t-kpi/--t-chart/--t-section) keep weight 400, so
       the KPI figures and chart titles are now plain Roboto rather than a
       serif. Hierarchy is carried by size alone. If they read too light,
       those three steps taking 500 is the one-line fix.
     - The caption step keeps its uppercase letter-spaced treatment but is no
       longer monospaced. This costs nothing structurally: Roboto's digits are
       equal-advance (all 1151/2048, asserted by the build), which is the
       property the numeric readouts actually depended on — see the tabular
       figures note below.

   VARIABLE font, one file, `font-weight: 100 900`: the interface asks for
   four weights (400/500/600/700) and this resolves each exactly, with no
   static-instance mapping to maintain. The build pins `wdth` to 100, since
   nothing here sets font-stretch.

   The scale is seven steps, below. Components reference a step
   (`font: var(--t-body)`) and never a raw size, which is what stops the scale
   drifting back to nineteen sizes. If something needs a size that is not a
   step, it is the wrong role for that element.

   ONE THING ROBOTO CANNOT DO, so do not reintroduce it as text: it contains
   **no arrows and no triangles** — of its 927 codepoints U+2190-2193 and
   U+25B2/U+25BC are all absent (checked against the upstream TTF). The
   Insights panel needs an arrow and up/down badges, so those are an inline
   SVG and CSS borders respectively. A shape cannot silently fall back to
   whatever the OS has, which is exactly what a missing glyph would do. */
@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 100 900;
  font-display: swap; src: url("/static/fonts/roboto-var.woff2") format("woff2");
}
/* Display face for headings and figures: Manrope (SIL Open Font License),
   latin subset, weights 500-800, self-hosted for the same reason Roboto is —
   no font CDN in the critical path of a page that sits next to a .gov.in
   domain. Body text stays Roboto. */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 500 800;
  font-display: swap; src: url("/static/fonts/manrope-var.woff2") format("woff2");
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
:root {
  /* One family behind all three role tokens. The roles are kept as separate
     names on purpose: every rule and the --t-* steps still declare which job
     they are doing, so putting a distinct display or mono face back is three
     lines here rather than an edit across the stylesheet.
     Arial/Helvetica ahead of the generic: Roboto's metrics are close to
     theirs, so a `swap` before the webfont lands does not move the layout
     much. (The previous serif needed a measured `size-adjust` fallback face
     for exactly this reason; Roboto does not, so that face is gone.) */
  --font-roboto: "Roboto", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-sans: var(--font-roboto);
  --font-mono: var(--font-roboto);
  --font-serif: var(--font-roboto);

  /* ── The scale. Only these seven. ──────────────────────────────────────
     Declared as `font` shorthands so a component cannot take the size
     without also taking the family, weight and leading that belong to the
     role. NOTE the shorthand resets font-variant-numeric, so any rule that
     wants tabular figures must declare them AFTER `font:` — see .num. */
  --t-kpi:     400 40px/1.1 var(--font-serif);   /* KPI figures */
  --t-chart:   400 22px/1.2 var(--font-serif);   /* chart titles */
  --t-section: 400 20px/1.2 var(--font-serif);   /* section headings */
  --t-body:    400 14px/1.5 var(--font-sans);    /* body, controls */
  --t-label:   400 13px/1.4 var(--font-sans);    /* labels, legend */
  --t-caption: 500 11px/1.3 var(--font-mono);    /* numeric captions */
  --t-axis:    400 11px/1.2 var(--font-sans);    /* axis ticks */

  --ink: #101114;
  /* Small muted text sits directly on --bg in places (.pathway-chip-label,
     .panel-sub) as well as on white cards, so it is checked against both:
     5.20:1 on the ground, 5.64:1 on white. (.sankey-legend used to be one of
     these; it lives on the Energy Flows dark strip now and carries its own
     light ink there.) */
  --muted: #5F6875;
  --muted-2: #8a8f9a;
  --line: #E1E4E7;
  /* The tab row's divider gets a colour of its own rather than the neutral
     --line: it is the one rule that separates navigation from data, so it is
     allowed to read as deliberate. A faded-denim blue — related to the blues
     already in the ramp (--lvl-2 / --accent) without being either of them, so
     it looks chosen rather than borrowed. Kept as a token because this is the
     kind of value that gets dialled: darker for more presence, or toward
     #A8C0D8 for a whisper. */
  --rule-accent: #8FAEC9;
  /* ── The GHG gauge, on dark ─────────────────────────────────────────────
     The box was a light blue (#C8E1F5) with a deep-denim track and a light
     meter on it. Every pair in that arrangement was individually legal and the
     whole still read badly: the meter is LIGHT, so on a light box the bar and
     its surround were the same weight and the gauge stopped announcing itself
     as a gauge — measured, 1.26:1 meter against box.
     Dark box fixes it at the root: a light meter on a dark ground is the
     highest-contrast arrangement available, and the numbers all improve
     rather than trade off. Measured, all four pairs:
       meter on track       6.18:1   (lime managed 5.07; on the old light box 2.63)
       track inside box     1.76:1   (reads as a recess)
       labels on box       12.91:1   (was 13.41 dark-on-light — a wash)
       box vs the white page above  17.52:1, vs the deck band below 14.96:1
     Navy rather than black, so it belongs with --rule-accent and
     --deck-divider rather than introducing a fifth neutral.

     The meter is AMBER, not the lime it started as. A green bar that fills up
     as emissions RISE reads backwards — full-and-green says "good, full marks"
     when it actually means the worst pathway the model produces (9.6 GtCO2 at
     least effort, against 2.0 at heroic). Amber is the warning tone the
     quantity deserves, and it measures strictly better than the lime on both
     pairs that matter: 6.18:1 against the track (was 5.07) and 11.73:1 for the
     readout that rides inside the fill (was 9.62). Note the lime is still
     correct elsewhere and was NOT changed — PALETTE.lime marks "more is
     better" quantities; this one is not. (The other example named here used
     to be .stat-clean, the Clean Share card, which is now Total Supply 2047
     and carries no accent either way.)

     True red was measured and rejected. The chart/Sankey red (#DD4153) gives
     only 2.35:1 against the track — the filled bar stops being distinguishable
     from the unfilled part, which defeats a meter — and it clears 4.5:1 with
     NEITHER dark nor white text, so the readout would be unreadable whichever
     way it flipped. Deep #C62828 is worse at 1.77:1. Only a light coral
     (#FF7A6B: 3.91:1 track, 7.42:1 text) works as a red here, and it is still
     weaker than the amber — that is the value to use if red is ever wanted,
     and the track would want revisiting alongside it. */
  --gauge-box: #0F1A28;
  --gauge-track: #2E4460;
  --gauge-meter: #F4C56C;   /* PALETTE amber — the chart/Sankey register */
  --gauge-ink: #D6DEE8;
  /* ── Effort ramp (ambition level 1→4) ────────────────────────────────────
     ONE definition, referenced everywhere the ramp appears: the lever
     fill/thumb, the Predefined-scenarios dots, the pathway chip, the deck's
     top rule, and the Insights direction badges. It used to be eight
     scattered hex literals across two Python files and this stylesheet, and
     they had already drifted — LEVEL_FILL's level 1 was a bright cyan
     (#29B6C7) while every other level-1 indicator was slate (#9AA3B2), so a
     lever at rest was the only cyan thing in the interface.
     Now in EU-Calc's own grey/blue/green register (the reference tool this
     project is modelled on), replacing first the original electric-blue/mint
     ramp and then a navy/forest one: grey at rest, through two blues, to
     green at all-out effort.

     Two constraints these values satisfy, both measured:
       - Luminance DARKENS monotonically (0.357 > 0.283 > 0.129 > 0.122), so
         the level still reads if colour is lost. An earlier pass at this
         register did not (grey was lighter than the blue two steps up).
       - --lvl-3 and --lvl-4 carry WHITE text (the Insights direction badges;
         the preset buttons that also did are a select now), so both clear
         4.5:1 against white: 5.86:1 and 6.12:1. The obvious brighter picks
         failed — #2E7EB8 gave 4.38:1 and a #4E9F4E green only 3.28:1.

     Level 5 exists only for lv49 ("Fuel Switching Choices - Iron and Steel"),
     the one lever in the workbook that goes that far.
     sidebar.py's LEVEL_FILL emits `var(--lvl-N)` rather than hex, so these
     stay the single source of truth. */
  --lvl-1: #9AA2AC;
  --lvl-2: #5B96C9;
  --lvl-3: #29699A;
  --lvl-4: #25702C;
  --lvl-5: #25702C;
  /* The base layer — the ground the whole page sits on. Pure white: the light
     grey that sat here (#F4F6F7, and #F4EFE3 beige before that) made the
     panels read as dull, so the page is now one bright white plane and every
     card/panel/box is separated by its 1px --line border alone rather than by
     a change of surface. That is EU-Calc's own arrangement too — their
     content plane is white throughout.
     --surface-2 exists because --bg was doing two jobs: the page ground AND
     the faint fill behind hovers and chips (.menu-btn:hover,
     .drawer-item:hover). Those need a tint to be visible at all, so they
     take --surface-2 and stop tracking the ground. */
  --bg: #FFFFFF;
  --surface-2: #F1F3F5;
  --accent: #29699A;
  /* Control deck. Everything inside the deck derives from these tokens, which
     is why re-colouring the band is a handful of values rather than a rewrite.

     The deck keeps a neutral grey band even though the page ground is white,
     matched to EU-Calc's own left-hand control sidebar: their controls sit on
     light neutral grey against a white content plane, which is exactly the
     relationship here — and it is the only surface change left on the page,
     so it is what tells you the controls are not more data. Neutral (equal
     R/G/B) rather than a cool-tinted grey; theirs is neutral and it reads
     cleaner against pure white.

     Tried and reverted: BEIGE (#F2EADA band, #D8CDB8 line, #C7BCA4 track).
     The contrast numbers were all fine or better than the greys' — 1.20:1
     against the page where the grey manages 1.14, and the warmed track went
     1.38 -> 1.57 — but on screen the warm band read badly against the white
     plane and the dark masthead, so it went back. Not worth re-attempting on
     measurements alone; this one is a look judgement.

     --deck-panel is no longer painted by the group lists — those lost their
     boxes and sit on the band directly. It survives for the two things in the
     deck that are genuinely raised: the Predefined-scenarios buttons and the
     sub-lever flyout rail. White on beige (1.20:1) is what makes those two
     read as lifted. */
  /* #EDEDED until the band was judged too close to the white page to read as
     a separate region. #E4E4E4 takes band-vs-page from 1.17:1 to 1.27:1 —
     still a quiet neutral, but the deck now has an edge without needing a
     border to draw one.
     The same step also helps the two things in here that are meant to look
     RAISED (the scenario buttons and the flyout rail, both --deck-panel
     white): their lift off the band rises 1.17 -> 1.27 by the same arithmetic.
     Anything painted ON the band had to move with it or lose the same 0.10 —
     see .lg-lever-track, which was re-solved to hold its original ratio.
     Body ink is unaffected at this range (15.5:1 -> 14.3:1). */
  --deck-bg: #E4E4E4;
  --deck-panel: #FFFFFF;
  --deck-line: #D4D4D4;
  --deck-row-line: rgba(16,17,20,.10);
  /* Vertical rule between the deck's group columns. Navy rather than the
     neutral --deck-line greys, same hue family as --accent (#29699A) two
     steps darker, so it reads as part of this palette rather than as a
     borrowed black.
     It is NOT painted at full strength — see .lg-col::before, which fades it
     top and bottom and holds it at 30%. Solid, this navy measures 8.87:1
     against the deck band, about seven times harder than any other hairline
     in the interface (--line on white and --deck-line on the band are both
     ~1.27:1, and the tab row's deliberate --rule-accent is 2.32:1). At that
     weight it read as a bar boxing each column in rather than as a division
     between them. Held at 30% it composites to ~#AAB6C2, 1.76:1 — the same
     order of presence as the tab rule. */
  --deck-divider: #1D4266;
  --deck-ink: #14161A;
  --deck-ink-2: #454B54;
  /* Checked against the BAND, not the panel: the band is the darker of the
     two surfaces this text lands on, so it is the binding constraint. 4.76:1
     on the band, 5.44:1 on the panel. (A comment here once claimed 4.5:1 for
     a value that actually measured 3.51:1 — hence the habit of recording the
     measured number.) */
  --deck-muted: #5F6875;
  /* Page insets, shared so the full-bleed bands (masthead, control deck) can
     cancel them exactly instead of hard-coding matching numbers. */
  --page-x: 24px;
  --page-top: 12px;
  /* Whole-UI scale. The stylesheet is px-based, so a root font-size change would not
     shrink it; `zoom` scales layout, text, borders and canvases together. Change this
     one number to resize the entire interface.

     This is only the STARTING value now. Every chart height here is a fixed px
     number tuned against a ~1080p window, so on a bigger monitor the whole
     interface used to render at that same physical size and leave a band of
     dead page background below the footer (the footer used to carry a "best
     viewed in 1920 x 1080" note covering for exactly this, since removed).
     dashboard.js's fitUiScale()
     measures where the footer actually lands and overrides this value on the
     root element until the content's own bottom meets the bottom of the
     window — so the UI grows into a large monitor and shrinks onto a small
     one. Width needs no equivalent: every column here is already fluid and
     fills whatever it is given. */
  --ui-scale: 0.9;
  /* Site header. ONE token for both strips (title band + nav), so they can
     never drift apart in colour. The brand blue from the ICED header.
     Contrast: white on this blue measures 3.08:1, which passes WCAG AA only
     for large text (the 26px bold title); the 15px nav links are held to
     600 weight but still sit below AA's 4.5:1 for body-size text. #2B7BB9
     (4.6:1) is the nearest shade that clears it, if that matters more than
     matching the screenshot. */
  --header-bg: #3D9AD9;
  --header-ink: #FFFFFF;
  /* Title band above the nav strip: white, with the brand blue as its ink. */
  --banner-bg: #FFFFFF;
  --banner-ink: var(--header-bg);
  /* The inner width both strips centre within, so logos and links align. */
  --header-max: 1600px;
  /* The header's height in layout px, kept current by dashboard.js
     (syncHeaderHeight). The fallback is the desktop height, for first paint. */
  --header-h: 118px;
}
/* The page wash — one declaration, used by the landing screen AND the
   calculator so the two are visibly the same place. Soft blue-to-green in
   the header's blue and the lever ramp's green, kept pale: body ink holds
   ~17:1 on it, and every card/panel paints its own opaque surface over it.
   `fixed` attachment so it is anchored to the window rather than to the
   element's own box — the two screens then line up exactly during the
   landing-to-dashboard transition instead of sliding against each other. */
:root {
  --page-wash:
    radial-gradient(60% 55% at 12% 18%, rgba(61,154,217,.20), transparent 70%),
    radial-gradient(55% 50% at 88% 82%, rgba(37,112,44,.16), transparent 70%),
    linear-gradient(160deg, #EEF6FC 0%, #F6FAF7 55%, #EAF4EC 100%);
}
body {
  font: var(--t-body);
  background: var(--page-wash) fixed;
  background-color: var(--bg);
  color: var(--ink);
  zoom: var(--ui-scale);
}
a { text-decoration: none; color: inherit; }

/* The "2" in every GtCO₂. This was a <sub> out of necessity — Instrument
   Serif had no U+2082 at all — and it stays one by choice: Roboto does carry
   U+2082 (verified), but the markup is already here, already tuned, and
   renders identically, so swapping it for the codepoint would be churn with
   no gain. The explicit line-height:0 is the load-bearing part: a default
   <sub> raises the line box, which on a 40px KPI figure pushed the card
   taller than its neighbour. */
sub { font-size: .58em; line-height: 0; vertical-align: -.12em; }

/* ── Tabular figures ─────────────────────────────────────────────────────
   On every number that changes while the reader watches: KPI figures, chart
   axis ticks, legend values, the Sankey's readout and its hover tooltip.
   Applied via a class AND directly on the numeric roles, because the `font`
   shorthand above resets font-variant-numeric — declaring it inside a rule
   that also sets `font:` only works in this order.

   Worth knowing what this does and does not buy, measured from the shipped
   file: Roboto's digits are ALREADY equal-advance (all 1151/2048 units), and
   tools/build_fonts.py now asserts that rather than noting it — so these
   declarations are belt-and-braces, and, more usefully, the canvas-drawn
   chart axes, chart tooltips and Sankey readout cannot jitter either, even
   though canvas 2D offers no way to ask for tabular figures at all.

   This is the one place the old three-family system had a real weakness that
   collapsing to Roboto removed: Instrument Serif's digits were proportional
   (249-460 units) with no tabular feature to switch to, so this rule was
   INERT on the 40px KPI figures — the largest changing numbers on the page.
   Roboto covers them properly. Roboto also ships an actual `tnum`, unlike
   IBM Plex, which needed none. */
.num, .stat-value, .panel-unit, .sankey-total, .sankey-tooltip,
.cdh-emissions-value, .cdh-emissions-max, .insights-line strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* header -> .page-grid (tab row/KPI cards/charts, with the Insights card in
   a second column to their right) -> Custom Pathways (.control-deck-h,
   full-width again, same technique as the masthead) -> footer, in normal
   document order. Everything is plain in-flow content that scrolls with the
   page; the Insights card is sticky but scrolls nothing internally.
   min-height here just keeps a short tab from leaving the footer stranded
   above the bottom of the window. */
/* Minus the sticky header: .page is the calculator view below the hero, and
   it is the space UNDER the header that it has to fill. */
.page { min-height: calc(100vh / var(--ui-scale) - var(--header-h)); display: flex; flex-direction: column; padding: var(--page-top) var(--page-x) 0; }

/* ── Site header ────────────────────────────────────────────────────────
   Two strips — title band, nav bar — in one sticky <header>. Both are
   block-level children of it, so they are the same width by construction
   (the full window), and both paint var(--header-bg), so they read as one
   band. Their contents share .site-header-inner, one centred max-width box,
   which is what lines the logos up with the links. A hairline of white at
   low alpha divides the two strips without a second colour. */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); color: var(--header-ink);
  box-shadow: 0 2px 10px -4px rgba(16,17,20,.35);
}
.site-header-inner {
  max-width: var(--header-max); margin: 0 auto;
  padding: 0 var(--page-x); box-sizing: border-box;
}
/* The title band is white; only the nav strip below it carries the blue.
   Its ink flips to the blue, so the title and hamburger read on white. */
.site-banner { padding: 6px 0; background: var(--banner-bg); color: var(--banner-ink); }
.site-banner .site-banner-title,
.site-banner .menu-btn { color: var(--banner-ink); }
.site-banner .menu-btn:hover,
.site-banner .menu-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--banner-ink); }
.site-banner .site-banner-title:focus-visible,
.site-banner .menu-btn:focus-visible { outline-color: var(--banner-ink); }
.site-banner-row {
  /* 1fr / auto / 1fr keeps the product name optically centred in the window
     regardless of what sits in the side slots. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.site-banner-title { display: flex; align-items: center; gap: 14px; color: var(--header-ink); min-width: 0; }
.site-banner-title:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 6px; }
/* The one piece of display text in the header: 26px bold, uppercase, so it
   counts as WCAG "large text" and clears 3:1 on the brand blue. */
.site-banner-title-text {
  font: 700 26px/1.1 var(--font-sans); letter-spacing: .02em; text-transform: uppercase;
  white-space: nowrap;
}

.site-nav { border-top: 1px solid rgba(255,255,255,.22); }
.site-nav-row { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; }
.site-nav-link {
  display: flex; align-items: center; padding: 8px 14px; border-radius: 6px;
  font: 600 15px/1.2 var(--font-sans); color: var(--header-ink);
  transition: background .14s;
}
.site-nav-link:hover { background: rgba(255,255,255,.16); }
.site-nav-link:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.site-nav-home svg { width: 20px; height: 20px; }
.site-banner-side { min-width: 0; }
/* 48px, up from 36. At 36 both marks were small enough that the NITI emblem's
   fine navy linework and ACPET's lettering were sitting there unreadable —
   present as shapes, not identifiable. 48 clears that and still reads as
   secondary to the 64px wordmark between them. */
/* 72px: on the white title band the NITI emblem and ACPET mark need no
   plate to show up, only size — at 48 their linework and lettering were
   too small to read. */
.site-banner-logo { height: 72px; width: auto; display: block; }
/* Both marks sit on a white plate on the dark band. The NITI one is
   navy-and-gold artwork with no white variant in img/, and filtering an
   official emblem to white would throw away its gold. The ACPET one is a PNG
   with no alpha channel at all (RGB, verified from the header) despite its
   "_White" name — its white is painted in, so it renders as a white rectangle
   on any dark surface no matter what; plating it makes that rectangle look
   chosen and matches the one opposite. */
.site-banner-logo-plated {
  background: #fff;
  padding: 3px 7px;
  border-radius: 6px;
  box-sizing: content-box;
}
/* The one element the role list does not name, so the reasoning is here.
   The site's own title is display text — it is not body, not a label, not a
   numeric readout — so it takes the display face, and it takes an EXISTING
   step (--t-chart, 22px) rather than the 29px it used to have, because the
   scale is closed. It is deliberately not the KPI step: the largest type on
   the page should be the projection, not the masthead. */
/* The centre wordmark. .site-banner-title (the plain-text version) was here;
   the lockup in img/ says the same thing in both scripts and is the project's
   own mark, so the text is now only the img's alt.

   It IS a real transparent PNG (RGBA, corners at alpha 0) — unlike ACPET's,
   which only claims to be. It is plated anyway, for contrast rather than for
   a painted-in background: the wordmark's type is #4E565A and this band is
   #3F4247, about 1.3:1, so unplated the words would be there and unreadable.

   64px against the 36px side logos. The artwork is 925x270, ~3.4:1, so height
   is the wrong axis to judge it by — matched to the logos it reads as a third
   small badge, and the Devanagari line in particular needs the pixels to
   resolve at all. This is the masthead's subject; the other two are credits.
   max-width stops it crowding them on a narrow window, and `height: auto`
   under that cap keeps the ratio. */
.site-banner-title-logo {
  height: 56px; width: auto; max-width: min(40vw, 560px);
  object-fit: contain; display: block;
  /* Tighter than the side logos' 3px/7px: at this size the default pad drew a
     wide white slab, and the artwork already carries its own margin. */
  padding: 2px 8px;
}

/* ── Masthead menu ────────────────────────────────────────────────────── */
.site-banner-actions { justify-self: end; position: relative; display: flex; align-items: center; gap: 10px; }
.menu-btn {
  width: 34px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  /* Light-on-dark now that the masthead is a dark band — var(--muted) here
     was a mid grey chosen for a white bar and would have all but vanished. */
  color: var(--header-ink); cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.menu-btn svg { width: 19px; height: 19px; }
/* A translucent white wash rather than a light fill — the same treatment the
   drawer's own close button uses on its dark header. */
.menu-btn:hover { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.menu-btn[aria-expanded="true"] { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.menu-btn:focus-visible { outline: 2px solid #8FC2E8; outline-offset: 2px; }

/* Right-hand slide-in drawer for the site menu. Fixed to the viewport, so
   opening it costs the page no height and every tab keeps its no-scroll fit.
   Kept out of the tab order when closed via visibility:hidden (a transition
   on visibility lets the slide still play on the way out). */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: 236px; max-width: 82vw;
  background: #fff; border-left: 1px solid var(--line);
  box-shadow: -14px 0 34px -18px rgba(16,17,20,.34);
  display: flex; flex-direction: column;
  visibility: hidden; transform: translateX(100%);
  transition: transform .22s ease, visibility .22s;
}
.drawer.is-open { visibility: visible; transform: translateX(0); }

/* Dark header holding the close control, matching the masthead's height so
   the two line up when the drawer is open. */
.drawer-head {
  flex: none; height: 53px; background: var(--header-bg);
  display: flex; align-items: center; justify-content: flex-end; padding: 0 12px;
}
.drawer-close {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer;
}
.drawer-close svg { width: 20px; height: 20px; }
.drawer-close:hover { background: rgba(255,255,255,.16); }
.drawer-close:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

.drawer-nav { display: flex; flex-direction: column; padding: 18px 0; }
.drawer-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 20px; font: var(--t-body); font-weight: 500; color: var(--ink);
}
.drawer-item:hover { background: var(--surface-2); color: var(--accent); }
.drawer-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.drawer-icon { width: 13px; height: 13px; flex: none; color: var(--muted-2); }
.drawer-item:hover .drawer-icon { color: var(--accent); }

/* ── Tab row ────────────────────────────────────────────────────────── */
/* Hairline under the tab row, separating navigation from the data below it.
   Once the cards and chart panels lost their borders there was nothing between
   the tab row and the content — just open space — and the row read as floating
   above the charts rather than heading them.
   It spans the main column only, not the window: the Insights card is a
   sibling column whose top aligns with this row, so a full-bleed rule would
   cut straight across it. The masthead's own border-bottom and the deck's
   accent rule are the same device at the page's other two seams. */
.tab-row {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 9px;
  margin-bottom: 11px;
  border-bottom: 1px solid var(--rule-accent);
}

/* ── Pill tab selector ────────────────────────────────────────────────
   Grouped, not nine-in-a-row. One flat evenly-spaced strip of nine claimed
   nine equally-weighted modules; they are three kinds of thing (physical
   energy / impacts / money — see tabs.py), so the row is three labelled
   clusters separated by a rule. The label is what does the work: a separator
   alone would have implied structure without saying what it was. */
.pill-tabs { display: flex; align-items: stretch; gap: 0; width: fit-content; max-width: 100%; flex-wrap: wrap; flex: none; }
.pill-group { display: flex; flex-direction: column; gap: 3px; padding: 0 14px; border-left: 1px solid var(--line); }
.pill-group:first-child { padding-left: 0; border-left: 0; }
.pill-group-label { font: var(--t-axis); color: var(--muted-2); padding-left: 3px; }
.pill-group-tabs { display: flex; gap: 2px; background: #E7EAEC; border-radius: 9px; padding: 3px; }
.pill-tab { padding: 6px 13px; border-radius: 7px; font: var(--t-body); color: var(--muted); white-space: nowrap; cursor: pointer; }
.pill-tab.active { font-weight: 600; color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(16,17,20,.12); }
.pill-tab:hover:not(.active) { color: var(--ink); }
.pill-tab.disabled { opacity: .45; cursor: not-allowed; }
/* Critical Minerals has no model behind it yet, so it does not get to look
   like the eight that do. */
.pill-tab.upcoming { color: var(--muted-2); }
.pill-tab.upcoming::after {
  content: "soon"; margin-left: 7px; font: var(--t-axis); letter-spacing: .04em;
  padding: 1px 5px; border-radius: 999px; background: var(--surface-2); color: var(--muted-2);
  vertical-align: 1px;
}
/* Energy Flows is the purpose-built view (full-bleed Sankey, own control
   strip) and its tab carries a mark of that — the same denim as the rule
   under the tab row, so it reads as part of the page's own language. */
.pill-tab.featured:not(.active) { color: var(--accent); }
.pill-tab.featured::before {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 1px;
  background: var(--accent); margin-right: 7px; vertical-align: 2px;
}

/* Pathway chip, right end of the tab row: dot + label + the predefined-
   scenario <select>. It is both the readout and the chooser — the select
   moved here out of the Custom Pathways head, where it duplicated the state
   this chip was already reporting. Dot colour keys off the same four-effort
   ramp as the levers themselves. */
/* No box of its own. This used to be a white 999px pill wrapping the dot, the
   label and the select — so the control had two nested outlines, an oval one
   around a rectangular dropdown inside it, and the oval was the louder of the
   two while being the part that was not clickable. The wrapper is now a bare
   flex row; the <select> is the only bordered thing, which is correct because
   the <select> is the only thing you can operate. */
.pathway-chip {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: transparent; border: 0; border-radius: 0;
  padding: 0; font: var(--t-body);
}
/* The dropdown IS the control's edge now (it used to be borderless inside the
   pill). 7px radius rather than the pill's 999px: it is a rectangular control
   with a chevron, and a fully rounded end on a box this wide reads as a tag
   rather than as something you can open. The chevron stays a background image
   rather than an added element, so this is still one native <select> with
   nothing overlaying its hit area. */
.pathway-chip-select {
  height: 28px; padding: 0 26px 0 10px; margin: 0;
  border: 1px solid var(--line); border-radius: 7px; background-color: #fff;
  color: var(--ink); font: var(--t-body); font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314161A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 13px 13px;
}
.pathway-chip-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The custom state reads as a state, not as a selection: no preset is loaded,
   so the control is shown unset rather than pretending otherwise. */
.pathway-chip-select:invalid, .pathway-chip-select option[value=""] { color: var(--muted); }
/* ── The dropdown carries the effort level ───────────────────────────────
   An 8px dot was the only thing that changed when the pathway changed, in a
   row full of other small round things — the correct signal at a size nobody
   would notice. The control itself takes the level's colour now: a wash behind
   it and the level's own hue on its edge, which is a change to an object the
   width of a control rather than to 50 square pixels of it.

   The variables are still defined on .pathway-chip (the attribute selector
   needs the element carrying data-level) but they are CONSUMED by the select
   below, which is the only box left after the pill was removed.

   Wash + edge, not a solid fill, and the text stays ink. The ramp spans
   #9AA2AC to #25702C, so a solid fill would need white text on the dark levels
   and dark text on the light ones — the control would invert halfway up its
   own scale, and level 1 in white would be 2.3:1. The washes are the ramp
   colours at roughly 8% on white, all of which hold --ink above 15:1.

   The edge is a 1px border PLUS a 1px inset ring of the same colour rather
   than a 2px border: the ring costs no layout, so switching pathway cannot
   shift the tab row beside it by a pixel. --chip-edge also drives :hover, so
   the hover state stops overriding the level colour with grey. */
.pathway-chip-select {
  background-color: var(--chip-wash, #fff);
  border-color: var(--chip-edge, var(--line));
  box-shadow: inset 0 0 0 1px var(--chip-edge, transparent);
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.pathway-chip-select:hover { border-color: var(--chip-edge, #9AA2AC); }
.pathway-chip[data-level="1"] { --chip-edge: var(--lvl-1); --chip-wash: #F1F3F5; }
.pathway-chip[data-level="2"] { --chip-edge: var(--lvl-2); --chip-wash: #EDF4FA; }
.pathway-chip[data-level="3"] { --chip-edge: var(--lvl-3); --chip-wash: #E9F1F7; }
.pathway-chip[data-level="4"] { --chip-edge: var(--lvl-4); --chip-wash: #EAF4EB; }
/* Custom is not a point on the ramp — no preset is loaded — so it reads as
   unset: the neutral the dot already used, on the palest wash. */
.pathway-chip[data-level="custom"] { --chip-edge: #C8D0DC; --chip-wash: #F7F9FB; }

/* The dot stays. It is redundant with the wash by design — colour is the only
   channel carrying this, and the dot is what keeps it legible to anyone who
   cannot separate the washes from each other or from white. */
.pathway-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-edge, var(--lvl-1)); flex: none; transition: background-color .18s ease; }
/* ── One role for the small-caps mono ─────────────────────────────────────
   The mono face at small size with wide letter-spacing was on section
   headers, KPI captions, the footer, the pathway name and a clock all at
   once, which made it read as a decorative skin rather than as a signal.
   It now means exactly one thing: THIS IS A MEASUREMENT — a metric's caption
   ("FINAL DEMAND 2047", "GHG 2047"), its unit ("Mtoe"), or a figure itself
   (.lg-subcat-count, .sankey-total). That is the Sankey's own
   convention, which already got this right: mono for "Total primary supply:
   2902.5 Mtoe", plain sans for the node labels.
   Everything that is a heading, a label for a name, or a status word is plain
   sans below — including this one, which captions a pathway NAME. */
.pathway-chip-label { font: var(--t-label); font-weight: 500; color: var(--muted); cursor: pointer; }
/* .pathway-chip-value was the pathway's name as static text. The <select> in
   the chip displays that name itself now, so a separate readout beside it
   would have been the same word twice. */

/* ── Page grid: the tab row, KPI cards and charts ───────────────────────── */
/* ONE column now. This was a two-track grid with the Insights card in a 268px
   second track beside the charts; Insights has moved into the Custom Pathways
   band (see .lg-insights-col), which had that much unused width to the right
   of its lever columns anyway. So every chart on every tab got ~282px of
   width back — and it is still a grid rather than a plain block because
   the layout notes below key off it, and because a second track may well
   come back.
   It covers the tab row + KPI cards + charts ONLY: Custom Pathways renders
   after this grid closes, full-width.
   flex:0 0 auto (natural height) — a flex-grow cascade down through
   .main-col/.view.active/.chart-duo into the actual chart-wrap tiers was
   tried here (so charts could grow to fill leftover viewport height), but
   capping it anywhere in that chain (needed to stop charts from stretching
   into visibly empty canvas) just relocated the same blank band to
   whichever ancestor was still uncapped one level up. The chart tiers
   further down are simply bigger FIXED values now instead — bigger than
   the original tuning, but a fixed size can't ever mismatch its own
   container the way a capped-partway-through-a-growth-chain one can. */
.page-grid { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
/* .page-grid.rail-hidden was here: Energy Flows collapsed the Insights track
   so the Sankey got its width back. Both the rule and the class that toggled
   it are gone — the grid is single-column on every tab now, and Insights is a
   Custom Pathways column where the Sankey never competed with it. */
.page-main { min-width: 0; display: flex; flex-direction: column; }
.main-col { flex: 0 0 auto; min-width: 0; }

/* ── Insights: the deck's right-hand column ──────────────────────────────
   Its history, briefly, because it has moved three times: a full-bleed blue
   gradient column on the LEFT of the page, then a white card in a second
   page-grid track on the RIGHT of the charts, and now a column of the Custom
   Pathways band. The move off the page grid is what gave every chart its
   width back; the band already had unused space to the right of its lever
   columns, so this costs nothing.
   It sits immediately after the lever region (.lg-cols) — NOT pushed to the
   far edge of the window. `margin-left: auto` used to pin it right, which on a
   wide monitor opened several hundred pixels of nothing between the controls
   and the commentary about those controls, and made the two read as unrelated
   halves of the band. The levers now flex to fill their own fixed region
   instead, so the gap closes from the left and this panel stays put whatever
   the rail is doing. It carries the same faded navy rule the lever columns
   carry between them (--deck-divider), so the separation between controls and
   commentary reads like the separations between control groups.
   No background of its own: the group lists sit directly on the band and so
   does this. The header's tinted icon tile and the rule under it are what
   give it a focal point — that treatment survives from the card version.

   Do NOT give this a max-height derived from --ui-scale (a
   `calc(100vh / var(--ui-scale))` cap plus overflow-y:auto was tried on the
   card version and reverted). fitUiScale() computes --ui-scale FROM the
   content's height, so a height that reads --ui-scale back closes the loop:
   the two chase each other and layout never settles. It does not degrade
   gracefully either — it hung the page outright at 3440x1297 while staying
   fine at 1366x768, since whether it converges depends on the numbers. Any
   cap here has to be a plain px value, independent of both the scale and the
   viewport. */
/* Widened from 300/340 once the panel started carrying two lists instead of
   three or four short lines. At the old width both columns' content wrapped
   on almost every line — a lever name like "Hydrogen Production for Telecom
   and Transport" took three — which made the panel tall, and height here is
   not free: fitUiScale() derives --ui-scale FROM content height, so a tall
   panel shrinks the whole page. Spending the deck's unused horizontal room
   buys the height back. The deck had it to spare: the lever columns are their
   own width and cluster left (see the history above). */
.lg-insights-col {
  position: relative;
  flex: 0 1 620px; min-width: 0; max-width: 680px;
  display: flex; flex-direction: column;
  padding-left: 20px;
}
.lg-insights-col::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    color-mix(in srgb, var(--deck-divider) 30%, transparent) 18%,
    color-mix(in srgb, var(--deck-divider) 30%, transparent) 76%,
    transparent 100%);
}
.lg-insights-col[hidden] { display: none; }

/* flex-basis 0, not auto. With `auto` the item's base size is its CONTENT
   height, so the panel's content propagated up into the deck's height — and
   the deck's height is what fitUiScale() scales the whole page against. That
   made the page re-zoom every time the panel's line count changed, i.e. on
   every lever move: raise four levers, get four more lines, and the entire UI
   quietly shrank to keep the footer on the window's bottom edge. Nothing was
   wrong with the fit; the panel simply should never have been one of its
   inputs. A basis of 0 takes the content out of the measurement, leaving the
   column to stretch to whatever height the LEVER columns set. */
.rail-insights { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
/* Header: tinted icon tile + label, over a full-width rule. The tile is what
   gives the card a focal point now that the whole panel isn't coloured. */
.rail-insights-head {
  flex: none; display: flex; align-items: center; gap: 9px;
  font: var(--t-body); font-weight: 600; color: var(--ink);
  padding-bottom: 10px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.rail-insights-head svg {
  width: 24px; height: 24px; flex: none; padding: 5px; border-radius: 7px;
  background: rgba(41,105,154,.10); color: var(--accent);
}
/* The two lists sit side by side: "what you changed" left, "what it did"
   right. auto-fit rather than a fixed `1fr 1fr` so the pair collapses back to
   a single column on its own once the rail is too narrow to give each 250px —
   no media query, and no breakpoint tied to viewport width, which would be
   the wrong variable anyway (what matters is how wide the RAIL ended up after
   the lever columns took theirs). */
.rail-insights-body {
  /* Same flex-basis-0 reasoning as .rail-insights above: the list's own height
     must not reach the deck. It takes the height the column was given and
     scrolls anything past it, so a 1-lever pathway and a 30-lever one occupy
     exactly the same box and the page never re-zooms between them.
     max-height is a plain px value — deliberately not vh and not derived from
     --ui-scale, either of which would close the feedback loop the block above
     .lg-insights-col warns about. min-height keeps it usable if the lever
     columns are ever short enough to squeeze it. */
  flex: 1 1 0; min-height: 180px; max-height: 420px; overflow-y: auto;
  font: var(--t-body); color: var(--ink);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0 26px; align-content: start;
}
/* The idle state is running prose, not two parallel lists — it spans. */
.insights-section-wide { grid-column: 1 / -1; }
/* Each column's own last line drops its divider, so the two columns don't end
   on a stray rule at different heights. */
.insights-section > .insights-line:last-child { border-bottom: 0; padding-bottom: 0; }
/* .insights-group-label is back, along with the lever-change list it used to
   separate from the KPI effects. It was removed when the panel was reduced to
   a single list, on the reasoning that one list under a panel header needs no
   second heading — correct at the time. The panel now runs two lists that say
   different KINDS of thing, choices then consequences, and the reader needs to
   know which one they are looking at: a lever line and a KPI line are both
   "name, badge, figure" and are otherwise hard to tell apart at a glance.
   Deliberately quiet — a label, not a heading. It sits inside a panel that
   already has a real header, so matching that weight would give the panel two
   competing titles. First one has no top margin: it would push the whole list
   down from the header for no reason. */
.insights-group-label {
  font: var(--t-caption); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 14px 0 2px;
}
.insights-group-label:first-child { margin-top: 0; }
/* The workbook's own ambition note, quoted under the lever line it belongs to
   (Control!H:K — the same prose the slider tooltip shows). No divider and no
   badge: it is an annotation on the line above, not a separate finding, and
   the indent plus the rule on the left is what ties it there. Sized down one
   step because it is two to three sentences of source material sitting inside
   a panel of one-line summaries. */
.insights-note {
  font: var(--t-label); color: var(--muted);
  margin: -2px 0 9px 28px; padding-left: 9px;
  border-left: 2px solid var(--line);
}
/* Each line gets its own divider (padding+border, not a bottom margin),
   and the direction badge is a small filled chip instead of a bare glyph —
   reusing the same ramp colors as the effort-level chips elsewhere
   (LEVEL_FILL's blue/green) rather than introducing new ones, so "raised"
   / "lowered" reads as a real visual distinction, not just a tiny arrow. */
.insights-line {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.insights-line:last-child { border-bottom: 0; padding-bottom: 0; }
/* The triangle inside the badge is drawn with borders, not set as a glyph.
   Roboto has no U+25B2/U+25BC (nor any arrow), so a character here would have
   been served by a system fallback inside a coloured chip. A CSS triangle has
   no font dependency at all — the same answer this project reached for the
   card-header caret when IBM Plex turned out not to cover "▾". */
.insights-arrow {
  flex: none; width: 19px; height: 19px; margin-top: 1px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.insights-arrow::before {
  content: ""; display: block;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
}
.insights-arrow-up { background: var(--lvl-3); }
.insights-arrow-down { background: var(--lvl-4); }
/* 1px of optical nudge each way: a triangle's visual centre sits toward its
   base, so a geometrically centred one reads as slightly high or low. */
.insights-arrow-up::before { border-bottom: 5px solid #fff; margin-bottom: 1px; }
.insights-arrow-down::before { border-top: 5px solid #fff; margin-top: 1px; }

/* The drawn before/after arrow (arrowEl()/ARROW_SVG in dashboard.js), for the
   same reason. Sized in `em` so it tracks whatever line it lands in. */
.in-arrow {
  width: 1.05em; height: 1.05em; vertical-align: -.18em;
  margin: 0 .18em; color: var(--muted); flex: none;
}
.sankey-tooltip .in-arrow { color: inherit; }
/* The changed figure inside a sentence: a weight bump, nothing more. It used
   to switch to the display face for contrast, which is now out of bounds —
   the serif is for KPI figures and titles, and a number set into running
   prose is prose. It keeps tabular figures (see .num) so a before/after pair
   lines up. */
.insights-line strong { font-weight: 600; }

/* ── KPI stat cards (All Energy only) ─────────────────────────────────
   Not four equal cards. `repeat(auto-fit, minmax(190px, 1fr))` gave the same
   width and the same 32px figure to the number the model exists to project
   (2047 demand), the tonnage of CO2 that comes with it, and two percentages
   derived from the same supply total — four things of very different weight,
   rendered identically, which is what made the row read as generated.
   Two headline cards at ~1.6fr each, then one 1fr column holding the
   supporting pair stacked. See all_energy.py. */
/* Three columns since the emissions card left, and the supporting pair is no
   longer stacked. It was `1.6fr 1.6fr 1fr` — two headline cards plus a narrow
   column holding the pair one above the other. With one headline card left,
   keeping that shape put the figure at the left edge of a box half the page
   wide with nothing in the rest of it. The pair comes out of its stack via
   `display: contents` on .stat-stack, so its two cards become grid items of
   this row directly — no markup change, and all-energy.py keeps a wrapper it
   still needs at the narrow breakpoint. */
/* One grey tray holding three white blocks. The row was three separate
   accent-coloured cards floating on the page, which read as three unrelated
   widgets; it then became one white box with hairline dividers, which read as
   flat. The tray is the middle answer: --surface-2 grey behind, the three
   blocks raised off it in white with their own radius, so they group as one
   object but each figure still has an edge of its own. Separation is now the
   gap plus the tone step — no dividers, no per-block colour. */
.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px; margin-bottom: 10px; align-items: stretch;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px;
}
.stat-stack { display: contents; }
/* The white block. `--stat-lift` is the hover translation, kept as a variable
   so the transform composes in one place; the border lightens to the accent
   at 28% rather than switching colour outright, which at this size is a hint
   that the block is live and not a second state to read. */
.stat-card {
  background: #fff; border: 1px solid transparent; border-radius: 9px;
  padding: 9px 14px 8px;
  box-shadow: 0 1px 2px rgba(16, 17, 20, .05);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
  will-change: transform;
}
.stat-card:hover {
  border-color: rgba(41, 105, 154, .28);
  box-shadow: 0 3px 10px rgba(16, 17, 20, .09);
  transform: translateY(-1px);
}
/* The figure is the thing the hover is pointing at, so it takes the accent
   while the block is under the cursor. Caption and label stay grey — they are
   the parts that have to hold contrast, and neither moves. */
.stat-card .stat-value { transition: color .16s ease; }
.stat-card:hover .stat-value { color: var(--accent); }
.stat-label { font: var(--t-caption); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* 30px, down from the --t-kpi step's 40. The row was taking more height than
   the two charts beneath it warranted, and --ui-scale then shrank everything
   else to fit. Declared here rather than as a new scale step: --t-kpi is still
   the role, this is the KPI row's own tighter size, and nothing else uses it.
   `font:` shorthand resets font-variant-numeric, so the tabular declaration
   in the .num block has to stay after this — it does. */
.stat-value { font: var(--t-kpi); font-size: 30px; color: var(--ink); margin: 4px 0 2px; }
.stat-note { font: var(--t-label); color: var(--muted); }
/* Was the level-4 green — the last of the per-card colour after the row
   became one box, and the only caption of the three that wasn't grey. */
.stat-note-accent { color: var(--muted); }

/* The per-card accents (amber demand, green clean share, blue imports, each
   with a faint background wash) were removed when the row became one box:
   colour was the thing making the three read as separate objects, and the
   hairline rule between sections now does the separating on its own. The
   .stat-demand / .stat-supply / .stat-imports classes stay in the markup as
   hooks; nothing styles them. (.stat-supply was .stat-clean until the Clean
   Share card became Total Supply 2047 — the hook was renamed with it, since
   a hook named for a card that is gone is worse than no hook.) Figure and
   caption were always ink and grey, so contrast is unchanged — --muted on
   white is 5.4:1 or better. */

/* The headline section: a bigger figure and more room, so it reads as the
   lead of the three rather than one of three equals. */
.stat-card-lead { padding: 11px 18px 10px; }
.stat-card-lead .stat-value { margin: 5px 0 3px; }

/* The supporting pair: two compact rows in the narrow column, figure and
   caption on one line at caption scale. Same data family as the leads, a
   sixth of the ink. */
/* .stat-stack is `display: contents` in the row above, so this rule only
   governs the narrow breakpoint, where it becomes a real 2-up grid again. */
.stat-stack { min-width: 0; }
.stat-card-min { padding: 8px 13px 7px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.stat-min-figure { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
/* 19px, from --t-chart's 22 — the whole row came down a step, see .stat-value. */
.stat-card-min .stat-value { font: var(--t-chart); font-size: 19px; margin: 0; flex: none; }
.stat-card-min .stat-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1023px) {
  /* Two columns: the headline spans both, the pair sits side by side beneath.
     Three cards in a row is too tight for a figure and its caption on one
     line at this width. */
  .stat-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-card-lead { grid-column: 1 / -1; }
  /* Nothing else to turn at this width: the blocks are separated by the tray
     gap, which works the same in two rows as in one. */
}

/* The lift is decoration on a block that is not clickable — the colour and
   shadow still say "live" without it. */
@media (prefers-reduced-motion: reduce) {
  .stat-card { transition: none; }
  .stat-card:hover { transform: none; }
}

/* ── Panels (All Energy / Electricity duo charts) ──────────────────────── */
/* Chart containers carry no box. They were white cards with a 1px --line
   border on a white page, so the border was the only thing drawing them; with
   it gone the chart sits directly on the page, which is how the EU-Calc
   reference presents its own charts (title, plot, nothing around them).
   Padding stays — it is what keeps the plot off the page inset and its
   neighbour. */
.panel { min-width: 0; background: transparent; border: 0; border-radius: 0; padding: 10px 14px 8px; margin-bottom: 8px; }

/* Energy Demand + Energy Supply. NOT 1fr 1fr any more, and the reason is
   measurable rather than aesthetic: both charts carry a right-hand legend,
   Supply's has ten entries against Demand's eight, and Supply owns the
   longest label in the interface — "Oil and petroleum products", which the
   equal split was clipping to "Oil and petroleum produc". The plot then got
   whatever the legend left, so the CHART that had more to show was the one
   drawn smaller.
   1fr : 1.32fr is that difference, not a round number picked to look
   deliberate. Any tab whose two panels genuinely are equivalent still gets
   the equal split — this override is scoped to the wide panel's own class
   (all_energy.py sets it), so Electricity's duo is untouched. */
.chart-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 8px; align-items: stretch; }
.chart-duo:has(.chart-duo-supply-wide) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.32fr); }
.chart-duo .panel { margin-bottom: 0; }
@media (max-width: 1023px) {
  .chart-duo, .chart-duo:has(.chart-duo-supply-wide) { grid-template-columns: 1fr; }
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 1px; flex-wrap: wrap; }
.panel h2 { font: var(--t-chart); margin: 0 0 1px; }
/* Mono and tracked like the other captions, but NOT uppercased. "Mtoe" is a
   unit symbol, not a label: the M is mega and the lowercase toe is tonne of
   oil equivalent, so "MTOE" is simply wrong notation — and it shipped that
   way for one pass here before this comment existed. The small-caps
   treatment belongs to captions ("FINAL DEMAND 2047"), not to units. */
.panel-unit { font: var(--t-caption); font-weight: 400; letter-spacing: .04em; color: var(--muted); }
.panel-sub { font: var(--t-label); color: var(--muted); margin: 0 0 6px; }
.panel .changed-note { display: none; font: var(--t-axis); color: #a0761f; font-weight: 700; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.panel.changed .changed-note, .panel.card.changed .changed-note { display: inline; }

/* Four fixed chart heights, not one shared value — tuned so each tab's
   proportions read consistently against All Energy's own (the reference):
   All Energy alone carries a KPI stat-row above its charts; Indicators/Costs
   alone carry a sub-tab row; and the .panel (chart-duo) wrapper All Energy/
   Electricity share has slightly different chrome than the .card
   (chart-grid) wrapper the other tabs use. Bumped up from the original
   301/398/373/340 — a flex-grow chain that let these fill leftover
   viewport height was tried and reverted (see .page-grid above): capping
   it anywhere just relocated the same blank band one level up the chain,
   so these are bigger fixed numbers instead, which can't ever mismatch
   their own container. */
.chart-wrap, .chart-wrap-duo { position: relative; }
/* ── Four tiers, set so every tab FITS AT THE SAME --ui-scale ─────────────
   This is what the four numbers are for, and the reason they differ.
   fitUiScale() shrinks the whole interface until the footer meets the bottom
   of the window, and it runs per tab — so a tab whose content is taller gets
   a smaller scale, and the masthead, the deck, the type and everything else
   visibly resize when you switch to it. All Energy is the tab that has a KPI
   row, so it was the tall one: measured at 1920x1080, its content came to
   1070 logical px against ~1020 for every other chart tab, giving scale 0.921
   against their 0.966-0.973 — a 5.4% jump on every switch.

   The fix is to take it out of the charts rather than out of the scale, which
   is what the tiers do: each tab's chart height is set so its TOTAL content
   height lands on the same ~1020, and the scale then comes out the same
   everywhere. So All Energy's charts are the shortest precisely because it is
   the only tab carrying KPI cards, and Electricity's are the tallest because
   it has neither a KPI row nor a sub-tab row to pay for.

   Derived from measurement, not taste: logical content height is
   clientHeight / scale, so moving a tab from its own scale to the target is a
   known number of pixels off (or onto) its one chart row. All Energy went
   1070 -> 1020 logical, i.e. 380 - 50 = 330; then the KPI row lost its
   stacked column (three cards in a row rather than one plus a 2-high stack,
   97px instead of 126) and gave 29px back, so 359. Electricity was 7px short
   of the target rather than over, hence 460 -> 467. Verified: every tab with
   charts now fits at one scale — 0.966 at 1920x1080, 1.319 at 2560x1440.

   IF A TAB'S STRUCTURE CHANGES (a KPI row added or removed, a sub-tab row
   appearing, a chart moving between .panel and .card), these numbers drift
   out of sync. Re-measure rather than nudging by eye: read the fitted scale
   per tab, convert to logical height, and correct each tier by the
   difference in one pass. */
.chart-wrap-duo { height: 359px; }                 /* All Energy: the only tab with a KPI row */
.chart-wrap-duo-lg { height: 467px; }              /* Electricity: .panel chrome, no KPI row */
.chart-wrap-lg { height: 440px; }                  /* Emissions/Energy Security/Land & Water: .card chrome, no KPI, no subtabs */
.chart-wrap { height: 400px; }                     /* Indicators/Costs: .card chrome, no KPI, has subtabs */

/* ── Shared chart-grid/card (other 8 tabs) — same rounded v2 language ── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 8px; align-items: stretch; }
.card { background: transparent; border: 0; border-radius: 0; padding: 11px 14px 9px; position: relative; }
.card h3 { font: var(--t-chart); margin: 0 0 2px; }
.card .card-sub { font: var(--t-label); color: var(--muted); margin: 2px 0 7px; }
.card .changed-note { display: none; font: var(--t-axis); color: #a0761f; font-weight: 700; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.card.changed .changed-note { display: inline; }

#error { color: #c0392b; font: var(--t-body); }

/* ── Views / tabs ───────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

.subtabs { display: flex; gap: 3px; background: #E7EAEC; border-radius: 8px; padding: 2px; margin-bottom: 6px; width: fit-content; max-width: 100%; flex-wrap: wrap; }
.subtab { font: var(--t-body); color: var(--muted); cursor: pointer; padding: 4px 11px; border-radius: 6px; }
.subtab:hover:not(.active) { color: var(--ink); }
.subtab.active { font-weight: 600; color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(16,17,20,.12); }
.subtab.disabled { color: #c3c6d4; cursor: not-allowed; }
.subview { display: none; }
.subview.active { display: block; }
.coming-soon-note { color: var(--muted); font: var(--t-body); background: #fff; border: 1px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; }

/* ── Energy Flows — the one view that is not on the page's grid ──────────
   Everything else here is a section inside .page's inset. This tab breaks
   out of it entirely: the view cancels the inset on both sides so the Sankey
   gets the full window width, which for a five-column diagram with ~40 links
   is legibility rather than styling. .page-grid is already collapsed to one
   column and the Insights rail hidden for this view (dashboard.js), so
   nothing is left beside it to align to.
   Deliberately NOT normalised with the other tabs' spacing: this one is
   built around one question and is allowed to look like it. */
.flows-view.active { display: block; margin: 0 calc(-1 * var(--page-x)); }

/* Its own control strip. The year selector, the total-supply readout and the
   node-colour key are all apparatus for this single diagram, so they share
   one band instead of being scattered as page furniture — a toolbar above and
   a legend far below the plot, which is what this was.
   The dark band is the page's existing vocabulary (masthead and footer are
   the same #3F4247), reused here to say "this section is its own thing". */
/* Energy Flows shows the Sankey alone. dashboard.js puts `flows-only` on
   <body> while that tab is active and takes it off on every other tab; the
   Custom Pathways band (GHG 2047 gauge, lever columns, Insights) is hidden
   for the duration. `display:none` rather than a layout change on purpose —
   the deck's markup and every lever's state stay exactly as they were, so
   switching away and back costs nothing and re-renders nothing. */
body.flows-only .control-deck-h { display: none; }

.flows-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 18px 24px;
  flex-wrap: wrap;
  background: #3F4247; color: #E7E9EB;
  padding: 9px var(--page-x) 10px;
  margin-bottom: 6px;
}
.flows-strip-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.flows-strip-label { font: var(--t-label); font-weight: 500; color: #A9AFB6; }
/* Year tabs inverted for the dark strip — the light-grey pill group they
   inherit from the other tabs is invisible on it. */
.year-tabs { display: flex; gap: 2px; background: rgba(255,255,255,.10); border-radius: 9px; padding: 3px; }
.year-btn { border: none; background: transparent; padding: 7px 13px; border-radius: 7px; font: var(--t-body); font-weight: 500; color: #C3C7CC; cursor: pointer; transition: color .15s, background .15s; }
.year-btn:hover { color: #fff; }
.year-btn.active { font-weight: 600; color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }

/* No overflow:hidden. It was here to clip the Sankey to the card's rounded
   corners; the card has neither a radius nor a background any more, so all it
   still did was slice the hover tooltip in half whenever the pointer was near
   an edge — the tooltip is absolutely positioned inside this element.
   (renderSankey's showTip also clamps the tooltip's own position, so the two
   together keep it whole AND inside the plot.) */
.sankey-card { position: relative; border-radius: 0; padding: 6px var(--page-x) 10px; background: transparent; border: 0; }
/* The Sankey is the headline view of the whole site, so it gets the space
   rather than being squeezed to keep the control deck above the fold. Sized
   off the viewport, not a magic number: renderSankey() lays out to the
   measured height and re-renders on resize, so there is nothing to keep in
   sync here. */
/* A FALLBACK only. This was the real sizing — a clamp subtracting a guess at
   the page chrome from 100vh — and a guess is what put a scrollbar on the tab:
   any change to the masthead, tab row or control strip made it wrong, and it
   had no way to know the Custom Pathways band is hidden here. renderSankey()
   calls sizeSankeyToViewport(), which measures the gap between this element
   and the footer and writes the answer as an inline height that overrides this
   rule. The clamp stays for the moment before the first render. */
#sankeySvg { width: 100%; height: clamp(320px, calc((100vh / var(--ui-scale)) - 220px), 900px); display: block; position: relative; }
/* ── Sankey flow tracing ─────────────────────────────────────────────────
   Hovering a node traces its whole chain (see renderSankey's trace()): the
   links on that route get .is-traced, everything else .is-dimmed, and a dashed
   overlay copy of each traced link gets .is-on so the route visibly runs.
   The opacity values carry !important because the base stroke-opacity is set
   as a presentation ATTRIBUTE by d3, and an attribute would otherwise win
   over a class here. */
.sankey-link { transition: stroke-opacity .18s ease; cursor: pointer; }
.sankey-link.is-traced { stroke-opacity: .68 !important; }
.sankey-link.is-dimmed { stroke-opacity: .07 !important; }
/* Clicking holds the current selection (renderSankey's pinned state). A pinned
   route is the traced route carried a step further — fully opaque rather than
   .68 — so "held" reads as more committed than "hovered" without introducing
   a second colour or an outline the diagram would have to explain. Pinning
   dims the rest harder than hover does for the same reason: a state you chose
   to sit in can afford to isolate its subject more than one you are merely
   passing through. */
.sankey-link.is-pinned { stroke-opacity: .92 !important; }
.sankey-svg-pinned .sankey-link.is-dimmed { stroke-opacity: .04 !important; }

.sankey-node, .sankey-label { transition: opacity .18s ease; }
.sankey-node.is-dimmed, .sankey-label.is-dimmed { opacity: .22; }
/* pointer, not crosshair: these are clickable now, and crosshair reads as
   "inspect a coordinate" rather than "this does something". */
.sankey-node { cursor: pointer; }
.sankey-node.is-pinned { stroke: var(--ink); stroke-width: 1.5px; paint-order: stroke; }

/* Entry reveal. `forwards` is the load-bearing part: it holds
   stroke-dashoffset at 0 once the animation ends, so a link's final state is
   "fully drawn" by declaration. Nothing — an interrupted re-render, a missed
   event, a thrown handler — can leave a flow stranded invisible, which is the
   failure mode the d3-transition version of this actually shipped with.
   renderSankey sets stroke-dasharray/-dashoffset and a per-link
   animation-delay inline. */
.sankey-reveal { animation: sankey-reveal .52s ease-out forwards; }
@keyframes sankey-reveal { to { stroke-dashoffset: 0; } }

.sankey-fade-in { animation: sankey-fade-in .32s ease-out backwards; }
@keyframes sankey-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* The moving dashes. Only ever painted on a traced route, so nothing on the
   page animates until the reader asks for it by hovering — a diagram that
   shimmers permanently is a diagram nobody can read. */
.sankey-flow { opacity: 0; transition: opacity .2s ease; }
.sankey-flow.is-on { opacity: .5; animation: sankey-flow 1.2s linear infinite; }
@keyframes sankey-flow { to { stroke-dashoffset: -36px; } }

@media (prefers-reduced-motion: reduce) {
  .sankey-flow.is-on { animation: none; opacity: .32; }
  /* renderSankey already skips adding these classes under reduced motion;
     this is here so a stylesheet-only reading of the file is not misleading,
     and in case the classes ever arrive by another route. */
  .sankey-reveal, .sankey-fade-in { animation: none; }
}

.sankey-tooltip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .12s ease;
  background: #fff; color: var(--ink); padding: 9px 12px; border-radius: 8px;
  font: var(--t-label); border: 1px solid var(--line);
  transform: translate(-50%, -120%); white-space: nowrap;
}
.sankey-tooltip.show { opacity: 1; }
/* Flipped under the cursor when there is no room above (showTip decides). */
.sankey-tooltip.is-below { transform: translate(-50%, 24%); }
.sankey-tooltip b { color: var(--accent); }
/* Mono, and this is the reference case for that rule: it is a measurement
   with a unit ("Total primary supply: 2902.5 Mtoe"). On the dark strip it
   drops the white pill it wore on the white page — it is inside a band now,
   so it needs no card of its own. */
.sankey-total { font: var(--t-caption); letter-spacing: .04em; color: #A9AFB6; background: transparent; border: 0; padding: 0; }
.sankey-total b { color: #fff; }
.sankey-legend { display: flex; gap: 16px; font: var(--t-label); color: #C3C7CC; flex-wrap: wrap; }
.sankey-legend span { display: flex; align-items: center; gap: 6px; }
.sankey-legend i.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ── Site footer ──────────────────────────────────────────────────────────
   Full-bleed band at the very foot of the page, same technique as the
   masthead (negative margins cancel .page's own padding/inset) but with no
   top margin to cancel, since it's the flex column's last child rather than
   its first — it just needs to bleed sideways and sit flush at the bottom. */
.site-footer {
  flex: none;
  /* margin-top:auto, not the 6px it used to be. .page is a min-height:100vh
     flex column, but nothing in it grows, so on any tab whose content is
     shorter than the window the column simply ended early and the footer sat
     wherever the content stopped — most visibly on Energy Flows, which hides
     the Custom Pathways band entirely and left the footer stranded mid-screen
     with white below it. `auto` absorbs the leftover space, so the footer is
     on the bottom edge of the window when content is short and directly after
     the content when it is long. (The old 6px gap goes with it; against a
     full-bleed dark band it was not doing visible work.) */
  margin: auto calc(-1 * var(--page-x)) 0;
  padding: 6px var(--page-x);
  background: #3F4247;
  color: #C3C7CC;
  /* Plain sans: the footer is a copyright line and two download links, not a
     measurement. It was in the mono purely because everything small was. */
  font: var(--t-caption); line-height: 1.4; letter-spacing: .06em;
  text-align: center;
}
.site-footer a { color: #8FC2E8; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ── Custom Pathways (control deck) ─────────────────────────────────────
   Full-bleed band on both edges again, a direct sibling of .page-grid
   rather than nested in .page-main — the Insights rail only runs alongside
   the tab row/KPI cards/charts above (see .page-grid), not this. Fixed top
   margin, not margin-top:auto: auto pinned this band to the bottom of
   .page's own min-height (100vh), which on a tab shorter than the viewport
   left a dead gap of page background between the charts and this band —
   exactly the gap that prompted this fix. It now just sits directly under
   whatever's above it, like every other stacked section on the page. */
/* `flex: 1 0 auto`, not `0 0 auto`: the deck is the last block before the
   footer, and with the footer on `margin-top: auto` any space the fit left
   over showed as a band of page ground between the two. The deck absorbs it
   now — it grows past its content height, its own background reaches the
   footer, and the room goes to the levers (.lever-grid grows in turn, below).
   It never shrinks (`0` basis-shrink), so a deck taller than the window still
   pushes the page rather than compressing its own rows.
   (In the desktop app shell the deck is instead a fixed share of the window;
   see APP SHELL at the end of this file.) */
/* The deck's own flat grey (--deck-bg) is gone: it is now the page wash
   showing through, so the calculator and the landing screen are one
   surface. The lever boxes inside were already rgba(255,255,255,.55), i.e.
   designed to float on a tint rather than on the grey, so they gain from
   it. A hairline keeps the "data above, controls below" edge the grey used
   to draw, and --deck-ink is unchanged: it is dark, and the wash is paler
   than the grey it replaces, so every contrast ratio in here went up. */
.control-deck-h {
  flex: 1 0 auto; background: none; border: 0; border-radius: 0; box-shadow: none;
  border-top: 1px solid var(--deck-line);
  color: var(--deck-ink); overflow: visible;
  display: flex; flex-direction: column; position: relative;
  margin: 16px calc(-1 * var(--page-x)) 0;
  padding: 12px var(--page-x) 14px;
}
/* ── GHG gauge along the deck's top edge ─────────────────────────────────
   Replaces a decorative 2px effort-ramp gradient that sat here. Same job as
   the divider (it marks where data ends and controls begin) but it now
   carries a number: the pathway's 2047 emissions against a fixed 0-10 GtCO2
   scale. Full-bleed via negative margins that cancel the deck's own top and
   side padding, exactly as .site-banner does against .page. */
.cdh-emissions {
  display: flex; align-items: center; gap: 12px;
  margin: -12px calc(-1 * var(--page-x)) 10px;
  padding: 7px var(--page-x) 8px;
  /* Dark navy box, amber meter — see --gauge-box for the measurements that
     drove going dark, and for why the meter is amber rather than the lime it
     started as. Labels are LIGHT on it now (12.91:1); the dark ink they used
     to carry was correct for the old light-blue box.
     Bordered in the tab rule's own denim, which ties the page's two blue
     rules together and gives the band a real edge. On the dark box that
     border now reads 7.56:1 (it was 1.71:1 on the light one), so the edge is
     crisper than before, while still holding against the white page above
     (2.32:1) and the deck grey below (1.98:1).
     The side borders land on the window edges, since the band is full-bleed —
     the negative side margins cancel the deck's own padding. */
  background: var(--gauge-box);
  border: 1px solid var(--rule-accent);
}
/* The gauge's caption takes the small-caps treatment; its max READOUT does
   not. See .panel-unit for why a unit symbol is never uppercased. */
.cdh-emissions-label {
  font: var(--t-caption); letter-spacing: .06em; text-transform: uppercase;
  color: var(--gauge-ink); white-space: nowrap; flex: none;
}
.cdh-emissions-max {
  font: var(--t-caption); letter-spacing: .04em;
  color: var(--gauge-ink); white-space: nowrap; flex: none;
}
/* 15px, not the 7px hairline this started as: the readout sits INSIDE the
   fill, and a 10.5px label in a 7px bar spills its glyphs onto the light
   track above and below, where white text is unreadable. The band has to be
   taller than its own type. */
.cdh-emissions-track {
  position: relative; flex: 1 1 auto; height: 15px; min-width: 0;
  /* The UNFILLED part has to contrast the meter, or you cannot read how full
     the bar is — that is the whole point of a meter. Against the dark box the
     same denim now gives 5.07:1 to the meter (it managed 2.63:1 on the old
     light box) and still reads as a recess within its surround at 1.76:1. */
  border-radius: 999px; background: var(--gauge-track);
}
.cdh-emissions-fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  border-radius: 999px; background: var(--gauge-meter);
  transition: width .45s cubic-bezier(.16,.84,.44,1);
}
/* Rides the end of the fill, the way EU-Calc's own cumulative-emissions bar
   labels its head. .is-inside flips it to the fill's left when the bar is
   nearly full, so the number can't run off the track. */
/* Rides the head of the fill, as EU-Calc's own cumulative-emissions bar does.
   Default is just outside it in dark ink (for a fill too narrow to hold the
   text); .is-inside tucks it within the fill in white, which is where it sits
   for any normal value. dashboard.js picks between them by measuring the
   fill's actual pixel width, not by guessing a percentage. */
.cdh-emissions-value {
  position: absolute; top: 50%; left: 0;
  transform: translate(9px, -50%);
  font: var(--t-caption); color: var(--gauge-ink); white-space: nowrap;
  transition: left .45s cubic-bezier(.16,.84,.44,1);
}
/* TWO colours, because the readout lands on two different grounds and the box
   is dark now: outside the fill it sits on the denim track and takes the same
   light ink as the labels (8.51:1); tucked inside the fill it sits on the
   amber meter and has to flip to dark (11.73:1 — it was 9.62:1 while the meter
   was lime, so the amber improved this pair too). It was dark in BOTH
   positions while the box was light blue, which was right then and would be
   invisible on the track now. This pair is why a dark red meter is not an
   option here — see --gauge-meter. */
.cdh-emissions-value.is-inside {
  transform: translate(calc(-100% - 9px), -50%);
  color: #101114;
}
.cdh-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 9px; flex: none; }
.cdh-head-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; }
.cr-title { font: var(--t-section); white-space: nowrap; }
/* Empty while idle (dashboard.js's setStatus), so the deck head has no
   placeholder text sitting in it pretending to be a signal — it only appears
   while a recalculation is actually running, or after one fails. */
/* ── Collapsing the deck ────────────────────────────────────────────────
   "Hide levers" gives the charts the whole window. Only .lever-grid is
   hidden; the CO2e meter and the section title stay, so a shut deck still
   names the loaded pathway and still shows what it emits. Nothing about the
   pathway changes — see initDeckCollapse() in dashboard.js, which also
   re-measures the charts afterwards. */
.deck-toggle {
  margin-left: auto; flex: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  border: 1px solid var(--deck-line); background: rgba(255,255,255,.72);
  font: 600 12px/1 var(--font-sans); color: var(--accent);
  transition: background .15s, border-color .15s;
}
.deck-toggle:hover { background: #fff; border-color: var(--accent); }
.deck-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.deck-toggle-chevron {
  width: 7px; height: 7px; flex: none;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(135deg) translate(-1px, -1px);   /* points up: "put it away" */
  transition: transform .2s ease;
}
html.deck-collapsed .deck-toggle-chevron { transform: rotate(-45deg) translate(-1px, -1px); }
html.deck-collapsed .lever-grid { display: none; }
/* The deck keeps its band, so the page does not lose its footing when the
   levers go; it simply shrinks to the meter and the title. */
html.app-shell .control-deck-h { transition: max-height .28s ease; }
html.app-shell.deck-collapsed .control-deck-h { max-height: none; }
@media (prefers-reduced-motion: reduce) {
  html.app-shell .control-deck-h { transition: none; }
  .deck-toggle-chevron { transition: none; }
}
#status-chip { font: var(--t-label); font-weight: 500; color: var(--deck-ink); white-space: nowrap; }
#status-chip:empty { display: none; }
#status-chip.recalculating { color: #96650F; }
#status-chip.error { color: #C0392B; }

/* The predefined-scenario select used to be styled here, as .cdh-pathway* in
   the deck head. It lives in the tab row's pathway chip now (.pathway-chip-
   select above) — the chip already reported which pathway was loaded, so a
   chooser here and a readout there were two controls for one fact. Before
   that it was four always-visible buttons; the reasoning for collapsing them
   into one select is recorded on .pathway-chip-select. */

/* Flexbox, not grid: the rail (see .lg-rail-col below) needs to be able to
   sit right next to WHICHEVER lever column was clicked, not always parked
   in the same spot — a fixed track-based grid ties a column's width to its
   position, so moving the rail between positions would also swap widths
   with whatever used to be there. Flex items carry their own width
   regardless of DOM order, so dashboard.js can move the rail's actual DOM
   node next to the clicked column (chevron.closest('.lg-col').after(rail))
   and the layout still reflows correctly. */
.lever-grid {
  /* Grows with the deck (above), so the extra height lands on the levers
     rather than as dead padding under them. With align-items:stretch the
     columns take the new height too, and .lg-col spreads its own rows into
     it — see the justify-content there. */
  flex: 1 0 auto; display: flex;
  /* stretch, so every column is the tallest column's height and the navy
     rules between them are equal full-height lines (see .lg-col::before).
     40px of gap, up from 26: the rule sits in the middle of it, and 13px of
     clear space either side is what stops it reading as an edge belonging to
     one of the two columns. */
  align-items: stretch; gap: 40px;
  /* Columns are their own width and cluster at the left rather than each
     taking 1/4 of the window. They used to be `flex: 1 1 0`, so the four
     groups spread across the full page and the gaps between them grew with
     the monitor — on a wide screen the deck read as four islands with a lot
     of nothing between them. A control panel wants its controls together;
     leftover width belongs at the end, not distributed between the groups. */
  justify-content: flex-start;
}

/* ── The lever region: the levers' "confined space" ──────────────────────────
   Everything that is a control — the three group columns plus the slide-out
   rail — lives inside this one flex item, and Insights is the item after it.
   The point is that this box's width does NOT depend on what the levers are
   doing: opening a sub-sector's rail redistributes width INSIDE here (the
   three columns narrow to make room, and widen again on close) instead of
   shoving the Insights panel sideways by 285px every time someone opens a
   flyout. Commentary that jumps when you touch a control reads as breakage.

   1464 is not a taste number, it is the open state measured: three columns at
   their derived 353 (see .lg-col) + two 40px gaps between them + a 40px gap to
   the rail + the rail's own 285 = 1464. So with a flyout open every column is
   at exactly the width it was designed around, and with it closed the same
   1464 is shared by three columns (461 each), the surplus going to the tracks
   — see .lg-lever-cell. `0 1` so it still compresses rather than overflowing
   on a narrow window; logical deck width runs ~1790-2700 across 1366→3440. */
.lg-cols {
  flex: 0 1 1464px; min-width: 0;
  display: flex; align-items: stretch; gap: 40px;
}
/* Width is derived, not chosen: chevron 15 + gap 10 + title 168 + gap 10 +
   track 150 = 353. It also has to clear the widest GROUP heading, which is
   "Supply — Renewable and Clean Energy" — measured at 251px plus its 7px dot
   and 7px gap = 265, so 353 holds it without wrapping.
   `1 1 353px`, not `0 1`: the columns share .lg-cols above between them, so
   they grow past 353 when the rail is shut and fall back to it when the rail
   takes its 285. 353 stays the basis (and the floor the rail's arithmetic is
   built on) rather than becoming a fixed size. */
/* space-between, so a column that is shorter than the row distributes the
   slack between its groups instead of packing to the top and leaving a block
   of empty deck beneath. `gap: 9px` stays the MINIMUM — space-between only
   ever adds to it — so nothing gets tighter than it was, and a full column
   lays out exactly as before because there is no slack to distribute. */
.lg-col { display: flex; flex-direction: column; justify-content: space-between; gap: 9px; min-width: 0; flex: 1 1 353px; position: relative; }

/* ── Navy rule between sections ──────────────────────────────────────────
   Drawn as an absolutely-positioned ::before sitting in the gap, NOT as a
   border-left on the column. A border lives inside the box, so with
   box-sizing:border-box it would come out of the column's own 353px and put
   the line hard against this column's first character instead of centred
   between the two; positioning it in the gap leaves every width derivation
   above untouched.
   `align-items: stretch` on .lever-grid (its default, restored from
   flex-start) makes every column as tall as the tallest, so the rules are
   equal full-height lines rather than ragged ones ending wherever their own
   column happens to stop. Column CONTENT still packs to the top, since
   .lg-col is itself a flex column. */
/* Faded at both ends rather than a hard full-height line. A rule that stops
   dead at the top and bottom of the tallest column reads as an edge — it
   boxes each column in, and it draws a boundary through the empty space below
   the shorter columns where there is nothing to divide. Fading it out means it
   is at its most visible exactly where the rows are, and is nothing where the
   space is: it fills the gap without claiming it. Held at 30% of the navy
   (~1.76:1 against the band) rather than solid — see --deck-divider. */
.lg-col + .lg-col:not(.lg-rail-col)::before {
  content: ""; position: absolute; left: -20px; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    color-mix(in srgb, var(--deck-divider) 30%, transparent) 18%,
    color-mix(in srgb, var(--deck-divider) 30%, transparent) 76%,
    transparent 100%);
}
/* The flyout rail is injected between columns when a sub-sector opens, so the
   column that lands after it would otherwise draw its rule inside the rail. */
.lg-rail-col.is-open + .lg-col::before { display: none; }

/* No card chrome. Each group used to be a white rounded box with a border on
   the grey band; it is now just a heading over a list of rows, sitting
   directly on the band — the arrangement EU-Calc's own control sidebar uses.
   --deck-panel is consequently no longer painted anywhere in the deck itself
   (the Predefined-scenarios buttons and the flyout rail still use it). */
.lg-box { min-width: 0; background: transparent; border: 0; border-radius: 0; padding: 2px 2px 4px; overflow: visible; }
.lg-box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 3px; margin-bottom: 2px; }
/* A group heading, so plain sans in its own case — "Demand", not "DEMAND" in
   spaced monospace caps. The uppercase mono treatment here was the same one
   the KPI captions use, which put a section title and a unit label in the
   same voice. */
.lg-box-title { font: var(--t-body); font-weight: 600; color: var(--deck-ink); display: flex; align-items: center; gap: 7px; }
/* Group accent dot — ties each panel to what it controls: blue = demand,
   green = clean supply, slate = fossil, indigo = network. */
.lg-box-title::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--group-accent, var(--muted-2)); flex: none; }
.lg-box-demand  { --group-accent: var(--lvl-3); }
.lg-box-clean   { --group-accent: var(--lvl-4); }
.lg-box-conv    { --group-accent: var(--lvl-1); }
.lg-box-network { --group-accent: var(--lvl-2); }
/* .lg-box-econ / .lg-box-costs went with the Economics and Costs groups, which
   are sub-categories of Other now (levers.py) and so have no panel of their
   own to accent. */
.lg-box-other { --group-accent: var(--lvl-1); }

.lg-subcats { display: flex; flex-direction: column; }
/* Rules between rows removed with the boxes — spacing alone separates them,
   as in the reference sidebar. (Flyout rows keep their own rules: those sit
   on a white panel where a list needs the help.) */
/* 3px, not 5. The lever itself grew 24 -> 28px tall, and at 1366x768 the fit
   is already pinned to its UI_SCALE_MIN floor of 0.7 — so 4px added per row
   came straight off the bottom of the window and pushed the footer out of
   view. Taking it back out of the padding makes the row pitch identical to
   what it was (24+10 = 28+6 = 34px), so the deck is exactly as tall as
   before while the control inside it is bigger. */
.lg-subcat-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
/* A fixed WIDTH, not a fixed share. `flex: 1` was wrong first (the label ate
   all the slack and pushed its slider to the far right of the column), and
   `0 0 50%` was still wrong: a share of a column that stretched to a quarter
   of the window is a share of an arbitrary number, and it measured 272px
   against a longest real label of 162px — ~110px of dead space on every row.
   168px is that longest label ("Renewable Generation · 8", measured) plus a
   little slack, so the tracks sit right after the names and still line up on
   one x down the column. The one label longer than this — "Hydrogen
   Production for Telecom and Transport", 301px — was already ellipsised at
   272; its full text is the first line of the row's hover popup now, which is
   why it no longer carries a native `title` (that was a second tooltip). */
.lg-subcat-title { flex: 0 0 168px; min-width: 0; font: var(--t-body); color: var(--deck-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-subcat-count { font: var(--t-label); color: var(--muted); }
/* Draggable lever — a native <input type=range> (drag the thumb, click the
   track, or arrow-key it while focused, all for free) laid transparently
   over a styled track+fill+thumb it actually drives. dashboard.js's
   initLevers reads the level's own ramp colors back out of data-fills
   (LEVEL_FILL, sidebar.py) and repaints the fill/thumb on every input event
   and on every external update (recalc, pathway button, flyout edit).
   Hovering/focusing anywhere on the ROW shows one popup inside the deck band
   (.lever-tooltip, dashboard.js): for a single lever its Control-sheet note
   for the level it is on, for a bundled row what that one control does and
   where it sits. Never both, and never a per-lever list. */
/* Restyled from a glossy candy slider to a flat, precise one. What made the
   old control read as cheap was not the geometry so much as three effects
   stacked on it: a radial-gradient "bubble" thumb with a specular highlight,
   a saturated glow halo ringing it at all times, and a heavy inset shadow
   pressed into the track. Those are consumer-app cues. Removed all three in
   favour of flat fills, one hairline, and a shadow only where it signals
   depth — the thumb sitting above the track.
   The thumb is a white disc with the level's own colour as its ring rather
   than a solid colour blob: it keeps the ramp legible at 14px, reads as a
   precision control rather than a toy, and holds its edge against both the
   grey deck panel it sits on and the fill running under it. */
/* ── One track geometry for every row ────────────────────────────────────
   Width was briefly per-row, derived from how many Control-sheet levers the
   row drives (the comment above sidebar.py's _lever_html has the history). It
   encoded something true and still read as a mess: twelve tracks of twelve
   lengths ending on twelve x positions, with nothing to scan down.
   Now one width, set HERE and nowhere else, and — with .lg-subcat-title at a
   fixed width and the chevron slot always reserved — every track in a column
   starts AND ends on the same two x positions. What still differs between rows is only what
   the model itself differs on: how many ticks (a row capped at 3 has three
   snap points, one that reaches 5 has five) and where the handle sits. */
/* 150px, up from 132: the track is the control, and at the old width it read
   as a hairline detail beside its label rather than as the thing you drag.
   `0 1 150px` rather than `none` so it compresses with the column instead of
   forcing an overflow; the ticks and thumb are absolutely positioned in
   percentages, so a narrower track stays correct. */
.lg-lever-cell {
  flex: 0 1 150px; width: 150px; min-width: 96px;
}
/* In the deck (not the rail), the track is what absorbs a column's surplus.
   The column is elastic now — 353 with a flyout open, ~461 with it shut (see
   .lg-cols) — and the rest of the row is fixed: chevron 15, title 168, two
   10px gaps. If the track stayed at 150 that surplus would land as dead space
   at the right-hand end of every row, so the tracks would stop short of their
   own column and the deck would look ragged down its right edge. Growing the
   track instead spends it on the control itself, and since every column in the
   region is the same width every track still starts and ends on the same two x
   positions — the property .lg-lever-cell's fixed width was there to protect.
   Capped at 260 so a very wide window can't turn a 5-step lever into a ruler.
   Flyout rows are excluded: they live in the rail's fixed 285px, where the
   growth would come straight out of the lever name beside the track. */
.lg-subcat-row:not(.lg-flyout-row) > .lg-lever-cell {
  flex: 1 1 150px; width: auto; max-width: 260px;
}
.lg-lever { position: relative; width: 100%; height: 28px; --lg-lever-color: var(--lvl-1); }
.lg-lever-track {
  position: absolute; left: 0; right: 0; top: 50%; height: 7px; transform: translateY(-50%);
  /* The track used to sit on a white box inside the band; with the boxes gone
     it sits on the band itself, where a #D4D4D4 track (1.27:1) was too faint
     to read as a track — #C9C9C9 on the old #EDEDED gave 1.41:1 and that is
     the legibility this control was tuned to.
     When --deck-bg went #EDEDED -> #E4E4E4 the track had to follow, or it
     would have given back exactly the contrast the band just gained: on the
     new ground #C9C9C9 measures 1.30:1, which is nearly the #D4D4D4 that was
     rejected in the first place. #C1C1C1 restores the ratio to 1.42:1. Solve
     it again the same way if the band ever moves.
     Still holds up on white in the flyout rail (1.75:1, was 1.59:1). */
  border-radius: 999px; background: #C1C1C1;
  box-shadow: inset 0 0 0 1px rgba(16,17,20,.05);
}
.lg-lever-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px;
  background: var(--lg-lever-color); width: 0%;
  transition: width .16s ease, background-color .16s ease;
}
/* The spread band: the real low-to-high extent of a bundled row's levers
   when they are NOT all on one level (paintLever draws it, updateLeverRow
   decides). This is what a single averaged handle was hiding — Buildings on
   the heroic pathway is five levers at 4 and one capped at 3, and the row
   was reporting a tidy single position for a state that has none.
   Drawn taller than the track and semi-transparent in the level's own colour
   so it reads as "anywhere in here", not as a second fill. */
.lg-lever-band {
  display: none;
  position: absolute; top: 50%; height: 14px; transform: translateY(-50%);
  border-radius: 3px;
  background: color-mix(in srgb, var(--lg-lever-color) 26%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lg-lever-color) 45%, transparent);
  pointer-events: none;
}
/* Ticks sit on the unfilled track only in effect — the fill runs over them —
   so they read as remaining stops rather than decoration. */
.lg-lever-tick {
  position: absolute; top: 50%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: rgba(16,17,20,.3); transform: translateY(-50%);
  pointer-events: none;
}
.lg-lever-thumb {
  position: absolute; top: 50%; left: 0%; width: 20px; height: 20px; margin-left: -10px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    inset 0 0 0 3px var(--lg-lever-color),
    0 1px 2px rgba(16,17,20,.22),
    0 0 0 1px rgba(16,17,20,.10);
  transform: translateY(-50%);
  transition: left .16s ease, box-shadow .16s ease;
  pointer-events: none;
}
/* Hover/drag lift the thumb with shadow depth instead of scaling it — a
   control that grows under the cursor is the other tell of a toy slider. */
.lg-lever:hover .lg-lever-thumb {
  box-shadow:
    inset 0 0 0 3px var(--lg-lever-color),
    0 2px 5px rgba(16,17,20,.26),
    0 0 0 1px rgba(16,17,20,.14);
}
.lg-lever.is-dragging .lg-lever-thumb {
  box-shadow:
    inset 0 0 0 4px var(--lg-lever-color),
    0 2px 6px rgba(16,17,20,.3),
    0 0 0 1px rgba(16,17,20,.16);
}
/* Mixed (a bundled row whose levers genuinely disagree — see
   updateLeverRow): a hollow thumb, i.e. the ring without a settled centre,
   rather than the old triple-ring halo. */
/* --surface-2, not --deck-bg or --deck-panel: both of those are white or
   near-white, so filling the thumb with either made "mixed" identical to the
   ordinary white thumb. This has needed re-pointing every time the deck
   surfaces changed — what it wants is "a tint that is clearly not white".
   Worth knowing: --surface-2 only measures 1.11:1 against the white thumb, so
   this state is subtle. It reads because the ring thins at the same time, not
   because of the fill alone. */
.lg-lever.is-mixed .lg-lever-thumb {
  background: var(--surface-2);
  box-shadow:
    inset 0 0 0 2px var(--lg-lever-color),
    0 1px 2px rgba(16,17,20,.22),
    0 0 0 1px rgba(16,17,20,.10);
}
.lg-lever-input {
  position: absolute; inset: 0; margin: 0; width: 100%; height: 100%;
  appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer;
}
/* The invisible native thumb has to match the visible one's size, or the hit
   area and the mark you are aiming at stop agreeing. */
.lg-lever-input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; opacity: 0; }
.lg-lever-input::-moz-range-thumb { width: 20px; height: 20px; opacity: 0; border: 0; }
.lg-lever-input::-moz-range-track { background: transparent; }
.lg-lever:focus-within .lg-lever-track { outline: 2px solid #7FB0DA; outline-offset: 3px; }

/* One shared floating box (dashboard.js's initLeverTooltip), positioned
   against whichever row is hovered/focused and CLAMPED INSIDE the Custom
   Pathways band — same position:fixed + measured-rect technique the Sankey's
   own tooltip uses, with the band rather than the window as the bounds.
   It describes a control, and every control is in that band; the version that
   clamped to the viewport put a tall popup at the top-left of the page, over
   the charts, next to nothing it was describing.

   280px, back down from 320: the box is now four short lines at most (name,
   state, and either an ambition note or the group's two-line explanation),
   not the per-lever LIST it used to be. The height cap is what keeps it a
   popup — a plain px value, never one derived from --ui-scale or the
   viewport, for the reason recorded above .lg-insights-col. It is a ceiling
   for a pathological note, not the normal case: the longest note in the
   workbook renders at ~150px here. */
.lever-tooltip {
  position: fixed; z-index: 70; max-width: 280px; max-height: 190px; overflow-y: auto;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(16,17,20,.2);
  padding: 10px 13px; font: var(--t-body);
  pointer-events: none;
}
.lever-tooltip[hidden] { display: none; }
/* The row's own name — the popup's title, and the only place a truncated
   label ("Growth of fl…") can be read in full. */
.lever-tip-head {
  font: var(--t-body); font-weight: 600; color: var(--ink);
  padding-bottom: 6px; margin-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
/* Where the control sits right now: "Level 3 of 4" for one lever, or the
   bundled row's own state sentence from updateLeverRow() — which is three
   different sentences, because a saturated row and a row that is genuinely
   out of step are not the same thing. Accent-tinted so the value reads apart
   from the prose under it. */
.lever-tip-state {
  font: var(--t-caption); color: var(--accent);
  background: rgba(41,105,154,.10); border-radius: 5px; padding: 3px 7px;
  display: inline-block;
}
/* The Control sheet's ambition note for that level (single levers only). */
.lever-tip-note { font: var(--t-label); color: var(--muted); margin-top: 7px; }
/* A bundled row's two lines: what the control does, then where the detail is.
   The hint is quieter than the explanation above it — it is an instruction
   about the interface, not a fact about the model. */
.lever-tip-sub { font: var(--t-label); color: var(--muted); margin-top: 7px; }
.lever-tip-hint { font: var(--t-label); color: var(--muted-2); margin-top: 4px; }

/* A multi-lever row's LABEL is a click target for its flyout too, not just the
   chevron — reaching for a 15px chevron to see what a row bundles was the only
   way in. dashboard.js adds .is-expandable to rows that have one, and binds
   the same toggle to the title. The chevron stays: it carries the aria-expanded
   state and the keyboard path, and it is what the arrow animates on.
   Only the title is clickable, deliberately not the whole row — the row also
   holds the lever, and a click there has to reach the slider. */
.lg-subcat-row.is-expandable .lg-subcat-title { cursor: pointer; }
.lg-subcat-row.is-expandable .lg-subcat-title:hover { color: var(--accent); }
.lg-subcat-row.is-expandable:hover .lg-expand-btn { color: var(--deck-ink); }

/* Holds the chevron's place on rows that have no flyout to open (single-lever
   sub-sectors), so their label — and the slider that begins where the label
   ends — starts on the same x as every expandable row's. */
.lg-expand-spacer { flex: none; width: 15px; height: 15px; }
/* Chevron: opens the individual-lever flyout for a multi-lever sub-sector row. */
.lg-expand-btn {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; padding: 0; border: 0; background: transparent;
  color: var(--deck-ink); cursor: pointer; border-radius: 4px;
}
.lg-expand-btn:hover { color: var(--deck-ink); background: rgba(16,17,20,.06); }
.lg-expand-btn svg { width: 11px; height: 11px; transition: transform .3s cubic-bezier(.16,.84,.44,1); }
.lg-expand-btn[aria-expanded="true"] { color: var(--deck-ink); }
.lg-expand-btn[aria-expanded="true"] svg { transform: rotate(90deg); }

/* The rail. dashboard.js moves this flex item's actual DOM position next to
   whichever lever column held the clicked chevron — a flex item's own width
   is independent of where it sits, unlike a grid track, which is what makes
   "open right next to the lever you clicked" possible without swapping
   widths with whatever used to be in that slot. flex-basis animates 0 ->
   260px on .is-open; overflow:hidden clips the card beneath the 0-width
   state so it reads as sliding out rather than reflowing text mid-animation.

   align-self is deliberately flex-start, NOT stretch: stretch derives the
   rail's height from the tallest sibling in the row, but the row with 8
   individual levers (Renewable Generation) is itself taller than every
   lever column — stretching to "match" would instead inflate the whole
   row (and the fixed-height page past the no-scroll budget) to match IT.
   max-height caps the rail independently so a tall sub-sector scrolls
   inside the rail instead. */
.lg-rail-col {
  flex: 0 0 0px; align-self: flex-start; overflow: hidden; min-width: 0;
  max-height: 260px;
  /* Eased out rather than linear-ish: fast off the mark, settling at the end,
     so the columns beside it look like they are making room rather than being
     shoved. */
  transition: flex-basis .34s cubic-bezier(.16,.84,.44,1);
}
/* 285, up from 260, to pay for the wider track: a flyout row is name + track
   in this width, so growing the track by 18px would otherwise come straight
   out of the lever name beside it. */
.lg-rail-col.is-open { flex-basis: 285px; }
.lg-rail {
  height: 100%; min-width: 275px; box-sizing: border-box;
  /* No card chrome, matching the group lists beside it. This is a real 5th
     column of the lever grid rather than an overlay, so with the white card
     gone it simply reads as one more column on the band. */
  background: transparent; border: 0; border-radius: 0;
  overflow-y: auto; padding: 4px 12px 6px;
}
/* One block per multi-lever sub-sector, all sharing the rail above; exactly
   one is display:block at a time (dashboard.js's initLeverFlyouts). Each
   keeps its own header/close/rows — the rail itself supplies the card
   chrome (background/border), these are now plain content blocks. */
/* display can't be transitioned, so the panel's own entrance is an animation
   rather than a transition: it fades and slides in behind the rail that is
   still widening, and its rows follow in a short stagger. That reads as the
   list arriving rather than appearing fully-formed in a box that is still
   growing. The stagger is capped at six rows — Renewable Generation has
   eight levers and a delay per row would leave the last ones visibly late. */
.lg-flyout { display: none; }
.lg-flyout.is-open { display: block; animation: flyout-in .3s cubic-bezier(.16,.84,.44,1) both; }
@keyframes flyout-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}
.lg-flyout.is-open .lg-flyout-row { animation: flyout-row-in .26s ease-out both; }
.lg-flyout.is-open .lg-flyout-row:nth-child(1) { animation-delay: .06s; }
.lg-flyout.is-open .lg-flyout-row:nth-child(2) { animation-delay: .10s; }
.lg-flyout.is-open .lg-flyout-row:nth-child(3) { animation-delay: .14s; }
.lg-flyout.is-open .lg-flyout-row:nth-child(4) { animation-delay: .18s; }
.lg-flyout.is-open .lg-flyout-row:nth-child(5) { animation-delay: .22s; }
.lg-flyout.is-open .lg-flyout-row:nth-child(n+6) { animation-delay: .26s; }
@keyframes flyout-row-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.lg-flyout-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: var(--t-body); font-weight: 600;
  color: var(--deck-ink); padding: 7px 0 6px; margin-bottom: 2px;
}
.lg-flyout-close {
  border: 0; background: transparent; font: var(--t-chart); cursor: pointer;
  color: var(--deck-ink); padding: 0 2px;
}
.lg-flyout-close:hover { color: var(--ink); }
/* Rules gone here too — the flyout no longer sits on a white panel where a
   list needed the help, it sits on the band with everything else. */
.lg-flyout-row { padding: 6px 0; gap: 10px; }
.lg-flyout-name { flex: 1; min-width: 0; font: var(--t-body); color: var(--deck-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* Anyone who has asked their OS for less motion gets the same layout with the
   movement removed — the flyout still opens, it just doesn't slide, stagger or
   swing its chevron. */
@media (prefers-reduced-motion: reduce) {
  .lg-rail-col { transition: none; }
  .lg-flyout.is-open,
  .lg-flyout.is-open .lg-flyout-row { animation: none; }
  .lg-expand-btn svg { transition: none; }
}

/* ── Site header: responsive ────────────────────────────────────────────
   Breakpoints are REAL viewport widths (media queries ignore body's zoom).
   Below 1100px the title text goes and the wordmark alone carries the name
   (it says the same thing; the link's aria-label keeps it for screen
   readers). Below 768px the nav strip collapses into the hamburger, which
   opens the existing drawer, and the marks scale down. */
.menu-btn { display: none; }
@media (max-width: 1100px) {
  .site-banner-title-text { display: none; }
}
@media (max-width: 768px) {
  .site-nav { display: none; }
  .menu-btn { display: flex; }
  .site-banner-logo { height: 44px; }
  .site-banner-title-logo { height: 40px; }
}
@media (max-width: 480px) {
  /* Three marks plus the hamburger in 375px: the side logos and the wordmark
     step down again so the row never collides. */
  /* auto | shrinkable centre | auto, instead of 1fr | auto | 1fr: the side
     marks keep their size and the wordmark scales down into what is left,
     rather than the centre column claiming its full width and pushing the
     ACPET mark over its end. */
  .site-banner-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .site-banner-logo { height: 34px; }
  .site-banner-title { gap: 0; justify-self: center; min-width: 0; max-width: 100%; }
  .site-banner-title-logo { width: 100%; height: auto; max-height: 34px; max-width: 100%; box-sizing: border-box; }
}

/* Anchor links (#dashboard, #top) glide rather than jump, and land below the
   sticky header: dashboard.js sets scroll-padding-top on <html> from the
   header's measured height. Instant for anyone who asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── Landing hero ───────────────────────────────────────────────────────
   Exactly one screen under the sticky header. 100vh is divided by
   --ui-scale for the same reason .page's min-height is: body's zoom scales
   vh along with everything else. Soft blue-to-green wash in the header's
   blue and the lever ramp's green, kept pale so the body ink holds its
   full ~17:1 contrast on it. */
.hero {
  position: relative; box-sizing: border-box;
  min-height: calc(100vh / var(--ui-scale) - var(--header-h));
  display: flex; align-items: center; justify-content: center;
  padding: 48px var(--page-x) 88px;
  background: var(--page-wash) fixed;
  overflow: hidden;
}
.hero-inner { width: 100%; max-width: 1180px; text-align: center; }
.hero-eyebrow {
  margin: 0 0 12px; font: 600 13px/1.3 var(--font-sans);
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.hero-title {
  margin: 0 auto 16px; max-width: 18em;
  font: 700 48px/1.1 var(--font-sans); letter-spacing: -.01em; color: var(--ink);
}
.hero-sub {
  margin: 0 auto 28px; max-width: 44em;
  font: 400 18px/1.55 var(--font-sans); color: #3A414B;
}
.hero-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 44px; }
.hero-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; border: 2px solid var(--accent);
  font: 600 15px/1 var(--font-sans);
  transition: background .15s, color .15s, transform .15s, box-shadow .15s;
}
/* --accent, not --header-bg, for the filled button: white on #29699A is
   6.2:1, so the button label passes AA at body size where the brighter
   header blue would not. */
.hero-btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(41,105,154,.7); }
.hero-btn-primary:hover { background: #1F5783; border-color: #1F5783; }
.hero-btn-secondary { background: rgba(255,255,255,.75); color: var(--accent); }
.hero-btn-secondary:hover { background: #fff; }
.hero-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }








.hero-scroll {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); background: rgba(255,255,255,.8); border: 1px solid var(--line);
}
.hero-scroll svg { width: 22px; height: 22px; }
.hero-scroll:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .hero-scroll svg { animation: hero-bounce 1.8s ease-in-out infinite; }
}
@keyframes hero-bounce {
  0%, 100% { transform: translateY(-3px); }
  50%      { transform: translateY(4px); }
}

@media (max-width: 1100px) {
}
@media (max-width: 600px) {
  .hero { padding-top: 32px; }
  .hero-title { font-size: 36px; }
  .hero-sub { font-size: 16px; }
}

/* ── Scroll reveal ──────────────────────────────────────────────────────
   Armed only when dashboard.js adds .reveal-armed to <html> (it skips that
   for reduced motion and for browsers without IntersectionObserver), so
   with no script every section is simply visible.
   Opacity and translate only — neither changes a box's size, so chart sizing
   (getBoundingClientRect-based) and fitUiScale's measurements are
   unaffected. The settled state is transform:none, never a transform left
   in place: that would make these sections the containing block for the
   position:fixed popups inside them. */
.reveal-armed .reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal-armed .reveal.is-visible { opacity: 1; transform: none; }

/* ── Chart panels, after the ICED "Renewable Energy Progress" chart ─────
   Every chart sits on a plate with rounded corners, which is what lifts it
   off the page. Scoped with :has(canvas) so KPI cards and text panels keep
   their own chrome. The canvas itself stays transparent, so the plate shows
   through the plot, the legend and the axis labels alike.

   The plate was a solid pale blue (#E4EFF6), chosen when the page ground was
   flat white. The ground is now the gradient wash, whose blue corner is
   almost the same colour, so the plate's edge went soft exactly where the
   wash is bluest — visible in a side-by-side at 1600x900. It is now
   TRANSLUCENT WHITE: a crisp edge against every part of the wash, more
   contrast for the palest series (Solar's yellow, the clean green), the same
   chrome as the landing page's demo card — and still translucent, so the
   wash tints through and the two screens stay one surface. The deck's lever
   boxes have worked this way all along (.lg-box, rgba white .55).

   To go back to the flat plate: set --chart-plate to #E4EFF6 and drop the
   border and box-shadow. */
.panel:has(canvas), .card:has(canvas) {
  background: var(--chart-plate);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px -20px rgba(16, 17, 20, .45);
  border-radius: 14px;
  padding: 14px 18px 12px;
}
:root { --chart-plate: rgba(255, 255, 255, .72); }

/* ── Compact layout: windows narrower than 1024px ───────────────────────
   From 1024px up the calculator is the app shell (see APP SHELL below).
   Below that, zooming cannot help: the desktop deck
   needs ~1500 layout px, so on a tablet or phone the old behaviour was to
   pin --ui-scale at its 0.7 floor and still scroll sideways, with tiny text
   and colliding lever columns. dashboard.js now holds --ui-scale at 1 below
   1024px (COMPACT_MAX_WIDTH, keep the two in step) and this block reflows
   the page instead, so media-query widths here are real CSS px. */
@media (max-width: 1023px) {
  :root { --page-x: 16px; }

  /* Tabs: groups wrap onto new lines; the pathway chooser takes its own. */
  .tab-row { align-items: flex-start; }
  .pill-tabs { width: 100%; row-gap: 10px; }
  /* A group wider than the row (Impacts, six tabs) wraps inside its own pill
     rather than pushing past the window edge. */
  .pill-group { min-width: 0; max-width: 100%; }
  .pill-group-tabs { flex-wrap: wrap; }
  .pathway-chip { margin-left: 0; }

  /* Lever deck: the columns wrap instead of sharing one fixed-width row,
     two up on a tablet and one on a phone, and Insights drops below them at
     full width. The navy rules between columns only make sense side by side,
     so they go. */
  .lever-grid { flex-wrap: wrap; gap: 24px; }
  .lg-cols { flex: 1 1 100%; flex-wrap: wrap; gap: 20px 32px; }
  .lg-col { flex: 1 1 320px; }
  .lg-col + .lg-col:not(.lg-rail-col)::before,
  .lg-insights-col::before { display: none; }
  .lg-insights-col { flex: 1 1 100%; max-width: none; padding-left: 0; }
  /* Insights takes its natural height here. The flex-basis-0 rules on
     .rail-insights(-body) exist to keep its content out of fitUiScale's
     measurement; there is no fit in compact mode, and on its own row a zero
     basis collapses the panel and lets its text spill over the footer. */
  .rail-insights, .rail-insights-body { flex: none; max-height: none; }
  /* An open flyout gets a full row of its own rather than squeezing in
     beside a column. */
  .lg-rail-col.is-open { flex-basis: 100%; max-height: none; }
  .lg-rail { min-width: 0; }
  /* Lever names may give way a little before the track does. */
  .lg-subcat-title { flex: 0 1 168px; }

  /* Charts are single-column here already (the 1080px rules above); keep the
     multi-chart grids in step. */
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  /* Phones: the tab groups become one horizontally scrolling strip, the
     standard pattern for a tab bar wider than the screen. The strip scrolls;
     the page never does. */
  .pill-tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px;
  }
  .pill-tabs::-webkit-scrollbar { display: none; }
  .pill-group { flex: none; max-width: none; }
  .pill-group-tabs { flex-wrap: nowrap; }

  /* KPI cards one per row. */
  .stat-row { grid-template-columns: minmax(0, 1fr); }
  .stat-card-min .stat-note { white-space: normal; }

  .lg-col { flex-basis: 100%; }
  .panel:has(canvas), .card:has(canvas) { padding: 12px 10px 10px; }
  .site-footer { line-height: 1.6; }

  /* Energy Flows year picker: six buttons share the strip's width instead of
     running 4px past a 375px screen. */
  .flows-strip-main { min-width: 0; max-width: 100%; }
  .year-tabs { flex-wrap: wrap; max-width: 100%; }
  .year-btn { flex: 1 1 auto; padding: 7px 8px; }
}

@media (max-width: 1023px) {
  /* Compact layout: a lever row is name + slider, and in a wrapped column
     there is no room for both side by side without cutting the name off, so
     the slider drops under its name and takes the full width. Flyout rows
     follow the same rule. */
  .lg-subcat-row { flex-wrap: wrap; row-gap: 2px; }
  .lg-subcat-title { flex: 1 1 calc(100% - 40px); }
  .lg-subcat-row > .lg-lever-cell,
  .lg-subcat-row:not(.lg-flyout-row) > .lg-lever-cell { flex: 1 1 100%; max-width: none; width: auto; }
}


/* ════════════════════════════════════════════════════════════════════════
   REDESIGN LAYER
   Everything below restyles; nothing changes what is computed or where the
   controls live. Kept as one block at the end so it reads as one system and
   can be backed out as one unit.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Tokens for the redesign layer ───────────────────────────────────────
   One theme. Colours are the interface's existing ones: --accent for the
   interface blue, the --lvl-* effort ramp for levers, the deck greys, and
   the series palette in dashboard.js for the charts. */
:root {
  --font-display: "Manrope", "Roboto", "Helvetica Neue", Arial, system-ui, sans-serif;
  --surface-card: #FFFFFF;
  --flash: #FFF4C2;
}

/* ── Typography ─────────────────────────────────────────────────────────
   Manrope for headings and figures, Roboto for running text. Every figure
   is tabular so values that change while you watch do not jitter. */
.panel h2, .card h3, .cr-title, .hero-title, .hero-about-head, .site-banner-title-text,
.lg-box-title, .rail-insights-head, .gauge-number, .stat-value {
  font-family: var(--font-display);
}
.panel h2, .card h3 { font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.cr-title { font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.stat-value, .gauge-number, .kpi-delta, .gauge-trend, .gauge-mark, .insights-line strong {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}




/* ── KPI cards ──────────────────────────────────────────────────────────
   One tint and one ink per card; the ink drives the icon, the sparkline
   (currentColor) and the chip, so each card is one colour story. The
   figure itself stays in body ink for contrast. */
.kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-card { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; padding: 11px 16px 11px; }
.kpi-head { display: flex; align-items: center; gap: 8px; }
.kpi-icon { width: 16px; height: 16px; flex: none; color: var(--muted); display: flex; }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-width: 0; }
.kpi-figure { min-width: 0; }
.kpi-card .stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 1px; white-space: nowrap; }
.kpi-spark { flex: 0 1 120px; width: 120px; height: 40px; color: var(--accent); min-width: 60px; }
.kpi-foot { display: flex; }
.kpi-delta {
  font: 500 12px/1 var(--font-sans); color: var(--muted);
  background: var(--surface-2); padding: 5px 9px; border-radius: 6px; white-space: nowrap;
}
.kpi-delta:empty { display: none; }
@media (max-width: 1023px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row .kpi-demand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: minmax(0, 1fr); }
}

/* ── GHG gauge: a thermometer ───────────────────────────────────────────
   Bulb + tube in the gauge's own navy and amber, reference ticks labelled
   on the tube, and the reading large on the right with a trend arrow. */
.gauge {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: 8px 22px;
}
.gauge-title { display: flex; flex-direction: column; gap: 3px; }
.gauge-scale { font: var(--t-caption); color: color-mix(in srgb, var(--gauge-ink) 70%, transparent); }
.gauge-thermo { display: flex; align-items: center; min-width: 0; padding-top: 18px; }
.gauge-bulb {
  width: 22px; height: 22px; border-radius: 50%; flex: none; margin-right: -6px; z-index: 1;
  background: var(--gauge-meter);
  box-shadow: 0 0 0 3px var(--gauge-box);
}
/* ── The tube, as an instrument ─────────────────────────────────────────
   Recessed rather than flat: an inner shadow at the top edge and a hairline
   at the bottom read as a channel cut into the box, which is what makes a
   meter look like a meter rather than a progress bar. The unlabelled
   gradations are one per gigatonne, drawn as a repeating gradient on the
   track itself — they make the scale legible without putting a single
   number on the bar, which is the whole point: the caption already says
   0-10 GtCO2e, and nothing here asserts a target. */
.gauge-tube {
  flex: 1 1 auto; height: 16px; border-radius: 999px; position: relative;
  background:
    repeating-linear-gradient(90deg,
      transparent 0 calc(10% - 1px), rgba(255,255,255,.14) calc(10% - 1px) 10%),
    var(--gauge-track);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,255,255,.07);
}
/* The mercury runs hotter toward its head, so the end of the fill is the
   brightest thing on the bar and the eye goes to the reading. */
.gauge-mercury {
  border-radius: 999px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--gauge-meter) 78%, #B9792A) 0%,
    var(--gauge-meter) 72%,
    color-mix(in srgb, var(--gauge-meter) 72%, #fff) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
/* The head: its own colour, not the meter's. A meter's needle is the thing
   you read, so it stops being part of the bar — a white core in a deep amber
   ring, lifted off the tube by a ring of the box colour and a soft halo.
   NOTE the tube deliberately has no `overflow: hidden`: the pin is a CHILD
   of the tube and stands 20px tall in a 16px channel, so clipping the tube
   would behead it. The mercury is kept inside by its own border-radius. */
.gauge-pin {
  position: absolute; top: 50%; width: 20px; height: 20px; margin-left: -10px;
  transform: translateY(-50%); border-radius: 50%; z-index: 2;
  background: #fff;
  box-shadow:
    inset 0 0 0 5px var(--gauge-head),
    0 0 0 2px var(--gauge-box),
    0 0 10px 1px color-mix(in srgb, var(--gauge-head) 55%, transparent),
    0 1px 4px rgba(0,0,0,.45);
  transition: left .45s cubic-bezier(.16,.84,.44,1);
}
:root { --gauge-head: #E8873C; }
.gauge-marks { position: absolute; inset: 0; pointer-events: none; }
/* -3px, not the -5px the bare ticks had: the pennant's own point is what
   marks the spot now, so the stem only has to bridge the gap, and every
   pixel it overshoots by is a pixel the charts give up. */
.gauge-mark {
  position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px;
  background: var(--gauge-ink); opacity: .9; border-radius: 1px;
}
/* The reference labels are PENNANTS, not floating text — after the UK
   calculator's CO2e meter, where each flag is a filled chip with a point
   touching the tube at the value it marks. A chip you cannot mistake for an
   axis label, and a point that says "this exact spot", which a centred
   caption three pixels above the tick did not.
   The tip is cut out of the chip with clip-path rather than drawn as a
   second rotated box: one element, so it cannot drift out of register with
   its own background. */
.gauge-mark::after {
  content: attr(data-label); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); white-space: nowrap;
  font: 700 9.5px/1 var(--font-sans); color: #0F1A28;
  background: var(--gauge-ink); padding: 3px 7px 8px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 5px), calc(50% + 4px) calc(100% - 5px),
                     50% 100%, calc(50% - 4px) calc(100% - 5px), 0 calc(100% - 5px));
}
/* Flipped below the tube: dashboard.js alternates the marks so two close
   together cannot collide, so the point has to flip with them. */
.gauge-mark.is-below::after {
  bottom: auto; top: 100%; padding: 8px 7px 3px;
  clip-path: polygon(0 5px, calc(50% - 4px) 5px, 50% 0, calc(50% + 4px) 5px,
                     100% 5px, 100% 100%, 0 100%);
}
/* Two kinds, two colours: where India measurably WAS, against where it is
   aiming. Both are tested on --gauge-box (#0F1A28), and both carry dark ink
   rather than light, because a pale chip on a near-black box is the legible
   direction. */
.gauge-mark[data-kind="target"] { background: var(--gauge-flag-target); }
.gauge-mark[data-kind="target"]::after { background: var(--gauge-flag-target); }
:root { --gauge-flag-target: #4FC08A; }
/* Placeholder references are dashed in the stem, and starred in their label. */
.gauge-mark.is-placeholder {
  background: repeating-linear-gradient(180deg, var(--gauge-ink) 0 3px, transparent 3px 5px);
}
.gauge-mark.is-placeholder[data-kind="target"] {
  background: repeating-linear-gradient(180deg, var(--gauge-flag-target) 0 3px, transparent 3px 5px);
}
.gauge-reading { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
/* The "what am I looking at" button, as the UK meter carries. Deliberately
   the quietest thing in the band until it is hovered. */
.gauge-info {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--gauge-ink) 55%, transparent);
  background: none; color: var(--gauge-ink); cursor: help;
  font: 700 11px/1 var(--font-display); font-style: italic;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.gauge-info:hover { background: var(--gauge-ink); color: var(--gauge-box); border-color: var(--gauge-ink); }
.gauge-info:focus-visible { outline: 2px solid var(--gauge-ink); outline-offset: 2px; }
.gauge-number { font-size: 26px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.gauge-trend { font: 600 12px/1 var(--font-sans); padding: 5px 9px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--gauge-ink); }
@media (max-width: 760px) {
  .gauge { grid-template-columns: minmax(0, 1fr) auto; }
  .gauge-thermo { grid-column: 1 / -1; grid-row: 2; }
}

/* ── Levers: one card per group ───────────────────────────────────────────
   The navy rules between columns go; each group sits in its own light card
   on the deck band. Track colours are still the effort ramp (paintLever). */
.lg-col + .lg-col:not(.lg-rail-col)::before, .lg-insights-col::before { display: none; }
.lever-grid { gap: 18px; }
.lg-cols { gap: 16px; }
.lg-col { gap: 14px; justify-content: flex-start; }
.lg-box {
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--deck-line);
  border-radius: 10px; padding: 10px 14px 6px;
}
.lg-box-title { font-weight: 700; font-size: 14px; }

/* Bottom padding carries the numbered stops, which now clear the thumb (see
   .lg-lever-tick::after) and so sit 4px lower than they used to. */
.lg-subcat-row { padding: 3px 0 16px; }
/* Stays a block (not flex) so a long name still ends in an ellipsis; the
   icon rides inline at the start of the text. */
.lg-subcat-title { flex-basis: 190px; }
.lg-subcat-icon { display: inline-block; width: 15px; height: 15px; margin-right: 7px; vertical-align: -3px; color: var(--deck-muted); }
/* Numbered stops under the track: 1..max, from the ticks already rendered
   for each snap position (a CSS counter, no markup). */
.lg-lever-track { counter-reset: stop; }
.lg-lever-tick { counter-increment: stop; }
/* 14px, not 10px: the thumb is 20px tall and centred on the track, so it
   reaches 10px below the centre — and 11.2px while hovered, where it scales
   to 1.12. At 10px the digit's top two pixels sat under the thumb, and since
   the thumb is an opaque white disc 20px wide against a ~5px digit, the
   number at the CURRENT level looked like it was missing rather than
   covered. The tick box is 4px tall and centred, so this offset is measured
   from 2px above the track's centre line: 14px puts the digit's top at
   centre + 12, clear of the hovered thumb by just under a pixel.
   Anything that changes the thumb's size or hover scale has to move this. */
.lg-lever-tick::after {
  content: counter(stop); position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  font: 500 9.5px/1 var(--font-sans); color: var(--deck-muted);
}
.lg-lever-thumb { transition: left .16s ease, box-shadow .16s ease, transform .16s ease; }
.lg-lever:hover .lg-lever-thumb, .lg-lever.is-dragging .lg-lever-thumb { transform: translateY(-50%) scale(1.12); }

/* ── Insights: a callout card ───────────────────────────────────────────── */
/* Narrower than the old 620px rail: Insights is a callout now, and the lever
   cards beside it get the width for their tracks. */
.lg-insights-col { padding-left: 0; flex: 0 1 400px; }
.rail-insights {
  background: var(--surface-card); border-radius: 14px;
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  padding: 12px 16px 12px;
  box-shadow: 0 2px 10px -6px rgba(16,17,20,.25);
}
.rail-insights-head { font-weight: 700; font-size: 15px; }
.insights-line strong {
  font-family: var(--font-display); font-weight: 800; font-size: 1.14em; color: var(--ink);
}
@keyframes insight-flash {
  0%   { background: var(--flash); }
  100% { background: transparent; }
}
.insights-line.is-flash { animation: insight-flash 1.6s ease-out 1; border-radius: 6px; }

/* ── Motion off ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gauge-pin, .gauge-mercury, .lg-lever-thumb { transition: none !important; }
  .insights-line.is-flash { animation: none; }
}

/* Placed after the redesign layer, which would otherwise win on order. */
@media (max-width: 1023px) {
  .lg-insights-col { flex: 1 1 100%; }
  .lg-subcat-title { flex: 1 1 calc(100% - 40px); }
}
/* Gauge reference labels alternate above and below the tube (dashboard.js
   marks every second one by value), so two close references never print on
   top of each other on a narrow tube. */
/* With the reference flags off (SHOW_GAUGE_REFS in dashboard.js) nothing
   hangs above or below the tube but the pin and its halo, so this is 10px
   rather than the 24px the pennants needed. IF THE FLAGS COME BACK, this
   and the app-shell override below have to go back to 24px / 17px or the
   chips will be clipped by the navy box.
   (A second `.is-below::after` rule lived here and only re-stated the flip
   the pennant rule already does; it would have overridden that rule's own
   offset, so it is gone.) */
.gauge-thermo { padding-top: 10px; padding-bottom: 10px; }


/* ── Short laptop screens ───────────────────────────────────────────────
   On a 1366x768 laptop the browser leaves ~650px of height, and the
   calculator cannot fit that even at UI_SCALE_MIN, so the page scrolls.
   Two things keep it usable when it does:

   1. The tab row (tabs + Pathway chooser) sticks under the site header, so
      the reader never loses the navigation while scrolling through charts.
      It is sticky within .page-main, so it lets go when Custom Pathways
      comes up. top is --header-h, which dashboard.js keeps equal to the
      header's real height in layout px.
   2. Below 860px of height the header itself slims down, which hands that
      height straight back to the charts. */
/* Frosted rather than solid white: it sits on the page wash now, and an
   opaque strip would read as a seam across the gradient. In the shell
   nothing scrolls under it, so there it can simply be transparent. */
.tab-row {
  position: sticky; top: var(--header-h); z-index: 40;
  background: rgba(255,255,255,.80);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding-top: 6px;
}
html.app-shell .tab-row { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-height: 860px) {
  .site-banner { padding: 2px 0; }
  .site-banner-logo { height: 46px; }
  .site-banner-title-logo { height: 40px; }
  .site-banner-title-text { font-size: 21px; }
  .site-nav-row { min-height: 32px; }
  .site-nav-link { padding: 5px 12px; font-size: 14px; }
}


/* ════════════════════════════════════════════════════════════════════════
   APP SHELL (desktop, 1024px and up)
   The dashboard behaves like a desktop web app rather than a document: it
   fills the window exactly and the page itself does not scroll. Everything
   below is scoped to html.app-shell, which dashboard.js (and the inline
   script in base.py, for first paint) sets whenever the window is wider than
   COMPACT_MAX_WIDTH. Below that the stacked compact layout applies instead.

   Scaling is ONE number, --ui-scale, applied as `zoom` on <body>: the
   stylesheet is authored in px against a 1600x900 reference and the whole
   interface — type, padding, gaps, icons, canvases — scales together with
   the window (fitUiScale: min(width/1600, height/900), floor 0.8). So the
   arrangement is identical on a 1366 laptop, a 1920 monitor and a 2560
   monitor; only its size changes. Below what the 0.8 floor can fit
   (--app-min-w x --app-min-h of layout space) the page scrolls instead of
   squeezing further — the "scale down, then scroll" behaviour.

   Inside the shell, rows are fixed: header / tabs / [KPI row] / charts (the
   only row that flexes) / GHG gauge / Custom Pathways / footer. Every flex
   or grid child on the way down to a chart has min-height: 0, so charts can
   shrink into whatever the row has instead of pushing the page longer.
   ════════════════════════════════════════════════════════════════════════ */
:root {
  --app-min-w: 1260px;   /* keep in step with APP_MIN_W in dashboard.js */
  --app-min-h: 700px;    /* keep in step with APP_MIN_H */
}
html.app-shell { height: 100%; overflow: hidden; }
html.app-shell.app-overflow { overflow: auto; }
html.app-shell body {
  height: calc(100vh / var(--ui-scale));
  height: calc(100dvh / var(--ui-scale));
  min-width: var(--app-min-w); min-height: var(--app-min-h);
  display: flex; flex-direction: column; overflow: hidden;
}
html.app-shell .site-header { position: relative; flex: none; }

/* The header is always the slim version inside the shell: it is the same
   share of the window on every screen. */
html.app-shell .site-banner { padding: 2px 0; }
html.app-shell .site-banner-logo { height: 46px; }
html.app-shell .site-banner-title-logo { height: 40px; }
html.app-shell .site-banner-title-text { font-size: 21px; }
html.app-shell .site-nav-row { min-height: 32px; }
html.app-shell .site-nav-link { padding: 5px 12px; font-size: 14px; }

/* ── Main column: fills everything between header and window bottom ──── */
html.app-shell .page {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
  padding-top: 8px;
}
/* Basis 0: the charts area is what is LEFT after the deck takes its natural
   height, so it never competes with the deck for space it does not need. */
html.app-shell .page-grid { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; align-items: stretch; }
html.app-shell .page-main { flex: 1 1 auto; min-height: 0; }
html.app-shell .tab-row { position: static; flex: none; padding-top: 0; margin-bottom: 6px; padding-bottom: 5px; flex-wrap: nowrap; gap: 12px; }
/* Tabs and the Pathway chooser on ONE line at the reference width. The tab
   strip is the part that gives way (it scrolls sideways within itself) when
   the layout is narrow — e.g. a 1366 laptop at 125% browser zoom — so the
   Pathway chooser is never pushed off the right edge. */
html.app-shell .pill-tabs {
  /* `0 1 auto`, not the base rule's `none`: the strip has to be allowed to
     shrink before it will scroll inside itself. */
  flex: 0 1 auto;
  flex-wrap: nowrap; min-width: 0; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
html.app-shell .pill-tabs::-webkit-scrollbar { display: none; }
html.app-shell .pill-group { padding: 0 9px; }
html.app-shell .pill-tab { padding: 5px 9px; font-size: 13px; }
html.app-shell .pathway-chip { flex: none; }
html.app-shell .page { padding-top: 6px; }
html.app-shell .panel, html.app-shell .card { padding-top: 7px; padding-bottom: 6px; }
html.app-shell .main-col { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
html.app-shell #error { flex: none; }
html.app-shell .view.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
html.app-shell .subtabs { flex: none; }
html.app-shell .subview.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
html.app-shell .kpi-row { flex: none; margin-bottom: 8px; }
/* Two lines per card in the shell — label + chip, then figure + sparkline —
   so the KPI row costs the charts as little height as possible. */
html.app-shell .kpi-card {
  padding: 7px 14px 7px; gap: 2px 12px;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
  grid-template-areas: "head foot" "body body";
}
html.app-shell .kpi-head { grid-area: head; }
html.app-shell .kpi-foot { grid-area: foot; align-self: center; }
html.app-shell .kpi-body { grid-area: body; align-items: center; }
html.app-shell .kpi-card .stat-value { font-size: 23px; margin: 0; }
html.app-shell .kpi-card .stat-note { display: none; }
html.app-shell .kpi-figure { display: flex; align-items: baseline; gap: 8px; }
html.app-shell .kpi-spark { height: 28px; }

/* Chart containers: one row each, filling it. */
html.app-shell .chart-duo,
html.app-shell .chart-grid {
  flex: 1 1 auto; min-height: 0; margin-bottom: 0;
  grid-template-rows: minmax(0, 1fr);
}
html.app-shell .chart-duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
html.app-shell .chart-duo:has(.chart-duo-supply-wide) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.32fr); }
html.app-shell .chart-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
html.app-shell .panel,
html.app-shell .card { display: flex; flex-direction: column; min-height: 0; min-width: 0; margin-bottom: 0; }
html.app-shell .panel-head,
html.app-shell .card h3,
html.app-shell .card .card-sub { flex: none; }
/* No fixed pixel heights: the wrapper takes the row's remaining height and
   the canvas is pinned inside it, so the canvas can never feed its own size
   back into the wrapper. dashboard.js sizes the chart from the wrapper with
   a ResizeObserver. */
html.app-shell .chart-wrap,
html.app-shell .chart-wrap-duo,
html.app-shell .chart-wrap-duo-lg,
html.app-shell .chart-wrap-lg {
  position: relative; flex: 1 1 0; height: auto; min-height: 120px;
}
html.app-shell .chart-wrap > canvas,
html.app-shell .chart-wrap-duo > canvas,
html.app-shell .chart-wrap-duo-lg > canvas,
html.app-shell .chart-wrap-lg > canvas { position: absolute; left: 0; top: 0; }

/* Energy Flows: the Sankey fills the row too. */
html.app-shell .flows-view.active { display: flex; flex-direction: column; }
html.app-shell .flows-strip { flex: none; }
html.app-shell .sankey-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
html.app-shell #sankeySvg { flex: 1 1 0; height: 0; min-height: 200px; }

/* ── Custom Pathways: its natural height, capped, scrolling inside ─────────
   At the 1600x900 reference every lever row fits without scrolling. On a
   window short enough that the deck would take more than that,
   it is capped at 45% (what the deck needs at the reference size) and the
   lever columns scroll inside instead, so the charts keep the larger share
   of a short laptop window. */
html.app-shell .control-deck-h {
  flex: 0 1 auto; max-height: 45%; min-height: 0; overflow: hidden;
  margin-top: 10px; padding-top: 10px; padding-bottom: 10px;
}
html.app-shell .cdh-emissions { flex: none; margin-bottom: 8px; }
html.app-shell .cdh-head { flex: none; margin-bottom: 6px; }
html.app-shell .lever-grid { flex: 1 1 auto; min-height: 0; align-items: stretch; }
html.app-shell .lg-cols { min-height: 0; align-items: stretch; }
html.app-shell .lg-col { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
html.app-shell .lg-subcat-title { flex-shrink: 1; }
/* Insights takes whatever width the levers leave, so a wide screen has no
   empty strip at the right of the deck. */
html.app-shell .lg-insights-col { flex: 1 1 380px; min-height: 0; max-width: none; }
html.app-shell .rail-insights { flex: 1 1 0; min-height: 0; }
html.app-shell .rail-insights-body { flex: 1 1 0; min-height: 0; max-height: none; overflow-y: auto; }
/* The slider track stays readable however wide its card gets. */
html.app-shell .lg-subcat-row:not(.lg-flyout-row) > .lg-lever-cell { max-width: 260px; }
html.app-shell .site-footer { flex: none; margin-top: 0; }

/* Thin styled scrollbars on the panels that scroll internally. */
html.app-shell .lg-col,
html.app-shell .rail-insights-body,
html.app-shell .lg-rail {
  scrollbar-width: thin; scrollbar-color: rgba(16,17,20,.25) transparent;
}
html.app-shell .lg-col::-webkit-scrollbar,
html.app-shell .rail-insights-body::-webkit-scrollbar,
html.app-shell .lg-rail::-webkit-scrollbar { width: 6px; }
html.app-shell .lg-col::-webkit-scrollbar-thumb,
html.app-shell .rail-insights-body::-webkit-scrollbar-thumb,
html.app-shell .lg-rail::-webkit-scrollbar-thumb { background: rgba(16,17,20,.22); border-radius: 3px; }

/* ── Landing screen ─────────────────────────────────────────────────────
   The hero is its own screen over the app (below the header), not a section
   above it, so the app never needs a page scroll. "Explore the Calculator"
   and the Dashboard links dismiss it; Home brings it back. The app is laid
   out and charted underneath the whole time, so it appears fully drawn. */
html.app-shell .hero {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--header-h);
  min-height: 0; z-index: 45;
  /* The landing screen FITS; it does not scroll. The demo card is a flex
     column whose chart row absorbs the slack (see below), so the content is
     sized to the window rather than clipped by it. overflow stays hidden as
     the backstop — if some future addition did overrun, clipping is the
     signal to fix it, where a scrollbar would quietly hide it. */
  overflow: hidden;
  padding-top: 20px; padding-bottom: 20px;
  transition: opacity .34s ease, visibility .34s,
              transform .44s cubic-bezier(.22,.8,.26,1), filter .34s ease;
}
/* Leaving: the landing screen lifts and dissolves toward the viewer while
   the calculator rises into its place (see the main#dashboard rule). */
html.app-shell:not(.show-landing) .hero {
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: scale(1.045) translateY(-14px); filter: blur(7px);
}
/* Below the app's minimum nothing can be made to fit, so there the landing
   screen scrolls internally rather than clipping. It stays fixed: taking it
   out of flow is what keeps the calculator from leaving an empty screen's
   worth of space under it. */
html.app-shell.app-overflow .hero { overflow-y: auto; }

/* The calculator underneath: it is laid out and charted the whole time, so
   this only moves it — translate and opacity, never scale, because a scaled
   canvas resamples and every chart would go soft mid-animation. */
html.app-shell main.page {
  transition: opacity .34s ease, transform .44s cubic-bezier(.22,.8,.26,1);
}
html.app-shell.show-landing main.page {
  opacity: 0; transform: translateY(18px);
}
@media (prefers-reduced-motion: reduce) {
  html.app-shell .hero, html.app-shell main.page { transition: none; }
  html.app-shell:not(.show-landing) .hero { transform: none; filter: none; }
  html.app-shell.show-landing main.page { transform: none; }
}

/* Compact gauge inside the shell. */
html.app-shell .gauge { padding-top: 4px; padding-bottom: 4px; }
/* Tighter than the document layout, because in the shell this band is
   competing with the charts for a fixed window. 8px clears the pin (20px
   tall in a 16px channel, so 2px proud of each edge) and its halo. See the
   base rule: restoring the reference flags means restoring 17px here. */
html.app-shell .gauge-thermo { padding-top: 8px; padding-bottom: 8px; }
html.app-shell .gauge-number { font-size: 22px; }
html.app-shell .gauge-mark::after { font-size: 9.5px; }
html.app-shell .lg-subcat-row { padding: 2px 0 14px; }
html.app-shell .lg-box { padding-top: 8px; padding-bottom: 4px; }
html.app-shell .lg-col { gap: 10px; }

/* "Coming soon" tabs: the note fills the charts row rather than sitting at
   the top of an empty half-screen. */
html.app-shell .coming-soon-note {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
/* The Insights body scrolls internally; fade its bottom edge so a clipped
   line reads as "more below" rather than as a cut-off sentence. */
html.app-shell .rail-insights-body {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent 100%);
}


/* ════════════════════════════════════════════════════════════════════════
   LANDING: pitch left, working demo right
   One row on desktop (40/60), stacked below 900px. The demo card borrows the
   dashboard's own lever markup and palette, so a visitor who moves a slider
   here meets the same control on the next screen.
   ════════════════════════════════════════════════════════════════════════ */
.hero-inner {
  display: grid; grid-template-columns: minmax(0, 40fr) minmax(0, 60fr);
  gap: clamp(24px, 3vw, 52px); align-items: center;
  max-width: 1500px; text-align: left;
}
.hero-pitch { min-width: 0; }
.hero-title { margin: 0 0 14px; max-width: 14em; font-size: clamp(32px, 3.4vw, 46px); }
.hero-sub { margin: 0 0 10px; max-width: 30em; font-size: clamp(16px, 1.15vw, 19px); }
.hero-audience { margin: 0 0 22px; font: 500 14px/1.5 var(--font-sans); color: var(--muted); }
.hero-ctas { margin-bottom: 0; }

/* About this tool: a plain heading and body text, always visible. It was a
   <details> and before that four What/Why/How/Who cards; neither earned the
   click or the space. No collapsed-state rule is needed any more, which also
   retires the overlap the hidden grid used to cause at tablet widths. */
.hero-about { margin-top: 22px; max-width: 46em; }
.hero-about-head {
  margin: 0 0 8px; font: 700 16px/1.25 var(--font-display); color: var(--ink);
}
.hero-about-body { margin: 0 0 10px; font: 400 15px/1.6 var(--font-sans); color: #3A414B; }
.hero-about-body:last-child { margin-bottom: 0; }

/* ── The demo card ────────────────────────────────────────────────────── */
.demo-card {
  background: var(--surface-card); border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(14px, 1.3vw, 20px) clamp(16px, 1.5vw, 24px);
  box-shadow: 0 18px 44px -28px rgba(16, 17, 20, .45);
  display: grid; gap: clamp(8px, .9vw, 14px); min-width: 0;
}
.demo-card[aria-busy="true"] .demo-outcome,
.demo-card[aria-busy="true"] .demo-punch { visibility: hidden; }
.demo-card.is-unavailable { display: none; }
.demo-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.demo-card-title { margin: 0; font: 700 17px/1.2 var(--font-display); color: var(--ink); }
.demo-card-sub { margin: 0; font: 400 12px/1.4 var(--font-sans); color: var(--muted); }

.demo-levers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.demo-lever { min-width: 0; }







/* Taller than v1: the ghost outline and the gap under it are the card's
   main picture, so they get the room. */
.demo-chart-wrap { position: relative; height: clamp(170px, 21vh, 250px); }
.demo-chart-wrap canvas { position: absolute; inset: 0; }




.demo-stat-label { font: var(--t-caption); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }



.demo-story {
  margin: 0; font: 400 13px/1.55 var(--font-sans); color: #3A414B;
  background: var(--surface-2); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 8px 12px;
}





.demo-target-measure { font: 400 9.5px/1 var(--font-sans); color: var(--muted); font-style: normal; }



.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;
}

@media (max-width: 1100px) {
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .hero-title { max-width: none; }
}
@media (max-width: 620px) {
  .demo-levers { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
}

/* ── Making the landing screen FIT ──────────────────────────────────────
   Measured before this was written: the hero's own scroller was running
   over by 6-55px at nearly every desktop size (41px at 1366x657, 55px at
   2560x1440), because the demo card's height was the sum of nine fixed
   rows and the chart's clamp() answered to the viewport, not to what was
   left of the card.

   The fix is the same discipline the app shell already uses: the card is a
   flex COLUMN capped at the height available, and exactly one row — the
   chart — is allowed to shrink. Every other child keeps its automatic
   min-height, so text can never be squashed; the chart gives up its height
   first and stops at 96px. Nothing measures anything, so there is no
   feedback loop with fitUiScale. */
html.app-shell .hero-inner { align-items: center; height: 100%; }
html.app-shell .hero-pitch { max-height: 100%; overflow-y: auto; }
html.app-shell .demo-card {
  display: flex; flex-direction: column;
  max-height: 100%; min-height: 0;
  /* A touch tighter than the document version: this card now has to share
     one screen with the header and its own chart. */
  padding: clamp(12px, 1.1vw, 17px) clamp(14px, 1.3vw, 20px);
  gap: clamp(6px, .62vw, 10px);
}
html.app-shell .demo-chart-wrap {
  flex: 0 1 auto; min-height: 96px;
  height: clamp(150px, 19vh, 230px);
}
/* The caption reserves a line even when empty; inside the shell that line
   is 12px of a screen that has none to spare, so it only takes space while
   it is saying something. */
html.app-shell .demo-caption { min-height: 0; }
html.app-shell .demo-card:not(.has-caption) .demo-caption { display: none; }
/* Below the app's minimum the cap has to come off: the hero scrolls there,
   and a card capped at a height smaller than its own content pushes that
   content out past its white box instead of growing. Measured at 1100x520,
   where the chart, legend and keys were all sitting below the card's edge. */
html.app-shell.app-overflow .demo-card { max-height: none; }
html.app-shell.app-overflow .demo-chart-wrap { flex: none; }

/* ── Demo card, v2: a demo rather than a small dashboard ─────────────────
   Segmented step buttons instead of sliders, one big outcome instead of
   three equal stats, a generated punchline, and the targets folded away. */
.demo-card { gap: clamp(7px, .75vw, 12px); }

/* ── The demo's own masthead ──────────────────────────────────────────── */
.demo-head { display: flex; flex-direction: column; gap: 4px; }
.demo-badge {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  margin: 0; padding: 3px 9px 3px 7px; border-radius: 999px;
  background: #E7F3EC; color: #1F6B3A;
  font: 700 10px/1 var(--font-sans); letter-spacing: .09em; text-transform: uppercase;
}
.demo-badge-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
  animation: demo-live 2s ease-in-out infinite;
}
@keyframes demo-live { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.demo-title { margin: 0; font: 800 clamp(17px, 1.4vw, 21px)/1.2 var(--font-display); color: var(--ink); letter-spacing: -.01em; }
.demo-lede { margin: 0; font: 400 14px/1.55 var(--font-sans); color: #3A414B; max-width: 62ch; }
/* Cause and effect in three beats, so the controls below have a stated job. */
.demo-steps {
  list-style: none; margin: 4px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.demo-step {
  display: flex; align-items: center; gap: 6px;
  font: 500 11.5px/1.2 var(--font-sans); color: #3A414B;
}
.demo-step-n {
  width: 17px; height: 17px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font: 700 10px/1 var(--font-sans);
}
.demo-step + .demo-step::before {
  content: "→"; color: var(--muted-2); margin-right: 2px;
}

/* Caption: the intro's narration, then "Your turn". Holds its line so the
   card does not jump when it appears and clears. */
.demo-caption {
  margin: 0; min-height: 1.25em;
  font: 600 12.5px/1.25 var(--font-sans); color: var(--accent);
  opacity: 0; transition: opacity .25s ease;
}
.demo-card.has-caption .demo-caption { opacity: 1; }
.demo-caption.is-hint { color: var(--ink); }

/* ── Step buttons ─────────────────────────────────────────────────────── */
.demo-lever-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 5px; }
.demo-lever-label { font: 600 13px/1.3 var(--font-sans); color: var(--ink); }
.demo-lever-assume {
  font: 500 11.5px/1.35 var(--font-sans); color: var(--muted);
  min-height: 1.35em; cursor: help;
}
.step-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.step-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px 5px; min-height: 52px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-card); color: var(--muted-2);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.step-btn:hover { border-color: var(--accent); color: var(--accent); }
.step-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Filled up to the chosen level, so four buttons read as one scale. */
.step-btn.is-below { background: #DCEAF6; border-color: rgba(41,105,154,.38); color: var(--accent); }
.step-btn.is-on {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 12px -5px rgba(41,105,154,.8);
}
.step-btn.is-on .step-num { color: #fff; }
/* The glyph grows with the level: the same mark at four sizes says "more of
   this", where four different pictures would just be decoration. */
.step-icon { width: 13px; height: 13px; transition: width .16s ease, height .16s ease; }
.step-btn[data-level="2"] .step-icon { width: 16px; height: 16px; }
.step-btn[data-level="3"] .step-icon { width: 19px; height: 19px; }
.step-btn[data-level="4"] .step-icon { width: 22px; height: 22px; }
.step-num { font: 600 10px/1 var(--font-sans); color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ── Outcome: three equal readings, no hero block ─────────────────────
   The oversized GHG card (and the two grey boxes beside it) made the demo
   look like a dashboard whose headline was a number. The chart is the
   picture; these are three readings off it, at the same weight. */
.demo-outcome {
  list-style: none; margin: 0; padding: 9px 0 0;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 18px;
}
.demo-stat {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
  background: none; padding: 0; border-radius: 0; cursor: help;
}
.demo-stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 5px; }
.demo-stat-label { font: var(--t-caption); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.demo-stat-value {
  font: 600 19px/1.2 var(--font-display); color: var(--ink);
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  transition: color .3s ease;
}
.demo-stat-value[data-dir="good"] { color: #1F6B3A; }
.demo-stat-value[data-dir="bad"] { color: #A33; }
.demo-stat-delta { font: 500 11px/1.35 var(--font-sans); color: var(--muted); }
.demo-stat-delta[data-dir="good"] { color: #1F6B3A; }
.demo-stat-delta[data-dir="bad"] { color: #A33; }

/* ── Legend, as DOM so each key can carry a popover ──────────────────── */
.demo-legend {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px;
}
.demo-legend-key {
  display: inline-flex; align-items: center; gap: 6px; cursor: help;
  font: 500 11.5px/1.3 var(--font-sans); color: #4A5260;
}
.demo-legend-key:hover { color: var(--ink); }
.demo-legend-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.demo-legend-mark {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--key-color);
}
/* The ghost line's key is a dash, as it is drawn. */
.demo-legend-mark.is-dashed {
  width: 14px; height: 0; border-radius: 0; background: none;
  border-top: 2px dashed var(--key-color);
}

/* ── Punchline ────────────────────────────────────────────────────────── */
.demo-punch { padding: 0; }
.demo-punch-head {
  margin: 0; font: 600 14px/1.4 var(--font-sans); color: var(--ink);
}
.demo-punch-detail { margin: 2px 0 0; font: 400 11.5px/1.5 var(--font-sans); color: var(--muted); }
.demo-punch-detail strong { font-weight: 700; color: #3A414B; font-variant-numeric: tabular-nums; }

/* ── Targets, folded away ─────────────────────────────────────────────── */
.demo-targets-toggle > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font: 600 11.5px/1 var(--font-sans); color: var(--muted); padding: 3px 0;
}
.demo-targets-toggle > summary::-webkit-details-marker { display: none; }
.demo-targets-toggle > summary::before {
  content: ""; width: 5px; height: 5px; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .18s ease;
}
.demo-targets-toggle[open] > summary::before { transform: rotate(45deg); }
.demo-targets-toggle > summary:hover { color: var(--accent); }
.demo-targets-toggle > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Taken out of layout while collapsed, or the browser lays it over the call
   to action below: a closed <details> hides its content, but still gives this
   flex box a rect that takes no part in the <details>' own height. */
.demo-targets-toggle:not([open]) .demo-targets { display: none; }
.demo-targets { display: flex; flex-wrap: wrap; gap: 5px; padding-top: 5px; }
.demo-target-chip {
  display: inline-flex; align-items: baseline; gap: 5px;
  font: 500 11px/1 var(--font-sans); color: var(--ink);
  background: #EAF2F8; border: 1px solid rgba(41,105,154,.18);
  border-radius: 999px; padding: 4px 9px; cursor: help;
}
.demo-target-measure { font: 400 9.5px/1 var(--font-sans); color: var(--muted); font-style: normal; }
.demo-targets-note { flex: 1 1 100%; margin: 2px 0 0; font: 400 10px/1.4 var(--font-sans); color: var(--muted); }

/* ── Closing call to action ───────────────────────────────────────────── */
.demo-cta {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 12px; border-radius: 10px;
  background: #EAF2F8; border: 1px solid rgba(41,105,154,.2);
  font: 500 12.5px/1.3 var(--font-sans); color: var(--accent); text-align: center;
  transition: background .15s, border-color .15s;
}
.demo-cta strong { font-weight: 700; }
.demo-cta:hover { background: #DCEAF5; border-color: var(--accent); }
.demo-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Intro and the "Your turn" hint ───────────────────────────────────── */
.demo-card.is-intro .step-group { pointer-events: none; }
.demo-card.show-hint .step-group {
  position: relative;
  animation: demo-hint-pulse 1.9s ease-in-out infinite;
  border-radius: 12px;
}
/* The hand, on the renewable control only — one place to look. */
.demo-card.show-hint .demo-lever[data-demo-lever="renewable"] .step-group::after {
  content: ""; position: absolute; right: -6px; bottom: -14px; width: 22px; height: 22px;
  background: currentColor; color: var(--accent); pointer-events: none;
  -webkit-mask: var(--hand-mask) center / contain no-repeat;
  mask: var(--hand-mask) center / contain no-repeat;
  animation: demo-hand 1.9s ease-in-out infinite;
}
:root {
  /* A pointing hand, inline so it costs no request. */
  --hand-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 11V5.5a1.5 1.5 0 0 1 3 0V11"/><path d="M12 11V4.5a1.5 1.5 0 0 1 3 0V11"/><path d="M15 11V6.5a1.5 1.5 0 0 1 3 0V13a7 7 0 0 1-7 7h-1a6 6 0 0 1-5.2-3L3 13.5a1.6 1.6 0 0 1 2.7-1.7L9 15"/></svg>');
}
@keyframes demo-hint-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(41,105,154,0); }
  50%      { box-shadow: 0 0 0 5px rgba(41,105,154,.14); }
}
@keyframes demo-hand {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(-4px, -5px); }
}
@media (prefers-reduced-motion: reduce) {
  .demo-card.show-hint .step-group,
  .demo-card.show-hint .step-group::after { animation: none; }
  .demo-caption { transition: none; }
}

@media (max-width: 620px) {
  .demo-outcome { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* ══ Hover guidance popovers ══════════════════════════════════════════
   One element, reused: tooltips.js moves it, fills it and points its arrow.
   position:fixed on a child of <body>, so its coordinates are LOGICAL px —
   tooltips.js divides every measured rect by --ui-scale before writing one. */
.tip-pop {
  position: fixed; z-index: 1200; max-width: 320px; min-width: 190px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 10px; padding: 10px 13px 11px;
  box-shadow: 0 16px 38px -14px rgba(16, 17, 20, .38), 0 2px 6px rgba(16, 17, 20, .08);
  pointer-events: none;            /* never steals the hover it describes */
  opacity: 0; transform: scale(.96); transform-origin: center top;
  transition: opacity .15s ease, transform .15s ease;
}
.tip-pop[data-side="bottom"] { transform-origin: center bottom; }
.tip-pop.is-in { opacity: 1; transform: scale(1); }
.tip-pop-title {
  font: 700 14.5px/1.35 var(--font-display); color: var(--ink); margin-bottom: 3px;
}
.tip-pop-body p { margin: 0 0 4px; font: 400 14px/1.45 var(--font-sans); color: #3A414B; }
.tip-pop-body p:last-child { margin-bottom: 0; }
/* The arrow: a rotated square showing two of its borders, so it carries the
   card's own edge rather than a painted-on triangle. */
.tip-pop-arrow {
  position: absolute; width: 10px; height: 10px; margin-left: -5px;
  background: #fff; border: 1px solid var(--line); transform: rotate(45deg);
}
.tip-pop[data-side="bottom"] .tip-pop-arrow {
  bottom: -6px; border-top: none; border-left: none;
}
.tip-pop[data-side="top"] .tip-pop-arrow {
  top: -6px; border-bottom: none; border-right: none; border-top-color: var(--accent);
  border-left-color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  .tip-pop { transition: none; transform: none; }
  .tip-pop.is-in { transform: none; }
}

/* The things that carry one. */
.tip-term {
  font-weight: 600; color: var(--accent); cursor: help;
  border-bottom: 1px dashed rgba(41, 105, 154, .55);
}
.tip-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.tip-hint {
  width: 13px; height: 13px; flex: none; margin-left: 4px;
  color: var(--accent); opacity: .65; vertical-align: -2px;
}
.demo-lever-label { cursor: help; }
.demo-lever-label:hover .tip-hint { opacity: 1; }
.demo-lever-label:focus-visible,
.demo-step:focus-visible,
.demo-chart-wrap:focus-visible,
.demo-targets-toggle > summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 5px;
}
.demo-step { cursor: help; }
.step-btn[data-tip-dynamic] { cursor: pointer; }

/* The masthead tightens when the card is short. The lede used to be hidden
   outright here; it is now the page's "how to use" instruction, including
   the two scenario terms, so it shrinks instead of disappearing. */
@media (max-height: 760px) {
  html.app-shell .demo-lede { font-size: 12.5px; line-height: 1.45; }
  html.app-shell .demo-steps { margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-badge-dot { animation: none; }
}
