/* ============================================================
   TCP 05 · "The Kitchen Table & the Capitol"
   One page, two registers. body[data-register] flips surface,
   type voice, and which copy line leads. Same facts, two rooms.
   ============================================================ */

:root {
  /* Table register (default) */
  --surface: #FFF9EF;
  --surface-2: #FFFFFF;
  --text: #33220F;          /* 12.5:1 on surface */
  --text-soft: #6B5335;     /* 5.6:1 on surface */
  --accent: #B4500F;        /* AA-adjusted brand orange, 5.2:1 */
  --accent-2: #8A5A00;      /* gold-derived for small text */
  --gold: #FDBE57;
  --line: #E7D9BE;
  --btn-solid-bg: #B4500F;
  --btn-solid-fg: #FFF9EF;
  --head-font: "Fraunces", Georgia, serif;
  --head-weight: 560;
  --head-track: -0.012em;
  --radius: 12px;
}

body[data-register="capitol"] {
  --surface: #00263F;
  --surface-2: #003357;
  --text: #F2F7FB;          /* 13.5:1 on surface */
  --text-soft: #A8C2D6;     /* 7.1:1 on surface */
  --accent: #FDBE57;
  --accent-2: #FDBE57;
  --line: #1D4A6B;
  --btn-solid-bg: #FDBE57;
  --btn-solid-fg: #00263F;
  --head-font: "Archivo", system-ui, sans-serif;
  --head-weight: 750;
  --head-track: -0.02em;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.62;
  transition: background-color 0.45s ease, color 0.45s ease;
}
img { max-width: 100%; height: auto; display: block; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--gold); color: #33220F; padding: 0.75rem 1.25rem; font-weight: 700;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--gold); }

/* ---------- Register copy switching ----------
   Both spans exist in the DOM; only the active register's copy
   is rendered (display) so AT reads a single coherent page.   */
.reg-table, .reg-capitol { display: none; }
body[data-register="table"] .reg-table { display: inline; }
body[data-register="capitol"] .reg-capitol { display: inline; }

/* Crossfade veil on switch (skipped under reduced motion) */
body.is-switching main { opacity: 0.15; }
main { transition: opacity 0.28s ease; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: #14212B;
  color: #fff;
}
.header-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.7rem 1.5rem;
}
.brand img { width: 126px; height: auto; }
.primary-nav { margin-left: auto; }
.primary-nav ul { display: flex; gap: 0.2rem; list-style: none; margin: 0; padding: 0; }
.primary-nav a {
  color: #fff; text-decoration: none; font-weight: 600; font-size: 0.94rem;
  padding: 0.6rem 0.65rem; border-radius: 6px; display: block;
}
.primary-nav a:hover { background: rgba(255,255,255,0.13); }
.header-utils { display: flex; align-items: center; gap: 0.7rem; }
.menu-btn {
  display: none; background: none; border: 1.5px solid rgba(255,255,255,0.5);
  color: #fff; font: inherit; font-weight: 600; border-radius: 8px;
  padding: 0.5rem 1rem; min-height: 44px; cursor: pointer;
}

