/* Gas Desk website. Design system: DESIGN.md Part 7 (DECISIONS.md G44, G46, G47). Components read tokens only; the two
   themes change tokens, never components. Values follow the Economist Design System (EVIDENCE.md Part 5.3) under the
   launch campaign's navy, magenta and Questrial: hairline rules, no boxes, shadows or gradients, one type scale (ratio
   1.125), one 130 ms transition. The home stage (G45) keeps its own choreography and is the only exception. */
@layer tokens, base, layout, components, pages, utilities;

/* ---------- tokens ---------- */
@layer tokens {
  :root {
    /* light theme (default) */
    --bg: #ffffff;
    --surface: #f2f4f6;                /* campaign mist */
    --surface-2: #ffffff;
    --ink: #1f3864;                    /* campaign navy: headings, terms, emphasis */
    --text: #3d4650;                   /* campaign body text */
    --muted: #5f6874;                  /* campaign grey, 4.5:1 on --surface */
    --rule: #d9dee3;                   /* hairline rule */
    --rule-strong: #1f3864;            /* emphasised rule */
    --field-border: #80868e;           /* 3:1 against --bg and --surface, WCAG 1.4.11 */
    --accent: #c2005f;                 /* campaign magenta */
    --accent-strong: #c2005f;          /* button fill; white label 6.0:1 */
    --accent-hover: #9a004c;
    --accent-soft: #fbe6f0;            /* pale tint for fills, never a gradient */
    --data: #0089a3;                   /* the issue's teal: charts and marks, not text */
    --ok: #1f6b45;
    --err: #a3261b;
    --on-accent: #ffffff;
    --scrim: rgba(255, 255, 255, .94);
    --hero-ink: #ffffff;               /* text on the home stage, both themes */
    --hero-bg: #16294b;

    /* type: Questrial for everything the campaign sets; IBM Plex Mono only for figures */
    --font-sans: "Questrial", "Century Gothic", "Avenir Next", Arial, sans-serif;
    --font-display: var(--font-sans);
    --font-wordmark: "Helvetica Neue", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    /* modular scale, base 16 px, ratio 1.125 (steps -3 to 11) */
    --step--3: .7023rem; --step--2: .7901rem; --step--1: .8889rem; --step-0: 1rem; --step-1: 1.125rem; --step-2: 1.2656rem;
    --step-3: 1.4238rem; --step-4: 1.6018rem; --step-5: 1.802rem; --step-6: 2.0273rem; --step-7: 2.2807rem;
    --step-8: 2.5658rem; --step-9: 2.8865rem; --step-10: 3.2473rem; --step-11: 3.6532rem;
    --fs-display: var(--step-8);
    --fs-h1: var(--step-7);
    --fs-h2: var(--step-5);
    --fs-h3: var(--step-2);
    --fs-lede: var(--step-1);
    --fs-body: var(--step-0);
    --fs-small: var(--step--1);
    --fs-micro: var(--step--2);
    --lead-upper: 1.2;                 /* sizes of step 3 (22.8 px) and up */
    --lead-lower: 1.4;                 /* below */

    /* space (4 px base), radius, layout */
    --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
    --r-1: 2px; --r-2: 2px; --r-3: 2px;
    --content: 1200px;
    --reading: 68ch;
    --gutter: max(24px, env(safe-area-inset-left, 0px));
    --gap: 12px;
    --head-h: 72px;

    /* motion: one transition for the interface */
    --t: .13s ease-in-out;
    /* the home stage's choreography only (G45) */
    --stage-2: 200ms; --stage-4: 560ms; --stage-5: 800ms;
    --ease-out: cubic-bezier(.215, .61, .355, 1);
    --ease-in-out: cubic-bezier(.65, 0, .35, 1);

    color-scheme: light;
  }
  @media (min-width: 60rem) {
    :root {
      --fs-display: var(--step-11);
      --fs-h1: var(--step-10);
      --fs-h2: var(--step-7);
      --fs-h3: var(--step-3);
      --fs-lede: var(--step-2);
      --fs-body: var(--step-1);
      --gutter: max(32px, env(safe-area-inset-left, 0px));
      --gap: 16px;
    }
  }

  :root[data-theme="dark"] {
    --bg: #0b1526;
    --surface: #111f38;
    --surface-2: #111f38;
    --ink: #eef2f8;
    --text: #c3cbd8;
    --muted: #8f9bb0;
    --rule: #24365a;
    --rule-strong: #c3cbd8;
    --field-border: #6a7c9e;
    --accent: #ff4fa0;                 /* lifted for 4.5:1 text on dark */
    --accent-strong: #c2005f;
    --accent-hover: #e01a7a;
    --accent-soft: #2a1030;
    --data: #3fc1d9;
    --ok: #5fcb91;
    --err: #ff7a6b;
    --scrim: rgba(11, 21, 38, .96);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 16px); }
  body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 400 var(--fs-body)/var(--lead-lower) var(--font-sans);
    font-synthesis: none;              /* Questrial has one weight: never fake a bold */
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  }
  img, svg, video { max-width: 100%; height: auto; }
  a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--t); }
  a:hover { text-decoration-thickness: 2px; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  b, strong { font-weight: 400; color: var(--ink); }   /* emphasis is colour, not weight */
  h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .5em; font-weight: 400; text-wrap: balance; }
  h1 { font: 400 var(--fs-h1)/var(--lead-upper) var(--font-display); letter-spacing: -.01em; }
  h2 { font: 400 var(--fs-h2)/var(--lead-upper) var(--font-display); }
  h3 { font-size: var(--fs-h3); line-height: var(--lead-lower); }
  h4 { font-size: var(--step-0); line-height: var(--lead-lower); }
  @media (min-width: 60rem) { h3 { line-height: var(--lead-upper); } }
  /* flow: every block leaves room before the next (pass mark RD4) */
  p, ul, ol, dl, table, figure, form, .table-wrap, .rows { margin: 0 0 var(--s-4); }
  :where(p, ul, ol, dl, table, figure, form, .table-wrap, .rows):last-child { margin-bottom: 0; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
  ::selection { background: var(--accent-strong); color: var(--on-accent); }
  table { font-variant-numeric: tabular-nums; }
  small { font-size: var(--step--2); }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  }
}

