/* =========================================================
   Statefulai — shared stylesheet
   ========================================================= */

:root {
  --bg:        #07090d;
  --bg-2:      #0b0e14;
  --bg-3:      #11151d;
  --bg-4:      #161b25;
  --line:      #1a1f2a;
  --line-2:    #232a37;
  --line-3:    #2c3444;
  --fg:        #e6e8ec;
  --fg-2:      #a8aeba;
  --fg-3:      #6c7280;
  --fg-4:      #4a505b;
  --mint:      oklch(0.88 0.18 155);
  --mint-2:    oklch(0.78 0.18 155);
  --mint-dim:  oklch(0.88 0.18 155 / 0.12);
  --mint-mid:  oklch(0.88 0.18 155 / 0.38);
  --amber:     oklch(0.85 0.13 75);
  --violet:    oklch(0.78 0.13 290);
  --blue:      oklch(0.78 0.13 235);
  --danger:    oklch(0.72 0.18 25);
  --radius:    12px;
  --radius-lg: 18px;
  --maxw:      1240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: 'Geist', system-ui, sans-serif;
  font-feature-settings: "ss01","cv11";
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}
.mono { font-family: 'Geist Mono', ui-monospace, monospace; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--mint); color: #000; }

img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.wrap-narrow { max-width: 920px; margin: 0 auto; padding: 0 32px; }

/* ---------- ambient background ---------- */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 50% -10%, oklch(0.88 0.18 155 / 0.08), transparent 60%),
    radial-gradient(40vw 40vh at 90% 30%, oklch(0.78 0.13 290 / 0.06), transparent 60%);
}
.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(80vw 80vh at 50% 30%, #000 30%, transparent 80%);
}

/* ---------- nav ---------- */
nav.top {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(7,9,13,0.65);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
}
.logo-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.logo-mark::before {
  content: ""; position: absolute; inset: 0;
  background: conic-gradient(from 0deg, var(--mint), transparent 60%, var(--mint));
  opacity: 0.45;
  animation: spin 8s linear infinite;
}
.logo-mark::after {
  content: ""; position: absolute; inset: 3px; border-radius: 5px;
  background: var(--bg-3);
}
.logo-mark span {
  position: relative; z-index: 1; font-family: 'Geist Mono', monospace;
  font-size: 12px; color: var(--mint); font-weight: 600;
}
@keyframes spin { to { transform: rotate(360deg); } }

