:root {
  /* Mirrors packages/tokens in kais-front. */
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-elevated: #1E1E1E;
  --border: #2A2A2A;
  --border-hover: #3A3A3A;
  --text-primary: #F0F0F0;
  --text-secondary: #8A8A8A;
  --text-tertiary: #5A5A5A;
  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-2: #3B82F6;
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: Inter, system-ui, -apple-system, sans-serif;
  --font-heading: "Inter Tight", Inter, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

#space {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
  z-index: 60;
}

a { color: inherit; text-decoration: none; }

main { position: relative; z-index: 1; }

/* ---------- nav ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 10, 10, 0.55);
  border-bottom: 1px solid rgba(42, 42, 42, 0.6);
}

.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-dim { color: var(--text-tertiary); font-weight: 500; }

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.65);
}

.nav-links { display: flex; gap: 26px; font-size: 14px; color: var(--text-secondary); }
.nav-links a { transition: color 0.2s var(--ease-out); }
.nav-links a:hover { color: var(--text-primary); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 7, 12, 0.82) 0%, rgba(7, 7, 12, 0.45) 42%, transparent 68%),
    linear-gradient(180deg, rgba(7, 7, 12, 0.45) 0%, transparent 30%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 120px 24px 80px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.6);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 28px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

h1, h2, .lede, .section-lede, .kicker {
  text-shadow: 0 2px 26px rgba(5, 5, 10, 0.85), 0 1px 6px rgba(5, 5, 10, 0.6);
}

h1 {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(46px, 7.2vw, 86px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #ffffff 30%, #a5a8f5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
}

.lede {
  max-width: 540px;
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.cta-center { justify-content: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.22s var(--ease-out);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.45);
}

.btn-ghost {
  background: rgba(20, 20, 20, 0.6);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-ghost:hover { border-color: var(--border-hover); background: var(--surface-elevated); }

.btn-sm { padding: 8px 14px; font-size: 13px; font-family: var(--font-mono); }
.btn[disabled] { opacity: 0.4; cursor: default; pointer-events: none; }

.hero-stats {
  display: flex;
  gap: 44px;
  margin-top: 56px;
  flex-wrap: wrap;
}

.hero-stats dt {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.hero-stats dd {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.hero-hint {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 0 24px;
}

.hero-copy > * { animation: rise 0.9s var(--ease-out) both; }
.hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
.hero-copy > *:nth-child(2) { animation-delay: 0.15s; }
.hero-copy > *:nth-child(3) { animation-delay: 0.28s; }
.hero-copy > *:nth-child(4) { animation-delay: 0.4s; }
.hero-copy > *:nth-child(5) { animation-delay: 0.52s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

.journal-ticker {
  position: absolute;
  right: 38px;
  bottom: 56px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--text-tertiary);
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000 0%, transparent 96%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 96%);
  max-width: 60vw;
  overflow: hidden;
  white-space: nowrap;
}

.jline { animation: jline-in 0.45s var(--ease-out) both; }
.jline:first-child { color: var(--text-secondary); }

@keyframes jline-in {
  from { opacity: 0; transform: translateY(-7px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .journal-ticker { display: none; }
}

/* ---------- sections ---------- */

.section { position: relative; padding: 130px 0; }

.manifesto { padding: 170px 0; }
.manifesto h2 { font-size: clamp(40px, 6vw, 68px); }
.manifesto .pill-row { margin-top: 36px; }

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
  max-width: 860px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(10, 10, 14, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  transition: border-color 0.25s var(--ease-out), color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.pill:hover {
  border-color: rgba(99, 102, 241, 0.85);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.22);
}

.pill code { color: #A5B4FC; }

.pill-row-lg .pill { font-size: 13.5px; padding: 11px 18px; }

.section-inner { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

.kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 22px;
}

.section-lede {
  max-width: 640px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 44px;
}

/* ---------- capabilities ---------- */

.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 44px;
}

.cap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.cap:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 12px 44px rgba(99, 102, 241, 0.12);
}

.cap-glyph {
  font-size: 21px;
  color: var(--accent);
  margin-bottom: 14px;
  text-shadow: 0 0 16px rgba(99, 102, 241, 0.6);
}

