/* ============================================================
   Robotics Industry & Policy Tracker — design system
   Per DESIGN.md § 15: four named themes (caves / naked-sun /
   dawn / robot-dreams), role-based CSS variables, web fonts
   justified as theme identity. WCAG 2.1 AA across all themes.
   ============================================================ */

/* --- Universal tokens (theme-independent) --- */

:root {
  /* Type stacks: each theme overrides --font-serif (display) and
     --font-sans (body). Mono stays universal. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-serif: "Charter", "Iowan Old Style", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    monospace;

  /* Layout */
  --max-w: 1280px;
  --header-h: 56px;

  /* Theme-tunable aesthetic tokens (defaults if no theme is set) */
  --radius-card: 10px;
  --radius-pill: 999px;
  --surface-backdrop: none;
  --transition-fast: 90ms;
  --transition-base: 120ms;
  --transition-slow: 200ms;

  /* Tabular numerals everywhere */
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Theme 1: Caves of Steel (Earth) ---
   The enclosed City: eight million people under one roof, no sky, permanent
   artificial light. Two book details drive the palette away from generic dark
   mode: the accent is low-pressure *sodium* amber (#FFB000) — the real colour
   of the lighting a domed City and its expressway strips would run on, where
   the old #FFC700 was a lemon yellow no sodium lamp emits — and "positive" is
   yeast-vat green, since Earth eats what the New Jersey yeast farms grow, not
   the neon #00FF66 of a terminal. Greys carry a faint blue-steel cast: steel
   and concrete, not warm carbon. Sharpest radii of the four. */

[data-theme="caves"] {
  --font-serif: "Barlow Condensed", "Arial Narrow", "Helvetica Condensed", "Impact", sans-serif;
  --font-sans: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  --bg: #101013;
  --surface: #191a1e;
  --surface-2: #232529;
  --border: #303338;
  --border-strong: #6b7280;
  --text: #f2f3f5;
  --text-muted: #adb2ba;
  --text-faint: #949ba5;
  --accent: #ffb000;
  --accent-soft: #3a2600;
  --accent-on: #101013;
  --link: #ffb000;

  --status-positive: #86c46a;
  --status-positive-soft: #1c2a16;
  --status-warning: #ffb000;
  --status-warning-soft: #3a2600;
  --status-negative: #ff6b5e;
  --status-negative-soft: #3a1613;
  --status-neutral: #adb2ba;
  --status-neutral-soft: #26282c;

  --cat-funding: #c3a2f0;
  --cat-deployment: #5fd6ce;
  --cat-policy: #f0c560;
  --cat-competitive: #f58aae;
  --cat-supplychain: #8fb4f0;
  --cat-geopolitics: #f5a07c;
  --cat-research: #9cd98f;

  --dir-accelerating: #86c46a;
  --dir-stable: #adb2ba;
  --dir-slowing: #ffb000;

  --radius-card: 2px;
  --radius-pill: 2px;
  --shadow-rest: 0 0 0 1px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 0 0 1px var(--border-strong);
}

/* --- Theme 2: The Naked Sun (Solaria) ---
   Twenty thousand people on a whole planet, ten thousand robots each, and a
   sun so exposed it is the thing Baley cannot bear to stand under. The word is
   *bleached*, so every neutral here is cold: the old palette's alabaster beige
   (#F0ECE1 / #E5E0D5) was the single biggest reason this theme read as a
   slightly duller Dawn instead of its opposite, and it is now cold grey. The
   accent is Solarian estate cypress pushed toward teal — the only saturated
   thing on an over-lit world. Slowest transitions of the four (Solarians do
   not hurry, and they meet by "viewing", never in person). */

[data-theme="naked-sun"] {
  --font-serif: "Didot", "Bodoni MT", "Bodoni Moda", "Big Caslon", "Palatino Linotype", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  --bg: #fbfcfc;
  --surface: #ffffff;
  --surface-2: #eceff1;
  --border: #dfe4e7;
  --border-strong: #7c8489;
  --text: #15181a;
  --text-muted: #4f585d;
  --text-faint: #5f686e;
  --accent: #14564a;
  --accent-soft: #d6e5e1;
  --accent-on: #fbfcfc;
  --link: #14564a;

  --status-positive: #14564a;
  --status-positive-soft: #d6e5e1;
  --status-warning: #7a5b10;
  --status-warning-soft: #efe8d3;
  --status-negative: #8a2318;
  --status-negative-soft: #f0dad6;
  --status-neutral: #4f585d;
  --status-neutral-soft: #e8ebed;

  --cat-funding: #4a3778;
  --cat-deployment: #155757;
  --cat-policy: #71460f;
  --cat-competitive: #872458;
  --cat-supplychain: #264778;
  --cat-geopolitics: #57241f;
  --cat-research: #245524;

  --dir-accelerating: #14564a;
  --dir-stable: #4f585d;
  --dir-slowing: #71460f;

  --radius-card: 14px;
  --shadow-rest: none;
  --shadow-elevated: 0 2px 20px rgba(21, 24, 26, 0.05);
  --transition-base: 200ms;
  --transition-slow: 320ms;
}

/* --- Theme 3: The Robots of Dawn (Aurora) ---
   Aurora is named for the goddess of the dawn — the World of the Dawn, first
   and richest of the Spacer worlds. The old palette had the right idea and the
   wrong depth: #8C4303 reads brown, not sunrise, and left no headroom. The
   accent is now a deeper terracotta struck by low sun, the category ramp gains
   the violet of the sky before sunrise (funding) and a true rose
   (competitive), and the neutrals stay unapologetically warm — this is the one
   theme allowed to be, since it is what Naked Sun is now defined against. */

[data-theme="dawn"] {
  --font-serif: "Cormorant Garamond", Georgia, "Iowan Old Style", "Apple Garamond", "Palatino", serif;
  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  --bg: #fff8f2;
  --surface: #ffffff;
  --surface-2: #f3e4d6;
  --border: #e8d9c7;
  --border-strong: #8c7454;
  --text: #2b221c;
  --text-muted: #655648;
  --text-faint: #756454;
  --accent: #9a3d12;
  --accent-soft: #f7e2ce;
  --accent-on: #fff8f2;
  --link: #9a3d12;

  --status-positive: #3b6534;
  --status-positive-soft: #e1ebd6;
  --status-warning: #8f4a0c;
  --status-warning-soft: #f7e2ce;
  --status-negative: #8a2618;
  --status-negative-soft: #f5d7d1;
  --status-neutral: #655648;
  --status-neutral-soft: #eee5dc;

  --cat-funding: #5a3a8c;
  --cat-deployment: #1b6363;
  --cat-policy: #8f5312;
  --cat-competitive: #a32a64;
  --cat-supplychain: #37547f;
  --cat-geopolitics: #653232;
  --cat-research: #3f6a3d;

  --dir-accelerating: #3b6534;
  --dir-stable: #655648;
  --dir-slowing: #8f5312;

  --radius-card: 16px;
  --shadow-rest: 0 1px 3px rgba(43, 34, 28, 0.08);
  --shadow-elevated: 0 8px 24px rgba(43, 34, 28, 0.10);
}

/* --- Theme 4: Robot Dreams (the subconscious) ---
   Repainted off cyan-on-midnight, which owed more to stock sci-fi than to the
   1986 story. What Elvex actually dreams is a colourless grey in which robots
   labour, lit by one distant sun — so: a grey-indigo ground (not a saturated
   space blue), warm-silver text, warm-grey hairlines, and a single amber light
   as the accent. The glass surfaces and the glow stay, because the dream is
   still soft-edged and lit from within; only the hue moved. `--accent-on` is
   still mandatory inside any accent fill — amber on warm silver is ~1.9:1. */

[data-theme="robot-dreams"] {
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, "Palatino Linotype", serif;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

  --bg: #14151a;
  --surface: rgba(31, 33, 41, 0.66);
  --surface-2: rgba(31, 33, 41, 0.45);
  --border: rgba(205, 199, 187, 0.16);
  --border-strong: rgba(205, 199, 187, 0.55);
  --text: #e8e4db;
  --text-muted: #a39d91;
  --text-faint: #9a9488;
  --accent: #f2a65a;
  --accent-soft: rgba(242, 166, 90, 0.14);
  --accent-on: #14151a;        /* MUST be used for text inside any accent fill */
  --link: #f2a65a;

  --status-positive: #8fd79a;
  --status-positive-soft: rgba(143, 215, 154, 0.14);
  --status-warning: #f2c75a;
  --status-warning-soft: rgba(242, 199, 90, 0.14);
  --status-negative: #f08279;
  --status-negative-soft: rgba(240, 130, 121, 0.14);
  --status-neutral: #a39d91;
  --status-neutral-soft: rgba(163, 157, 145, 0.14);

  --cat-funding: #c4a6e8;
  --cat-deployment: #7ed9c0;
  --cat-policy: #f2c75a;
  --cat-competitive: #ee93b0;
  --cat-supplychain: #9db6e8;
  --cat-geopolitics: #f0a37e;
  --cat-research: #a6d392;

  --dir-accelerating: #8fd79a;
  --dir-stable: #a39d91;
  --dir-slowing: #f2c75a;

  --radius-card: 12px;
  --shadow-rest: 0 0 0 1px rgba(242, 166, 90, 0.08);
  --shadow-elevated: 0 0 24px rgba(242, 166, 90, 0.16);
  --surface-backdrop: blur(12px) saturate(120%);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

/* The [hidden] trap — explicit override per DESIGN.md § 12.1 */
[hidden] { display: none !important; }

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 90ms;
}
a:hover { border-bottom-color: var(--link); }

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* iOS auto-zoom suppression */
  color: var(--text);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   Layout — header, container
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  height: var(--header-h);
}

/* Header status block (replaces the old brand wordmark). Wrapped in an
   <a href="index.html"> so the upper-left area still navigates home. */
.header-updated {
  display: flex;
  flex: 0 0 auto;   /* fixed sibling — see the flex-basis note on .primary-nav */
  flex-direction: column;
  gap: 0;
  line-height: 1.15;
  color: var(--text-muted);
  border-bottom: none;
  transition: color var(--transition-base, 120ms);
}
.header-updated:hover { color: var(--text); border-bottom: none; }
.header-updated-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  font-weight: 600;
}
.header-updated-date {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--text);
}

