:root {
  --bg: #060911;
  --scope-bg:#04070d; --topbar-bg:rgba(6,9,17,.96);
  --bg-surface: #0c1222;
  --bg-card: #111a30;
  --bg-card-hover: #172340;
  --border: #1a2845;
  --border-focus: #34d399;
  
  --text-main: #e2e8f0;
  --text-muted: #c3cedd;
  --text-dim: #b8c5d6;
  
  --mint: #34d399;
  --mint-glow: rgba(52, 211, 153, 0.15);
  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.15);
  --amber: #f59e0b;
  --rose: #ffadb9;
  --purple: #dbb7ff;
  
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visually-hidden:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  white-space: normal;
  padding: 0.5rem 1rem;
  background: var(--mint);
  color: var(--bg);
  font-weight: bold;
}

/* Header & Nav */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.brand:hover {
  color: var(--mint);
}

.langsw {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.langsw a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.langsw a:hover {
  color: var(--mint);
}

.langsw a[aria-current="page"] {
  color: var(--bg);
  background: var(--mint);
  font-weight: 600;
}

/* Shell Containers */
.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

.shell-wide {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Hero Section */
.hero {
  padding: 4.5rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at 50% 0%, rgba(52, 211, 153, 0.08) 0%, rgba(6, 9, 17, 0) 70%);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mint);
  margin-bottom: 1rem;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.standfirst {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 820px;
  margin-bottom: 2.5rem;
}

/* Ledger Line Metrics Grid */
.ledgerline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.ledgerline > div {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease;
}

.ledgerline > div:hover {
  border-color: rgba(52, 211, 153, 0.4);
}

.ledgerline .n {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.ledgerline .n.highlight-mint {
  color: var(--mint);
}

.ledgerline .n.highlight-cyan {
  color: var(--cyan);
}

.ledgerline .l {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Content & Prose Blocks */
.block {
  padding: 4rem 0;
  border-bottom: 1px solid var(--border);
}

.prose h2 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.prose h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 2rem 0 0.75rem;
}

.prose p {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.prose p strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Vector RF Console Panel */
.console-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin: 2.5rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.console-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mint);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Vector Analyzer Layout (IQ Plane vs Signal Metrics) */
.analyzer-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

@media (max-width: 800px) {
  .analyzer-grid {
    grid-template-columns: 1fr;
  }
}

.iq-plane-wrapper {
  background: var(--scope-bg);
  border: 1px solid var(--bg-card-hover);
  border-radius: 8px;
  position: relative;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iq-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.metrics-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.telemetry-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.telemetry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.telemetry-item-lbl {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.telemetry-item-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Dual Inspection Card (Protocol vs Physics) */
.dual-inspection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (max-width: 680px) {
  .dual-inspection {
    grid-template-columns: 1fr;
  }
}

.inspection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.inspection-card.protocol-valid {
  border-left: 4px solid var(--cyan);
}

.inspection-card.rf-verdict-genuine {
  border-left: 4px solid var(--mint);
}

.inspection-card.rf-verdict-spoof {
  border-left: 4px solid var(--rose);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.04) 0%, var(--bg-card) 100%);
}

.inspection-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.code-snippet {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--bg-card-hover);
}

/* Environment Generalization Matrix */
.eval-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.eval-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem;
  text-align: center;
  transition: all 0.2s ease;
}

.eval-card.status-excellent {
  border-color: rgba(52, 211, 153, 0.4);
}

.eval-card.status-collapse {
  border-color: rgba(244, 63, 94, 0.5);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.06) 0%, var(--bg-card) 100%);
}

.eval-env-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.eval-auroc-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.eval-card.status-excellent .eval-auroc-val { color: var(--mint); }
.eval-card.status-collapse .eval-auroc-val { color: var(--rose); }

/* Buttons & Chips */
.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 0.5rem;
}

.btn-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--mint);
}

.btn-chip.active {
  background: rgba(52, 211, 153, 0.15);
  color: var(--mint);
  border-color: var(--mint);
  font-weight: 600;
}

/* Tables */
.data-table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th, td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

td {
  background: var(--bg);
  color: var(--text-muted);
}

tr:last-child td {
  border-bottom: none;
}

.mono-cell {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 3.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.9rem;
}