.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--fg-2); }
.nav-links a { position: relative; transition: color .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--fg); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -22px;
  height: 2px; background: var(--mint);
}
.nav-cta { display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; transition: all .2s ease;
  font-family: inherit; white-space: nowrap;
}
.btn.lg { padding: 12px 18px; font-size: 14.5px; border-radius: 10px; }
.btn-ghost { color: var(--fg-2); }
.btn-ghost:hover { color: var(--fg); }
.btn-secondary { background: var(--bg-3); border-color: var(--line-2); color: var(--fg); }
.btn-secondary:hover { background: var(--bg-4); border-color: var(--line-3); }
.btn-primary { background: var(--mint); color: #04140a; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary .arrow { transition: transform .2s; }
.btn-primary:hover .arrow { transform: translateX(3px); }

/* ---------- typography helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg-3);
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px; color: var(--fg-2);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

h1, h2, h3, h4 { letter-spacing: -0.025em; line-height: 1.05; margin: 0; font-weight: 500; }
h1 { font-size: clamp(44px, 6.5vw, 84px); }
h2 { font-size: clamp(34px, 4.4vw, 56px); letter-spacing: -0.03em; }
h3 { font-size: 22px; letter-spacing: -0.015em; line-height: 1.25; }
h4 { font-size: 17px; line-height: 1.3; font-weight: 500;}
p { margin: 0; }
.lead { font-size: 19px; color: var(--fg-2); line-height: 1.55; max-width: 620px; }
.lead-narrow { font-size: 16.5px; color: var(--fg-2); line-height: 1.6; }
.accent { color: var(--mint); }
.strike { color: var(--fg-3); text-decoration: line-through; text-decoration-color: var(--danger); }

section { position: relative; z-index: 1; }
.section { padding: 120px 0; border-top: 1px solid var(--line); }
.section-sm { padding: 80px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; flex-direction: column; gap: 16px; max-width: 780px; margin-bottom: 64px; }
.section-head h2 { text-wrap: balance; }
.section-head p { color: var(--fg-2); font-size: 18px; max-width: 640px; }

/* ---------- breadcrumb / page header ---------- */
.page-header {
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.page-header .crumbs {
  display: flex; gap: 10px; align-items: center;
  font-family: 'Geist Mono', monospace; font-size: 11.5px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.page-header .crumbs a:hover { color: var(--fg); }
.page-header .crumbs .sep { color: var(--fg-4); }
.page-header h1 {
  font-size: clamp(40px, 5.5vw, 64px);
  text-wrap: balance; max-width: 920px;
}
.page-header .deck { margin-top: 24px; max-width: 680px; }

/* ---------- generic cards ---------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg-2); padding: 28px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--line-3); }
.card.linked:hover { border-color: var(--mint-mid); transform: translateY(-2px); cursor: pointer; }

/* ---------- terminal ---------- */
.terminal {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg-2); overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6);
}
.terminal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-3);
}
.terminal header .lights { display: flex; gap: 6px; }
.terminal header .lights span { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.terminal header .lights span:nth-child(1) { background: oklch(0.7 0.18 25 / 0.6); }
.terminal header .lights span:nth-child(2) { background: oklch(0.82 0.16 75 / 0.6); }
.terminal header .lights span:nth-child(3) { background: oklch(0.78 0.18 145 / 0.6); }
.terminal header .title {
  font-family: 'Geist Mono', monospace; font-size: 11.5px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em;
}
.terminal pre {
  margin: 0; padding: 22px 24px;
  font-family: 'Geist Mono', monospace; font-size: 13.5px;
  line-height: 1.65; color: var(--fg);
  white-space: pre-wrap; word-break: break-word;
  overflow-x: auto;
}
.terminal.tight pre { padding: 18px 22px; font-size: 12.5px; line-height: 1.6; }
.tok-c { color: var(--fg-3); }
.tok-k { color: var(--violet); }
.tok-s { color: var(--mint); }
.tok-n { color: var(--amber); }
.tok-p { color: var(--fg); }
.tok-f { color: #9cc7ff; }
.caret {
  display: inline-block; width: 8px; height: 1.1em;
  background: var(--mint); vertical-align: -3px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- footer ---------- */
footer.bottom {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  position: relative; z-index: 1;
}
.foot {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px;
  color: var(--fg-3); font-size: 13.5px;
}
.foot h6 {
  margin: 0 0 14px; font-size: 11.5px; color: var(--fg-2);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-family: 'Geist Mono', monospace; font-weight: 500;
}
.foot ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.foot a:hover { color: var(--fg); }
.foot-bottom {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Geist Mono', monospace; font-size: 11.5px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ---------- CTA strip ---------- */
.cta-strip {
  margin: 0; padding: 120px 0;
  border-top: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.cta-strip .wrap { text-align: center; }
.cta-strip h2 { text-wrap: balance; }
.cta-strip .lead { margin: 18px auto 32px; }
.cta-strip::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(50vw 40vh at 50% 50%, oklch(0.88 0.18 155 / 0.08), transparent 70%);
  pointer-events: none;
}

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- small-screen ---------- */
@media (max-width: 980px) {
  .nav-links { display: none; }
  .section { padding: 80px 0; }
  .section-sm { padding: 60px 0; }
  .foot { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Component classes used by individual pages
   ========================================================= */

/* arch flow */
.arch {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  padding: 32px; position: relative; overflow: hidden;
}
.arch-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px;
  align-items: stretch;
}
.arch-node {
  background: var(--bg-3); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 130px; position: relative;
}
.arch-node.core { background: oklch(0.88 0.18 155 / 0.05); border-color: var(--mint-mid); }
.arch-node h5 { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: -0.01em; }
.arch-node .sub { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em; }
.arch-node .ic {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--bg); border: 1px solid var(--line-2);
  display: grid; place-items: center;
}
.arch-arrow { display: grid; place-items: center; color: var(--fg-3); }
.arch-legend {
  margin-top: 24px; display: flex; gap: 24px; flex-wrap: wrap;
  font-family: 'Geist Mono', monospace; font-size: 11px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em;
}

@media (max-width: 980px) {
  .arch-row { grid-template-columns: 1fr; }
  .arch-arrow { transform: rotate(90deg); }
}

/* two-col split */
.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start;
}
.split-7-5 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; }
.split-5-7 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; align-items: start; }
@media (max-width: 980px) {
  .split, .split-7-5, .split-5-7 { grid-template-columns: 1fr; }
}

/* big numbered list (used in feature/use-case pages) */
.bignum-list { display: flex; flex-direction: column; gap: 28px; counter-reset: bn; }
.bignum {
  display: grid; grid-template-columns: 60px 1fr; gap: 20px; align-items: start;
}
.bignum .num {
  font-family: 'Geist Mono', monospace;
  font-size: 13px; color: var(--mint);
  letter-spacing: 0.1em;
  padding-top: 4px;
}
.bignum .num::before {
  counter-increment: bn;
  content: counter(bn, decimal-leading-zero);
}
.bignum h4 { font-size: 18px; margin-bottom: 6px; }
.bignum p { color: var(--fg-2); font-size: 15px; line-height: 1.6; }

/* feature row */
.feat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.feat-row .feat {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg-2); padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.feat-row .feat .ic {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  display: grid; place-items: center; color: var(--mint);
}
.feat-row .feat h4 { font-size: 16px; }
.feat-row .feat p { color: var(--fg-2); font-size: 14px; line-height: 1.6; }
@media (max-width: 980px) { .feat-row { grid-template-columns: 1fr; } }

/* table */
.tbl {
  width: 100%; border-collapse: collapse;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 14px;
}
.tbl th, .tbl td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th {
  background: var(--bg-3); color: var(--fg-2);
  font-family: 'Geist Mono', monospace; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.featured-row td { background: oklch(0.88 0.18 155 / 0.04); }

/* in-page nav (anchor sidebar) */
.tocnav {
  position: sticky; top: 96px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; padding-right: 12px;
}
.tocnav a {
  display: block;
  padding: 6px 10px; border-radius: 6px;
  color: var(--fg-3);
  border-left: 2px solid transparent;
}
.tocnav a.active, .tocnav a:hover { color: var(--fg); border-left-color: var(--mint); background: var(--bg-2); }
.tocnav h6 {
  margin: 0 0 6px; padding: 0 10px;
  font-family: 'Geist Mono', monospace; font-size: 11px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500;
}

/* in-page heading */
.h-anchor {
  scroll-margin-top: 88px;
  font-size: 28px; letter-spacing: -0.02em; margin-top: 64px; margin-bottom: 18px;
}
.h-anchor:first-child { margin-top: 0; }
.h-anchor .num {
  font-family: 'Geist Mono', monospace; font-size: 12px;
  color: var(--mint); margin-right: 12px; vertical-align: middle;
  letter-spacing: 0.1em;
}
.h-sub { font-size: 18px; color: var(--fg-2); margin: 0 0 18px; line-height: 1.55; max-width: 720px; }

.prose p { color: var(--fg-2); font-size: 15.5px; line-height: 1.7; margin: 0 0 14px; }
.prose ul { color: var(--fg-2); font-size: 15.5px; line-height: 1.7; padding-left: 18px; margin: 0 0 16px; }
.prose ul li { margin-bottom: 4px; }
.prose strong { color: var(--fg); font-weight: 500; }

/* callout */
.callout {
  display: grid; grid-template-columns: 28px 1fr; gap: 14px;
  padding: 18px 20px; border-radius: var(--radius);
  background: oklch(0.88 0.18 155 / 0.04);
  border: 1px solid var(--mint-mid);
  font-size: 14.5px; color: var(--fg-2);
  margin: 18px 0;
}
.callout .ic { color: var(--mint); padding-top: 2px; }
.callout strong { color: var(--fg); font-weight: 500; }

/* tag chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-family: 'Geist Mono', monospace; font-size: 11px;
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--fg-2);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.chip.mint { color: var(--mint); border-color: var(--mint-mid); background: oklch(0.88 0.18 155 / 0.06); }
.chip.violet { color: var(--violet); border-color: oklch(0.78 0.13 290 / 0.4); }
.chip.amber { color: var(--amber); border-color: oklch(0.85 0.13 75 / 0.4); }

/* page footer card (next/prev) */
.next-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px;
}
.next-card a {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 24px; border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  transition: border-color .2s, background .2s;
}
.next-card a:hover { border-color: var(--mint-mid); background: var(--bg-3); }
.next-card .label {
  font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.next-card .title { font-size: 17px; font-weight: 500; }

/* spec block (used in docs / how-it-works) */
.spec-row {
  display: grid; grid-template-columns: 200px 1fr;
  gap: 24px; padding: 18px 0;
  border-top: 1px solid var(--line);
}
.spec-row:first-child { border-top: none; }
.spec-row .key {
  font-family: 'Geist Mono', monospace; font-size: 12px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.1em;
}
.spec-row .val { color: var(--fg-2); font-size: 14.5px; line-height: 1.6; }
.spec-row .val strong { color: var(--fg); }
@media (max-width: 700px) { .spec-row { grid-template-columns: 1fr; gap: 6px; } }

/* hero meta */
.hero-meta {
  margin-top: 40px; display: flex; gap: 24px; flex-wrap: wrap;
  color: var(--fg-3); font-family: 'Geist Mono', monospace; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .ok { color: var(--mint); }

/* pretty stats band */
.stats-band {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg-2); overflow: hidden;
}
.stat-cell { padding: 32px 26px; border-right: 1px solid var(--line); }
.stat-cell:last-child { border-right: none; }
.stat-cell .label {
  font-family: 'Geist Mono', monospace; font-size: 11px;
  color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.stat-cell .big { font-size: 44px; letter-spacing: -0.03em; }
.stat-cell .big small { font-size: 22px; }
.stat-cell .note { font-size: 13px; color: var(--fg-3); margin-top: 4px; }
@media (max-width: 980px) {
  .stats-band { grid-template-columns: 1fr 1fr; }
  .stat-cell:nth-child(2) { border-right: none; }
  .stat-cell:nth-child(1), .stat-cell:nth-child(2) { border-bottom: 1px solid var(--line); }
}
