:root {
  /* Light mode tokens mapping to the GOOD baseline (Default) */
  color-scheme: light;
  --canvas: #f4f5f2;
  --surface: #ffffff;
  --surface-quiet: #ecefea;
  --surface-raised: #ffffff;
  --ink: #111713;
  --muted: #5d6961;
  --line: #ccd3cd;
  --line-strong: #9ca8a0;
  
  --green: #087a4b;
  --green-soft: #dff4e8;
  --red: #b4232f;
  --red-soft: #fae5e7;
  --blue: #245f91;
  --blue-soft: #e1edf7;
  --amber: #8a5900;
  --amber-soft: #f8edcf;
  
  --shadow: 0 18px 50px rgba(17, 23, 19, 0.08);
}

[data-theme="dark"] {
  /* Dark mode tokens */
  color-scheme: dark;
  --canvas: #0a0e0c;
  --surface: #111713;
  --surface-quiet: #18221b;
  --surface-raised: #1f2a22;
  --ink: #fbfcfa;
  --muted: #9ca8a0;
  --line: #2d3b32;
  --line-strong: #3f5145;
  
  --green: #00d27a;
  --green-soft: rgba(0, 210, 122, 0.12);
  --red: #ff4757;
  --red-soft: rgba(255, 71, 87, 0.12);
  --blue: #40a9ff;
  --blue-soft: rgba(64, 169, 255, 0.12);
  --amber: #fadb14;
  --amber-soft: rgba(250, 219, 20, 0.12);
  
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    linear-gradient(var(--line) 1px, transparent 1px),
    var(--canvas);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button, a { font: inherit; }
a { color: inherit; }

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  z-index: 20;
  background: var(--ink);
  color: var(--canvas);
}
.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  margin: 0;
  overflow: visible;
  clip: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line-strong);
  background: var(--canvas);
}

/* Progressive enhancement for reveal */
.reveal {
  opacity: 1;
  transform: none;
}
body.js-enabled .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
body.js-enabled .reveal.visible {
  opacity: 1;
  transform: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand-symbol {
  display: block;
  width: 50px;
  height: 34px;
}

.brand-symbol-image {
  display: block;
  width: 100%;
  height: 100%;
}

nav {
  display: flex;
  justify-content: flex-end;
  gap: 22px;
}

nav a, .header-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover, nav a:focus-visible, .header-link:hover, .header-link:focus-visible { color: var(--ink); }
.header-link { justify-self: end; }

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 10px 14px;
  justify-self: end;
}

/* Engine Syncing Indicator */
.engine-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-quiet);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 var(--green-soft);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 var(--green-soft); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

main, footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  padding: 64px 0 32px;
  max-width: 880px;
}

.eyebrow, .section-label {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 8px; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro > p {
  max-width: 760px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 19px;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0 28px;
}

.intro-action {
  width: auto;
  min-width: 220px;
  text-decoration: none;
}

.secondary-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.secondary-action:hover,
.secondary-action:focus-visible { border-color: var(--ink); background: var(--surface); }

.proof-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.proof-rail div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 62px;
  padding: 14px 16px;
  background: var(--surface);
}

.proof-rail div + div { border-left: 1px solid var(--line); }
.proof-rail strong { font-size: 22px; }
.proof-rail span { color: var(--muted); font-size: 12px; }

.ai-safety-story {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 4px;
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.story-step {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface-quiet);
  text-align: center;
}

.story-step span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 6px;
}

.story-step strong {
  font-size: 13px;
  color: var(--ink);
}

.story-arrow {
  color: var(--line-strong);
  font-weight: bold;
}