/* Priority+ nav. Every section link ships once, in .nav-list; app.js moves the
   trailing ones into .nav-overflow (inside the "Sections" disclosure) until the
   strip fits, and moves them back as the window widens. Two consequences the
   CSS has to hold up:
     - the nav must be the flex item that absorbs the leftover width, so
       `nav.clientWidth` is the space JS is actually fitting into — hence
       flex:1 1 auto + min-width:0 rather than the old margin-left:auto only;
     - before JS runs (and with JS off) nothing may be unreachable, so the
       default is a horizontally scrollable chip strip. .nav-managed, added by
       app.js, hands overflow back to the dropdown. */
nav.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  /* `1 1 0`, NOT `1 1 auto`. With an auto basis the nav's share of the header
     row depends on its own content, so `nav.clientWidth` measured while every
     link is inline came back 317px — and then settled at 289px once the links
     moved out and the siblings relaxed back to their natural widths. The
     layout was fitting to a width that no longer existed by the time it
     finished, which is what printed "US vs China" underneath "Sections".
     A zero basis makes the nav's width a pure function of the siblings, so
     one measurement holds for the whole pass. */
  flex: 1 1 0;
  min-width: 0;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
nav.primary-nav::-webkit-scrollbar { display: none; }
nav.primary-nav.nav-managed { overflow: visible; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.nav-list > li { flex: 0 0 auto; }
.nav-overflow {
  list-style: none;
  margin: 0;
  padding: 0;
}
nav.primary-nav a,
.primary-more > summary {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  border-bottom: none;
  font-weight: 500;
  font-size: 14px;
  transition: background 120ms, color 120ms;
}
nav.primary-nav a:hover,
nav.primary-nav a[aria-current="page"],
.primary-more > summary:hover,
.primary-more[data-current="true"] > summary {
  background: var(--surface-2);
  color: var(--text);
}
.primary-more {
  position: relative;
  /* Must NOT shrink. app.js reserves `more.offsetWidth` when deciding how many
     links fit, and it takes that measurement while every link is still inline
     — i.e. while the flex row is over-full. With the default `flex: 0 1 auto`
     the browser had already squeezed this button down, so the reserve came
     back ~60px instead of ~83px and the layout stopped one link too early,
     leaving "US vs China" printed underneath "Sections" at 420px. */
  flex: 0 0 auto;
}
.primary-more > summary {
  list-style: none;
  cursor: pointer;
}
.primary-more > summary::-webkit-details-marker {
  display: none;
}
.primary-more > summary::after {
  content: "v";
  display: inline-block;
  margin-left: 6px;
  color: var(--text-faint);
  font-size: 12px;
}
.primary-more[open] > summary::after {
  transform: rotate(180deg);
}
.primary-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: var(--surface-backdrop);
  -webkit-backdrop-filter: var(--surface-backdrop);
  box-shadow: var(--shadow-elevated);
  z-index: 60;
}
.primary-more-menu a {
  display: block;
  white-space: nowrap;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: background 120ms, color 120ms;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 16px 52px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

h1.page-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.015em;
  margin: 4px 0 4px;
  line-height: 1.15;
}
.page-lede {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 64ch;
  margin: 0 0 18px;
  line-height: 1.5;
}

