/* ==========================================================================
   One North America — styles
   Institutional and modern: ink and paper, one signal color.
   Archivo (display) · Public Sans (text) · IBM Plex Mono (data). No italics.
   ========================================================================== */

:root {
  /* Palette shared with julianserra.xyz: warm paper and ink */
  --ink: #141311;
  --ink-2: #1b1a17;
  --ink-3: #24221e;
  --line-ink: rgba(236, 232, 223, 0.12);
  --on-ink: #ece8df;
  --on-ink-muted: #9a948a;

  --paper: #f2efe8;
  --paper-2: #e8e4da;
  --line-paper: rgba(25, 23, 20, 0.14);
  --on-paper: #191714;
  --on-paper-muted: #6f6a61;

  /* Monarch */
  --signal: #f08a24;        /* monarch orange on dark */
  --signal-deep: #a84b0a;   /* monarch orange for text on paper (AA) */
  --monarch: #d9731c;       /* North America in charts */
  --monarch-black: #17120e;

  /* Country identity — validated categorical palette (all pairs, both modes) */
  --ca: #9f3960;
  --us: #248fcc;
  --mx: #56a76a;

  --f-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1240px;
  --radius: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--on-ink);
  font: 400 17px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }
em, i, cite { font-style: normal; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: 16px; top: -60px; z-index: 200; background: var(--signal); color: var(--ink); padding: 10px 14px; font-weight: 600; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow { max-width: 900px; }

.display {
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.0;
  text-wrap: balance;
}
.hl { color: var(--signal); }
.paper .hl { color: var(--signal-deep); }
.mono { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; }

.kicker { color: var(--signal); margin-bottom: 18px; display: flex; align-items: center; gap: 12px; font-weight: 500; }
.kicker::before { content: ""; width: 24px; height: 2px; background: currentColor; }
.paper .kicker { color: var(--signal-deep); }

/* ---------- Sections ---------- */
section { position: relative; }
.ink { background: var(--ink); color: var(--on-ink); }
.paper { background: var(--paper); color: var(--on-paper); }
.ink, .paper { padding: clamp(80px, 11vw, 150px) 0; }

.sec-head { max-width: 880px; margin-bottom: clamp(40px, 6vw, 72px); }
.sec-head h2 { font-size: clamp(2.4rem, 5.6vw, 4.6rem); }
.sec-sub { margin-top: 22px; font-size: clamp(1.05rem, 1.5vw, 1.22rem); line-height: 1.55; max-width: 680px; color: var(--on-ink-muted); }
.paper .sec-sub { color: var(--on-paper-muted); }
.src { margin-top: 14px; font-size: 0.62rem; color: var(--on-ink-muted); opacity: 0.85; text-transform: none; letter-spacing: 0.02em; }
.paper .src { color: var(--on-paper-muted); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-signal { background: var(--signal); color: var(--ink); }
.btn-signal:hover { background: #f59b45; }
.btn-ghost { border-color: var(--line-ink); color: var(--on-ink); background: transparent; }
.btn-ghost:hover { border-color: var(--on-ink); }

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px var(--gutter);
  transition: background 0.35s, border-color 0.35s, color 0.35s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled { background: rgba(20, 19, 17, 0.82); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-color: var(--line-ink); }
.nav.on-paper.scrolled { background: rgba(242, 239, 232, 0.86); border-color: var(--line-paper); color: var(--on-paper); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-display); font-weight: 700; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: auto; fill: var(--signal); transform-origin: center; transition: fill 0.35s; }
.nav.on-paper .brand-mark { fill: var(--signal-deep); }
.brand:hover .brand-mark { animation: flap 0.36s ease-in-out 4 alternate; }
@keyframes flap { from { transform: scaleX(1) translateY(0); } to { transform: scaleX(0.3) translateY(-2px); } }
.nav-links { display: flex; gap: 26px; }
.nav-links a { text-decoration: none; font-size: 0.9rem; color: var(--on-ink-muted); transition: color 0.2s; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--on-ink); }
.nav-links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--signal); }
.nav.on-paper .nav-links a { color: var(--on-paper-muted); }
.nav.on-paper .nav-links a:hover, .nav.on-paper .nav-links a.active { color: var(--on-paper); }
.lang { display: inline-flex; border: 1px solid var(--line-ink); border-radius: 999px; padding: 3px; }
.lang button { border: 0; background: transparent; padding: 6px 11px; border-radius: 999px; font: 500 0.72rem var(--f-mono); letter-spacing: 0.08em; color: var(--on-ink-muted); }
.lang button[aria-pressed="true"] { background: var(--on-ink); color: var(--ink); }
.nav.on-paper .lang { border-color: var(--line-paper); }
.nav.on-paper .lang button { color: var(--on-paper-muted); }
.nav.on-paper .lang button[aria-pressed="true"] { background: var(--on-paper); color: var(--paper); }
.lang-panel, .menu-btn { display: none; }
.menu-btn { align-items: center; gap: 10px; border: 1px solid var(--line-ink); background: transparent; color: inherit; border-radius: 999px; padding: 8px 14px 8px 12px; font: 500 0.85rem var(--f-body); }
.nav.on-paper .menu-btn { border-color: var(--line-paper); }
.menu-ico { display: grid; gap: 5px; width: 16px; }
.menu-ico i { display: block; height: 1.5px; background: currentColor; border-radius: 1px; transition: transform 0.3s var(--ease); }
.nav.open .menu-ico i:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav.open .menu-ico i:last-child { transform: translateY(-3.25px) rotate(-45deg); }
@media (max-width: 920px) {
  .lang-bar { display: none; }
  .menu-btn { display: inline-flex; }
  /* The section list becomes a full-width panel below the bar, with the language switch inside it. */
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0; max-height: calc(100vh - 64px); overflow-y: auto; flex-direction: column; gap: 0;
    padding: 8px var(--gutter) 28px; background: var(--ink); border-bottom: 1px solid var(--line-ink);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s var(--ease), visibility 0s 0.25s;
  }
  .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; transition: opacity 0.25s, transform 0.25s var(--ease); }
  .nav-links a, .nav.on-paper .nav-links a { font-family: var(--f-display); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.01em; color: var(--on-ink); padding: 14px 0; border-bottom: 1px solid var(--line-ink); }
  .nav-links a.active::after { display: none; }
  .nav .nav-links a:hover, .nav.on-paper .nav-links a:hover { color: var(--on-ink); }
  .nav .nav-links a.active, .nav.on-paper .nav-links a.active { color: var(--signal); }
  .lang-panel, .nav.on-paper .lang-panel { display: inline-flex; align-self: flex-start; margin-top: 22px; border-color: var(--line-ink); }
  .lang-panel button, .nav.on-paper .lang-panel button { padding: 9px 16px; font-size: 0.78rem; color: var(--on-ink-muted); }
  .lang-panel button[aria-pressed="true"], .nav.on-paper .lang-panel button[aria-pressed="true"] { background: var(--on-ink); color: var(--ink); }
  .nav.open, .nav.open.on-paper.scrolled { background: var(--ink); color: var(--on-ink); border-color: var(--line-ink); }
  .nav.open .brand-mark { fill: var(--signal); }
  .nav.open .menu-btn { border-color: var(--line-ink); }
  body.menu-open { overflow: hidden; }
}

/* ==========================================================================
   Hero — the borders fade, the perimeter remains
   ========================================================================== */
.hero { background: var(--ink); }
.hero-inner {
  position: relative; height: 100vh; min-height: 680px; max-height: 1080px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: clamp(20px, 4vw, 56px);
  padding: 92px var(--gutter) 56px; max-width: 1440px; margin: 0 auto;
}
.hero-copy { position: relative; z-index: 2; }
.eyebrow { color: var(--on-ink-muted); margin-bottom: 24px; animation: rise 0.9s var(--ease) both; }
.hero h1 { font-size: clamp(2.8rem, 5.4vw, 5.4rem); line-height: 0.96; }
.hero-line { display: block; animation: rise 0.9s 0.08s var(--ease) both; }
.hero-line + .hero-line { animation-delay: 0.16s; }
/* "Three tariffs." is struck through, then "One market." takes its place. */
.hero-swap { display: grid; justify-items: start; }
.hero-swap > * { grid-area: 1 / 1; }
.strike { position: relative; display: inline-block; text-decoration: none; color: var(--on-ink); transition: color 0.5s var(--ease) 0.3s, opacity 0.55s var(--ease), transform 0.55s var(--ease); }
.strike::after {
  content: ""; position: absolute; left: -0.04em; right: -0.04em; top: 0.5em; height: max(3px, 0.065em);
  background: var(--signal); border-radius: 2px; transform: scaleX(0); transform-origin: left center;
  transition: transform 0.75s cubic-bezier(0.65, 0, 0.25, 1);
}
.hero.struck .strike { color: var(--on-ink-muted); }
.hero.struck .strike::after { transform: scaleX(1); }
.swap-b { opacity: 0; transform: translateY(0.4em); transition: opacity 0.7s var(--ease) 0.15s, transform 0.7s var(--ease) 0.15s; }
.hero.converged .strike { opacity: 0; transform: translateY(-0.4em); }
.hero.converged .swap-b { opacity: 1; transform: none; }
.hero-sub { margin-top: 26px; max-width: 540px; font-size: clamp(1.02rem, 1.35vw, 1.16rem); color: var(--on-ink-muted); animation: rise 0.9s 0.28s var(--ease) both; }
.hero-facts { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--on-ink-muted); text-transform: none; letter-spacing: 0.02em; font-size: 0.8rem; animation: rise 0.9s 0.36s var(--ease) both; }
.hero-facts strong { color: var(--on-ink); font-weight: 500; font-size: 1rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; animation: rise 0.9s 0.44s var(--ease) both; }