.replay-shell {
  margin-bottom: 88px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.replay-heading, .panel-heading, .claim-board-heading, .receipt-topline, .receipt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.replay-heading {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.replay-heading h2, .panel-heading h3, .claim-board-heading h3 { margin-bottom: 0; }
.section-label { margin-bottom: 4px; }

.mode-badge, .proposal-state {
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: var(--surface-quiet);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.replay-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; }
.proposal-panel, .gate-panel { padding: 24px; }
.proposal-panel { border-right: 1px solid var(--line); }
.panel-heading { margin-bottom: 22px; }

.trade-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 24px;
  border-top: 1px solid var(--line);
}

.trade-facts div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.trade-facts div:nth-child(odd) { padding-right: 16px; }
.trade-facts div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.trade-facts dt { color: var(--muted); font-size: 12px; }
.trade-facts dd { margin: 3px 0 0; font-weight: 750; }
.danger-text { color: var(--red); }

.primary-action {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--canvas);
  cursor: pointer;
  font-weight: 750;
  transition: opacity 0.2s;
}
.primary-action:hover { opacity: 0.9; }
.primary-action:disabled { cursor: wait; opacity: 0.68; }

.action-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.text-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gate-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.gate {
  min-height: 66px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.gate-index { color: var(--line-strong); font: 700 11px ui-monospace, monospace; }
.gate-copy strong, .gate-copy small { display: block; }
.gate-copy strong { font-size: 14px; }
.gate-copy small { color: var(--muted); font-size: 12px; }
.gate-status { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.gate.is-checking { border-color: var(--blue); background: var(--blue-soft); transform: translateX(3px); }
.gate.is-passed { border-color: var(--green); background: var(--green-soft); }
.gate.is-passed .gate-status { color: var(--green); }
.gate.is-refused { border-color: var(--red); background: var(--red-soft); }
.gate.is-refused .gate-status { color: var(--red); }
.broker-gate.is-locked { border-style: dashed; opacity: 0.58; }

.decision {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-quiet);
}

.decision-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  font-weight: 850;
}

.decision strong, .decision small { display: block; }
.decision small { color: var(--muted); }
.decision.is-refused { border-color: var(--red); background: var(--red-soft); }
.decision.is-refused .decision-icon { border-color: var(--red); background: var(--red); color: var(--ink); }

.evidence-section, .architecture-section { margin-bottom: 88px; }
.section-heading { max-width: 720px; margin-bottom: 28px; }
.section-heading h2 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; }
.section-heading > p:last-child { color: var(--muted); }

.equation {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.1fr;
  align-items: stretch;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.equation > div { padding: 22px; }
.equation span, .equation strong, .equation small { display: block; }
.equation span { color: var(--muted); font-size: 12px; }
.equation strong { margin: 5px 0; font-size: 19px; }
.equation small { color: var(--muted); }
.equation .operator { align-self: center; color: var(--line-strong); font-size: 24px; }
.equation-result { background: var(--red-soft); }
.equation-result strong, .equation-result small { color: var(--red); }

.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.receipt-card {
  padding: 22px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: 5px 5px 0 var(--line);
}

.receipt-topline { padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font: 750 11px ui-monospace, monospace; }
.tag { font-family: Inter, sans-serif; padding: 2px 6px; font-size: 10px; font-weight: 800; border-radius: 2px; }
.live-tag { background: var(--green-soft); color: var(--green); }
.verified-tag { background: var(--blue-soft); color: var(--blue); }

.receipt-verdict, .credit-value { margin: 20px 0 6px; font-size: clamp(36px, 6vw, 58px); font-weight: 850; line-height: 1; }
.receipt-verdict { color: var(--red); }
.credit-value { color: var(--green); }
.receipt-card > p:not(.receipt-verdict):not(.credit-value) { color: var(--muted); }
.receipt-footer { align-items: flex-start; flex-direction: column; gap: 6px; margin-top: 28px; color: var(--muted); font-size: 11px; }
.receipt-footer code { max-width: 100%; overflow-wrap: anywhere; color: var(--ink); background: var(--surface-quiet); padding: 4px; border: 1px solid var(--line); }
.compact-heading { margin-bottom: 22px; }

.architecture-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  margin-bottom: 28px;
}

.panel-box { padding: 20px; border: 1px solid var(--line); background: var(--surface); }

.architecture-flow article { min-height: 150px; }
.architecture-flow h3 { margin: 20px 0 7px; }
.architecture-flow p { color: var(--muted); font-size: 14px; }
.architecture-flow .control-node { border-color: var(--green); background: var(--green-soft); }
.flow-number { color: var(--muted); font: 750 11px ui-monospace, monospace; }
.flow-arrow { display: grid; width: 52px; place-items: center; color: var(--line-strong); }