/* ============================================================
   BLUF — Bottom Line Up Front. One per page, directly under the
   lede. The single most important takeaway, stated first.
   ============================================================ */
.bluf {
  display: flex;
  gap: 14px;
  align-items: baseline;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 13px 16px;
  margin: 0 0 22px;
  max-width: 74ch;
}
.bluf-tag {
  flex: none;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent);
  white-space: nowrap;
}
.bluf-body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.bluf-body strong { font-weight: 600; }
@media (max-width: 540px) {
  .bluf { flex-direction: column; gap: 5px; padding: 12px 14px; }
}

h2.section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 20px 0 8px;
}
/* Section rule — the horizontal keyline a newspaper puts under a section head.
   Modifier, not a new class, so every existing .section-title is unaffected. */
h2.section-title.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-strong);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================================================
   Front page (index.html) — newspaper furniture.
   Masthead → lead + rail → secondary stories → data sections.
   All of it renders from RT.* so the bake step produces the same
   markup for crawlers; nothing here is duplicated per breakpoint.
   ============================================================ */

.masthead {
  border-bottom: 3px solid var(--text);
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.masthead-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.masthead-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(30px, 5.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 6px 0 0;
}
.masthead-strap {
  font-family: var(--font-serif);
  font-size: clamp(15px, 2vw, 19px);
  color: var(--text-muted);
  margin: 8px 0 0;
  max-width: 60ch;
}
.masthead-standfirst {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* Lead + rail. Single grid, one DOM order: on narrow screens the rail simply
   stacks under the lead, which is also the reading order a screen reader gets. */
.front-top {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.front-well { min-width: 0; }
/* Inside the well the rule sits tighter than a page-level section head. */
.front-well .section-title.rule { margin-top: 22px; }
@media (max-width: 860px) {
  .front-top { grid-template-columns: 1fr; gap: 20px; }
}

.lead-story { border-bottom: 1px solid var(--border); padding-bottom: 18px; }
.lead-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.lead-flag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.lead-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.018em;
  margin: 0 0 10px;
}
.lead-title a { color: var(--text); border-bottom: none; }
.lead-title a:hover { color: var(--accent); }
.lead-deck {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 12px;
  max-width: 68ch;
}
.lead-byline,
.story-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.lead-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
.lead-original { font-size: 13px; margin-left: auto; }

/* Rail */
.front-rail {
  border-left: 1px solid var(--border);
  padding-left: 20px;
}
@media (max-width: 860px) {
  .front-rail { border-left: none; padding-left: 0; border-top: 2px solid var(--border-strong); padding-top: 14px; }
}
.rail-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 6px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-strong);
}
.brief-list { list-style: none; margin: 0; padding: 0; }
.brief {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.brief-link { color: inherit; border-bottom: none; display: block; }
.brief-link:hover .brief-title { color: var(--accent); }
.brief-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 2px;
}
/* Colour-only variants of the same seven category tokens the pills use. Text,
   not a filled chip, because the rail is a dense list — but the mapping has to
   stay identical to the .pill.cat-* block above, so both are edited together. */