.hero-map { margin: 0; position: relative; animation: fade 1.2s 0.2s both; }
#hero-map { width: 100%; height: auto; max-height: calc(100vh - 170px); overflow: visible; }
.hero-map figcaption { margin-top: 10px; color: var(--on-ink-muted); font-size: 0.6rem; text-transform: none; letter-spacing: 0.03em; }
.replay { border: 0; background: none; padding: 0; margin-left: 6px; font: inherit; color: var(--signal); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.map-label { font-family: var(--f-mono); font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--on-ink); paint-order: stroke; stroke: rgba(20, 19, 17, 0.55); stroke-width: 4px; font-weight: 500; }
.map-label.na { fill: var(--signal-deep); stroke: none; font-size: 22px; font-weight: 500; letter-spacing: 0.14em; }

.scroll-cue { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--on-ink-muted); font-size: 0.58rem; transition: opacity 0.4s; }
.scroll-cue i { width: 1px; height: 34px; background: linear-gradient(var(--on-ink-muted), transparent); animation: cue 2.2s infinite var(--ease); transform-origin: top; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

@media (max-width: 920px) {
  .hero-inner { height: 100svh; min-height: 640px; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); align-content: start; gap: 8px; padding-top: 84px; padding-bottom: 28px; }
  .hero h1 { font-size: clamp(2.6rem, 11vw, 4rem); }
  .hero-sub { font-size: 0.98rem; margin-top: 16px; }
  .hero-facts { margin-top: 14px; }
  .hero-cta { display: none; }
  .scroll-cue { display: none; }
  /* The map takes whatever height is left after its caption and the SAI line, so nothing overlaps or is cut off. */
  .hero-map { align-self: stretch; display: flex; flex-direction: column; min-height: 0; }
  #hero-map { flex: 1 1 0; min-height: 0; height: auto; max-height: none; }
}
@media (max-width: 920px) and (max-height: 760px) { .hero-sub { display: none; } }
@media (max-width: 920px) and (min-height: 761px) {
  .hero-cta { display: flex; margin-top: 18px; gap: 10px; }
  .hero-cta .btn { padding: 11px 16px; font-size: 0.88rem; }
}

/* ==========================================================================
   01 Union at a glance
   ========================================================================== */
.pillars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 2px solid var(--on-paper); }
.pillar { position: relative; padding: 26px 22px 30px 0; }
.pillar + .pillar { padding-left: 22px; border-left: 1px solid var(--line-paper); }
.pillar-n { position: absolute; top: 26px; right: 18px; color: var(--on-paper-muted); }
.pillar-ico { width: 40px; height: 40px; fill: none; stroke: var(--signal-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 22px; }
.pillar h3 { font-family: var(--f-display); font-size: 1.32rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.12; margin-bottom: 10px; }
.pillar p { color: var(--on-paper-muted); font-size: 0.97rem; }
@media (max-width: 1080px) {
  .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pillar, .pillar + .pillar { padding: 26px 22px 30px 0; border-left: 0; border-bottom: 1px solid var(--line-paper); }
  .pillar:nth-child(even) { padding-left: 22px; border-left: 1px solid var(--line-paper); }
}
@media (max-width: 560px) {
  .pillars { grid-template-columns: 1fr; }
  .pillar:nth-child(even) { padding-left: 0; border-left: 0; }
}

.stays { margin-top: 48px; display: grid; grid-template-columns: 180px 1fr; gap: 14px 32px; align-items: start; padding: 28px; background: var(--paper-2); border-radius: var(--radius); }
.stays h3 { color: var(--on-paper); padding-top: 6px; }
.stays ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stays li { padding: 7px 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-paper); font-weight: 500; font-size: 0.93rem; }
.stays p { grid-column: 2; color: var(--on-paper-muted); font-size: 0.95rem; }
@media (max-width: 720px) { .stays { grid-template-columns: 1fr; } .stays p { grid-column: auto; } }

/* ==========================================================================
   02 Common tariff schedule
   ========================================================================== */
.schedule { margin-top: clamp(28px, 4vw, 40px); background: var(--ink-2); border: 1px solid var(--line-ink); border-radius: var(--radius); padding: clamp(18px, 3vw, 32px); }
.tb-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.tb-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.02em; line-height: 1.1; }
.tb-sub { margin-top: 6px; color: var(--on-ink-muted); font-size: 0.64rem; text-transform: none; letter-spacing: 0.02em; }
.tb-head, .tb-row { display: grid; grid-template-columns: minmax(150px, 0.9fr) minmax(0, 2fr) minmax(180px, 1.1fr); gap: 12px 28px; align-items: center; }
.tb-head { padding-bottom: 12px; border-bottom: 1px solid var(--line-ink); color: var(--on-ink-muted); font-size: 0.62rem; }
.tb-row { padding: 18px 0; border-bottom: 1px solid var(--line-ink); }
.tb-row:last-child { border-bottom: 0; }
.tb-row.avg { border-top: 1px solid var(--on-ink-muted); margin-top: -1px; }
.tb-prod b { display: block; font-weight: 600; font-size: 1.02rem; }
.tb-prod span { font-family: var(--f-mono); font-size: 0.64rem; color: var(--on-ink-muted); }
/* Three bars, one per country; the label sits at the end of each bar. */
.tb-bars { display: grid; }
.tb-bar { display: flex; align-items: center; gap: 10px; height: 20px; overflow: hidden; transition: height 0.6s var(--ease), opacity 0.45s; }
.tb-bar i { display: block; flex: none; height: 10px; min-width: 3px; width: calc((100% - 7.5rem) * var(--k)); border-radius: 0 3px 3px 0; transition: width 0.8s var(--ease), background 0.5s, height 0.5s var(--ease); }
.tb-bar.c-ca i { background: var(--ca); } .tb-bar.c-us i { background: var(--us); } .tb-bar.c-mx i { background: var(--mx); }
.tb-bar span { font-family: var(--f-mono); font-size: 0.78rem; white-space: nowrap; transition: opacity 0.4s; }
.tb-bar abbr { text-decoration: none; font-size: 0.62rem; color: var(--on-ink-muted); margin-right: 2px; }
.tb-bar .v-cu { position: absolute; opacity: 0; pointer-events: none; }
.tb-bar:first-child { position: relative; }
.tb-rule { display: flex; align-items: baseline; gap: 10px; color: var(--on-ink-muted); font-size: 0.86rem; line-height: 1.4; }
.tb-rule .rule-tag { flex: none; width: auto; min-width: 26px; height: 26px; padding: 0 7px; margin: 0; border-radius: 999px; font-size: 0.66rem; }
.tb-head .v-cu, .schedule[data-mode="cu"] .tb-head .v-now { display: none; }
.schedule[data-mode="cu"] .tb-head .v-cu { display: inline; color: var(--signal); }
/* In the union: the U.S. and Mexico bars fold into the first, which turns orange at the common rate. */
.schedule[data-mode="cu"] .tb-bar:not(:first-child) { height: 0; opacity: 0; }
.schedule[data-mode="cu"] .tb-bar:first-child { height: 30px; }
.schedule[data-mode="cu"] .tb-bar:first-child i { width: calc((100% - 7.5rem) * var(--one)); height: 16px; background: var(--signal); }
.schedule[data-mode="cu"] .tb-bar .v-now { position: absolute; opacity: 0; }
.schedule[data-mode="cu"] .tb-bar .v-cu { position: static; opacity: 1; color: var(--signal); font-weight: 500; }
.schedule[data-mode="cu"] .tb-row.open .tb-bar:first-child i { width: 0; min-width: 0; }
.schedule[data-mode="cu"] .tb-row.open .tb-bar .v-cu { font-family: var(--f-display); font-size: 1rem; }
.schedule-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 18px; color: var(--on-ink-muted); font-size: 0.64rem; }
.schedule-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-ca { background: var(--ca); } .dot-us { background: var(--us); } .dot-mx { background: var(--mx); } .dot-na { background: var(--signal); }
.schedule-note { margin-top: 14px; font-size: 0.78rem; color: var(--on-ink-muted); line-height: 1.55; max-width: 900px; }
@media (max-width: 900px) {
  .tb-head { display: none; }
  .tb-row { grid-template-columns: 1fr; gap: 10px; }
}
/* The toggle on dark backgrounds, with a nudge until the first click */
.toggle.toggle-ink { margin: 0; border-color: var(--line-ink); background: var(--ink); }
.toggle.toggle-ink button { color: var(--on-ink-muted); }
.toggle.toggle-ink button[aria-pressed="true"] { color: var(--ink); }
.toggle.toggle-ink .toggle-thumb { background: var(--on-ink); }
.toggle.toggle-ink:has(button[data-view="cu"][aria-pressed="true"]) .toggle-thumb { transform: translateX(100%); background: var(--signal); }
.toggle button.hint { animation: hint 2.4s var(--ease) 1.2s infinite; border-radius: 999px; }
@keyframes hint { 0%, 60%, 100% { box-shadow: 0 0 0 0 rgba(240, 138, 36, 0); } 30% { box-shadow: 0 0 0 5px rgba(240, 138, 36, 0.35); } }

