/* ---- Alliance (self-hosted) — replaces Google Fonts Urbanist ---- */
@font-face { font-family: 'Alliance No.1'; src: url('/assets/webFonts/AllianceNo1Light/font.woff2')     format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.1'; src: url('/assets/webFonts/AllianceNo1Regular/font.woff2')   format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.1'; src: url('/assets/webFonts/AllianceNo1SemiBold/font.woff2')  format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.1'; src: url('/assets/webFonts/AllianceNo1Bold/font.woff2')      format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.1'; src: url('/assets/webFonts/AllianceNo1ExtraBold/font.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.2'; src: url('/assets/webFonts/AllianceNo2Light/font.woff2')     format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.2'; src: url('/assets/webFonts/AllianceNo2Regular/font.woff2')   format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.2'; src: url('/assets/webFonts/AllianceNo2SemiBold/font.woff2')  format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.2'; src: url('/assets/webFonts/AllianceNo2Bold/font.woff2')      format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Alliance No.2'; src: url('/assets/webFonts/AllianceNo2ExtraBold/font.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

/* Base link colour. Nav + brand + speaker-name links keep their dark ink
   via more-specific selectors below. */
a, a:visited { color: var(--accent); }
a:hover { color: var(--accent-strong); }

  /* ============================================================
     GINC design tokens. Mirrors the Sovereign Speech Index palette
     so this template inherits the look-and-feel cleanly.
     ============================================================ */
  /* ------------------------------------------------------------
     ACTIVE PALETTE: color_scheme_1.
     To revert, restore color_scheme_2 (the previous warm-grey palette):
       LIGHT  --bg #f4f3ef  --panel #ebeae5  --ink #1a1a1a  --ink-muted #555
              --ink-faint #888  --neutral-bar #d9d8d2  --neutral-other #c8c7c1
              --border #d6d5d0  --toggle-bg #ebeae5
       DARK   --bg #1a1a17  --panel #262622  --ink #ebeae5  --ink-muted #aaaaa5
              --ink-faint #7a7a75  --neutral-bar #3a3a35  --neutral-other #4a4a45
              --border #3a3a35  --toggle-bg #2f2f2a
       (scheme_2 had no dedicated --accent; links used #6652ff / #4a3ce0)
     ------------------------------------------------------------ */
  :root {
    --bg: #F7FAFC;
    --panel: #EDF2F7;
    --ink: #1A202C;
    --ink-muted: #2D3748;
    --ink-faint: #718096;
    --neutral-bar: #E2E8F0;

    --accent: #6652FF;
    --accent-strong: #4A3CE0;


    --border: #E2E8F0;
    --toggle-bg: #E2E8F0;
    --page-pad-x: 24px;
    --page-max-width: calc(320px * 3 + 32px * 2 + 48px);
  }
  [data-theme="dark"] {
    --bg: #1A202C;
    --panel: #2D3748;
    --ink: #F7FAFC;
    --ink-muted: #CBD5E0;
    --ink-faint: #A0AEC0;
    --neutral-bar: #4A5568;
    --border: #4A5568;
    --toggle-bg: #2D3748;
    --accent: #8B7FFF;
    --accent-strong: #6652FF;
  }

  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  html, body {
    margin: 0; padding: 0; background: var(--bg); color: var(--ink);
    font-family: 'Alliance No.1', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  body {
    min-height: 100vh;
    padding: 0 0 64px;
    display: flex; flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  /* App launcher (grid icon + overlay) + brand icon are styled by app-launcher.js */

  /* ----- Site navigation ----- */
  .site-nav {
    position: sticky; top: 0; z-index: 100;
    width: 100%;
    max-width: var(--page-max-width);
    padding: 7px var(--page-pad-x) 16px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px; flex-wrap: wrap;
    margin-bottom: -8px;
  }
  /* Full-bleed, page-coloured backdrop so the bar masks content scrolling
     underneath. Solid for the top 75%, then fades to transparent over the
     bottom quarter, letting whatever is beneath show through only faintly. */
  .site-nav::before {
    content: ''; position: absolute; z-index: -1; pointer-events: none;
    top: 0; left: 50%; transform: translateX(-50%);
    width: 100vw; height: 100%;
    background: linear-gradient(to bottom, var(--bg) 0 75%, transparent);
  }
  .site-nav .brand { font-family: 'Alliance No.2', system-ui, sans-serif;
    font-family: 'Alliance No.1', system-ui, sans-serif;
    font-size: 12px; font-weight: 500; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--ink);
    text-decoration: none; flex-shrink: 0;
  }
  .site-nav .nav-group {
    display: flex; align-items: center;
    flex-wrap: wrap; gap: 18px; margin-left: auto;
  }
  .site-nav .links { font-family: 'Alliance No.2', system-ui, sans-serif;
    display: flex; flex-wrap: wrap; gap: 18px;
    font-size: 12.5px; font-weight: 600;
  }
  .site-nav .links a {
    color: var(--ink-muted); text-decoration: none;
    transition: color 0.15s;
  }
  .site-nav .links a:hover { color: var(--ink); }
  .site-nav .links a.active {
    color: var(--ink);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 2px;
  }
  /* Menu button — only on narrow screens, injected by app-launcher.js so
     it sits with the theme toggle and app switcher as a group of three. */
  .nav-burger {
    display: none; width: 30px; height: 30px; flex-shrink: 0;
    align-items: center; justify-content: center;
    background: transparent; border: 0; padding: 0; cursor: pointer;
    color: var(--ink-muted); border-radius: 6px;
    transition: background 0.15s, color 0.15s;
  }
  .nav-burger svg { width: 18px; height: 18px; display: block; }
  .nav-burger:hover, .nav-burger.open { color: var(--ink); background: var(--toggle-bg); }

  .theme-toggle {
    appearance: none; background: transparent; border: 0;
    color: var(--ink-muted); cursor: pointer;
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    padding: 0;
  }
  .theme-toggle:hover { color: var(--ink); background: var(--toggle-bg); }
  .theme-toggle svg { width: 18px; height: 18px; display: block; }
  .theme-toggle .icon-sun  { display: none; }
  .theme-toggle .icon-moon { display: block; }
  [data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
  [data-theme="dark"] .theme-toggle .icon-moon { display: none; }

  /* ----- Page wrapper ----- */
  .page-head, .page-body {
    width: 100%; max-width: var(--page-max-width);
    margin: 0 auto; padding: 0 var(--page-pad-x);
  }
  .page-head { display: flex; flex-direction: column; gap: 18px; }
  .page-body { display: flex; flex-direction: column; gap: 18px; }

  /* ----- Hero / meta ----- */
  .meta { display: flex; flex-direction: column; gap: 8px; max-width: 820px; }
  .meta h1 { font-family: 'Alliance No.2', system-ui, sans-serif; font-size: 48px; font-weight: 700; line-height: 1.08; margin: 0; letter-spacing: -0.02em; }
  .meta .sub { font-size: 15.5px; color: var(--ink-muted); line-height: 1.55; }
  .meta .sub a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted currentColor; }
  .meta .sub a:hover { color: var(--ink-muted); }
  @media (max-width: 700px) { .meta h1 { font-family: 'Alliance No.2', system-ui, sans-serif; font-size: 36px; }
}

  /* ----- Splash page head — a large centred masthead for the section
     landing pages. No artwork behind it, so it reads correctly in both
     light and dark themes. ----- */
  .page-head.splash { align-items: center; padding-top: 58px; padding-bottom: 26px; }
  .page-head.splash .meta { align-items: center; text-align: center; max-width: 900px; }
  .page-head.splash .meta h1 {
    font-size: clamp(38px, 5vw, 62px); line-height: 1.05; letter-spacing: -0.03em;
  }
  .page-head.splash .meta .sub {
    font-size: clamp(15.5px, 1.4vw, 18px); line-height: 1.55;
    color: var(--ink-muted); max-width: 880px;
  }
  @media (max-width: 640px) {
    .page-head.splash { padding-top: 34px; padding-bottom: 14px; }
}
  @keyframes ai-blink { 50% { opacity: 0; } }

  /* ----- Section heading ----- */
  /* Names a subsection. The rule above it does the separating, so
     consecutive sections need no extra divider of their own. Matches the
     National Capability Atlas so the two sites read as one family. */
  .fb-h3 {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: clamp(17px, 1.7vw, 23px); font-weight: 700;
    letter-spacing: -0.015em; text-transform: none; color: var(--ink);
    border-top: 1px solid var(--border);
    margin: 54px 0 18px; padding-top: 12px; scroll-margin-top: 18px;
  }
  .section-blurb {
    font-size: 13.5px; color: var(--ink-muted); line-height: 1.55; max-width: 760px;
    margin: 0 0 8px;
  }

  /* ===== Changelog (changelog.html) =====
     One release per section: a head carrying the version and date, the
     counts that moved, then the prose of what changed. ----- */
  .cl-release { display: flex; flex-direction: column; }
  /* The divider belongs to the whole head row, so it runs the full width —
     under the version tag and date as well as the title — rather than
     stopping where the heading text's own rule would end. */
  .cl-head {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px;
    border-top: 1px solid var(--border);
    margin: 54px 0 10px; padding-top: 12px;
  }
  .cl-head .fb-h3 { border-top: 0; margin: 0; padding-top: 0; flex: 1 1 auto; }
  /* The version reads as a number rather than a code, so it takes the
     display face like the counts below it, not the monospace of an id. */
  .cl-ver {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 12px; font-weight: 700; letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums; color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 6px; padding: 2px 8px; flex-shrink: 0;
  }
  .cl-date {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink-faint); flex-shrink: 0;
  }
  .cl-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 10px; margin: 18px 0 4px;
  }
  .cl-stat {
    display: flex; flex-direction: column; gap: 4px;
    border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px;
  }
  .cl-stat-n {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .cl-stat-k {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-faint);
  }
  .cl-sub {
    font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--ink-faint);
    margin: 30px 0 10px;
  }
  .cl-list {
    font-size: 13.5px; color: var(--ink-muted); line-height: 1.6;
    max-width: 860px; margin: 0; padding-left: 18px;
    display: flex; flex-direction: column; gap: 7px;
  }
  .cl-list b, .dom-para b { color: var(--ink); }
  .cl-list a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted currentColor; }
  .cl-list a:hover { color: var(--ink-muted); }
  /* A long code column would otherwise push the table past the page. */
  .cl-table-wrap { overflow-x: auto; margin-top: 12px; }
  .cl-table {
    border-collapse: collapse; width: 100%; min-width: 620px;
    font-size: 13px; color: var(--ink-muted);
  }
  .cl-table th {
    text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-faint);
    border-bottom: 1px solid var(--border); padding: 0 14px 8px 0;
  }
  .cl-table td { border-bottom: 1px solid var(--border); padding: 10px 14px 10px 0; vertical-align: top; }
  .cl-table tr:last-child td { border-bottom: 0; }
  /* A code is read as one string, so it holds its line and the wrapper
     scrolls instead of breaking it mid-identifier. */
  .cl-table code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px; color: var(--ink); white-space: nowrap;
  }
  .cl-table td:first-child { white-space: nowrap; }
  .cl-foot { font-size: 12px; color: var(--ink-faint); line-height: 1.55; max-width: 760px; margin: 16px 0 0; }

  /* ===== Capability detail box (index.html) =====
     Clicking a cell in the framework grid opens this: what the node is,
     its code, its description, and the capabilities it relates to. Those
     are clickable in turn, so the box walks the framework without
     leaving the grid. ----- */
  .cd-scrim {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.38);
    display: none; align-items: center; justify-content: center;
    padding: 24px;
  }
  .cd-scrim.open { display: flex; }
  .cd-box {
    width: 100%; max-width: 520px; max-height: min(78vh, 660px);
    display: flex; flex-direction: column;
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.28);
    padding: 22px 22px 6px;
  }
  .cd-head { display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0; }
  .cd-title {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 19px; font-weight: 700; letter-spacing: -0.015em;
    line-height: 1.2; margin: 0;
  }
  .cd-code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink-faint);
    margin-top: 5px; word-break: break-all;
  }
  .cd-close {
    appearance: none; background: transparent; border: 0; padding: 0;
    margin-left: auto; flex-shrink: 0; cursor: pointer;
    width: 28px; height: 28px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink-faint); transition: background 0.15s, color 0.15s;
  }
  .cd-close:hover { background: var(--toggle-bg); color: var(--ink); }
  .cd-close svg { width: 15px; height: 15px; display: block; }
  /* `contain` keeps a flick at the end of the box from carrying on into the
     page behind it, which on a phone reads as the grid running away. */
  .cd-scroll { overflow-y: auto; overscroll-behavior: contain; margin-top: 14px; padding-bottom: 18px; }
  .cd-desc { font-size: 14px; line-height: 1.6; color: var(--ink-muted); margin: 0; }
  .cd-sub {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--ink-faint);
    margin: 20px 0 8px; padding-top: 14px; border-top: 1px solid var(--border);
  }
  .cd-meta {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink-faint);
    margin-top: 16px;
  }
  /* Boundary conditions, order logic and what changed at the last revision —
     prose that reads under its own heading rather than as another list row. */
  .cd-note {
    font-size: 13px; line-height: 1.6; color: var(--ink-muted);
    margin: 0;
  }
  .cd-count {
    font-variant-numeric: tabular-nums; letter-spacing: 0;
    color: var(--ink-faint); font-weight: 600;
  }
  .cd-list { display: flex; flex-direction: column; gap: 2px; }
  .cd-item, .cd-item:visited {
    display: flex; align-items: center; gap: 8px;
    /* Long capability names have to wrap rather than push the row wider
       than the box — a flex item won't shrink past min-content unless told. */
    min-width: 0; overflow-wrap: anywhere;
    font-size: 13px; color: var(--ink); text-decoration: none;
    padding: 7px 9px; border-radius: 7px; cursor: pointer;
    background: transparent; border: 0; font-family: inherit; text-align: left;
    transition: background 0.15s, color 0.15s;
  }
  .cd-item:hover { background: var(--toggle-bg); color: var(--accent); }
  /* Classification rows — the dimension, domain and group a node sits
     under, each labelled so the three read as one path. */
  .cd-path-k {
    flex-shrink: 0; width: 76px; font-size: 10px;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
  }
  .cd-ext::after {
    content: '↗'; margin-left: auto; flex-shrink: 0;
    font-size: 11px; color: var(--ink-faint);
  }
  @media (max-width: 640px) {
    .cd-scrim { padding: 14px; align-items: flex-end; }
    .cd-box { max-height: 84vh; border-radius: 14px 14px 0 0; }
}

  /* ===== Datasets (datasets.html) =====
     Six square tiles across the top, then one numbered profile row per
     dataset, alternating sides. Layout and copy adapted from the
     Factbase datasets page, in our own type and palette. ----- */
  /* Wider than the page's normal gutters — six tiles need the room — but
     still a contained column rather than the full-bleed treatment the
     framework grid uses. */
  .ds-wrap {
    width: 100%; max-width: 1300px; box-sizing: border-box;
    margin: 0 auto; padding: 0 var(--page-pad-x);
  }

  /* ----- Overview tiles ----- */
  .ds-tiles {
    display: grid;
    /* minmax(0,1fr) lets a column shrink under its content's min-width;
       without it a long name forces the grid wider than the viewport. */
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px; margin-top: 8px;
  }
  .ds-square {
    position: relative; display: flex; flex-direction: column;
    min-width: 0; padding: 20px; border-radius: 20px;
    background: var(--panel); color: var(--ink);
    text-decoration: none; border: 1px solid var(--border);
    transition: background-color 0.16s ease, transform 0.18s ease, border-color 0.16s ease;
  }
  /* A half-square spacer drops the title to roughly the tile's midpoint.
     It stays in flow, so a long description grows the tile rather than
     spilling past its floor, and grid stretch keeps every title on the
     same baseline. */
  .ds-square::before { content: ''; display: block; flex-shrink: 0; padding-top: 46%; }
  .ds-square:hover { background: var(--toggle-bg); border-color: var(--ink-faint); transform: translateY(-2px); }
  /* Icon pinned top-left, out of flow so the spacer measures from the
     tile's top edge rather than from under the icon. */
  .ds-square-ico {
    position: absolute; top: 20px; left: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 13px;
    background: var(--neutral-bar); color: var(--ink);
  }
  .ds-square-ico svg { width: 22px; height: 22px; display: block; }
  .ds-square-text { display: flex; flex-direction: column; }
  .ds-square-nm {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 15px; font-weight: 600; line-height: 1.2;
  }
  .ds-square-desc { margin-top: 6px; font-size: 12.5px; line-height: 1.35; color: var(--ink-faint); }
  @media (max-width: 1100px) { .ds-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
  @media (max-width: 600px) { .ds-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

  /* ----- Profile rows ----- */
  .ds-row { padding-top: 96px; }
  .ds-row:first-of-type { padding-top: 44px; }
  .ds-row-inner {
    display: grid; grid-template-columns: 1.05fr 0.95fr;
    gap: 60px; align-items: center;
  }
  .ds-row.reverse .ds-media { order: -1; }
  .ds-num {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 60px; font-weight: 700; line-height: 1;
    letter-spacing: -0.02em; color: var(--accent);
    font-variant-numeric: tabular-nums;
  }
  .ds-row h2 {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    margin: 16px 0 0; font-size: 32px; font-weight: 600;
    line-height: 1.15; letter-spacing: -0.02em; color: var(--ink);
  }
  .ds-row .ds-para { margin-top: 20px; font-size: 15.5px; line-height: 1.55; color: var(--ink-muted); }
  .ds-facts { display: flex; flex-wrap: wrap; gap: 14px 40px; margin-top: 30px; }
  .ds-fact { display: flex; flex-direction: column; gap: 4px; }
  .ds-fact strong {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 24px; font-weight: 700; color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .ds-fact span { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }

  /* The showcase card standing in for each dataset's visual. */
  .ds-card {
    display: flex; flex-direction: column; justify-content: space-between;
    min-height: 340px; padding: 36px; border-radius: 30px;
    background: var(--panel); border: 1px solid var(--border); overflow: hidden;
  }
  .ds-card-ico { color: var(--ink); }
  .ds-card-ico svg { width: 48px; height: 48px; display: block; }
  .ds-card-title {
    font-family: 'Alliance No.2', system-ui, sans-serif;
    font-size: 22px; font-weight: 600; color: var(--ink);
  }
  .ds-card-sub {
    margin-top: 6px; font-size: 12px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-faint);
  }

  @media (max-width: 1280px) { .ds-row h2 { font-size: 28px; }
}
  @media (max-width: 900px) {
    .ds-row-inner { grid-template-columns: 1fr; gap: 32px; }
    /* Stacked, every row reads lead-then-media; the alternation only
       makes sense while the two sit side by side. */
    .ds-row.reverse .ds-media { order: 0; }
}
  @media (max-width: 768px) {
    .ds-row { padding-top: 64px; }
    .ds-row h2 { font-size: 24px; }
    .ds-num { font-size: 48px; }
    .ds-card { min-height: 240px; padding: 26px; border-radius: 22px; }
}

  /* ===== National Capability Framework (capabilities.html) ===== */
  /* Full-bleed: body is a centred flex column spanning the whole viewport,
     so width:100% on this (non-stretched) flex child fills the window edge
     to edge — outside the page's normal max-width gutters. */
  .fw-full {
    width: 100%;
    padding: 22px 24px 40px; box-sizing: border-box;
  }
  .fw-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px; align-items: start;
  }
  .fw-col {
    border-radius: 16px; padding: 14px;
    background: var(--fw-bg); border: 1px solid var(--fw-bd);
  }
  .pw-hard { --pw: #3f8fd0; --pw-cat: #2b6aa3; --fw-bg: #e9f3fb; --fw-bd: #cfe5f6; }
  .pw-soft { --pw: #57b35c; --pw-cat: #2f7a3d; --fw-bg: #ebf6ec; --fw-bd: #d2ead4; }
  .pw-econ { --pw: #e8a92e; --pw-cat: #9c711d; --fw-bg: #fdf4e3; --fw-bd: #f3e2c0; }
  [data-theme="dark"] .pw-hard { --fw-bg: rgba(63,143,208,0.10); --fw-bd: rgba(63,143,208,0.32); --pw-cat: #7fb6e4; }
  [data-theme="dark"] .pw-soft { --fw-bg: rgba(87,179,92,0.10);  --fw-bd: rgba(87,179,92,0.32);  --pw-cat: #84cf89; }
  [data-theme="dark"] .pw-econ { --fw-bg: rgba(232,169,46,0.10); --fw-bd: rgba(232,169,46,0.32); --pw-cat: #e6bd66; }
  .fw-cat {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--pw-cat); margin: 2px 2px 12px;
  }
  /* Same badge as the domain heads, but outlined rather than filled —
     it sits on the column's pale wash, not on a saturated domain bar. */
  .fw-cat-badge {
    margin-left: auto; flex-shrink: 0; letter-spacing: 0;
    background: transparent; color: var(--pw-cat);
    border: 1px solid color-mix(in srgb, var(--pw-cat) 40%, transparent);
    border-radius: 6px; padding: 2px 8px; font-size: 10.5px; font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  /* CSV / JSON export tags — sit to the left of the count on a dimension
     or domain head and copy that branch of the framework to the clipboard.
     Deliberately quieter than the count beside them: the text and icon are
     held back from the head's own colour, and come up to it on hover. */
  .fw-cat-tools { display: flex; align-items: center; gap: 5px; margin-left: auto; flex-shrink: 0; }
  .fw-json {
    display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
    appearance: none; font-family: inherit; cursor: pointer;
    border-radius: 6px; padding: 2px 6px;
    font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em;
    background: transparent; color: color-mix(in srgb, var(--pw-cat) 55%, transparent);
    border: 1px solid color-mix(in srgb, var(--pw-cat) 22%, transparent);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .fw-json:hover {
    color: var(--pw-cat);
    border-color: color-mix(in srgb, var(--pw-cat) 40%, transparent);
    background: color-mix(in srgb, var(--pw-cat) 10%, transparent);
  }
  .fw-json-i { width: 10px; height: 10px; flex-shrink: 0; }
  .fw-json-done { display: none; }
  .fw-json.is-copied .fw-json-copy { display: none; }
  .fw-json.is-copied .fw-json-done { display: block; }
  .fw-domain {
    background: var(--pw); border-radius: 11px; padding: 10px;
    margin-bottom: 12px;
  }
  .fw-domain:last-child { margin-bottom: 0; }
  .fw-dom-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    color: #fff; font-weight: 700; font-size: 12px; letter-spacing: 0.04em;
    text-transform: uppercase; padding: 2px 3px 10px;
  }
  /* The export tags take room off the domain head, so at narrow widths the
     name wraps at its spaces rather than being cut. The name is a button:
     domain and dimension nodes carry boundary conditions and order logic of
     their own from v0.1, and the head is the only way to reach them. */
  /* The reset has to be complete: these sit inside a heading and a bar and
     must be indistinguishable from the text they replaced. The hover rule
     underlines with a shadow rather than a border, so nothing shifts. */
  .fw-dom-nm, .fw-cat-nm {
    min-width: 0; appearance: none; background: transparent; border: 0; padding: 0; margin: 0;
    font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
    line-height: inherit; text-align: left; cursor: pointer;
  }
  .fw-dom-nm:hover, .fw-cat-nm:hover { box-shadow: inset 0 -1px currentColor; }
  .fw-dom-tools { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
  .fw-dom-head .fw-json {
    background: transparent; color: rgba(255,255,255,0.62);
    border-color: rgba(255,255,255,0.26);
  }
  .fw-dom-head .fw-json:hover {
    color: #fff; border-color: rgba(255,255,255,0.5); background: rgba(0,0,0,0.16);
  }
  .fw-badge {
    flex-shrink: 0; background: rgba(0,0,0,0.20); color: #fff;
    border-radius: 6px; padding: 2px 7px; font-size: 10.5px;
    font-variant-numeric: tabular-nums;
  }
  /* Column-major fill (top-to-bottom, then next column) — a fixed 4 rows
     (set inline) keeps domains aligned: e.g. a 6-group domain reads 4 on
     the left, 2 on the right. minmax(0,1fr) makes every card equal width. */
  .fw-areas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: column; gap: 6px; }
  .fw-area {
    min-width: 0;
    position: relative; appearance: none; border: 0; font-family: inherit; text-align: left;
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    background: color-mix(in srgb, #fff 16%, var(--pw));
    color: #fff; text-decoration: none; border-radius: 7px;
    padding: 8px 9px; font-size: 11.5px; font-weight: 500; cursor: pointer;
    transition: background 0.15s, transform 0.05s;
  }
  .fw-area:visited { color: #fff; }
  /* Hovered / focused group lifts above siblings and reveals its dropdown. */
  .fw-area:hover, .fw-area:focus-within { z-index: 70; }
  .fw-area:hover, .fw-area:focus-visible { background: color-mix(in srgb, #000 22%, var(--pw)); }
  .fw-area-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Capability dropdown (level 4) — opens on hover / keyboard focus. */
  .fw-pop {
    display: none;
    position: absolute; top: 100%; left: 0; z-index: 60;
    width: 290px; max-width: 86vw; max-height: 348px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--border); border-radius: 11px;
    box-shadow: 0 18px 44px rgba(0,0,0,0.3);
    padding: 6px 5px 5px;
  }
  .fw-area:hover > .fw-pop, .fw-area:focus-within > .fw-pop { display: block; }
  .fw-pop-head {
    position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
    gap: 8px; background: var(--pw); color: #fff; border-radius: 8px;
    padding: 9px 11px; font-size: 11.5px; font-weight: 700; margin-bottom: 4px;
  }
  .fw-pop-list { display: flex; flex-direction: column; gap: 1px; }
  /* A button, not a link — an end capability opens the detail box rather
     than navigating away, so it needs the button chrome stripped back to
     the row it used to be. */
  .fw-cap {
    display: block; width: 100%; padding: 8px 11px; border-radius: 7px; text-decoration: none;
    color: var(--ink); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    appearance: none; background: transparent; border: 0;
    font-family: inherit; text-align: left; cursor: pointer;
  }
  .fw-cap:hover { background: var(--toggle-bg); color: var(--accent); }
  .fw-num {
    flex-shrink: 0; background: rgba(0,0,0,0.18); color: #fff;
    border-radius: 5px; padding: 1px 6px; font-size: 10px;
    font-variant-numeric: tabular-nums;
  }
  /* As the window narrows, first collapse each domain's group cards to a
     single column so they fit (dimensions stay side by side). */
  @media (max-width: 1024px) {
    .fw-areas {
      grid-template-columns: minmax(0, 1fr);
      grid-auto-flow: row; grid-template-rows: none !important;
    }
    /* Three columns in a narrow window leaves the domain bar too little
       room for a name and two labelled tags, so the tags run on their
       icons alone (the tooltip still names the format). The dimension
       heads have the room, and keep their labels. */
    .fw-dom-head .fw-json-lbl { display: none; }
    .fw-dom-head .fw-json { padding: 3px 5px; }
}
  /* Below that, stack the three dimensions (Hard / Soft / Economic) vertically;
     full width lets the group cards return to two columns. */
  @media (max-width: 720px) {
    .fw-grid { grid-template-columns: 1fr; }
    .fw-areas { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    /* Full-width domains have room for the labels again. */
    .fw-dom-head .fw-json-lbl { display: inline; }
    .fw-dom-head .fw-json { padding: 2px 6px; }
}
  @media (max-width: 460px) {
    .fw-areas { grid-template-columns: 1fr; }
    .fw-pop { width: 86vw; }
}
  .cd-title { font-family: 'Alliance No.2', system-ui, sans-serif; font-size: 18px; font-weight: 700; line-height: 1.15; margin: 9px 0 10px; }
  .cd-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }
  .dom-para {
    font-size: 13.5px; color: var(--ink-muted); line-height: 1.6;
    max-width: 860px; margin: 11px 0 0;
  }
  .dom-para b { color: var(--ink); }

  /* ----- Mobile responsiveness ----- */
  @media (max-width: 640px) {
    :root { --page-pad-x: 16px; }
    body { padding: 0 0 48px; gap: 16px; }
    .site-nav { gap: 10px; }
    .site-nav .nav-group { gap: 8px; }
    /* The app switcher pulls itself 12px left of the nav-group gap; the
       burger does the same so the three icons read as one tight group. */
    .nav-burger { display: inline-flex; margin-right: -12px; }
    /* Links become a panel hung under the button group; the burger,
       theme toggle and app switcher stay in a row on the right. */
    .site-nav .links {
      display: none; position: absolute; top: calc(100% - 10px); right: var(--page-pad-x);
      z-index: 60; min-width: 180px; flex-direction: column; gap: 2px;
      background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 8px; font-size: 13.5px;
    }
    .site-nav .links.open { display: flex; }
    .site-nav .links a { padding: 9px 12px; border-radius: 8px; }
    .site-nav .links a:hover { background: var(--toggle-bg); }
    .site-nav .links a.active { border-bottom: 0; padding-bottom: 9px; color: var(--accent-strong); }
    .meta h1 { font-family: 'Alliance No.2', system-ui, sans-serif; font-size: 30px; }
    .meta .sub { font-size: 14px; }
    .dom-para { font-size: 13px; }
}

  /* On the narrowest phones the tracked-out wordmark is wider than the
     bar, which leaves the page a pixel or two scrollable sideways.
     Tighten the tracking rather than truncate the name. */
  @media (max-width: 400px) {
    .site-nav .brand { font-size: 11.5px; letter-spacing: 0.11em; }
  }

  /* ----- Footer ----- */
  .site-footer {
    width: 100%; max-width: var(--page-max-width);
    margin: 40px auto 0;
    padding: 18px var(--page-pad-x) 0;
    border-top: 1px solid var(--border);
    font-size: 11.5px; letter-spacing: 0.04em;
    color: var(--ink-faint); font-weight: 500;
  }
  .site-footer a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
  .site-footer a:hover { color: var(--ink); }