.brief-cat.cat-funding     { color: var(--cat-funding); }
.brief-cat.cat-deployment  { color: var(--cat-deployment); }
.brief-cat.cat-policy      { color: var(--cat-policy); }
.brief-cat.cat-competitive { color: var(--cat-competitive); }
.brief-cat.cat-supplychain { color: var(--cat-supplychain); }
.brief-cat.cat-geopolitics { color: var(--cat-geopolitics); }
.brief-cat.cat-research    { color: var(--cat-research); }
.brief-title { font-size: 13.5px; line-height: 1.35; font-weight: 500; }
.brief-meta { font-size: 11px; color: var(--text-faint); }
.brief-all { border-bottom: none; padding-top: 12px; font-size: 13px; font-weight: 600; }

/* Secondary stories — 3 across, collapsing to 1 with no duplicate markup. */
.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}
.story-card {
  padding: 4px 20px 0;
  border-left: 1px solid var(--border);
}
.story-card:first-child { padding-left: 0; border-left: none; }
.story-card:last-child { padding-right: 0; }
.story-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.story-co { font-size: 11.5px; color: var(--text-faint); }
.story-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.22;
  letter-spacing: -0.008em;
  margin: 0 0 8px;
}
.story-title a { color: var(--text); border-bottom: none; }
.story-title a:hover { color: var(--accent); }
.story-deck {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 10px;
}
@media (max-width: 860px) {
  .story-grid { grid-template-columns: 1fr; }
  .story-card {
    padding: 14px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .story-card:first-child { border-top: none; padding-top: 4px; }
}

/* Touch targets. The front page turned three things into links that weren't:
   the category chip (a <span> in renderNewsCard, an <a> to the filtered feed
   here), "Read original" on the lead, and the rail's "All N stories". At their
   type sizes they land around 21px, against the 44px floor CLAUDE.md and
   DESIGN.md both call non-negotiable. Padding would wreck the layout, so the
   hit area is grown with a transparent ::after — the chip keeps its 21px
   visual weight and gains a 44px target. Pointer devices don't need it. */
@media (pointer: coarse) {
  .lead-kicker .pill,
  .story-kicker .pill,
  .lead-original,
  .brief-all a {
    position: relative;
  }
  .lead-kicker .pill::after,
  .story-kicker .pill::after,
  .lead-original::after,
  .brief-all a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
  /* The brief rows are the rail's main target: give the whole row the height
     rather than just the headline's line box. */
  .brief-link { min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
}

/* ============================================================
   Executive brief — three quotable findings under the BLUF.
   Memo-style: each bullet stands alone as a staffer's takeaway.
   ============================================================ */
.exec-brief {
  max-width: 74ch;
  margin: 0 0 22px;
}
.exec-brief-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: brief;
  display: grid;
  gap: 10px;
}
.exec-brief-list li {
  counter-increment: brief;
  position: relative;
  padding: 10px 14px 10px 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}
.exec-brief-list li strong { color: var(--text); font-weight: 600; }
.exec-brief-list li::before {
  content: counter(brief);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.exec-brief-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}
.exec-brief-note a { color: var(--text-muted); border-bottom: 1px dotted var(--border-strong); }

/* ============================================================
   Chart legend — shared dot legend for SVG charts (app.js
   renderProductionTrend fills these on index / china / supply-chain).
   ============================================================ */
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 0; font-size: 12px; color: var(--text-muted); }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ============================================================
   Score bar — visual tally of scoreboard edge calls (china.html).
   Colors pair with the labeled counts above it; never color-only.
   ============================================================ */