/* ---------- layout ---------- */
@layer layout {
  .wrap { max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }
  .narrow { max-width: calc(760px + 2 * var(--gutter)); }
  section { padding-block: var(--s-8); }
  .band { background: var(--surface); }
  .grid3, .grid4, .cards { display: grid; gap: var(--s-5) var(--s-6); }
  .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-7); align-items: start; }
  .stack { display: flex; flex-direction: column; }
  .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s-6); padding-block: var(--s-5); border-top: 1px solid var(--rule); }
  @media (max-width: 1024px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 768px) {
    section { padding-block: var(--s-7); }
    .grid3, .grid4, .cards, .split, .row { grid-template-columns: minmax(0, 1fr); }
    .split { gap: var(--s-6); }
    .row { gap: var(--s-2); }
  }
}

/* ---------- components ---------- */
@layer components {
  /* skip link */
  .skip { position: absolute; left: var(--gutter); top: -100px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; text-decoration: none; }
  .skip:focus { top: 12px; }

  /* type helpers */
  .eyebrow { font: 400 var(--fs-micro)/var(--lead-lower) var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--s-4); }
  .eyebrow a { color: inherit; text-decoration: none; }
  .lede { font-size: var(--fs-lede); line-height: var(--lead-lower); color: var(--text); max-width: 60ch; }
  .meta, .small { font-size: var(--fs-small); color: var(--muted); }
  .prose { max-width: var(--reading); }
  .prose h2 { margin-top: 1.6em; }
  .num { text-align: right; font-family: var(--font-mono); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
  .sel { user-select: all; font-family: var(--font-mono); font-size: var(--step--1); }

  /* wordmark */
  .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; line-height: 1; }
  .brand svg { width: 28px; height: 28px; flex: none; }
  .brand .wm { font: 700 var(--step-2)/1 var(--font-wordmark); letter-spacing: -.01em; white-space: nowrap; }
  .brand:hover { text-decoration: none; }

  /* header */
  .site-head {
    position: sticky; top: 0; z-index: 40; height: var(--head-h);
    background: var(--scrim); border-bottom: 1px solid var(--rule);
    transition: background-color var(--t), border-color var(--t), color var(--t);
  }
  .site-head .wrap { height: 100%; display: flex; align-items: center; gap: var(--s-6); position: relative; }
  .nav { display: flex; align-items: center; gap: var(--s-6); margin-left: var(--s-4); font-size: var(--step-0); }
  .nav a { color: var(--text); text-decoration: none; padding-block: 6px; border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--t), border-color var(--t); }
  .nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
  .head-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
  /* over the home stage: transparent until scrolled (site.js sets data-solid) */
  .site-head[data-over-hero]:not([data-solid]) { background: transparent; border-color: transparent; }
  .site-head[data-over-hero]:not([data-solid]) .brand,
  .site-head[data-over-hero]:not([data-solid]) .nav a,
  .site-head[data-over-hero]:not([data-solid]) .icon-btn,
  .site-head[data-over-hero]:not([data-solid]) .acct:not(.in) { color: var(--hero-ink); }
  .site-head[data-over-hero]:not([data-solid]) .icon-btn,
  .site-head[data-over-hero]:not([data-solid]) .acct:not(.in) { border-color: rgba(255, 255, 255, .45); }

  /* icon buttons: theme toggle and phone menu */
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 12px;
    font: 400 var(--fs-small)/var(--lead-lower) var(--font-sans); color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: var(--r-1); cursor: pointer;
    transition: border-color var(--t);
  }
  .icon-btn:hover { border-color: var(--ink); }
  .icon-btn svg { width: 18px; height: 18px; flex: none; }
  .theme-toggle .when-dark, :root[data-theme="dark"] .theme-toggle .when-light { display: none; }
  :root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
  .theme-toggle .label { display: none; }
  @media (min-width: 1280px) { .theme-toggle .label { display: inline; } }
  .menu-btn { display: none; }

  /* buttons: a main button for the principal action, a secondary beside it (Economist Design System; G47 C3) */
  .after-actions { margin-top: var(--s-8); }
  .actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); align-items: center; }
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 22px;
    font: 400 var(--step-0)/var(--lead-lower) var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer;
    color: var(--on-accent); background: var(--accent-strong); border: 1px solid var(--accent-strong); border-radius: var(--r-1);
    transition: background-color var(--t), border-color var(--t), color var(--t);
  }
  .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
  .btn.ghost { background: transparent; color: var(--ink); border-color: var(--field-border); }
  .btn.ghost:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
  .btn.small { min-height: 34px; padding: 0 14px; font-size: var(--step--1); }
  .btn[disabled] { opacity: .6; cursor: progress; }
  .head-tools .btn { min-height: 44px; }
  @media (max-width: 480px) { .btn { white-space: normal; text-align: center; max-width: 100%; padding-block: 10px; } }

  /* account (signed in), built by site.js */
  .acct { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; font: 400 var(--fs-small)/var(--lead-lower) var(--font-sans); color: var(--ink); text-decoration: none; border: 1px solid var(--rule); border-radius: var(--r-1); transition: border-color var(--t); }
  .acct:hover { border-color: var(--ink); text-decoration: none; }
  .acct.in { padding: 0; border: 0; min-width: 44px; justify-content: center; }
  .acct .av { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-strong); color: var(--on-accent); text-transform: uppercase; }
  .acct-menu { position: absolute; right: var(--gutter); top: calc(100% + 6px); z-index: 50; min-width: 260px; background: var(--bg); border: 1px solid var(--rule-strong); padding: 6px 0; }
  .acct-menu .who { display: flex; flex-direction: column; padding: 10px 16px 12px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
  .acct-menu .who span { font-size: var(--step--1); color: var(--muted); overflow-wrap: anywhere; }
  .acct-menu a { display: block; padding: 10px 16px; text-decoration: none; color: var(--text); transition: background-color var(--t); }
  .acct-menu a:hover, .acct-menu a:focus-visible { background: var(--surface); color: var(--ink); outline: none; }

  /* phone menu panel */
  .menu-panel {
    position: fixed; inset: 0; z-index: 60; background: var(--bg); padding: calc(var(--head-h) + 16px) var(--gutter) 32px;
    display: flex; flex-direction: column; gap: var(--s-2); overflow-y: auto;
    opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity var(--t), visibility 0s linear .13s;
  }
  .menu-panel[data-open] { opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
  .menu-panel nav { display: flex; flex-direction: column; }
  .menu-panel a.item { font: 400 var(--step-6)/var(--lead-upper) var(--font-display); color: var(--ink); text-decoration: none; padding-block: 10px; border-bottom: 1px solid var(--rule); }
  .menu-panel a.item[aria-current="page"] { color: var(--accent); }
  .menu-panel .panel-actions { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-6); }
  .menu-panel .panel-actions .btn { width: 100%; }
  .menu-panel .close { position: absolute; top: 14px; right: var(--gutter); }
  html[data-menu-shown], html[data-menu-shown] body { overflow: hidden; }

  @media (max-width: 1024px) {
    .site-head .nav, .head-tools .btn, .head-tools .acct:not(.in) { display: none; }
    .menu-btn { display: inline-flex; }
  }

  /* page head: flat mist, a hairline below (no gradient) */
  .pagehead { padding-block: var(--s-9) var(--s-7); background: var(--surface); border-bottom: 1px solid var(--rule); }
  .pagehead h1 { max-width: 20ch; }
  @media (max-width: 768px) { .pagehead { padding-block: var(--s-8) var(--s-6); } }

  /* ruled rows: the one list component (G47 C2). Hairline between items; optional number column in magenta; term in
     navy over a description. Replaces the old checklist, feature, contents and boxed answer. */
  .rows { list-style: none; padding: 0; border-bottom: 1px solid var(--rule); }
  .rows > li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding-block: var(--s-3); border-top: 1px solid var(--rule); }
  .rows.numbered > li { grid-template-columns: 3.5rem minmax(0, 1fr); column-gap: var(--s-3); }
  .rows .n { font: 400 var(--step--1)/var(--lead-lower) var(--font-mono); color: var(--accent); padding-top: .15em; }
  .rows .term { display: block; color: var(--ink); font-size: var(--fs-lede); line-height: var(--lead-lower); }
  .rows .desc { display: block; color: var(--text); }
  .rows.compact > li { padding-block: var(--s-2); }
  .rows.media > li { grid-template-columns: 120px minmax(0, 1fr); column-gap: var(--s-4); align-items: start; }
  .cover { display: block; width: 120px; height: 160px; border: 1px solid var(--rule); background: #fff; }
  @media (max-width: 480px) { .rows.media > li { grid-template-columns: 90px minmax(0, 1fr); } .cover { width: 90px; height: 120px; } }
  .card.with-cover { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
  /* columns that open on an emphasised rule (grids of three) */
  .ruled > * { border-top: 1px solid var(--rule-strong); padding-top: var(--s-4); }
  .ruled h3 { margin-bottom: .4em; }

  /* "On this page": anchor links under the page head (S&P product pages, EVIDENCE.md 5.5) */
  .onpage { position: sticky; top: var(--head-h); z-index: 30; background: var(--bg); border-bottom: 1px solid var(--rule); }
  .onpage .wrap { display: flex; gap: var(--s-2) var(--s-6); align-items: center; overflow-x: auto; white-space: nowrap; padding-block: var(--s-3); }
  .onpage-label { font: 400 var(--fs-micro)/var(--lead-lower) var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
  .onpage a { color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent; padding-block: 4px; transition: border-color var(--t); }
  .onpage a:hover { border-bottom-color: var(--accent); }
  [id] { scroll-margin-top: calc(var(--head-h) + 64px); }

  /* benchmark page (template, W4): the gate where the marks will sit */
  .benchmark-gate { border-top: 4px solid var(--accent); border-bottom: 1px solid var(--rule); padding-block: var(--s-5); }

  /* figures row: a number over its meaning (proof numbers, verified figures only) */
  .facts .fig { font: 400 var(--fs-h1)/var(--lead-upper) var(--font-display); color: var(--ink); margin-bottom: var(--s-2); }
  .facts p:last-child { color: var(--muted); font-size: var(--fs-small); }

  /* cards, tiles: hairline only, nothing moves */
  .card, .tile { display: block; color: inherit; text-decoration: none; background: var(--surface-2); border: 1px solid var(--rule); padding: var(--s-5); transition: border-color var(--t); }
  a.card:hover, a.tile:hover { border-color: var(--accent); text-decoration: none; }
  .tile p { margin: 0; color: var(--muted); font-size: var(--step--1); }

  /* definition list */
  .defs { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 12px 24px; }
  .defs dt { color: var(--ink); }
  .defs dd { margin: 0; }
  @media (max-width: 768px) { .defs { grid-template-columns: minmax(0, 1fr); gap: 2px; } .defs dd { margin-bottom: 12px; } }

  /* tables */
  table.plain { width: 100%; border-collapse: collapse; margin-top: var(--s-4); font-size: var(--step--1); border-top: 1px solid var(--rule-strong); }
  table.plain th, table.plain td { text-align: left; padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
  table.plain th { font: 400 var(--fs-micro)/var(--lead-lower) var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  table.plain th.num { text-align: right; }
  tr.prov td { color: var(--muted); }
  .table-wrap, .scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* forms (K29, U16: labels always visible; errors say what is wrong). A hairline box, no shadow. */
  .form { display: flex; flex-direction: column; gap: var(--s-4); background: var(--surface-2); border: 1px solid var(--rule); border-top: 4px solid var(--accent); padding: var(--s-6); }
  .form label { display: flex; flex-direction: column; gap: 6px; font-size: var(--step--1); color: var(--ink); }
  .form input, .form select, .form textarea {
    font: 400 var(--step-0)/var(--lead-lower) var(--font-sans); color: var(--ink); background: var(--bg);
    min-height: 46px; padding: 10px 14px; border: 1px solid var(--field-border); border-radius: var(--r-1); width: 100%;
    transition: border-color var(--t);
  }
  .form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
  .form input[aria-invalid="true"] { border-color: var(--err); }
  .form label.check { flex-direction: row; align-items: flex-start; gap: 12px; color: var(--text); font-size: var(--step--1); }
  .form label.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--accent-strong); }
  .form .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); }
  .form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; border-top-width: 1px; border-top-color: var(--rule); }
  .form.inline label { flex: 1 1 240px; }
  .form .btn { align-self: flex-start; }
  .form > * { margin-bottom: 0; }
  @media (max-width: 480px) { .form { padding: var(--s-5); } .form .two { grid-template-columns: minmax(0, 1fr); } .form .btn { align-self: stretch; } }
  .grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; align-items: end; margin-bottom: 24px; }
  .inline-form { display: inline-flex; gap: 6px; margin: 0 6px 6px 0; flex-wrap: wrap; }
  .inline-form input { font: inherit; font-size: var(--step--1); padding: 5px 8px; border: 1px solid var(--field-border); border-radius: var(--r-1); background: var(--bg); color: var(--ink); }
  .note { margin: 0; font-size: var(--step--1); min-height: 1.4em; }
  .note.ok { color: var(--ok); }
  .note.err { color: var(--err); }
  .note.ok::before { content: "✓ "; }
  .note.err::before { content: "⚠ "; }

  /* exhibits gallery: the issue's own pages, framed by a hairline (white in both themes, as printed) */
  .exhibits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); align-items: start; }
  .exhibit { margin: 0; background: #fff; border: 1px solid var(--rule); padding: 10px; transition: border-color var(--t); }
  .exhibit:hover { border-color: var(--accent); }
  .exhibit a { display: block; }
  .exhibit img { display: block; width: 100%; height: auto; }
  .exhibit figcaption { font-size: var(--step--1); color: #33383d; margin-top: 8px; }
  .exhibit figcaption span { display: inline-block; margin-right: 8px; font: 400 var(--step--3)/var(--lead-lower) var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: #c2005f; }
  .trial-exhibit { max-width: 420px; margin-top: var(--s-5); }
  .ex-network-map { grid-row: span 2; }
  .ex-key-figures { grid-column: span 2; }
  @media (max-width: 860px) { .exhibits { grid-template-columns: minmax(0, 1fr); } .ex-network-map, .ex-key-figures { grid-row: auto; grid-column: auto; } }
  @media (max-width: 600px) { .ex-wholesale-prices, .ex-key-figures, .trial-exhibit { display: none; } }

  /* data and Ask */
  .chart { margin: 0 0 24px; }
  .chart svg { width: 100%; height: auto; display: block; font: var(--step--2) var(--font-sans); fill: var(--muted); }
  .chart .grid { stroke: var(--rule); stroke-width: 1; }
  .chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
  .chart .pt, .chart .bar { fill: var(--accent); }
  .chart .prov { fill-opacity: .4; }
  .answer { border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); padding-block: var(--s-4); margin-bottom: 24px; }
  .answer p { margin: 0 0 var(--s-4); }
  .answer p:last-child { margin-bottom: 0; }
  .cites { padding-left: 1.2em; border-bottom: 1px solid var(--rule); }
  .cites li { padding-block: var(--s-3); border-top: 1px solid var(--rule); }
  .cites li p { margin: 0 0 var(--s-1); }
  .cites li p:last-child { margin-bottom: 0; }
  .pagehead .form.inline { margin-top: 16px; }

  /* footer */
  .site-foot { background: var(--surface); border-top: 1px solid var(--rule); padding-block: var(--s-8) var(--s-6); font-size: var(--step-0); }
  .site-foot .cols { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
  .site-foot h2 { font: 400 var(--fs-micro)/var(--lead-lower) var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s-4); }
  .site-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .site-foot a { color: var(--text); text-decoration: none; }
  .site-foot a:hover { color: var(--ink); text-decoration: underline; }
  .site-foot .tagline { color: var(--muted); max-width: 32ch; margin-top: var(--s-4); }
  .site-foot .legal { margin: var(--s-7) 0 0; padding-top: var(--s-5); border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 24px; }
  @media (max-width: 768px) { .site-foot .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .site-foot .cols > :first-child { grid-column: 1 / -1; } }

  /* staff console */
  .staff-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 12px; font-size: var(--step-0); }
  .staff table.plain { font-size: var(--step--1); }
  .staff .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 32px; }
  .staff .tiles .tile { display: flex; flex-direction: column; padding: 14px 16px; }
  .staff .tiles .tile b { font: 400 var(--step-4)/var(--lead-upper) var(--font-display); color: var(--ink); }
  .staff .tiles .tile b.long { font-size: var(--step-0); line-height: var(--lead-lower); padding-top: .35rem; }
  .staff .tiles .tile span { font-size: var(--step--1); color: var(--muted); }
  .staff { overflow-x: auto; }
  .staff .scroll-x table { min-width: 980px; }
  .staff .scroll-x td:first-child { min-width: 240px; }
  .staff .scroll-x th { white-space: nowrap; }
  .staff table.plain small { color: var(--muted); }
  .invoice { border: 1px solid var(--rule); padding: 32px; max-width: 760px; background: #fff; color: #33383d; }
  .invoice h1, .invoice h2, .invoice th { color: #111417; }
  .invoice header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 24px; font-size: var(--step--1); }
}

