:root {
  --bg: #060911;
  --bg-surface: #0c1222;
  --bg-card: #111a30;
  --bg-card-hover: #172340;
  --border: #1a2845;
  --border-focus: #34d399;
  
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --mint: #34d399;
  --mint-glow: rgba(52, 211, 153, 0.15);
  --cyan: #38bdf8;
  --cyan-glow: rgba(56, 189, 248, 0.15);
  --amber: #f59e0b;
  --rose: #f43f5e;
  --purple: #a855f7;
  
  --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: rgba(6, 9, 17, 0.85);
  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: #ffffff;
  margin-bottom: 1.5rem;
}

.standfirst {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #cbd5e1;
  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: #ffffff;
  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: #ffffff;
  margin-bottom: 1.25rem;
}

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

.prose p {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #cbd5e1;
  margin-bottom: 1.5rem;
}

.prose p strong {
  color: #ffffff;
  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: #04070d;
  border: 1px solid #142038;
  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: #ffffff;
}

/* 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: #cbd5e1;
  background: #060911;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid #142038;
}

/* 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: #ffffff;
}

.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: #ffffff;
  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: #cbd5e1;
}

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;
  }
}