.score-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  max-width: 74ch;
  margin: 8px 0 0;
  background: var(--surface-2);
}
.score-bar .seg { height: 100%; }
.score-bar .seg.cn { background: var(--status-negative); opacity: 0.85; }
.score-bar .seg.even { background: var(--status-neutral); opacity: 0.45; }
.score-bar .seg.us { background: var(--cat-supplychain); }

/* ============================================================
   Collapsible Sections
   ============================================================ */

details.collapsible-section {
  margin-top: 18px;
  margin-bottom: 16px;
}

details.collapsible-section > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
}

details.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

details.collapsible-section > summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-muted);
  position: absolute;
  left: 0;
  top: 6px;
  line-height: 1;
  transition: transform var(--transition-base, 120ms), color var(--transition-base, 120ms);
}

details.collapsible-section[open] > summary::before {
  transform: rotate(90deg);
}

details.collapsible-section > summary > h2.section-title {
  display: inline-block;
  margin-top: 0;
  margin-bottom: 4px;
  transition: color var(--transition-base, 120ms);
}

details.collapsible-section > summary > p.muted {
  margin-top: 0;
  margin-bottom: 14px;
}

details.collapsible-section > summary:hover > h2.section-title,
details.collapsible-section > summary:hover::before {
  color: var(--accent);
}

footer.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 18px 16px;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}

footer.site-footer .footer-credit {
  margin-top: 8px;
}

/* ============================================================
   KPI / stats strip
   ============================================================ */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 640px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (min-width: 1024px) {
  .kpi-strip { grid-template-columns: repeat(5, 1fr); }
}
/* If a page has only 4 KPIs (e.g. policies page), use 4-up on desktop */
.kpi-strip.cols-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 1024px) {
  .kpi-strip.cols-4 { grid-template-columns: repeat(4, 1fr); }
}
/* 6 KPIs (dashboard incl. the deployment-gap card) — 6-up on desktop */
@media (min-width: 1024px) {
  .kpi-strip.cols-6 { grid-template-columns: repeat(6, 1fr); }
}

.kpi-card {
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 10px 12px;
  box-shadow: var(--shadow-rest);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
/* KPI cards are drill-down links (dashboard). Anchor styling is neutralised so
   they still read as cards, with the hover lift borrowed from .card-hoverable
   as the affordance; :focus-visible is handled globally. The 44px floor keeps
   the touch target legal even when a card holds only a short value. */
a.kpi-card {
  color: inherit;
  min-height: 44px;
  transition: transform 120ms, box-shadow 120ms, border-color 120ms;
}
a.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-strong);
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ============================================================
   Pills
   ============================================================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--status-neutral-soft);
  color: var(--status-neutral);
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill.outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.pill.positive { background: var(--status-positive-soft); color: var(--status-positive); }
.pill.warning  { background: var(--status-warning-soft);  color: var(--status-warning); }
.pill.negative { background: var(--status-negative-soft); color: var(--status-negative); }
.pill.mixed    { background: var(--status-warning-soft);  color: var(--status-warning); }

/* Category pills — semantic to data type */
.pill.cat-funding     { background: color-mix(in srgb, var(--cat-funding) 14%, transparent); color: var(--cat-funding); }
.pill.cat-deployment  { background: color-mix(in srgb, var(--cat-deployment) 14%, transparent); color: var(--cat-deployment); }
.pill.cat-policy      { background: color-mix(in srgb, var(--cat-policy) 14%, transparent); color: var(--cat-policy); }
.pill.cat-competitive { background: color-mix(in srgb, var(--cat-competitive) 14%, transparent); color: var(--cat-competitive); }
.pill.cat-supplychain { background: color-mix(in srgb, var(--cat-supplychain) 14%, transparent); color: var(--cat-supplychain); }
.pill.cat-geopolitics { background: color-mix(in srgb, var(--cat-geopolitics) 14%, transparent); color: var(--cat-geopolitics); }
.pill.cat-research    { background: color-mix(in srgb, var(--cat-research) 14%, transparent); color: var(--cat-research); }