.cap h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.cap p { font-size: 14px; line-height: 1.65; color: var(--text-secondary); }

/* ---------- calculus ---------- */

.calc-block {
  background: rgba(12, 12, 18, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  overflow-x: auto;
  margin: 40px 0 48px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-secondary);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

.c-kw { color: #A5B4FC; font-weight: 500; }
.c-cm { color: var(--text-tertiary); }

.calc-line { display: block; opacity: 0; transform: translateX(-10px); }

.calc-block.revealed .calc-line {
  animation: calc-line-in 0.55s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 160ms + 0.2s);
}

@keyframes calc-line-in {
  to { opacity: 1; transform: none; }
}

.calc-caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 7px;
  vertical-align: -2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.9);
  animation: caret-blink 1.1s steps(1) infinite;
}

@keyframes caret-blink { 50% { opacity: 0; } }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 12px 44px rgba(99, 102, 241, 0.12);
}
.card-wide { grid-column: 1 / -1; }

.card h3 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.card-num { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.card p { font-size: 14.5px; line-height: 1.7; color: var(--text-secondary); }
.card code, .model code, .section-lede code { font-family: var(--font-mono); font-size: 0.92em; color: #A5B4FC; }

.invariant {
  margin-top: 48px;
  display: flex;
  align-items: center;
  gap: 34px;
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.12), rgba(59, 130, 246, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-xl);
  padding: 30px 36px;
  flex-wrap: wrap;
}

.invariant-formula {
  font-family: var(--font-mono);
  font-size: clamp(20px, 3vw, 28px);
  color: #C7CAFB;
  white-space: nowrap;
  text-shadow: 0 0 24px rgba(99, 102, 241, 0.55);
}

.invariant p { color: var(--text-secondary); font-size: 15px; max-width: 560px; }
.invariant strong { color: var(--text-primary); }

/* ---------- playground ---------- */

.playground {
  background: rgba(12, 12, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.45);
}

#playground-canvas {
  display: block;
  width: 100%;
  height: 480px;
  cursor: pointer;
}

.playground-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.4);
}

.playground-journal {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-tertiary);
}

/* ---------- models ---------- */

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.model {
  background: rgba(12, 12, 18, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.model:hover { border-color: rgba(99, 102, 241, 0.45); transform: translateY(-3px); }

.model::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.model:hover::after { opacity: 1; }

.model-glyph {
  font-size: 26px;
  color: var(--accent);
  margin-bottom: 16px;
  text-shadow: 0 0 18px rgba(99, 102, 241, 0.6);
}

.model h3 { font-family: var(--font-heading); font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.model-tag { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); margin-bottom: 14px; }
.model p:not(.model-tag) { font-size: 14.5px; line-height: 1.7; color: var(--text-secondary); }

/* ---------- determinism ---------- */

.determinism-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.ticks { list-style: none; display: flex; flex-direction: column; gap: 16px; }

.ticks li {
  position: relative;
  padding: 16px 20px 16px 46px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ticks li strong { color: var(--text-primary); }

.ticks li::before {
  content: "✓";
  position: absolute;
  left: 18px;
  top: 16px;
  color: var(--success);
  font-weight: 600;
}

/* ---------- closing / footer ---------- */

.closing { padding-bottom: 140px; }
.closing-inner { text-align: center; }
.closing .section-lede { margin: 0 auto 40px; }

.footer {
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
  background: rgba(7, 7, 12, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 26px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.footer-dim { font-family: var(--font-mono); color: var(--text-tertiary); }
.footer a:hover { color: var(--text-primary); }

/* ---------- reveal on scroll ---------- */

.section-inner > * { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.section-inner > .revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .section-inner > * { opacity: 1; transform: none; transition: none; }
  .pulse-dot { animation: none; }
  .hero-copy > * { animation: none; }
  .calc-line { opacity: 1; transform: none; animation: none !important; }
  .calc-caret { animation: none; }
  .jline { animation: none; }
}

@media (max-width: 860px) {
  .determinism-inner { grid-template-columns: 1fr; gap: 36px; }
  .nav-links a:not(:last-child) { display: none; }
  .hero-stats { gap: 28px; }
  .hero-stats dd { font-size: 24px; }
}