.lang { position: relative; }
.lang-btn {
  background: none; border: none; border-bottom: 2px solid rgba(255,255,255,0.5);
  color: #fff; font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 0.55rem 0.25rem; cursor: pointer; min-height: 44px;
  display: flex; align-items: center; gap: 0.4rem;
}
.lang-btn:hover { border-color: #fff; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; color: #14212B;
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  list-style: none; margin: 0; padding: 0.5rem;
  min-width: 210px; max-height: 60vh; overflow: auto; z-index: 60;
}
.lang-menu [role="option"] { padding: 0.55rem 0.9rem; border-radius: 6px; cursor: pointer; }
.lang-menu [role="option"]:hover { background: #F1EAD9; }
.lang-menu [role="option"][aria-selected="true"] { background: #B4500F; color: #fff; font-weight: 700; }
.lang-menu [role="option"]:focus-visible { outline: 3px solid #B4500F; outline-offset: -3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 0.8rem 1.5rem; border-radius: 8px;
  font-weight: 700; text-decoration: none; font-size: 1rem;
  border: 2px solid transparent; min-height: 44px; cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.btn-solid { background: var(--btn-solid-bg); color: var(--btn-solid-fg); }
.btn-solid:hover { filter: brightness(1.1); }
.btn-ghost { border-color: var(--accent); color: var(--accent); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.btn-gold { background: var(--gold); color: #33220F; }
.btn-gold:hover { background: #FFCD7A; }

/* ---------- Type ---------- */
h1, h2, h3 {
  font-family: var(--head-font);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-track);
  line-height: 1.12;
  transition: font-weight 0.2s ease;
}
.kicker {
  font-size: 0.88rem; font-weight: 700; color: var(--accent);
  letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 1rem;
}
.section-title {
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  margin: 0 0 1rem;
  text-wrap: balance;
}
.section-sub { color: var(--text-soft); max-width: 62ch; margin: 0 0 2.5rem; }
.proto { font-size: 0.8rem; opacity: 0.75; }

/* ---------- Hero ---------- */
.hero {
  max-width: 1240px; margin: 0 auto;
  padding: 4rem 1.5rem 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas:
    "copy figure"
    "switch figure";
  column-gap: 3.5rem; row-gap: 2.5rem;
  align-items: start;
}
.hero-copy { grid-area: copy; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); margin: 0 0 1.25rem; text-wrap: balance; }
.lede { font-size: 1.18rem; color: var(--text-soft); max-width: 58ch; margin: 0 0 1.9rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.hero-figure { grid-area: figure; margin: 0; }
.hero-figure img { border-radius: var(--radius); aspect-ratio: 4/3.5; object-fit: cover; }
.hero-figure figcaption { margin-top: 0.6rem; font-size: 0.88rem; color: var(--text-soft); }

/* The register switch — the concept's centerpiece */
.register-switch-wrap {
  grid-area: switch;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1rem;
  background: var(--surface-2);
  transition: background-color 0.45s ease, border-color 0.45s ease;
}
.register-label { margin: 0 0 0.7rem; font-weight: 700; font-size: 0.92rem; }
.register-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.register-btn {
  text-align: left; cursor: pointer;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: transparent; color: var(--text);
  padding: 0.8rem 1rem; font: inherit;
  min-height: 44px;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}
.register-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.register-btn-title { display: block; font-weight: 800; font-size: 1.02rem; }
.register-btn-sub { display: block; font-size: 0.85rem; color: var(--text-soft); }
.register-note { margin: 0.8rem 0 0; font-size: 0.88rem; color: var(--text-soft); font-style: italic; }

/* ---------- Relay ---------- */
.relay {
  border-block: 1px solid var(--line);
  background: var(--surface-2);
  padding: 4.5rem 1.5rem;
  transition: background-color 0.45s ease, border-color 0.45s ease;
}
.relay .section-title { text-align: center; margin-bottom: 3rem; }
.relay-track { max-width: 1140px; margin: 0 auto; }
.relay-path { width: 100%; height: 90px; display: block; margin-bottom: 1rem; }
.relay-path path {
  stroke: var(--line); stroke-width: 3; stroke-dasharray: 6 8; stroke-linecap: round;
}
.relay-runner {
  fill: var(--accent);
  offset-path: path("M 20 100 C 260 100, 260 20, 500 20 C 740 20, 740 100, 980 100");
}
.relay-track.is-visible .relay-runner {
  animation: relay-run 7s ease-in-out infinite alternate;
}
@keyframes relay-run {
  from { offset-distance: 0%; }
  to { offset-distance: 100%; }
}
.relay-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem;
  counter-reset: relay;
}
.relay-steps li { counter-increment: relay; }
.relay-steps h3 { font-size: 1.25rem; margin: 0 0 0.4rem; }
.relay-steps h3::before {
  content: counter(relay, decimal-leading-zero);
  display: block; font-size: 0.85rem; color: var(--accent);
  font-family: "Archivo", sans-serif; font-weight: 800; letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.relay-steps p { margin: 0; color: var(--text-soft); font-size: 0.97rem; }

/* ---------- Priorities (interlinear) ---------- */
.priorities { max-width: 1000px; margin: 0 auto; padding: 5rem 1.5rem; }
.priority-list { display: grid; gap: 0; border-top: 2px solid var(--text); }
.priority {
  display: grid; grid-template-columns: 72px 1fr; gap: 1.5rem;
  padding: 2.5rem 0; border-bottom: 1px solid var(--line);
}
.priority-num {
  font-family: var(--head-font);
  font-size: 2.6rem; font-weight: 300; color: var(--accent); line-height: 1;
}
.priority h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 0 0 0.75rem; text-wrap: balance; }
.priority-main { margin: 0 0 1rem; max-width: 62ch; }
.priority-gloss {
  margin: 0; font-size: 0.92rem; color: var(--text-soft);
  border-left: 3px solid var(--gold); padding-left: 0.9rem; max-width: 62ch;
}

/* ---------- Voice + evidence pair ---------- */
.pair { background: var(--surface-2); border-block: 1px solid var(--line); padding: 4.5rem 1.5rem; transition: background-color 0.45s ease; }
.pair-grid {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0,5fr) minmax(0,4fr) minmax(0,4fr); gap: 2.5rem;
  align-items: center;
}
.pair-photo { margin: 0; }
.pair-photo img { border-radius: var(--radius); aspect-ratio: 4/3; object-fit: cover; }
.pair-label {
  font-size: 0.82rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent-2); margin: 0 0 0.75rem;
}
.pair-table-side blockquote { margin: 0; }
.pair-table-side blockquote p {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.3; font-weight: 500; margin: 0 0 0.75rem;
}
.pair-table-side cite { font-style: normal; color: var(--text-soft); font-size: 0.95rem; }
.pair-fact { margin: 0 0 1.25rem; }

/* ---------- Moment ---------- */
.moment { max-width: 1240px; margin: 0 auto; padding: 5rem 1.5rem; }
.moment-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.moment-col {
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 1.9rem; display: flex; flex-direction: column; gap: 1.25rem;
  background: var(--surface-2);
  transition: background-color 0.45s ease, border-color 0.45s ease;
}
.moment-col.won { border-color: var(--accent); }
.moment-col h3 { font-size: 1.4rem; margin: 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.checklist li { padding-left: 1.7rem; position: relative; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 0.42em;
  width: 12px; height: 12px; border-radius: 50%;
  border: 3px solid var(--accent);
}
.moment-col.won .checklist li::before { background: var(--accent); }
.moment-col .btn { align-self: flex-start; margin-top: auto; }
.moment-cite { font-size: 0.9rem; color: var(--text-soft); margin: auto 0 0; }
.choose-strip {
  border-radius: var(--radius);
  background: var(--surface-2); border: 2px solid var(--gold);
  padding: 1.75rem; display: flex; gap: 2rem; align-items: center; justify-content: space-between;
  transition: background-color 0.45s ease;
}
.choose-strip p { margin: 0; max-width: 70ch; }
.choose-strip .btn { flex-shrink: 0; }

/* ---------- Research ---------- */
.research { background: var(--surface-2); border-block: 1px solid var(--line); padding: 5rem 1.5rem; transition: background-color 0.45s ease; }
.research .section-title { max-width: 1140px; margin-inline: auto; }
.research-grid {
  list-style: none; margin: 2rem auto 0; padding: 0;
  max-width: 1140px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem;
}
.research-grid a {
  display: block; text-decoration: none; color: inherit;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; height: 100%;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.research-grid a:hover { border-color: var(--accent); transform: translateY(-3px); }
.research-date { display: block; font-size: 0.85rem; font-weight: 700; color: var(--accent-2); margin-bottom: 0.5rem; }
.research-name { display: block; font-family: var(--head-font); font-size: 1.3rem; font-weight: var(--head-weight); line-height: 1.2; margin-bottom: 0.5rem; }
.research-gloss { display: block; font-size: 0.95rem; color: var(--text-soft); }
.research-more { max-width: 1140px; margin: 1.5rem auto 0; }
.research-more a { color: var(--accent); font-weight: 700; text-decoration: none; }
.research-more a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- News ---------- */
.news { max-width: 1000px; margin: 0 auto; padding: 4.5rem 1.5rem; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li {
  display: flex; gap: 1.5rem; align-items: baseline;
  padding: 1rem 0; border-bottom: 1px solid var(--line);
}
.news-date { font-size: 0.88rem; font-weight: 700; color: var(--accent-2); flex-shrink: 0; width: 90px; }
.news-list a { color: inherit; font-family: var(--head-font); font-size: 1.2rem; font-weight: var(--head-weight); text-decoration: none; line-height: 1.3; }
.news-list a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Close & footer ---------- */
.closing { text-align: center; padding: 3rem 1.5rem 5.5rem; }
.closing-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.site-footer { background: #14212B; color: #fff; padding: 3.5rem 1.5rem; }
.footer-inner { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; align-items: end; }
.footer-inner img { width: 140px; margin-bottom: 1rem; }
.footer-inner p { margin: 0 0 0.5rem; opacity: 0.85; }
.footer-inner a { color: #fff; }
.site-footer .proto { opacity: 0.6; }

.lang-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #14212B; color: #fff; border-radius: 999px;
  padding: 0.8rem 1.5rem; font-weight: 600; font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 90;
  max-width: min(90vw, 560px); text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "copy" "switch" "figure"; }
  .hero-figure img { aspect-ratio: 16/9; }
  .relay-steps { grid-template-columns: 1fr 1fr; }
  .relay-path { display: none; }
  .pair-grid { grid-template-columns: 1fr 1fr; }
  .pair-photo { grid-column: 1 / -1; }
  .pair-photo img { aspect-ratio: 21/9; }
}
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .primary-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #14212B; padding: 0.5rem 1rem 1.25rem;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; }
  .primary-nav a { padding: 0.85rem 0.75rem; font-size: 1.05rem; }
}
@media (max-width: 768px) {
  .moment-cols, .research-grid { grid-template-columns: 1fr; }
  .relay-steps { grid-template-columns: 1fr; }
  .pair-grid { grid-template-columns: 1fr; }
  .pair-photo img { aspect-ratio: 16/10; }
  .choose-strip { flex-direction: column; align-items: flex-start; }
  .priority { grid-template-columns: 48px 1fr; gap: 1rem; }
  .priority-num { font-size: 2rem; }
}
@media (max-width: 480px) {
  body { font-size: 1rem; }
  .header-inner { padding: 0.6rem 1rem; }
  .brand img { width: 104px; }
  .hero { padding: 2.5rem 1rem; }
  .register-switch { grid-template-columns: 1fr; }
  .hero-ctas .btn, .closing-actions .btn { width: 100%; text-align: center; }
  .news-list li { flex-direction: column; gap: 0.25rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  body.is-switching main { opacity: 1; }
  .relay-track.is-visible .relay-runner { animation: none !important; offset-distance: 100%; }
  .research-grid a:hover { transform: none; }
}