.pill.dir-accelerating { background: color-mix(in srgb, var(--dir-accelerating) 14%, transparent); color: var(--dir-accelerating); }
.pill.dir-stable       { background: color-mix(in srgb, var(--dir-stable) 14%, transparent); color: var(--dir-stable); }
.pill.dir-slowing      { background: color-mix(in srgb, var(--dir-slowing) 14%, transparent); color: var(--dir-slowing); }

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-rest);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-hoverable {
  transition: transform 120ms, box-shadow 120ms, border-color 120ms;
  cursor: pointer;
}
.card-hoverable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-strong);
}

.card-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.005em;
  margin: 0;
  line-height: 1.25;
}
.card-sub {
  color: var(--text-muted);
  font-size: 13px;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.card-meta .sep::before { content: "·"; padding: 0 4px; color: var(--text-faint); }

.card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   Filters
   ============================================================ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: 18px;
}
.filter-bar fieldset { border: 0; margin: 0; padding: 0; display: contents; }
.filter-bar legend { display: none; }

.filter-input,
.filter-select {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  min-height: 38px;
  outline: none;
  transition: border-color 90ms, background 90ms;
}
.filter-input:hover, .filter-select:hover { border-color: var(--border-strong); }
.filter-input:focus-visible, .filter-select:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
}
.filter-search {
  flex: 1 1 220px;
  min-width: 140px;
}
.filter-result-count {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  min-height: 38px;
  transition: background 120ms, border-color 120ms;
}
.btn:hover { background: var(--surface); border-color: var(--border-strong); }
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover { background: var(--surface-2); }

/* ============================================================
   Tables (data-dense — companies, policies)
   ============================================================ */

.table-wrap {
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow-wrap: break-word;
  min-width: 0;
  line-height: 1.4;
}
/* Dates and numbers should never wrap mid-value (e.g. "May 17, / 2026"). */
.data-table .tnum,
.data-table td.num { white-space: nowrap; }
/* Numeric/date columns hug their content so the text columns absorb the slack
   instead of every column stretching across the full width. */