/* The clearest case: one car, three tariffs */
.ev-case { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 56px); align-items: center; padding: clamp(24px, 4vw, 48px); border-radius: var(--radius); background: linear-gradient(135deg, rgba(240, 138, 36, 0.12), rgba(240, 138, 36, 0) 55%), var(--ink-2); border: 1px solid rgba(240, 138, 36, 0.35); }
.ev-copy h3.display { font-size: clamp(2.2rem, 4.4vw, 3.6rem); margin-bottom: 18px; }
.ev-copy p:not(.tag) { color: var(--on-ink-muted); margin-bottom: 14px; }
.ev-copy p.ev-punch { color: var(--on-ink); font-family: var(--f-display); font-weight: 600; font-size: clamp(1.1rem, 1.7vw, 1.3rem); line-height: 1.35; letter-spacing: -0.01em; }
.ev-copy .ev-link { margin-top: 6px; }
.ev-doors { margin: 0; }
.ev-doors h4 { font-size: 1.05rem; font-weight: 700; }
.ev-doors figcaption p { margin-top: 4px; color: var(--on-ink-muted); font-size: 0.62rem; text-transform: none; letter-spacing: 0.02em; }
.evb { margin-top: 18px; display: grid; gap: 14px; }
.evb-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 104px; gap: 14px; align-items: center; }
.evb-name { font-weight: 600; font-size: 0.98rem; line-height: 1.2; }
.evb-name small { display: block; font-weight: 400; color: var(--on-ink-muted); font-size: 0.76rem; }
.evb-track { position: relative; height: 30px; background: var(--ink-3); border-radius: 0 5px 5px 0; }
.evb-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--c); border-radius: 0 5px 5px 0; transition: width 1.3s var(--ease); }
.evb-val { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.03em; text-align: right; color: var(--c); line-height: 1; }
.evb-row:nth-child(2) .evb-val, .evb-row:nth-child(3) .evb-val { filter: brightness(1.35); }
.evb-flag { position: absolute; left: calc(5.5% + 14px); top: 50%; transform: translateY(-50%); padding: 4px 10px; border-radius: 999px; background: var(--signal); color: var(--ink); font-size: 0.6rem; white-space: nowrap; opacity: 0; transition: opacity 0.5s 1.2s; }
.in .evb-flag { opacity: 1; }
.evb-row.is-cheap .evb-track { box-shadow: inset 0 0 0 1px rgba(240, 138, 36, 0.5); }
.ev-union { margin-top: 20px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px dashed rgba(240, 138, 36, 0.6); font-size: 1.05rem; }
.ev-union .chip { font-size: 2rem; flex: none; box-shadow: none; }
.ev-union p { color: var(--on-ink-muted); }
.ev-union b { color: var(--signal); font-weight: 600; }
.ev-doors .chart-note { margin-top: 14px; }
@media (max-width: 960px) { .ev-case { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .evb-row { grid-template-columns: 92px minmax(0, 1fr) 76px; gap: 10px; }
  .evb-track { height: 24px; }
  /* The track is too short to hold the label: it drops below the bar. */
  .evb-row.is-cheap { margin-bottom: 20px; }
  .evb-flag { left: 0; top: calc(100% + 6px); transform: none; }
}

.rules { margin-top: 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.rule { padding: 24px; border: 1px solid var(--line-ink); border-radius: var(--radius); }
.rule-tag { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--signal); color: var(--ink); font-weight: 500; margin-bottom: 16px; }
.rule h3 { font-family: var(--f-display); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.01em; line-height: 1.15; margin-bottom: 10px; }
.rule p { color: var(--on-ink-muted); font-size: 0.93rem; }
.meter { margin-top: 18px; height: 8px; background: var(--ink-3); border-radius: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--signal); border-radius: 0 4px 4px 0; transition: width 1.4s 0.2s var(--ease); }
.rule.in .meter span { width: var(--w); }
.rule .meter-label { margin-top: 8px; font-size: 0.6rem; color: var(--on-ink-muted); text-transform: none; letter-spacing: 0.02em; }
@media (max-width: 1040px) { .rules { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .rules { grid-template-columns: 1fr; } }

/* ==========================================================================
   03 Perimeter
   ========================================================================== */
.per-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.per-map { margin: 0; position: sticky; top: 90px; }
#per-map { width: 100%; height: auto; overflow: visible; }
.per-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; color: var(--on-paper-muted); font-size: 0.64rem; text-transform: none; letter-spacing: 0.02em; }
.per-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--signal-deep); box-shadow: 0 0 0 4px rgba(168, 75, 10, 0.18); }
.xdot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--on-paper); background: var(--paper); }
.port-label { font-family: var(--f-mono); font-size: 21px; fill: var(--on-paper); letter-spacing: 0.02em; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
/* The map follows the toggle: today the internal borders are hard lines with customs;
   in the union they soften to dashes and the outer perimeter carries the weight. */
#per-map .pm-land { fill: #fbfaf6; stroke: #a84b0a; stroke-width: 1.6; transition: stroke-width 0.6s var(--ease); }
#per-map .pm-cover { fill: none; stroke: #fbfaf6; stroke-width: 5; }
#per-map .pm-border { fill: none; stroke: #191714; stroke-width: 2.6; stroke-linecap: round; transition: stroke 0.5s, stroke-width 0.5s; }
#per-map .pm-x { fill: #c2410c; stroke: #191714; stroke-width: 3; transition: fill 0.5s; }
.per-map[data-mode="cu"] #per-map .pm-land { stroke-width: 3.2; }
.per-map[data-mode="cu"] #per-map .pm-border { stroke: #9a948a; stroke-width: 1.2; stroke-dasharray: 4 5; }
.per-map[data-mode="cu"] #per-map .pm-x { fill: #f2efe8; }
#per-map .rt-bg { fill: none; stroke: rgba(25, 23, 20, 0.28); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
#per-map .rt-trail { fill: none; stroke: #191714; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.per-map[data-mode="cu"] #per-map .rt-trail { stroke: #a84b0a; }
#per-map .rt-gate { fill: #c2410c; stroke: #fbfaf6; stroke-width: 2; transition: opacity 0.4s, transform 0.5s var(--ease); }
.per-map[data-mode="cu"] #per-map .rt-gate { opacity: 0; }
#per-map .rt-ring { fill: none; stroke: #191714; stroke-width: 2.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
#per-map .rt-ring.on { animation: rt-pulse 1.1s var(--ease) infinite; }
.per-map[data-mode="cu"] #per-map .rt-ring { stroke: #a84b0a; }
.per-map[data-mode="fta"] #per-map .rt-ring:nth-of-type(3).on { stroke: #c2410c; stroke-width: 3.5; }
@keyframes rt-pulse { 0% { opacity: 0.9; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.6); } }
#per-map .rt-start { fill: #191714; }
#per-map .rt-dot circle { fill: #191714; stroke: #fbfaf6; stroke-width: 3; transition: fill 0.4s; }
#per-map .rt-dot rect { fill: #fbfaf6; }
.per-map[data-mode="cu"] #per-map .rt-dot circle { fill: #a84b0a; }
.rt-status { min-height: 3.1em; margin-top: 10px; font-size: 0.95rem; color: var(--on-paper-muted); line-height: 1.45; }
.rt-status b { display: block; color: var(--on-paper); font-size: 0.66rem; font-weight: 500; margin-bottom: 2px; }
.per-map[data-mode="fta"] .rt-status b { color: #c2410c; }
.per-map[data-mode="cu"] .rt-status b { color: var(--signal-deep); }
/* Stop list follows the moving part */
.stop.is-on .stop-dot { transform: scale(1.25); background: var(--on-paper); }
.route[data-mode="cu"] .stop.is-on .stop-dot { background: var(--signal-deep); }
.route[data-mode="fta"] .stop.is-friction.is-on .stop-dot { background: #c2410c; }
.stop.is-on h3 { color: var(--signal-deep); }
.route[data-mode="fta"] .stop.is-friction.is-on h3 { color: #c2410c; }
.route-note { margin-top: 4px; font-size: 0.82rem; color: var(--on-paper-muted); }
.route-meter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.route-meter > div { padding: 12px 14px; border-radius: var(--radius); background: var(--paper-2); }
.route-meter dt { color: var(--on-paper-muted); font-size: 0.56rem; line-height: 1.4; }
.route-meter dd { margin: 6px 0 0; font-family: var(--f-display); font-weight: 700; font-size: 1.8rem; letter-spacing: -0.03em; line-height: 1; }
.route[data-mode="fta"] .route-meter dd { color: #c2410c; }
.route[data-mode="cu"] .route-meter dd { color: var(--signal-deep); }


.toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-paper); border-radius: 999px; padding: 4px; margin-bottom: 24px; background: var(--paper-2); }
.toggle button { position: relative; z-index: 1; border: 0; background: none; padding: 11px 22px; border-radius: 999px; font-weight: 600; font-size: 0.92rem; color: var(--on-paper-muted); transition: color 0.3s; white-space: nowrap; }
.toggle button[aria-selected="true"] { color: var(--paper); }
.toggle-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--on-paper); transition: transform 0.45s var(--ease), background 0.45s; }
.toggle.is-cu .toggle-thumb { transform: translateX(100%); background: var(--signal-deep); }