footer a {
  color: var(--mint);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.footer-credits {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Subtle, token-coloured sharing row. */
.share{--sr-line:var(--border);--sr-ink:var(--text-muted);--sr-acc:var(--mint);--sr-ok:var(--text-muted);margin:0 0 2.5rem;padding:1rem 0 0;border-top:1px solid var(--border)}

/* share row (standards/v2/tools/share_row.py) */
.share-row{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center}
.share-row .lab{font-size:.95rem;opacity:.8;margin-right:.3rem}
.share-row a,.share-row button{display:inline-grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;padding:0;border-radius:50%;border:1px solid var(--sr-line,color-mix(in srgb,currentColor 28%,transparent));background:transparent;color:var(--sr-ink,inherit);text-decoration:none;cursor:pointer;font:inherit;transition:color .15s,border-color .15s}
.share-row a:hover,.share-row button:hover,.share-row a:focus-visible,.share-row button:focus-visible{color:var(--sr-acc,inherit);border-color:var(--sr-acc,currentColor)}
.share-row [hidden]{display:none}
@media (pointer:coarse){.share-row a,.share-row button{width:2.75rem;height:2.75rem}}
@media (max-width:30rem){.share-row .lab{flex-basis:100%;margin:0 0 .15rem}}
.share-status{font-size:.92rem;color:var(--sr-ok,inherit);min-height:1.2em;margin:.4rem 0 0}
.share-field{display:block;width:100%;max-width:36rem;margin-top:.4rem;font:inherit;font-size:.9rem}
/* Keep the muted share label above 7:1 on this dark palette. */
.share-row .lab{opacity:1}

[hidden]{display:none!important}
.theme-toggle{min-height:44px;padding:.4rem .65rem;border:1px solid var(--border);border-radius:6px;color:var(--text-main);background:var(--bg-card);font:600 .75rem var(--font-mono);cursor:pointer}
.topbar{gap:1rem}.langsw{margin-left:auto}.theme-toggle:focus-visible,select:focus-visible{outline:3px solid var(--border-focus);outline-offset:3px}
.demo-note,.source-link,.eval-metric{color:var(--text-muted)}
.demo-note{border-left:3px solid var(--cyan);padding:.8rem 1rem;background:var(--bg-surface);margin-block:1rem}
.experiment-controls{display:flex;gap:.6rem;flex-wrap:wrap;align-items:center}.experiment-controls label{display:grid;gap:.3rem;font-size:.8rem;color:var(--text-muted)}
.experiment-controls select{min-height:44px;background:var(--bg-card);color:var(--text-main);border:1px solid var(--border);padding:.4rem}
.console-header{flex-wrap:wrap;gap:1rem}.eval-env-name{min-height:3.3em}.eval-auroc-val{color:var(--text-main)}
.results-table{overflow:auto;margin-block:1rem;border:1px solid var(--border);border-radius:6px}.results-table table{border-collapse:collapse;min-width:850px;width:100%;font:500 .88rem/1.6 var(--font-mono);color:var(--text-main);background:var(--bg-card)}
.results-table th,.results-table td{padding:.75rem;border-bottom:1px solid var(--border);text-align:right}.results-table th:first-child{text-align:left}.results-table caption{text-align:left;padding:1rem;font-weight:700;color:var(--text-main)}
.btn-chip:disabled{cursor:default;opacity:.6}
@media(max-width:600px){.topbar{padding-inline:16px;gap:.6rem}.topbar .brand{font-size:.85rem}.theme-toggle{font-size:.68rem;padding:.35rem}.eval-matrix{grid-template-columns:1fr 1fr}.eval-card{padding:1rem}.eval-env-name{font-size:.85rem}.code-snippet{overflow-wrap:anywhere}.telemetry-item-val{font-size:.85rem}}
:root[data-theme="light"]{color-scheme:light;--bg:#f4f7fb;--bg-surface:#e9eff7;--bg-card:#ffffff;--bg-card-hover:#dce7f4;--scope-bg:#edf3fa;--topbar-bg:#f4f7fb;--text-main:#152333;--text-muted:#35465c;--text-dim:#35465c;--border:#687d91;--border-focus:#145540;--mint:#145540;--cyan:#1c4e78;--amber:#6a4100;--rose:#8c1635;--purple:#5b257a;}
@media(prefers-color-scheme:light){:root:not([data-theme]){color-scheme:light;--bg:#f4f7fb;--bg-surface:#e9eff7;--bg-card:#ffffff;--bg-card-hover:#dce7f4;--scope-bg:#edf3fa;--topbar-bg:#f4f7fb;--text-main:#152333;--text-muted:#35465c;--text-dim:#35465c;--border:#687d91;--border-focus:#145540;--mint:#145540;--cyan:#1c4e78;--amber:#6a4100;--rose:#8c1635;--purple:#5b257a;}}
