/* ========== Sovereign Clean Sky — design tokens ========== */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
  --space-4: 1rem;    --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem;    --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem;   --space-20: 5rem;   --space-24: 6rem;
  --space-32: 8rem;

  --font-display: 'Cabinet Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Satoshi', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 4px;
  --maxw: 1180px;
  --border-w: 1px;
}

/* Dark is the primary identity for this subject */
:root, [data-theme='dark'] {
  --color-bg: #07090d;
  --color-surface: #0c1016;
  --color-surface-2: #11161e;
  --color-surface-3: #171d27;
  --color-border: #1e2632;
  --color-border-strong: #2b3646;
  --color-text: #e8edf4;
  --color-text-muted: #8a97a8;
  --color-text-faint: #56616f;
  --color-attested: #35e0d4;
  --color-attested-dim: #14494a;
  --color-unattested: #ffab3d;
  --color-hostile: #ff5b5b;
  --color-gov: #7fa8ff;
  --grid-line: rgba(53, 224, 212, 0.055);
  --scope-ring: rgba(53, 224, 212, 0.16);
  --shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 18px 50px -28px rgba(0,0,0,0.9);
}

[data-theme='light'] {
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-surface-2: #eef1f5;
  --color-surface-3: #e5eaf0;
  --color-border: #d5dce4;
  --color-border-strong: #b8c3cf;
  --color-text: #101720;
  --color-text-muted: #55616f;
  --color-text-faint: #8894a2;
  --color-attested: #00807a;
  --color-attested-dim: #b6e6e2;
  --color-unattested: #a35c00;
  --color-hostile: #c22b2b;
  --color-gov: #2e5bbd;
  --grid-line: rgba(0, 128, 122, 0.06);
  --scope-ring: rgba(0, 128, 122, 0.18);
  --shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 12px 34px -22px rgba(16,23,32,0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint technical grid */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none; z-index: 0;
}

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--space-6); position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; margin: 0; text-wrap: balance; }
p { margin: 0 0 var(--space-4); }
a { color: var(--color-attested); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .18s ease; }
a:hover { border-bottom-color: currentColor; }
strong { font-weight: 700; color: var(--color-text); }
em { font-style: italic; color: var(--color-text); }

/* ========== chrome ========== */
header.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: var(--border-w) solid var(--color-border);
}
.topbar-in { display: flex; align-items: center; gap: var(--space-5); height: 62px; }
.brand { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm); letter-spacing: 0.005em; color: var(--color-text); border: 0; }
.brand svg { width: 26px; height: 26px; color: var(--color-attested); flex: none; }
.brand .sub { color: var(--color-text-faint); font-weight: 500; font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.06em; text-transform: uppercase; }
nav.links { margin-left: auto; display: flex; gap: var(--space-5); }
nav.links a { color: var(--color-text-muted); font-size: var(--text-sm); border: 0; }
nav.links a:hover { color: var(--color-attested); }
.theme-btn {
  background: var(--color-surface-2); border: var(--border-w) solid var(--color-border);
  color: var(--color-text-muted); width: 34px; height: 34px; border-radius: var(--radius);
  display: grid; place-items: center; cursor: pointer; flex: none; transition: color .18s, border-color .18s;
}
.theme-btn:hover { color: var(--color-attested); border-color: var(--color-border-strong); }
.theme-btn svg { width: 15px; height: 15px; }

/* ========== shared bits ========== */
section { padding-block: clamp(var(--space-16), 8vw, var(--space-32)); position: relative; z-index: 1; }
.eyebrow {
  font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--color-attested); margin-bottom: var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: currentColor; flex: none; }
.sec-title { font-size: var(--text-xl); margin-bottom: var(--space-5); max-width: 22ch; }
.lede { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 62ch; line-height: 1.5; }
.prose { max-width: 68ch; color: var(--color-text-muted); }
.prose p { margin-bottom: var(--space-5); }
.divider { height: 1px; background: var(--color-border); }