.route-intro { color: var(--on-paper-muted); margin-bottom: 18px; }
.stops { list-style: none; margin: 0; padding: 0; position: relative; }
.stops::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line-paper); }
.stop { position: relative; padding: 0 0 26px 40px; }
.stop-dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--on-paper); transition: all 0.35s var(--ease); }
.stop h3 { font-size: 1.05rem; margin-bottom: 4px; transition: color 0.3s; }
.stop p { color: var(--on-paper-muted); font-size: 0.95rem; }
.only-cu { display: none; }
.route[data-mode="cu"] .only-fta { display: none; }
.route[data-mode="cu"] .only-cu { display: block; animation: rise 0.5s var(--ease) both; }
.route[data-mode="fta"] .only-fta { animation: rise 0.5s var(--ease) both; }
.route[data-mode="fta"] .is-friction .stop-dot { background: #c2410c; border-color: #c2410c; box-shadow: 0 0 0 5px rgba(194, 65, 12, 0.2); }
.route[data-mode="cu"] .stop-dot { border-color: var(--signal-deep); }
.route[data-mode="cu"] .is-friction .stop-dot { background: var(--signal-deep); }

@media (max-width: 900px) {
  .per-grid { grid-template-columns: 1fr; }
  /* On phones the toggle sits above the map, so the map is in view when it changes. */
  .per-side { display: contents; }
  .per-side .toggle { order: -1; justify-self: start; margin-bottom: 0; }
  .per-map { position: relative; top: 0; }
  .route-meter dd { font-size: 1.5rem; }
}

/* ==========================================================================
   Charts (shared)
   ========================================================================== */
.chart { margin: 0; padding: clamp(20px, 3vw, 32px); background: var(--ink-2); border: 1px solid var(--line-ink); border-radius: var(--radius); position: relative; }
.paper .chart { background: #fff; border-color: var(--line-paper); }
.chart h3 { font-size: 1.08rem; font-weight: 700; }
.chart figcaption p { color: var(--on-ink-muted); margin-top: 6px; font-size: 0.64rem; text-transform: none; letter-spacing: 0.02em; }
.paper .chart figcaption p { color: var(--on-paper-muted); }
.chart-note { margin-top: 16px; color: var(--on-ink-muted); font-size: 0.62rem; text-transform: none; letter-spacing: 0.02em; line-height: 1.6; }
.paper .chart-note { color: var(--on-paper-muted); }
.chart-tip { min-height: 1.5em; margin-top: 10px; font-size: 0.7rem; color: var(--on-ink); text-transform: none; letter-spacing: 0.02em; }

.bars { margin-top: 22px; display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 56px; align-items: center; gap: 14px; }
.bar-name { font-weight: 500; font-size: 0.95rem; }
.bar-track { height: 20px; position: relative; }
.bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 0 4px 4px 0; background: #9aa3ad; transition: width 1.3s var(--ease); }
.reveal.in .bar-fill { width: var(--w, 0); }
.bar-row[data-hl] .bar-fill { background: var(--signal-deep); }
.bar-fill.c-mx { background: var(--mx); } .bar-fill.c-us { background: var(--us); } .bar-fill.c-ca { background: var(--ca); }
.bar-val { font-size: 0.8rem; text-align: right; }
@media (max-width: 540px) { .bar-row { grid-template-columns: 92px minmax(0, 1fr) 46px; gap: 10px; } }

.seg { display: inline-flex; border: 1px solid var(--line-ink); border-radius: 999px; padding: 3px; margin: 18px 0 0; align-self: flex-start; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; color: var(--on-ink-muted); font: inherit; }
.seg button[aria-pressed="true"] { background: var(--on-ink); color: var(--ink); }

/* ==========================================================================
   04 Demography
   ========================================================================== */
.demo-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pyramid-card { display: flex; flex-direction: column; }
.pyr-legend { display: flex; gap: 18px; margin-top: 14px; color: var(--on-ink-muted); font-size: 0.64rem; }
.pyr-legend > span { display: inline-flex; align-items: center; gap: 7px; }
#pyramid { width: 100%; height: auto; margin-top: 12px; }
#pyramid text { font-family: var(--f-mono); font-size: 11px; fill: var(--on-ink-muted); }
#pyramid .axis-label { fill: var(--on-ink); font-size: 11.5px; }
#pyramid .row-hit { fill: transparent; }
#pyramid .row-hit:hover, #pyramid .row-hit.on { fill: rgba(236, 231, 220, 0.07); }
.demo-side { display: grid; gap: 20px; }
.ages { padding: 24px; border: 1px solid var(--line-ink); border-radius: var(--radius); }
.ages .label { color: var(--on-ink-muted); margin-bottom: 10px; font-size: 0.64rem; }
.age-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line-ink); }
.age-row:last-child { border-bottom: 0; }
.age-row b { font-family: var(--f-mono); font-weight: 500; font-size: 1rem; }
.age-row.strong { color: var(--signal); }
.age-row.strong b { font-size: 1.25rem; }
.age-row.dim { color: var(--on-ink-muted); }
.wa { margin-top: 18px; display: grid; gap: 7px; }
.wa-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 0.86rem; }
.wa-row .wa-name { color: var(--on-ink-muted); }
.wa-row.is-na .wa-name { color: var(--on-ink); font-weight: 600; }
.wa-track { position: relative; height: 22px; }
.wa-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--on-ink-muted); }
.wa-bar { position: absolute; top: 3px; height: 16px; background: #5a636f; width: 0; transition: width 1.2s var(--ease), left 1.2s var(--ease); }
.wa-bar.pos { border-radius: 0 3px 3px 0; }
.wa-bar.neg { border-radius: 3px 0 0 3px; }
.wa-row.is-na .wa-bar { background: var(--signal); }
.wa-val { position: absolute; top: 2px; font-family: var(--f-mono); font-size: 0.72rem; white-space: nowrap; }
.demo-note { margin-top: 36px; max-width: 760px; font-size: 1.1rem; }
@media (max-width: 960px) { .demo-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   05 Economy
   ========================================================================== */
.eco-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--on-paper); }
.eco-stats .stat { padding: 28px 28px 32px 0; }
.eco-stats .stat + .stat { padding-left: 28px; border-left: 1px solid var(--line-paper); }
.stat-num { font-family: var(--f-display); font-weight: 700; font-size: clamp(3rem, 5.4vw, 4.6rem); letter-spacing: -0.035em; line-height: 1; margin-bottom: 14px; }
.eco-stats .stat p:not(.stat-num):not(.src) { color: var(--on-paper-muted); }
@media (max-width: 860px) {
  .eco-stats { grid-template-columns: 1fr; }
  .eco-stats .stat, .eco-stats .stat + .stat { padding: 26px 0; border-left: 0; border-bottom: 1px solid var(--line-paper); }
}
.sub-title { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: clamp(56px, 7vw, 88px) 0 24px; }
.tri { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tri-card { padding: 26px; background: #fff; border-radius: var(--radius); border-top: 4px solid var(--c); box-shadow: 0 1px 0 var(--line-paper); }
.tri-card .mono { color: var(--on-paper-muted); margin-bottom: 10px; }
.tri-card h4 { font-family: var(--f-display); font-weight: 700; font-size: 1.4rem; letter-spacing: -0.015em; margin-bottom: 8px; }
.tri-card p:last-child { color: var(--on-paper-muted); }
@media (max-width: 860px) { .tri { grid-template-columns: 1fr; } }
.trade-chart { margin-top: 28px; }

/* ==========================================================================
   06 People
   ========================================================================== */
.ppl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tie { padding: 22px; border: 1px solid var(--line-ink); border-radius: var(--radius); }
.tie .big { font-family: var(--f-display); font-weight: 700; font-size: 2.6rem; letter-spacing: -0.03em; line-height: 1; margin-bottom: 10px; }
.tie p:not(.big):not(.src) { color: var(--on-ink-muted); font-size: 0.95rem; }
.mobility { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); padding: clamp(24px, 4vw, 48px); background: var(--ink-2); border: 1px solid var(--line-ink); border-radius: var(--radius); }
.mobility h3 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); margin-bottom: 16px; }
.mobility p { color: var(--on-ink-muted); }
.mobility .kicker { color: var(--signal); }
.mob-contrast { border-left: 2px solid var(--signal); padding-left: 24px; display: grid; gap: 14px; align-content: start; }
.mob-contrast p:not(.src) { color: var(--on-ink); }
@media (max-width: 900px) { .ppl-grid, .mobility { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .ties { grid-template-columns: 1fr; } }

/* ==========================================================================
   07 World comparison
   ========================================================================== */
.compare { border-top: 2px solid var(--on-paper); }
.cmp-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line-paper); align-items: baseline; }
.cmp-row > span:first-child { color: var(--on-paper-muted); }
.cmp-row > span:not(:first-child) { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.15rem, 2.2vw, 1.8rem); letter-spacing: -0.02em; }
.cmp-row .na { color: var(--signal-deep); }
.cmp-head > span:not(:first-child) { font-family: var(--f-mono); font-size: 0.7rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--on-paper-muted); }
.cmp-head > span.na { color: var(--signal-deep); }
.world .chart-note { margin-top: 16px; }
@media (max-width: 600px) { .cmp-row { grid-template-columns: 1fr 1fr 1fr; } .cmp-row > span:first-child { grid-column: 1 / -1; } .cmp-head > span:first-child { display: none; } }

/* ==========================================================================
   08 Path
   ========================================================================== */
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: end; }
.stages li { padding: 22px; border: 1px solid var(--line-ink); border-radius: var(--radius); background: var(--ink-2); display: flex; flex-direction: column; justify-content: flex-end; }
.stages li:nth-child(1) { min-height: 190px; } .stages li:nth-child(2) { min-height: 220px; } .stages li:nth-child(3) { min-height: 250px; } .stages li:nth-child(4) { min-height: 280px; }
.stages li:nth-child(5) { min-height: 310px; background: var(--signal); border-color: var(--signal); color: var(--ink); }
.stages span { color: var(--signal); margin-bottom: auto; font-size: 0.9rem; }
.stages li:nth-child(5) span { color: var(--ink); }
.stages h3 { font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.015em; margin: 16px 0 6px; }
.stages p { color: var(--on-ink-muted); font-size: 0.92rem; }
.stages li:nth-child(5) p { color: rgba(20, 19, 17, 0.78); }
@media (max-width: 960px) { .stages { grid-template-columns: 1fr 1fr; } .stages li, .stages li:nth-child(n) { min-height: 0; } .stages li:nth-child(5) { grid-column: 1 / -1; } }
@media (max-width: 480px) { .stages { grid-template-columns: 1fr; } }

.ribbon { list-style: none; margin: 56px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 2px solid var(--line-ink); text-transform: none; letter-spacing: 0.02em; }
.ribbon li { position: relative; padding: 18px 12px 0 0; color: var(--on-ink-muted); font-size: 0.72rem; }
.ribbon li::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--on-ink-muted); }
.ribbon b { display: block; color: var(--on-ink); font-weight: 500; font-size: 0.9rem; margin-bottom: 4px; }
.ribbon .now::before { background: var(--on-ink); box-shadow: 0 0 0 5px rgba(236, 231, 220, 0.15); }
.ribbon .next::before { background: var(--signal); box-shadow: 0 0 0 5px rgba(240, 138, 36, 0.22); }
.ribbon .next b { color: var(--signal); }
@media (max-width: 760px) { .ribbon { grid-template-columns: 1fr 1fr 1fr; row-gap: 28px; } }
@media (max-width: 480px) { .ribbon { grid-template-columns: 1fr 1fr; } }