.data-table th.num,
.data-table td.num,
.data-table th.col-tight,
.data-table td.col-tight { width: 1%; white-space: nowrap; }
.data-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface-2);
  white-space: nowrap;
}
.data-table thead th button.sortable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}
.data-table thead th button.sortable:hover { color: var(--text); }
.data-table thead th .sort-indicator {
  font-size: 10px;
  opacity: 0.6;
}
.data-table tbody tr {
  transition: background 90ms;
}
.data-table tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td .secondary-line {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.muted-cell { color: var(--text-faint); font-style: italic; }

/* Company name + derived deployment-stage pill (companies table) */
.company-name-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-pill { font-size: 9.5px; padding: 1px 6px; letter-spacing: 0.06em; }

/* show-mobile: only visible when hide-mobile columns are hidden (≤760px).
   Must match .secondary-line specificity (0,3,0) to win. */
.data-table td .show-mobile { display: none; }

@media (max-width: 760px) {
  .data-table th.hide-mobile,
  .data-table td.hide-mobile { display: none; }
  .data-table td .show-mobile { display: block; }
}

/* ============================================================
   Detail panel — bottom sheet on mobile, side panel on desktop
   ============================================================ */

.detail-panel {
  position: fixed;
  z-index: 90;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-elevated);
  overflow-y: auto;
  transition: transform 200ms ease;
}
@media (max-width: 1023px) {
  .detail-panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    border-radius: 14px 14px 0 0;
    padding: 14px 16px max(20px, env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
  .detail-panel.open { transform: translateY(0); }
}
@media (min-width: 1024px) {
  .detail-panel {
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: min(520px, 40vw);
    border-radius: 0;
    border-top: 1px solid var(--border);
    padding: 22px 24px 40px;
    transform: translateX(100%);
  }
  .detail-panel.open { transform: translateX(0); }
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
.detail-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.detail-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.detail-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.detail-close:hover { background: var(--surface-2); color: var(--text); }

/* (Reduced-motion is consolidated at the bottom of the file.) */

/* Key-value grids */
.kv {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 6px 14px;
  margin: 12px 0 16px;
  font-size: 13.5px;
}
@media (min-width: 1024px) {
  .kv { grid-template-columns: 160px 1fr; }
}
/* Phones: stack label above value. A fixed label column forces multi-word
   labels ("Defense contracts", "Latest valuation") into ugly 2-line wraps
   while their values sit on one line — uneven rhythm. Stacking fixes both. */
@media (max-width: 560px) {
  .kv {
    grid-template-columns: 1fr;
    gap: 0;
    margin: 10px 0 14px;
  }
  .kv dt { padding-top: 11px; }
  .kv dt:first-of-type { padding-top: 0; }
  .kv dd { padding-top: 1px; }
}
.kv dt {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding-top: 1px;
}
.kv dd { margin: 0; }
.dd-note {
  color: var(--text-faint);
  font-size: 11.5px;
  display: block;
  margin-top: 1px;
}

/* Inline link list — sources etc. */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.link-list li {
  font-size: 12.5px;
  word-break: break-all;
}

/* Sub-section heads inside detail panel */
.detail-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.detail-section h3 {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.005em;
}
/* Tables nested inside a detail panel are in a narrower column than the main
   page table — compact the cells so columns don't crush on tablet/desktop. */
.detail-panel .data-table { font-size: 13px; }
.detail-panel .data-table th,
.detail-panel .data-table td { padding: 7px 10px; }
/* Phones: tighten the divider rhythm between detail sections. */
@media (max-width: 560px) {
  .detail-section { margin-top: 14px; padding-top: 12px; }
}

/* ============================================================
   Charts (SVG)
   ============================================================ */

.chart {
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 16px 14px;
  box-shadow: var(--shadow-rest);
}
.chart h2,
.chart h3 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-head h3 { margin-bottom: 0; }
.chart-toggle {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.chart-toggle .btn.ghost {
  padding: 3px 10px;
  font-size: 11.5px;
  min-height: 0;
}
.chart .chart-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis-label { fill: var(--text-muted); font-size: 10px; }
.chart-source {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
}
.chart-source a { color: var(--text-muted); border-bottom: 1px dotted var(--border-strong); }
.chart-source a:hover { color: var(--text); border-bottom-color: var(--text); }

/* Wayback / archive links — small, secondary, never compete with the primary source link. */
.archive-link {
  font-size: 11px;
  margin-left: 6px;
  color: var(--text-faint);
  border-bottom: 1px dotted var(--border-strong);
  white-space: nowrap;
}
.archive-link:hover {
  color: var(--text-muted);
  border-bottom-color: var(--text-muted);
}
.chart .grid-line { stroke: var(--border); }
.chart .series-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .series-dot { fill: var(--accent); }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: var(--cat-supplychain); }

.chart-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .chart-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   News + Theme feed
   ============================================================ */

.feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
/* Two columns from tablet up — the feed is the tallest thing on news.html, and
   ~360px cards read fine side by side. Halves scroll on tablet/desktop; mobile
   stays single-column. align-items:start so uneven card heights don't stretch. */
@media (min-width: 720px) {
  .feed { grid-template-columns: 1fr 1fr; gap: 12px 16px; align-items: start; }
}
.feed-card {
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-rest);
  transition: border-color var(--transition-base, 120ms), box-shadow var(--transition-base, 120ms);
}
.feed-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-elevated); }