/* ---------- pages ---------- */
@layer pages {
  /* Home stage (DESIGN.md Part 7.6, G45). Dark in both themes, like a trading floor's screens; text is --hero-ink.
     Without JS only scene 1 shows (the others carry [hidden]); home.js layers the scenes and runs the sequence.
     Entrances are CSS animations keyed to [data-active], so they run on first load and on every change of scene. */
  .stage { position: relative; isolation: isolate; height: 100vh; height: 100svh; min-height: 560px; margin-top: calc(-1 * var(--head-h)); padding: 0; background: var(--hero-bg); color: var(--hero-ink); overflow: hidden; }
  .stage-scenes { position: absolute; inset: 0; }
  .scene { position: absolute; inset: 0; display: flex; align-items: flex-end; opacity: 0; visibility: hidden;
    transition: opacity var(--stage-5) var(--ease-in-out), visibility 0s linear var(--stage-5); }
  .scene[data-active] { opacity: 1; visibility: visible; transition: opacity var(--stage-5) var(--ease-in-out), visibility 0s; z-index: 1; }
  .scene-art { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(90% 75% at 72% 38%, #2c4a86 0%, #16294b 60%, #0f1d38 100%); }
  .scene-art::after { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, rgba(15, 29, 56, .85) 0%, rgba(15, 29, 56, .35) 45%, rgba(15, 29, 56, 0) 70%), linear-gradient(180deg, rgba(15, 29, 56, .4) 0%, rgba(15, 29, 56, 0) 25%, rgba(15, 29, 56, 0) 60%, rgba(15, 29, 56, .85) 100%); }
  .art { position: absolute; inset: 0; transform-origin: 70% 45%; will-change: transform; }
  .scene[data-active] .art { animation: drift 7.6s linear both; }
  @keyframes drift { from { transform: scale(1); } to { transform: scale(1.06); } }

  .scene-copy { position: relative; width: 100%; padding-block: calc(var(--head-h) + 32px) clamp(120px, 17vh, 176px); }
  .scene .eyebrow { color: #ff79b6; }
  .scene-title { font: 400 var(--fs-display)/var(--lead-upper) var(--font-display); letter-spacing: -.02em; color: var(--hero-ink); max-width: 13ch; margin: 0 0 var(--s-5); }
  .scene-line { font-size: var(--fs-lede); line-height: var(--lead-lower); color: rgba(255, 255, 255, .84); max-width: 44ch; margin: 0 0 var(--s-6); }
  .scene-action { margin: 0; }
  .js .scene .eyebrow, .js .scene-title, .js .scene-line, .js .scene-action { opacity: 0; }
  .js .scene[data-active] .eyebrow { animation: rise var(--stage-4) var(--ease-out) 150ms both; }
  .js .scene[data-active] .scene-title { animation: rise var(--stage-4) var(--ease-out) 300ms both; }
  .js .scene[data-active] .scene-line { animation: rise var(--stage-4) var(--ease-out) 450ms both; }
  .js .scene[data-active] .scene-action { animation: rise var(--stage-4) var(--ease-out) 600ms both; }
  @keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  .stage :focus-visible { outline-color: #fff; }

  /* scene 1: the network drawn on */
  .art-network svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  .net-grid path { stroke: rgba(255, 255, 255, .05); stroke-width: 1; fill: none; }
  .net-lines path { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
  .js .scene[data-active] .net-lines path { animation: draw 1.4s var(--ease-out) calc(200ms + var(--d) * 140ms) both; }
  @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  .net-nodes circle { fill: #fff; transform-box: fill-box; transform-origin: center; }
  .js .scene[data-active] .net-nodes circle { animation: node 2.4s var(--ease-out) 1.4s infinite; }
  .net-nodes circle:nth-child(3n) { animation-delay: 1.9s !important; }
  .net-nodes circle:nth-child(3n+1) { animation-delay: 2.3s !important; }
  @keyframes node { 0% { opacity: .9; transform: scale(1); } 60% { opacity: .35; transform: scale(1.8); } 100% { opacity: .9; transform: scale(1); } }

  /* scene 2: releases, each with its source */
  .art-sources { display: grid; place-items: center end; padding: calc(var(--head-h) + 24px) max(var(--gutter), 6vw) 22vh 0; }
  .ledger { width: min(620px, 46vw); display: flex; flex-direction: column; gap: 14px; }
  .led-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); grid-template-rows: auto 6px; column-gap: 16px; row-gap: 8px; padding: 14px 18px; border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--r-2); background: rgba(255, 255, 255, .03); }
  .led-row .src { font: 400 var(--step--3)/var(--lead-lower) var(--font-mono); letter-spacing: .1em; color: #ff79b6; }
  .led-row .lbl { font-size: var(--step--1); color: rgba(255, 255, 255, .86); }
  .led-row .bar { grid-column: 1 / -1; height: 6px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
  .led-row .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #d6006e, #3fc1d9); transform-origin: left; transform: scaleX(var(--w)); }
  .js .scene[data-active] .led-row { animation: rise var(--stage-4) var(--ease-out) calc(250ms + var(--i) * 90ms) both; }
  .js .scene[data-active] .led-row .bar i { animation: fill-to 1.2s var(--ease-out) calc(600ms + var(--i) * 90ms) both; }
  @keyframes fill-to { from { transform: scaleX(0); } to { transform: scaleX(var(--w)); } }

  /* scene 3: the chain, with gas moving along it */
  .art-chain { display: grid; align-content: center; justify-items: end; padding: calc(var(--head-h) + 24px) max(var(--gutter), 6vw) 24vh 0; }
  .chain { list-style: none; margin: 0; padding: 0; width: min(760px, 58vw); display: grid; grid-template-columns: repeat(5, 1fr); position: relative; z-index: 1; }
  .chain li { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; font: 400 var(--step--2)/var(--lead-lower) var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .78); }
  .chain b { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #ff4fa0; background: var(--hero-bg); box-shadow: 0 0 0 6px rgba(255, 79, 160, .12); }
  .chain li:last-child b { border-color: #3fc1d9; box-shadow: 0 0 0 6px rgba(63, 193, 217, .12); }
  .js .scene[data-active] .chain li { animation: rise var(--stage-4) var(--ease-out) calc(250ms + var(--i) * 110ms) both; }
  .pipes { width: min(760px, 58vw); display: grid; grid-template-columns: repeat(5, 1fr); margin-top: -44px; }
  .pipes span { grid-column: span 1; position: relative; height: 2px; margin-left: 50%; width: 100%; background: rgba(255, 255, 255, .14); overflow: hidden; }
  .pipes span:nth-child(1) { grid-column: 1; } .pipes span:nth-child(2) { grid-column: 2; } .pipes span:nth-child(3) { grid-column: 3; } .pipes span:nth-child(4) { grid-column: 4; }
  .pipes i { position: absolute; top: -2px; left: 0; width: 18px; height: 6px; border-radius: 3px; background: #ff79b6; opacity: 0; }
  .js .scene[data-active] .pipes i { animation: flow 2.2s linear calc(900ms + var(--i) * 150ms) infinite; }
  .pipes i:nth-child(2) { animation-delay: calc(1630ms + var(--i) * 150ms) !important; }
  .pipes i:nth-child(3) { animation-delay: calc(2360ms + var(--i) * 150ms) !important; }
  @keyframes flow { 0% { transform: translateX(-20px); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(min(152px, 11.6vw)); opacity: 0; } }

  /* scene 4: a question resolving into cited pages */
  .art-ask { display: grid; align-content: center; justify-items: end; gap: 18px; padding: calc(var(--head-h) + 24px) max(var(--gutter), 6vw) 22vh 0; }
  .ask-q, .ask-cites li { width: min(560px, 44vw); border-radius: var(--r-3); }
  .ask-q { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); }
  .ask-k { font: 400 var(--step--3)/var(--lead-lower) var(--font-sans); letter-spacing: .12em; text-transform: uppercase; color: #ff79b6; }
  .ask-text { font-size: var(--step-0); color: #fff; }
  .ask-cites { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .ask-cites li { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 14px; row-gap: 8px; padding: 14px 18px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .1); border-left: 3px solid #d6006e; }
  .ask-cites .pg { grid-row: 1 / span 3; font: 400 var(--step--1)/var(--lead-lower) var(--font-mono); color: #3fc1d9; }
  .ask-cites .ln { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .14); }
  .ask-cites .ln.short { width: 62%; }
  .ask-cites em { font-style: normal; font-size: var(--step--2); color: rgba(255, 255, 255, .7); }
  .js .scene[data-active] .ask-q { animation: rise var(--stage-4) var(--ease-out) 200ms both; }
  .js .scene[data-active] .ask-cites li { animation: rise var(--stage-4) var(--ease-out) calc(700ms + var(--i) * 160ms) both; }

  /* scene 5: pages of the issue settling into place */
  .art-issue { perspective: 1400px; }
  .sheet { position: absolute; margin: 0; background: #fff; padding: 8px; border-radius: 4px; box-shadow: 0 30px 60px rgba(0, 0, 0, .55); }
  .sheet img { display: block; width: 100%; height: auto; }
  .sheet.s1 { width: clamp(220px, 22vw, 330px); right: 10vw; top: 14vh; transform: rotate(-4deg); }
  .sheet.s2 { width: clamp(200px, 20vw, 300px); right: 30vw; top: 30vh; transform: rotate(3deg); }
  .sheet.s3 { width: clamp(190px, 18vw, 280px); right: 6vw; top: 54vh; transform: rotate(2deg); }
  .js .scene[data-active] .sheet { animation: settle 1.1s var(--ease-out) both; }
  .js .scene[data-active] .sheet.s2 { animation-delay: 140ms; }
  .js .scene[data-active] .sheet.s3 { animation-delay: 280ms; }
  @keyframes settle { from { opacity: 0; translate: 0 40px; scale: 1.06; } to { opacity: 1; translate: 0 0; scale: 1; } }

  /* controls: pause first (WCAG 2.2.2), then one tab per scene with its progress */
  .stage-controls { position: absolute; left: 0; right: 0; bottom: clamp(28px, 5vh, 48px); z-index: 2; display: flex; align-items: center; gap: 16px; }
  .stage-pause { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: rgba(15, 29, 56, .4); color: #fff; cursor: pointer; transition: border-color var(--stage-2) var(--ease-out); }
  .stage-pause:hover { border-color: #fff; }
  .stage-pause svg { width: 18px; height: 18px; }
  .stage-pause .i-play, .stage[data-paused] .stage-pause .i-pause { display: none; }
  .stage[data-paused] .stage-pause .i-play { display: block; }
  .stage-tabs { flex: 1; display: flex; gap: 8px; max-width: 520px; }
  .stage-tabs [role="tab"] { flex: 1; height: 44px; padding: 0; background: none; border: 0; cursor: pointer; display: flex; align-items: center; }
  .stage-tabs .seg { position: relative; display: block; width: 100%; height: 3px; background: rgba(255, 255, 255, .22); border-radius: 2px; overflow: hidden; }
  .stage-tabs .seg i { position: absolute; inset: 0; background: #fff; transform: scaleX(0); transform-origin: left; }
  .stage-tabs [aria-selected="true"] .seg i { animation: progress var(--scene-ms, 7000ms) linear both; }
  .stage-tabs [data-done] .seg i { transform: scaleX(1); }
  .stage-tabs [role="tab"]:hover .seg { background: rgba(255, 255, 255, .4); }
  @keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .stage-count { font: 400 var(--step--2)/1 var(--font-mono); letter-spacing: .08em; color: rgba(255, 255, 255, .6); margin-left: auto; }
  .stage-count b { color: #fff; font-weight: 400; }

  /* Paused (button, hidden tab, off screen): the clock and the ambient loops hold still. Entrances always finish, so a
     paused stage never shows a half-drawn or invisible scene. */
  .stage[data-paused] .art, .stage[data-paused] .net-nodes circle, .stage[data-paused] .pipes i, .stage[data-paused] .stage-tabs .seg i { animation-play-state: paused; }
  @media (prefers-reduced-motion: reduce) {
    .scene[data-active] .art, .scene .net-nodes circle, .scene .pipes i { animation: none !important; }
    .stage-tabs [aria-selected="true"] .seg i { animation: none; transform: scaleX(1); }
  }

  @media (max-width: 1024px) {
    .art-sources, .art-chain, .art-ask { justify-items: center; place-items: start center; padding-top: calc(var(--head-h) + 6vh); }
    .ledger { width: min(560px, 86vw); }
    .chain, .pipes { width: min(640px, 88vw); }
    .ask-q, .ask-cites li { width: min(560px, 86vw); }
    .scene-art::after { background: linear-gradient(180deg, rgba(15, 29, 56, .55) 0%, rgba(15, 29, 56, .25) 30%, rgba(15, 29, 56, .7) 58%, rgba(15, 29, 56, .96) 82%); }
    .sheet.s1 { right: 6vw; } .sheet.s2 { right: auto; left: 8vw; } .sheet.s3 { display: none; }
  }
  @media (max-width: 768px) {
    .scene-title { max-width: 12ch; }
    /* Phones: the art keeps to the upper half, above the text, never behind it. */
    .art-sources, .art-chain, .art-ask { inset: 0 0 auto 0; height: 50%; padding: calc(var(--head-h) + 12px) var(--gutter) 0; align-content: start; justify-items: center; }
    .scene-art::after { background: linear-gradient(180deg, rgba(15, 29, 56, .45) 0%, rgba(15, 29, 56, 0) 18%, rgba(15, 29, 56, 0) 40%, rgba(15, 29, 56, .9) 56%, rgba(15, 29, 56, .98) 100%); }
    .ledger { gap: 10px; }
    .led-row { padding: 10px 14px; }
    .art-sources .led-row:nth-child(n+4), .art-ask .ask-cites li:nth-child(n+2) { display: none; }
    .ask-q { padding: 14px 16px; }
    .ask-text { font-size: var(--step--1); }
    .chain li span { font-size: var(--step--3); letter-spacing: .02em; }
    .stage-count { display: none; }
    .sheet.s1 { width: 44vw; top: 12vh; } .sheet.s2 { width: 40vw; top: 18vh; }
  }
  @media (max-height: 640px) and (min-width: 769px) { .scene-copy { padding-bottom: 104px; } .scene-title { font-size: var(--step-9); } }

  .intro { padding-block: var(--s-9); }
  .intro h2 { font-size: var(--fs-h2); }
  .coverage { margin-top: var(--s-6); }
  .closing { padding-block: var(--s-9); text-align: left; }
  .closing h2 { font-size: var(--fs-h1); }
}

/* ---------- utilities ---------- */
@layer utilities {
  .visually-hidden { font-size: var(--step--1); line-height: var(--lead-lower); position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  [hidden] { display: none !important; }
  mark.todo { background: var(--accent-soft); color: var(--accent); padding: 0 4px; font-family: var(--font-mono); font-size: var(--step--1); }
  @media print {
    .site-head, .site-foot, .staff-nav, .no-print, .pagehead .eyebrow, [data-flash], .skip, .menu-panel { display: none !important; }
    .invoice { border: 0; padding: 0; }
    section { padding-block: 0; }
  }
}