/* ==========================================================================
   09 FAQ
   ========================================================================== */
.qa { border-top: 2px solid var(--on-paper); }
.qa details { border-bottom: 1px solid var(--line-paper); }
.qa summary { list-style: none; cursor: pointer; padding: 22px 48px 22px 0; position: relative; font-family: var(--f-display); font-weight: 700; font-size: clamp(1.15rem, 2vw, 1.45rem); letter-spacing: -0.012em; line-height: 1.25; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-family: var(--f-body); font-weight: 300; font-size: 1.8rem; color: var(--signal-deep); transition: transform 0.3s var(--ease); }
.qa details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.qa details p { padding: 0 0 24px; max-width: 760px; color: var(--on-paper-muted); font-size: 1.03rem; }

/* ==========================================================================
   10 Foundations teaser
   ========================================================================== */
.found-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.found h2 { font-size: clamp(2.4rem, 5vw, 4rem); }
.found .sec-sub { margin-bottom: 28px; }
.refs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-ink); }
.refs li { display: grid; grid-template-columns: 56px 1fr; gap: 2px 14px; padding: 16px 0; border-bottom: 1px solid var(--line-ink); }
.refs span { grid-row: span 2; color: var(--signal); padding-top: 3px; }
.refs b { font-weight: 600; }
.refs em { color: var(--on-ink-muted); font-size: 0.93rem; }
.share { margin-top: 56px; display: flex; align-items: center; gap: 16px; }
.share-status { color: var(--on-ink-muted); font-size: 0.66rem; }
@media (max-width: 860px) { .found-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-foot { background: var(--ink); color: var(--on-ink-muted); padding: 48px 0 56px; border-top: 1px solid var(--line-ink); }
.foot-grid { display: grid; grid-template-columns: auto 1fr; gap: 16px 40px; align-items: center; }
.site-foot .brand { color: var(--on-ink); }
.foot-tri { grid-column: 1 / -1; font-size: 0.62rem; }
.foot-tri span { white-space: nowrap; }
.foot-note { grid-column: 1 / -1; max-width: 760px; font-size: 0.9rem; }
@media (max-width: 640px) { .foot-grid { grid-template-columns: 1fr; } }

/* SAI Derecho & Economía: a quiet signature. The letters take the text color; the arc under
   "SAI" is drawn in the monarch orange, like the perimeter line, and warms on hover. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sai-arc { fill: var(--sai-arc, currentColor); transition: fill 0.3s; }
.sai-mark { display: block; flex: none; width: 64px; height: auto; aspect-ratio: 74 / 47; --sai-arc: rgba(240, 138, 36, 0.8); transition: color 0.3s; }
.foot-sai, .hero-by { color: var(--on-ink-muted); text-decoration: none; transition: color 0.3s; }
.foot-sai:hover, .hero-by:hover, .foot-sai:focus-visible, .hero-by:focus-visible { color: var(--on-ink); }
.foot-sai:hover .sai-mark, .hero-by:hover .sai-mark { --sai-arc: var(--signal); }
.foot-sai { justify-self: end; display: inline-flex; align-items: center; gap: 14px; }
.foot-sai .mono { font-size: 0.6rem; text-transform: none; letter-spacing: 0.04em; }
.foot-sai .sai-mark { width: 82px; }
/* Phones: name, note, then the SAI line as its own ruled row, then the three names. */
@media (max-width: 640px) {
  .foot-grid { gap: 20px; }
  .site-foot .brand { order: 1; }
  .foot-note { order: 2; }
  .foot-sai { order: 3; justify-self: stretch; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--line-ink); border-bottom: 1px solid var(--line-ink); }
  .foot-sai .sai-mark { width: 74px; }
  .foot-tri { order: 4; line-height: 1.9; }
  .foot-egg { order: 5; min-height: 0; }
}
.hero-by { display: inline-flex; align-items: center; gap: 12px; margin-top: 30px; animation: rise 0.9s 0.52s var(--ease) both; }
.hero-by .mono { font-size: 0.6rem; text-transform: none; letter-spacing: 0.04em; }
.hero-by .sai-mark { width: 52px; }
/* On phones the map sits under the copy, so the signature moves below the map, under its caption. */
.hero-by-m { display: none; }
@media (max-width: 920px) {
  .hero-copy .hero-by { display: none; }
  .hero-by-m { display: inline-flex; align-self: flex-start; margin-top: 10px; gap: 10px; animation: fade 1.2s 0.6s both; }
  .hero-by-m .sai-mark { width: 44px; }
}
/* Foundations: the SAI mark as a masthead, opposite the kicker; inline on phones. */
.f-hero .wrap { position: relative; }
.f-by { position: absolute; top: 0; right: var(--gutter); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; color: var(--on-ink-muted); text-decoration: none; transition: color 0.3s; animation: fade 1.2s 0.3s both; }
.f-by .mono { font-size: 0.62rem; text-transform: none; letter-spacing: 0.04em; }
.f-by .sai-mark { width: 104px; }
.f-by:hover, .f-by:focus-visible { color: var(--on-ink); }
.f-by:hover .sai-mark { --sai-arc: var(--signal); }
@media (max-width: 760px) {
  .f-by { position: static; flex-direction: row; align-items: center; gap: 12px; margin-bottom: 28px; }
  .f-by .sai-mark { width: 64px; }
}

/* ==========================================================================
   Foundations page
   ========================================================================== */
.f-hero { padding: clamp(130px, 16vw, 190px) 0 clamp(64px, 8vw, 104px); }
.f-hero h1 { font-size: clamp(2.5rem, 5.2vw, 4.6rem); line-height: 0.98; max-width: 980px; }
.f-hero .sec-sub { max-width: 760px; }
/* What is on the page, and how much */
.f-counts { list-style: none; margin: 40px 0 0; padding: 22px 0 0; display: flex; flex-wrap: wrap; gap: 14px 44px; border-top: 1px solid var(--line-ink); }
.f-counts li { display: flex; align-items: baseline; gap: 10px; color: var(--on-ink-muted); font-size: 0.92rem; }
.f-counts b { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -0.03em; color: var(--signal); line-height: 1; }
.f-contents { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: none; }
.f-contents a { display: grid; gap: 6px; height: 100%; padding: 18px 18px 20px; border: 1px solid var(--line-ink); border-radius: var(--radius); text-decoration: none; background: var(--ink-2); transition: border-color 0.25s, transform 0.25s var(--ease), background 0.25s; }
.f-contents a:hover, .f-contents a:focus-visible { border-color: var(--signal); transform: translateY(-3px); background: var(--ink-3); }
.f-contents span { color: var(--signal); font-size: 0.68rem; }
.f-contents b { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--on-ink); }
.f-contents em { color: var(--on-ink-muted); font-size: 0.88rem; line-height: 1.45; }
@media (max-width: 1000px) { .f-contents { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .f-contents { grid-template-columns: 1fr; } .f-counts { gap: 10px 28px; } }

/* 01 The argument: a chain of numbered claims */
.chain { list-style: none; margin: 0; padding: 0; position: relative; max-width: 980px; }
/* Each step draws the line down to the next one, so it stops at the conclusion. */
.chain li:not(:last-child)::before { content: ""; position: absolute; left: 27px; top: 56px; bottom: 0; width: 2px; background: var(--line-paper); }
.chain li { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 24px; padding: 0 0 34px; }
.chain-n { position: relative; z-index: 1; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--paper); border: 2px solid var(--on-paper); font-family: var(--f-display); font-weight: 700; font-size: 1.4rem; }
.chain-body { padding-top: 10px; }
.chain h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.35rem, 2.4vw, 1.85rem); letter-spacing: -0.02em; line-height: 1.12; margin-bottom: 10px; }
.chain p:not(.chain-go) { color: var(--on-paper-muted); max-width: 720px; }
.chain-go { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chain-go .mono { color: var(--on-paper-muted); font-size: 0.62rem; margin-right: 2px; }
.chain-go a { font-family: var(--f-mono); font-size: 0.72rem; text-decoration: none; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-paper); color: var(--on-paper); background: #fff; transition: border-color 0.2s, color 0.2s, background 0.2s; }
.chain-go a:hover, .chain-go a:focus-visible { border-color: var(--signal-deep); color: var(--signal-deep); }
.chain-go .go-vision { border-color: transparent; background: none; color: var(--signal-deep); text-decoration: underline; text-underline-offset: 3px; }
.chain-go .go-vision::after { content: " →"; }
.chain li:hover .chain-n { border-color: var(--signal-deep); color: var(--signal-deep); }
.chain-end .chain-n { background: var(--signal-deep); border-color: var(--signal-deep); color: var(--paper); }
.chain-end h3 { color: var(--signal-deep); }
.chain-end { padding-bottom: 0; }
@media (max-width: 600px) {
  .chain li:not(:last-child)::before { left: 19px; top: 40px; }
  .chain li { grid-template-columns: 40px minmax(0, 1fr); gap: 16px; }
  .chain-n { width: 40px; height: 40px; font-size: 1.05rem; }
  .chain-body { padding-top: 4px; }
}

/* 02 The proposal */
.quotes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.quote-block { margin: 0; padding: 26px 30px; border-left: 4px solid var(--signal-deep); background: #fff; border-radius: 0 var(--radius) var(--radius) 0; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.quote-block p { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.2rem, 2vw, 1.55rem); line-height: 1.25; letter-spacing: -0.012em; }
.quote-block footer { color: var(--on-paper-muted); }
.ink .quote-block { background: var(--ink-2); border-left-color: var(--signal); }
.ink .quote-block footer { color: var(--on-ink-muted); }
.f-cta { margin-top: 28px; }
@media (max-width: 760px) { .quotes { grid-template-columns: 1fr; } }
.people-bios { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 40px; }
.bio { padding: 26px; background: var(--paper-2); border-radius: var(--radius); }
.bio h3 { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; margin-bottom: 8px; }
.bio p { color: var(--on-paper-muted); }
.ink .bio { background: transparent; border: 1px solid var(--line-ink); }
.ink .bio p { color: var(--on-ink-muted); }
@media (max-width: 760px) { .people-bios { grid-template-columns: 1fr; } }

/* Source kinds, used in the lineage and the evidence */
.kind { display: inline-block; vertical-align: 2px; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font: 500 0.58rem/1.5 var(--f-mono); letter-spacing: 0.05em; text-transform: uppercase; border: 1px solid currentColor; color: var(--on-ink-muted); white-space: nowrap; }
.paper .kind { color: var(--on-paper-muted); }
.kinds { list-style: none; margin: -24px 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; text-transform: none; letter-spacing: 0.02em; font-size: 0.66rem; color: var(--on-ink-muted); }
.kinds li { display: inline-flex; align-items: center; gap: 2px; }
.kinds .kind { margin: 0 8px 0 0; }

/* 03 Lineage */
.lineage { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--on-ink); }
.lineage li { position: relative; display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line-ink); }
.lineage .yr { font-family: var(--f-mono); color: var(--signal); }
.lineage b { font-weight: 600; }
.lineage p { color: var(--on-ink-muted); }
.paper .lineage { border-top-color: var(--on-paper); }
.paper .lineage li { border-color: var(--line-paper); }
.paper .lineage .yr { color: var(--signal-deep); }
.paper .lineage p { color: var(--on-paper-muted); }
.lineage .kind { margin-left: 0; margin-top: 6px; display: table; }
.lineage li.is-now { background: linear-gradient(90deg, rgba(168, 75, 10, 0.08), transparent 70%); }
.lineage li.is-now::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; width: 3px; background: var(--signal-deep); }
@media (max-width: 760px) { .lineage li { grid-template-columns: 70px 1fr; } .lineage p { grid-column: 2; } .lineage li.is-now::before { left: -8px; } }