.tag {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.06em;
  text-transform: uppercase; padding: var(--space-1) var(--space-3);
  border: var(--border-w) solid var(--color-border-strong); border-radius: 999px; color: var(--color-text-muted);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.t-att { color: var(--color-attested); border-color: color-mix(in oklab, var(--color-attested) 40%, transparent); }
.t-un  { color: var(--color-unattested); border-color: color-mix(in oklab, var(--color-unattested) 40%, transparent); }
.t-gov { color: var(--color-gov); border-color: color-mix(in oklab, var(--color-gov) 40%, transparent); }

/* ========== hero ========== */
.hero { padding-top: clamp(var(--space-12), 7vw, var(--space-24)); padding-bottom: clamp(var(--space-12), 6vw, var(--space-20)); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(var(--space-8), 5vw, var(--space-20)); align-items: center; }
.hero h1 { font-size: var(--text-3xl); margin-bottom: var(--space-6); }
.hero h1 .hl { color: var(--color-attested); }
.hero .lede { margin-bottom: var(--space-8); }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-8); }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600;
  padding: var(--space-3) var(--space-5); border-radius: var(--radius); cursor: pointer;
  border: var(--border-w) solid var(--color-border-strong); background: var(--color-surface-2);
  color: var(--color-text); transition: all .18s ease;
}
.btn:hover { border-color: var(--color-attested); color: var(--color-attested); }
.btn-primary { background: var(--color-attested); color: #04120f; border-color: var(--color-attested); }
[data-theme='light'] .btn-primary { color: #ffffff; }
.btn-primary:hover { filter: brightness(1.1); color: #04120f; }
[data-theme='light'] .btn-primary:hover { color: #fff; }

/* scope */
.scope-card {
  background: var(--color-surface); border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.scope-head {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-w) solid var(--color-border); background: var(--color-surface-2);
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-faint);
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--color-attested); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
#scope { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.scope-foot { padding: var(--space-4); border-top: var(--border-w) solid var(--color-border); background: var(--color-surface-2); }
.scope-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-4); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }
.scope-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.readout { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-faint); line-height: 1.8; }
.readout b { color: var(--color-text); font-weight: 500; }
.filter-btn { width: 100%; justify-content: center; }

/* ========== stack ========== */
.stack { display: grid; gap: var(--space-3); margin-top: var(--space-10); }
.layer {
  display: grid; grid-template-columns: 62px 1fr 200px; gap: var(--space-5); align-items: start;
  padding: var(--space-5); background: var(--color-surface); border: var(--border-w) solid var(--color-border);
  border-radius: var(--radius); transition: border-color .18s ease, transform .18s ease;
}
.layer:hover { border-color: var(--color-border-strong); }
.layer.own { border-color: color-mix(in oklab, var(--color-attested) 34%, var(--color-border)); background: color-mix(in oklab, var(--color-attested) 4%, var(--color-surface)); }
.layer-n { font-family: var(--font-mono); font-size: var(--text-lg); color: var(--color-text-faint); line-height: 1.2; }
.layer.own .layer-n { color: var(--color-attested); }
.layer h3 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.layer p { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }
.layer-status { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-faint); }
.layer-status.gap { color: var(--color-unattested); }
.layer-status.ok { color: var(--color-attested); }

/* ========== ladder ========== */
.ladder { display: grid; gap: 0; margin-top: var(--space-10); border: var(--border-w) solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.rung { display: grid; grid-template-columns: 124px 1fr 170px; gap: var(--space-5); padding: var(--space-4) var(--space-5); background: var(--color-surface); border-bottom: var(--border-w) solid var(--color-border); align-items: center; }
.rung:last-child { border-bottom: 0; }
.rung code { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-faint); }
.rung .act { font-size: var(--text-sm); color: var(--color-text-muted); }
.rung .use { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.rung.use-yes { background: color-mix(in oklab, var(--color-attested) 5%, var(--color-surface)); }
.rung.use-yes code, .rung.use-yes .act { color: var(--color-text); }
.rung.use-yes .use { color: var(--color-attested); }
.rung.use-no .use { color: var(--color-text-faint); }
.rung.use-never { background: color-mix(in oklab, var(--color-hostile) 5%, var(--color-surface)); }
.rung.use-never .use { color: var(--color-hostile); }

/* ========== stat strip ========== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: var(--space-10); }
.stat { padding: var(--space-6) var(--space-5); background: var(--color-surface); border: var(--border-w) solid var(--color-border); border-radius: var(--radius); }
.stat-n { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; color: var(--color-attested); line-height: 1; margin-bottom: var(--space-3); }
.stat-l { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.4; }

/* ========== cards ========== */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-top: var(--space-10); }
.card { padding: var(--space-6); background: var(--color-surface); border: var(--border-w) solid var(--color-border); border-radius: var(--radius); }
.card h3 { font-size: var(--text-lg); margin-bottom: var(--space-3); }
.card p { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }
.card .tier { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-faint); margin-bottom: var(--space-3); }
.card.rec { border-color: color-mix(in oklab, var(--color-attested) 34%, var(--color-border)); }
.card.rec .tier { color: var(--color-attested); }
.card.warn { border-color: color-mix(in oklab, var(--color-unattested) 30%, var(--color-border)); }
.card.warn .tier { color: var(--color-unattested); }