.governor-explanation { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.governor-explanation h3 { margin-bottom: 8px; }
.governor-explanation p { margin: 0; font-size: 14px; color: var(--muted); max-width: 400px; }
.gov-states { display: flex; align-items: center; gap: 12px; font: 700 12px ui-monospace, monospace; }
.g-state { padding: 6px 10px; border: 1px solid var(--line); background: var(--surface-quiet); }
.g-vent { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.g-arrow { color: var(--line-strong); }

.claim-board { border: 1px solid var(--line); background: var(--surface); }
.claim-board-heading { padding: 20px; border-bottom: 1px solid var(--line); }
.claim-board-heading a { color: var(--green); font-size: 13px; font-weight: 750; }
.claim-row {
  display: grid;
  grid-template-columns: 88px minmax(220px, 1fr) 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.claim-row:last-child { border-bottom: 0; }
.claim-row > span:last-child { color: var(--muted); }
.claim-state { width: fit-content; padding: 4px 7px; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.live-state { color: var(--green); background: var(--green-soft); }
.verified-state { color: var(--blue); background: var(--blue-soft); }
.tested-state { color: var(--amber); background: var(--amber-soft); }
.support-state { color: var(--muted); background: var(--surface-quiet); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
}
footer strong, footer span { display: block; }
footer strong { color: var(--ink); }
footer p { max-width: 570px; text-align: right; }
:focus-visible { outline: 3px solid rgba(64, 169, 255, 0.38); outline-offset: 3px; }

.recording-mode .site-header {
  position: static;
}

.recording-slate {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 36px);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.recording-slate strong {
  color: var(--red);
  font-size: 12px;
}

.recording-slate span {
  white-space: nowrap;
}

.recording-slate.is-hidden {
  display: none;
}

@media (max-width: 880px) {
  .site-header { grid-template-columns: 1fr auto; }
  nav { display: none; }
  .replay-grid { grid-template-columns: 1fr; }
  .proposal-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .equation { grid-template-columns: 1fr; }
  .equation .operator { height: 34px; }
  .architecture-flow { grid-template-columns: 1fr; }
  .flow-arrow { width: auto; height: 40px; transform: rotate(90deg); }
  .claim-row { grid-template-columns: 88px 1fr; }
  .claim-row > span:last-child { grid-column: 2; }
  .story-grid { grid-template-columns: 1fr; }
  .story-arrow { height: 24px; transform: rotate(90deg); }
  .governor-explanation { flex-direction: column; align-items: flex-start; gap: 16px; }
}

@media (max-width: 640px) {
  .site-header { min-height: 56px; padding: 0 16px; }
  .header-actions { gap: 6px 10px; }
  .header-link { font-size: 12px; }
  .engine-pill { display: none; }
  main, footer { width: min(100% - 24px, 1180px); }
  .intro { padding-top: 42px; }
  h1 { font-size: 40px; }
  .intro > p { font-size: 16px; }
  .intro-actions { flex-direction: column; }
  .intro-action, .secondary-action { width: 100%; justify-content: space-between; }
  .proof-rail { grid-template-columns: 1fr; }
  .proof-rail div + div { border-top: 1px solid var(--line); border-left: 0; }
  .replay-heading, .panel-heading, .claim-board-heading { align-items: flex-start; }
  .replay-heading { flex-direction: column; }
  .proposal-panel, .gate-panel { padding: 18px; }
  .trade-facts { grid-template-columns: 1fr; }
  .trade-facts div:nth-child(odd), .trade-facts div:nth-child(even) { padding: 11px 0; border-left: 0; }
  .gate { grid-template-columns: 28px 1fr; }
  .gate-status { grid-column: 2; }
  .receipt-grid { grid-template-columns: 1fr; }
  .receipt-footer { align-items: flex-start; flex-direction: column; }
  .receipt-footer code { max-width: 100%; }
  .claim-board-heading { flex-direction: column; }
  .claim-row { grid-template-columns: 1fr; gap: 7px; }
  .claim-row > span:last-child { grid-column: auto; }
  footer { flex-direction: column; }
  footer p { text-align: left; }
  .gov-states { flex-wrap: wrap; }
  .recording-slate { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