/* 04 Evidence */
.themes { display: grid; gap: 18px; }
.theme { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 56px); padding: clamp(24px, 3.5vw, 40px); background: #fff; border-radius: var(--radius); border: 1px solid var(--line-paper); scroll-margin-top: 88px; transition: border-color 0.4s, box-shadow 0.4s; }
.theme-n { font-family: var(--f-mono); color: var(--signal-deep); font-size: 0.74rem; margin-bottom: 12px; }
.theme h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 12px; }
.theme .claim { color: var(--on-paper-muted); }
.theme ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; align-content: start; }
.theme li { padding-left: 16px; border-left: 2px solid var(--line-paper); }
.theme li b { display: block; font-weight: 600; }
.theme li > span { color: var(--on-paper-muted); font-size: 0.95rem; }
.theme-fig { margin-top: 22px; display: grid; gap: 4px; }
.theme-fig b { font-family: var(--f-display); font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.8rem); letter-spacing: -0.03em; line-height: 1; color: var(--signal-deep); }
.theme-fig span { font-size: 0.88rem; color: var(--on-paper-muted); max-width: 360px; }
.theme-back { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 22px; font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.02em; text-decoration: none; color: var(--signal-deep); }
.theme-back span:first-child { color: var(--on-paper-muted); }
.theme-back span:last-child::after { content: " →"; }
.theme-back:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.ink .theme { background: var(--ink-2); border-color: var(--line-ink); }
.ink .theme-n, .ink .theme-fig b, .ink .theme-back { color: var(--signal); }
.ink .theme .claim, .ink .theme li > span, .ink .theme-fig span, .ink .theme-back span:first-child { color: var(--on-ink-muted); }
.ink .theme li { border-color: var(--line-ink); }
.theme:target { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(240, 138, 36, 0.25); }
@media (max-width: 860px) { .theme { grid-template-columns: 1fr; } }

/* 05 Open questions */
.oq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.oq { padding: clamp(22px, 3vw, 32px); background: #fff; border: 1px solid var(--line-paper); border-radius: var(--radius); display: flex; flex-direction: column; }
.oq h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.25rem, 2vw, 1.55rem); letter-spacing: -0.015em; line-height: 1.15; margin-bottom: 18px; }
.oq-k { font-size: 0.6rem; color: var(--on-paper-muted); margin-bottom: 6px; }
.oq-k + p { margin-bottom: 16px; }
.oq p:not(.oq-k):not(.src) { font-size: 0.97rem; }
.oq .oq-k:nth-of-type(1) + p { color: var(--on-paper-muted); }
.oq .oq-k:nth-of-type(2) { color: var(--signal-deep); }
.oq .src { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-paper); }
@media (max-width: 860px) { .oq-grid { grid-template-columns: 1fr; } }

/* 06 Fact sheet (and the bibliography search, which reuses the controls) */
.fs-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 20px; }
.fs-search { flex: 1 1 260px; max-width: 420px; }
.fs-search input { width: 100%; padding: 12px 16px 12px 40px; border-radius: 999px; border: 1px solid var(--line-ink); background: var(--ink-2) no-repeat 15px 50% / 15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a948a' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='7'/%3E%3Cpath d='M16 16l5.5 5.5'/%3E%3C/svg%3E"); color: var(--on-ink); font: inherit; font-size: 0.95rem; }
.fs-search input::placeholder { color: var(--on-ink-muted); }
.fs-search input:focus { outline: none; border-color: var(--signal); }
.fs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-chips button { border: 1px solid var(--line-ink); background: none; padding: 7px 13px; border-radius: 999px; font: 500 0.7rem var(--f-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--on-ink-muted); transition: color 0.2s, border-color 0.2s, background 0.2s; }
.fs-chips button:hover { color: var(--on-ink); border-color: var(--on-ink-muted); }
.fs-chips button[aria-pressed="true"] { background: var(--on-ink); border-color: var(--on-ink); color: var(--ink); }
.fs-csv { margin-left: auto; padding: 10px 18px; }
.fs-wrap { border: 1px solid var(--line-ink); border-radius: var(--radius); overflow-x: auto; }
.fs-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.fs-table th { position: sticky; top: 0; text-align: left; padding: 12px 16px; background: var(--ink-3); color: var(--on-ink-muted); font: 500 0.64rem var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.fs-table td { padding: 13px 16px; border-top: 1px solid var(--line-ink); vertical-align: top; color: var(--on-ink-muted); }
.fs-table tr:hover td { background: rgba(236, 232, 223, 0.03); }
.fs-table td:nth-child(2) { color: var(--on-ink); min-width: 260px; }
.fs-val { font-family: var(--f-mono); color: var(--signal) !important; white-space: nowrap; }
.fs-sec a { font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--on-ink-muted); text-decoration: none; white-space: nowrap; }
.fs-sec a:hover { color: var(--signal); }
.fs-src { font-size: 0.82rem; min-width: 180px; }
.fs-src a { color: var(--on-ink); text-decoration: underline; text-decoration-color: var(--line-ink); text-underline-offset: 3px; }
.fs-src a:hover { text-decoration-color: var(--signal); }
.fs-count { margin-top: 12px; color: var(--on-ink-muted); font-size: 0.62rem; text-transform: none; letter-spacing: 0.02em; }
.fs-controls .fs-count { margin: 0; }
@media (max-width: 720px) {
  .fs-csv { margin-left: 0; }
  .fs-wrap { border: 0; overflow: visible; }
  .fs-table thead { display: none; }
  .fs-table, .fs-table tbody, .fs-table tr, .fs-table td { display: block; }
  .fs-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; border-top: 1px solid var(--line-ink); }
  .fs-table td { padding: 0; border: 0; min-width: 0 !important; }
  .fs-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .fs-table td.fs-val { grid-column: 1 / -1; grid-row: 3; white-space: normal; font-size: 1.05rem; }
  .fs-table td.fs-src { grid-column: 1 / -1; grid-row: 4; }
  .fs-table tr:hover td { background: none; }
}

/* 08 Bibliography */
.biblio-groups { display: grid; gap: 36px; }
.biblio-group h3 { display: flex; align-items: baseline; gap: 10px; color: var(--signal); margin-bottom: 6px; padding-bottom: 10px; border-bottom: 2px solid var(--on-ink); }
.bg-n { color: var(--on-ink-muted); }
.biblio { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 48px; }
.biblio li { break-inside: avoid; padding: 12px 0; border-bottom: 1px solid var(--line-ink); color: var(--on-ink-muted); font-size: 0.93rem; line-height: 1.5; }
.biblio li b { color: var(--on-ink); font-weight: 600; }
.biblio li .t { color: var(--on-ink); }
.biblio a { color: var(--signal); text-decoration: none; }
@media (max-width: 860px) { .biblio { columns: 1; } }
.cite { margin-top: 56px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; padding: 28px; border: 1px solid var(--line-ink); border-radius: var(--radius); background: var(--ink-2); }
.cite > div { flex: 1 1 420px; }
.cite .kicker { margin-bottom: 12px; }
.cite-text { font-family: var(--f-mono); font-size: 0.82rem; line-height: 1.7; color: var(--on-ink); word-break: break-word; }