/* ========== table ========== */
.tbl-wrap { margin-top: var(--space-10); border: var(--border-w) solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--space-4) var(--space-5); border-bottom: var(--border-w) solid var(--color-border); font-size: var(--text-sm); vertical-align: top; }
th { background: var(--color-surface-2); font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.09em; color: var(--color-text-faint); font-weight: 500; }
td { background: var(--color-surface); color: var(--color-text-muted); }
td:first-child { color: var(--color-text); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

/* ========== list ========== */
.checks { list-style: none; padding: 0; margin: var(--space-8) 0 0; display: grid; gap: var(--space-4); max-width: 84ch; }
.checks li { display: grid; grid-template-columns: 20px 1fr; gap: var(--space-4); font-size: var(--text-sm); color: var(--color-text-muted); }
.checks li svg { width: 15px; height: 15px; margin-top: 5px; color: var(--color-attested); flex: none; }
.checks li b { color: var(--color-text); }

/* ========== callout ========== */
.callout {
  margin-top: var(--space-10); padding: var(--space-8);
  background: color-mix(in oklab, var(--color-unattested) 7%, var(--color-surface));
  border: var(--border-w) solid color-mix(in oklab, var(--color-unattested) 34%, var(--color-border));
  border-left: 3px solid var(--color-unattested); border-radius: var(--radius);
}
.callout h3 { font-size: var(--text-lg); margin-bottom: var(--space-4); color: var(--color-text); }
.callout p { color: var(--color-text-muted); max-width: 72ch; }
.callout p:last-child { margin-bottom: 0; }

.quote {
  margin: var(--space-10) 0 0; padding: var(--space-8);
  background: var(--color-surface); border: var(--border-w) solid var(--color-border);
  border-left: 3px solid var(--color-attested); border-radius: var(--radius);
  font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.4; color: var(--color-text);
}

/* ========== build path ========== */
.steps { counter-reset: s; list-style: none; padding: 0; margin: var(--space-10) 0 0; display: grid; gap: var(--space-3); }
.steps li {
  counter-increment: s; display: grid; grid-template-columns: 44px 1fr; gap: var(--space-5);
  padding: var(--space-5); background: var(--color-surface); border: var(--border-w) solid var(--color-border); border-radius: var(--radius);
}
.steps li::before { content: counter(s, decimal-leading-zero); font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-attested); }
.steps li h3 { font-size: var(--text-base); margin-bottom: var(--space-2); }
.steps li p { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }

/* ========== sources ========== */
.src-grid { columns: 2; column-gap: var(--space-8); margin-top: var(--space-8); }
.src-grid a { display: block; font-size: var(--text-sm); color: var(--color-text-muted); padding: var(--space-2) 0; break-inside: avoid; border: 0; }
.src-grid a:hover { color: var(--color-attested); }

footer { border-top: var(--border-w) solid var(--color-border); padding-block: var(--space-10); }
.foot-in { display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: center; justify-content: space-between; }
.foot-in p { margin: 0; font-size: var(--text-xs); color: var(--color-text-faint); font-family: var(--font-mono); }

/* ========== reveal ========== */
html.js .rv { opacity: 0; transform: translateY(14px); }
.rv { transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1); }
html.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .rv, html.js .rv.in { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .pulse { animation: none; }
}

/* ========== responsive ========== */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .layer { grid-template-columns: 40px 1fr; }
  .layer-status { grid-column: 2; }
  .rung { grid-template-columns: 80px 1fr; }
  .rung .use { grid-column: 2; }
  nav.links { display: none; }
  .src-grid { columns: 1; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .brand .sub { display: none; }
  th, td { padding: var(--space-3) var(--space-4); }
}