.feed-card .top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.feed-card h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  margin: 4px 0 6px;
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.feed-card h3 a {
  color: var(--text);
  border-bottom: none;
}
.feed-card h3 a:hover { color: var(--accent); }
.feed-card .summary {
  font-size: 14px;
  color: var(--text);
  margin: 0 0 8px;
}
.feed-card .footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Compact density mode */
.feed[data-density="compact"] .feed-card {
  padding: 6px 12px;
}
.feed[data-density="compact"] .feed-card h3 {
  font-size: 14px;
  margin: 2px 0 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.feed[data-density="compact"] .feed-card .summary,
.feed[data-density="compact"] .feed-card .footer-row {
  display: none;
}
/* In compact: only show category pill + date — hide sentiment/confidence pills and source */
.feed[data-density="compact"] .feed-card .top-row > .pill:not(:first-child) {
  display: none;
}
.feed[data-density="compact"] .feed-card .top-row .row-end > span:not(.tnum):not(.faint) {
  display: none;
}

/* Pagination bar */
.feed-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 4px;
}
.pag-info {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 90px;
  text-align: center;
}
.pag-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Density toggle active state */
.btn.ghost[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Theme — AI/curator narrative gets accent border per DESIGN.md § 11 */
.curator-narrative {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 14px;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text);
  line-height: 1.55;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 36px 18px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Loading state */
.loading {
  opacity: 0;
  pointer-events: none;
}
.skeleton {
  display: block;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* (Skeleton reduced-motion handled at the bottom of the file.) */

/* Touch / interaction */
button, [role="button"], a.btn {
  touch-action: manipulation;
}

/* Mobile nav adjustment */
@media (max-width: 540px) {
  .site-header-inner { gap: 8px; padding: 8px 12px; }
  .header-updated-label { display: none; }
  .header-updated-date { font-size: 13px; }
  /* Overflow is the priority+ layout's job now, not a display:none here — at
     this width it usually collapses the whole strip into "Sections" and keeps
     only the current page's link inline. */
  nav.primary-nav { gap: 0; }
  .nav-list { gap: 0; }
  nav.primary-nav a,
  .primary-more > summary { padding: 8px 7px; font-size: 13px; white-space: nowrap; }
  .primary-more { position: static; }
  .primary-more-menu {
    top: calc(100% - 6px);
    right: 48px;
  }
  /* Drop the picker's text label below 540px; the chevron is enough */
  .theme-picker > summary { padding: 0 8px; gap: 4px; }
  .theme-picker-current { display: none; }
  h1.page-title { font-size: 24px; }
  main { padding: 16px 12px 40px; }
}

/* ============================================================
   Theme picker (DESIGN.md § 15.4)
   Native <details> for disclosure, radios for selection.
   ============================================================ */

.theme-picker {
  position: relative;
  flex: 0 0 auto;   /* fixed sibling — see the flex-basis note on .primary-nav */
  font-family: var(--font-sans);
}
.theme-picker > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-base, 120ms), color var(--transition-base, 120ms), border-color var(--transition-base, 120ms);
}
.theme-picker > summary::-webkit-details-marker { display: none; }
.theme-picker > summary::marker { content: ""; }
.theme-picker > summary:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.theme-picker > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-picker-current {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.theme-picker-chevron {
  width: 10px;
  height: 10px;
  display: inline-block;
  flex: 0 0 10px;
  transition: transform var(--transition-base, 120ms);
}
.theme-picker[open] .theme-picker-chevron { transform: rotate(180deg); }

.theme-picker-menu {
  /* Hidden by default. position:absolute alone doesn't hide the menu —
     the native <details> rendering only suppresses non-absolute children
     of a closed <details>. So we must explicitly display:none here and
     re-enable display:flex on [open]. */
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  background: var(--surface);
  -webkit-backdrop-filter: var(--surface-backdrop, none);
  backdrop-filter: var(--surface-backdrop, none);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-elevated);
  margin: 0;
  padding: 6px;
  min-width: 240px;
  flex-direction: column;
  gap: 2px;
}
.theme-picker[open] > .theme-picker-menu {
  display: flex;
}
.theme-option {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  min-height: 36px;
  transition: background var(--transition-fast, 90ms);
}
.theme-option:hover { background: var(--surface-2); }
.theme-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  margin: 0;
  cursor: pointer;
  transition: border-color var(--transition-fast, 90ms);
  display: inline-grid;
  place-items: center;
}
.theme-option input[type="radio"]:checked {
  border-color: var(--accent);
}
.theme-option input[type="radio"]:checked::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.theme-option input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-option-name { font-weight: 500; }
.theme-option-tag {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  white-space: nowrap;
}

/* Override: cyan accent in Robot Dreams needs explicit on-text */
[data-theme="robot-dreams"] .btn.primary,
[data-theme="robot-dreams"] .pill.cat-accent {
  color: var(--accent-on);
}

/* Reduced-motion: kill transitions across themes + picker.
   This is the single source of truth for motion gating. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
  }
  .skeleton { animation: none; background: var(--surface-2); }
  .detail-panel,
  .detail-backdrop,
  .theme-picker-chevron { transition: none !important; }
}

/* Utility */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-end { margin-left: auto; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.serif { font-family: var(--font-serif); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.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;
}

/* Mobile (<=640px) Responsive Layout Refinements */
@media (max-width: 640px) {
  /* Hide verbose hero copy to save screen space */
  .page-lede,
  .eyebrow {
    display: none;
  }
  
  /* Slightly tighter layout spacing */
  .page-title {
    margin-top: 8px;
    margin-bottom: 12px;
  }

  /* Horizontal swipeable scroll-snap carousel for KPIs */
  .kpi-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding: 4px;
    margin-bottom: 16px;
    scrollbar-width: none; /* Firefox */
  }
  .kpi-strip::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Webkit */
  }
  .kpi-card {
    flex: 0 0 160px;
    scroll-snap-align: start;
    box-sizing: border-box;
  }

  /* Clean responsive 2-column grid for filters */
  .filter-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
  }
  .filter-search {
    grid-column: span 2;
    width: 100%;
  }
  .filter-input,
  .filter-select {
    width: 100%;
    box-sizing: border-box;
  }
  .filter-bar button {
    grid-column: span 1;
    width: 100%;
  }
  .filter-result-count {
    grid-column: span 2;
    text-align: right;
    margin: 4px 0 0 0;
  }

  /* Tables: tighten padding, allow num cells to wrap */
  .data-table {
    font-size: 13px;
  }
  .data-table th,
  .data-table td {
    padding: 9px 10px;
  }
  .data-table td.num {
    white-space: normal;
  }
}