/* 07 Methods */
.methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.method { padding: 24px; border: 1px solid var(--line-paper); border-radius: var(--radius); background: #fff; }
.method h3 { font-size: 1.05rem; margin-bottom: 8px; }
.method p { color: var(--on-paper-muted); font-size: 0.93rem; }
.method-repo { grid-column: 1 / -1; background: var(--on-paper); border-color: var(--on-paper); color: var(--paper); }
.method-repo p { color: rgba(242, 239, 232, 0.72); max-width: 720px; }
.repo-links { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; text-transform: none; letter-spacing: 0.02em; }
.repo-links a { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(242, 239, 232, 0.25); color: var(--paper); text-decoration: none; font-size: 0.72rem; transition: border-color 0.2s, color 0.2s; }
.repo-links a:hover { border-color: var(--signal); color: var(--signal); }
@media (max-width: 760px) { .methods { grid-template-columns: 1fr; } }


/* ==========================================================================
   The union in one sentence, with inline chips
   ========================================================================== */
.statement { padding: clamp(96px, 13vw, 176px) 0; }
.statement-text {
  max-width: 1120px; margin: 0 auto; text-align: center; text-wrap: balance;
  font-family: var(--f-display); font-weight: 600; font-size: clamp(1.75rem, 4.3vw, 3.8rem); line-height: 1.16; letter-spacing: -0.03em; color: var(--on-paper);
}
.statement-text .nw { white-space: nowrap; }
.chips { display: inline-flex; vertical-align: -0.2em; margin: 0 0.06em; }
.chips .chip { vertical-align: 0; margin: 0; }
.chips .chip + .chip { margin-left: -0.3em; }
.chip {
  display: inline-grid; place-items: center; width: 1.12em; height: 1.12em; border-radius: 50%; overflow: hidden;
  vertical-align: -0.2em; margin: 0 0.04em; background: var(--ink);
  box-shadow: 0 0 0 0.055em var(--paper), 0 0.14em 0.32em rgba(20, 19, 17, 0.16);
}
.chip svg { width: 66%; height: 66%; overflow: hidden; }
.chip svg.line { fill: none; stroke: var(--paper); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chip-ca { background: var(--ca); } .chip-us { background: var(--us); } .chip-mx { background: var(--mx); }
.chip-ca svg, .chip-us svg, .chip-mx svg, .chip-na svg { width: 74%; height: 74%; fill: var(--paper); }
.chip-na { background: var(--signal); }
.chip-pyramid { background: #fbfaf6; box-shadow: 0 0 0 0.055em var(--paper), inset 0 0 0 1px var(--line-paper), 0 0.14em 0.32em rgba(20, 19, 17, 0.16); }
.chip-pyramid svg { width: 76%; height: 76%; }
.chip-growth { background: var(--ink); }
.chip-growth svg.line { stroke: var(--signal); stroke-width: 3.4; }
.chip-rook { background: var(--monarch-black); }
.chip-rook svg { width: 70%; height: 70%; fill: var(--signal); }
/* Chips pop in one after another as the sentence enters. */
.statement-text .chip { transform: scale(0.3) rotate(-14deg); opacity: 0; transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s, box-shadow 0.3s, margin 0.35s var(--ease); }
.statement-text.in .chip { transform: none; opacity: 1; }
/* Each chip is a link to its part of the page: it lifts, its phrase lights up, and a label names the section. */
a.chip { cursor: pointer; text-decoration: none; outline-offset: 4px; }
.statement-text.in .chip:hover, .statement-text.in .chip:focus-visible { transform: translateY(-0.1em) scale(1.2) rotate(-6deg); box-shadow: 0 0 0 0.055em var(--paper), 0 0 0 0.12em var(--signal), 0 0.22em 0.5em rgba(20, 19, 17, 0.22); }
.statement-text .nw { transition: color 0.3s; }
.statement-text .nw:has(.chip:hover), .statement-text .nw:has(.chip:focus-visible) { color: var(--signal-deep); }
.statement-text .chips:hover .chip + .chip, .statement-text .chips:focus-within .chip + .chip { margin-left: 0.06em; }
.chip svg { transition: transform 0.4s var(--ease); }
.chip-truck:hover svg, .chip-truck:focus-visible svg { animation: chip-drive 0.5s ease-in-out infinite alternate; }
.chip-factory:hover svg, .chip-factory:focus-visible svg { transform: translateY(-6%); }
.chip-growth:hover svg path, .chip-growth:focus-visible svg path { stroke-dasharray: 70; animation: chip-draw 0.8s var(--ease) both; }
.chip-rook:hover svg, .chip-rook:focus-visible svg { transform: translateY(-9%) scale(1.06); }
.chip-pyramid:hover svg, .chip-pyramid:focus-visible svg { transform: scale(1.12); }
.chip-na:hover svg, .chip-na:focus-visible svg { transform: rotate(-12deg) scale(1.06); }
@keyframes chip-drive { from { transform: translateX(-6%); } to { transform: translateX(10%); } }
@keyframes chip-draw { from { stroke-dashoffset: 70; } to { stroke-dashoffset: 0; } }
.statement .wrap { position: relative; }
.chip-tip {
  position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; white-space: nowrap;
  padding: 7px 11px; border-radius: 999px; background: var(--on-paper); color: var(--paper); font-size: 0.66rem;
  opacity: 0; transition: opacity 0.2s, transform 0.25s var(--ease);
}
.chip-tip.on { opacity: 1; transform: translate(-50%, calc(-100% - 14px)); }
.statement-hint { margin-top: 28px; text-align: center; color: var(--on-paper-muted); font-size: 0.64rem; text-transform: none; letter-spacing: 0.03em; }

/* Links from the vision page to the evidence on the foundations page */
.ev-link { display: inline-block; margin-top: 22px; color: var(--signal); text-decoration: none; text-transform: none; letter-spacing: 0.02em; font-size: 0.72rem; line-height: 1.6; padding-bottom: 3px; border-bottom: 1px solid currentColor; transition: color 0.2s; }
.ev-link::after { content: "→"; display: inline-block; margin-left: 10px; transition: transform 0.25s var(--ease); }
.ev-link:hover::after { transform: translateX(5px); }
.paper .ev-link { color: var(--signal-deep); }
/* Arriving from a chip or a link: the section's kicker pulses once. */
section[id], figure[id] { scroll-margin-top: 72px; }
section:target .sec-head .kicker, section:target > .wrap > .sec-head .kicker { animation: arrive 1.6s var(--ease) 0.4s; }
figure:target { animation: arrive-box 1.8s var(--ease) 0.4s; }
@keyframes arrive { 0%, 100% { transform: none; } 30% { transform: translateX(10px); } }
@keyframes arrive-box { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 138, 36, 0); } 30% { box-shadow: 0 0 0 4px rgba(240, 138, 36, 0.6); } }

/* ==========================================================================
   Footer: the logo is an easter egg. The monarch has never needed a certificate of origin.
   ========================================================================== */
.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; }
.foot-egg { grid-column: 1 / -1; min-height: 20px; }
.egg { display: grid; place-items: center; padding: 2px; margin: -2px; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.egg .brand-mark { width: 30px; }
.egg:hover .brand-mark, .egg:focus-visible .brand-mark, .egg.on .brand-mark { animation: flap 0.42s ease-in-out infinite alternate; }
.egg:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.egg-note { font-size: 0.66rem; letter-spacing: 0.02em; color: var(--on-ink-muted); opacity: 0; transform: translateX(-8px); transition: opacity 0.5s, transform 0.5s var(--ease); }
.foot-grid:has(.egg:hover) .egg-note, .foot-grid:has(.egg:focus-visible) .egg-note, .foot-grid:has(.egg.on) .egg-note { opacity: 1; transform: none; }

/* ==========================================================================
   Modern-take blocks and new charts
   ========================================================================== */
.tag { display: inline-block; padding: 5px 10px; border-radius: 999px; border: 1px solid currentColor; color: var(--signal); margin-bottom: 18px; font-size: 0.64rem; }
.paper .tag { color: var(--signal-deep); }
.sub-head h3.display { font-size: clamp(1.8rem, 3.4vw, 2.8rem); margin-bottom: 18px; line-height: 1.05; }

.paperwork { margin-top: clamp(64px, 9vw, 112px); padding-top: clamp(40px, 5vw, 56px); border-top: 1px solid var(--line-paper); }
.sub-head { max-width: 820px; margin-bottom: 28px; }
.pw-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
#roo-chart, #slope, #wa-line { width: 100%; height: auto; overflow: visible; }
.chart, .pw-grid > *, .demo-grid > * { min-width: 0; }
/* Narrow layouts (set in main.js on small containers) use larger type in viewBox units. */
.svgc.narrow text { font-size: 14px; }
.svgc.narrow .lbl { font-size: 15px; }
#pyramid.narrow text { font-size: 14px; }
#pyramid.narrow .axis-label { font-size: 15px; }
.svgc text { font-family: var(--f-mono); font-size: 12px; fill: var(--on-ink-muted); }
.paper .svgc text { fill: var(--on-paper-muted); }
.svgc .lbl { fill: var(--on-ink); font-size: 13px; }
.paper .svgc .lbl { fill: var(--on-paper); }
.svgc .grid { stroke: var(--line-ink); }
.paper .svgc .grid { stroke: var(--line-paper); }
.svgc .acc { fill: var(--signal); }
.paper .svgc .acc { fill: var(--signal-deep); }
.ut-text { margin-top: 16px; font-size: 0.98rem; }
.paper .ut-text { color: var(--on-paper); }
.dumbbells { margin-top: 20px; display: grid; gap: 16px; }
.db { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; }
.db-name { font-size: 0.92rem; font-weight: 500; }
.db-track { position: relative; height: 34px; }
.db-axis { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-ink); }
.paper .db-axis { background: var(--line-paper); }
.db-line { position: absolute; top: 50%; height: 3px; margin-top: -1.5px; background: currentColor; opacity: 0.5; transition: left 1s var(--ease), width 1s var(--ease); }
.db-dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; transition: left 1s var(--ease); }
.db-dot.from { background: var(--paper); border: 2.5px solid currentColor; }
.ink .db-dot.from { background: var(--ink-2); }
.db-dot.to { background: currentColor; }
.db-lab { position: absolute; top: -6px; font-family: var(--f-mono); font-size: 0.7rem; transform: translateX(-50%); white-space: nowrap; }
.db-lab.from { top: auto; bottom: -8px; opacity: 0.75; }
@media (max-width: 900px) { .pw-grid { grid-template-columns: 1fr; } }

.then-now { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; height: 200px; margin-top: 22px; align-items: end; }
.step { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; gap: 6px; }
.step-bar { display: block; height: 0; background: #5d574e; border-radius: 4px 4px 0 0; transition: height 1.2s var(--ease); }
.step.now .step-bar { background: var(--monarch); }
.step b { font-family: var(--f-mono); font-weight: 500; font-size: 0.86rem; }
.step.now b { color: var(--signal); }
.step .mono { color: var(--on-ink-muted); font-size: 0.62rem; text-transform: none; letter-spacing: 0.02em; }
.slope-card { margin-top: 20px; }
.eco-facts { margin-top: 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.eco-facts article { padding: 24px; border: 1px solid var(--line-ink); border-radius: var(--radius); }
.eco-facts .big { font-family: var(--f-display); font-weight: 700; font-size: clamp(2rem, 3.4vw, 2.8rem); letter-spacing: -0.03em; line-height: 1; margin-bottom: 10px; color: var(--signal); }
.eco-facts p:not(.big):not(.src) { color: var(--on-ink-muted); font-size: 0.95rem; }
.ink .tri-card { background: var(--ink-2); box-shadow: none; border-left: 1px solid var(--line-ink); border-right: 1px solid var(--line-ink); border-bottom: 1px solid var(--line-ink); }
.ink .tri-card .mono, .ink .tri-card p:last-child { color: var(--on-ink-muted); }
@media (max-width: 960px) { .then-now, .eco-facts { grid-template-columns: 1fr; } }

.wa-line { margin-bottom: 20px; }
.paper .chart { background: #f7f5f0; }
.paper #pyramid text { fill: var(--on-paper-muted); }
.paper #pyramid .axis-label { fill: var(--on-paper); }
#pyramid .gridl { stroke: var(--line-ink); }
.paper #pyramid .gridl { stroke: var(--line-paper); }
.paper #pyramid .row-hit:hover, .paper #pyramid .row-hit.on { fill: rgba(25, 23, 20, 0.06); }
.paper .chart-tip { color: var(--on-paper); }
.paper .seg { border-color: var(--line-paper); }
.paper .seg button { color: var(--on-paper-muted); }
.paper .seg button[aria-pressed="true"] { background: var(--on-paper); color: var(--paper); }
.paper .pyr-legend { color: var(--on-paper-muted); }
.paper .ages { border-color: var(--line-paper); background: #f7f5f0; }
.paper .age-row { border-color: var(--line-paper); }
.paper .age-row.dim { color: var(--on-paper-muted); }
.paper .age-row.strong { color: var(--signal-deep); }
.paper .ages .label { color: var(--on-paper-muted); }

/* The scrambled egg theorem: steps scroll past a sticky canvas */
.egg-sec { border-top: 1px solid var(--line-ink); }
.scrolly { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.egg-fig { grid-column: 2; grid-row: 1; margin: 0; position: sticky; top: max(84px, calc(50vh - min(36vh, 330px) - 30px)); }
.egg-readout { display: flex; align-items: baseline; gap: 14px; min-height: 1.6em; }
.egg-year { color: var(--signal); font-size: 0.82rem; }
.egg-state { font-family: var(--f-display); font-weight: 600; font-size: 1.08rem; letter-spacing: -0.01em; color: var(--on-ink); }
.egg-readout.swap .egg-year, .egg-readout.swap .egg-state { animation: rise 0.5s var(--ease) both; }
.egg-stage { position: relative; height: min(72vh, 660px); }
#egg-canvas { display: block; width: 100%; height: 100%; }
.egg-fig figcaption { margin-top: 8px; color: var(--on-ink-muted); font-size: 0.6rem; text-transform: none; letter-spacing: 0.02em; }
.egg-steps { grid-column: 1; grid-row: 1; list-style: none; margin: 0; padding: 0; }
.egg-step { min-height: 82vh; display: flex; flex-direction: column; justify-content: center; padding-left: 24px; border-left: 2px solid var(--line-ink); opacity: 0.32; transition: opacity 0.5s var(--ease), border-color 0.5s; }
.egg-step:first-child { min-height: 64vh; justify-content: flex-start; padding-top: 12vh; }
.egg-step.is-active { opacity: 1; border-left-color: var(--signal); }
.egg-step .step-k { color: var(--signal); }
.egg-step h3 { font-family: var(--f-display); font-size: clamp(1.9rem, 3.4vw, 2.8rem); letter-spacing: -0.025em; line-height: 1.02; margin: 10px 0 14px; }
.egg-step p:not(.step-k):not(.egg-stat) { color: var(--on-ink-muted); max-width: 470px; }
.egg-stat { margin-top: 22px; display: grid; gap: 6px; max-width: 420px; }
.egg-stat b { font-family: var(--f-display); font-weight: 700; font-size: clamp(2.3rem, 4vw, 3.2rem); letter-spacing: -0.03em; line-height: 1; color: var(--signal); }
.egg-stat span { color: var(--on-ink-muted); font-size: 0.92rem; }
.theorem { margin-top: clamp(48px, 7vw, 88px); display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--on-ink); }
.theorem > div { padding: 26px 32px 0 0; }
.theorem > div + div { padding-left: 32px; border-left: 1px solid var(--line-ink); }
.th-k { color: var(--signal); }
.th-s { margin-top: 12px; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.3rem, 2.3vw, 1.8rem); line-height: 1.2; letter-spacing: -0.018em; text-wrap: pretty; }
.theorem > div + div .th-s::after { content: " \220E"; color: var(--signal); }
.egg-sec .chart-note { margin-top: 28px; max-width: 900px; }
@media (max-width: 900px) {
  .theorem { grid-template-columns: 1fr; }
  .theorem > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-ink); margin-top: 26px; }
}
/* Upright phones: the canvas fills the screen and draws in its upper part; each step is a card
   that slides up over it, so the text gets the whole screen to be read. Phones held sideways
   keep the side-by-side layout. Keep this query in step with EGG_OVERLAY in main.js. */
@media (max-width: 900px) and (min-height: 501px) {
  .scrolly { grid-template-columns: 1fr; gap: 0; }
  .egg-fig, .egg-steps { grid-column: 1; grid-row: 1; }
  .egg-fig { align-self: start; top: 60px; z-index: 1; height: calc(100vh - 60px); height: calc(100svh - 60px); display: flex; flex-direction: column; margin: 0 calc(var(--gutter) * -1); padding: 12px var(--gutter) 0; background: var(--ink); }
  .egg-readout { flex: none; }
  .egg-stage { flex: 1 1 auto; height: auto; min-height: 0; }
  .egg-fig figcaption { order: 1; margin: 2px 0 0; }
  .egg-stage { order: 2; }
  .egg-state { font-size: 0.98rem; }
  .egg-steps { position: relative; z-index: 2; pointer-events: none; }
  .egg-step, .egg-step:first-child { min-height: 100vh; min-height: 100svh; justify-content: flex-end; padding: 0 0 4svh; border: 0; opacity: 1; }
  .step-card { pointer-events: auto; padding: 18px 18px 20px; border-radius: var(--radius); background: rgba(27, 26, 23, 0.95); border: 1px solid var(--line-ink); border-left: 3px solid var(--signal); box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .egg-step h3 { font-size: 1.75rem; margin: 6px 0 10px; }
  .egg-step p:not(.step-k):not(.egg-stat) { font-size: 1rem; line-height: 1.55; }
  .egg-stat { margin-top: 14px; }
  .egg-stat b { font-size: 2.2rem; }
}
}

.found { overflow: hidden; }
.found .wrap { position: relative; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; transition-delay: 0ms !important; }
  .reveal { opacity: 1; transform: none; }
  .brand-mark { animation: none !important; }
}

/* ==========================================================================
   Phones: legible type everywhere (nothing under ~11px), larger map labels
   ========================================================================== */
@media (max-width: 600px) {
  .mono { font-size: 0.78rem; }
  .chart-note, .src, .chart figcaption p, .hero-map figcaption, .schedule-legend, .tb-sub, .tb-head, .tb-prod span,
  .per-legend, .rt-status b, .meter-label, .step .mono, .pyr-legend, .ages .label, .egg-fig figcaption, .ev-doors figcaption p,
  .statement-hint, .kinds, .fs-count, .theme-back, .chain-go .mono, .oq-k, .foot-tri, .egg-note, .share-status, .tag, .foot-sai .mono,
  .f-contents span, .fs-sec a, .fs-table th, .scroll-cue { font-size: 0.7rem; }
  .route-meter dt { font-size: 0.64rem; }
  .ev-link { font-size: 0.8rem; }
  .kind, .lineage .kind { font-size: 0.64rem; }
  .evb-flag { font-size: 0.64rem; padding: 3px 8px; }
  .tb-bar span { font-size: 0.86rem; }
  .tb-bar abbr { font-size: 0.7rem; }
  .ribbon li { font-size: 0.8rem; }
  .ribbon b { font-size: 0.95rem; }
  .db-lab { font-size: 0.74rem; }
  .chart-tip { font-size: 0.76rem; }
  .lang button { font-size: 0.78rem; }
  .map-label { font-size: 30px; stroke-width: 6px; }
  .map-label.na { font-size: 40px; }
  #per-map.narrow .port-label { font-size: 30px; stroke-width: 6px; }
  #per-map.narrow .port-minor { display: none; }
  #per-map.narrow .rt-ring { stroke-width: 4; }
}
