/* ============================================================
   Design tokens — OKLCH, dual theme
   ============================================================ */
:root {
  --font-sans: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Satoshi", "Inter", sans-serif;

  --maxw: 1180px;
  --radius: 10px;
  --radius-sm: 7px;
  --border-w: 1px;

  /* type scale — deliberate ladder, ~1.25 between adjacent steps */
  --t-label: 0.6875rem;  /* 11px  mono labels / tags */
  --t-meta:  0.78rem;    /* 12.5px mono meta */
  --t-sm:    0.875rem;   /* 14px  secondary / nav */
  --t-body:  0.9375rem;  /* 15px  card + supporting body */
  --t-lead:  1.0625rem;  /* 17px  section intro lead */
  --t-h3:    1.1875rem;  /* 19px  card subheads */
  --t-h2:    clamp(1.75rem, 1.2rem + 2vw, 2.5rem);

  /* spacing scale — 4 / 8 grid */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* shared accent (lime — the "signal" color) */
  --accent: oklch(0.86 0.20 128);
  --accent-strong: oklch(0.80 0.20 130);
  --accent-soft: oklch(0.86 0.20 128 / 0.14);
  --accent-line: oklch(0.86 0.20 128 / 0.4);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* DARK (default) */
[data-theme="dark"] {
  --bg: oklch(0.18 0.006 260);
  --bg-1: oklch(0.205 0.007 260);
  --bg-2: oklch(0.235 0.008 260);
  --panel: oklch(0.215 0.007 260);
  --fg: oklch(0.96 0.004 260);
  --fg-muted: oklch(0.74 0.008 260);
  --fg-faint: oklch(0.66 0.008 260);
  --border: oklch(0.34 0.008 260);
  --border-strong: oklch(0.44 0.009 260);
  --grid-line: oklch(1 0 0 / 0.04);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.4);
  --code-bg: oklch(0.155 0.006 260);
}

/* LIGHT */
[data-theme="light"] {
  --bg: oklch(0.962 0.009 92);
  --bg-1: oklch(0.94 0.011 90);
  --bg-2: oklch(0.915 0.012 88);
  --panel: oklch(0.985 0.007 92);
  --fg: oklch(0.25 0.013 78);
  --fg-muted: oklch(0.45 0.012 80);
  --fg-faint: oklch(0.48 0.012 82);
  --border: oklch(0.86 0.011 88);
  --border-strong: oklch(0.76 0.013 88);
  --grid-line: oklch(0.30 0.02 80 / 0.05);
  --shadow: 0 1px 2px oklch(0.3 0.02 80 / 0.07);
  --code-bg: oklch(0.945 0.012 90);
  --accent: oklch(0.49 0.14 134);
  --accent-strong: oklch(0.44 0.14 134);
  --accent-soft: oklch(0.58 0.15 134 / 0.12);
  --accent-line: oklch(0.58 0.15 134 / 0.45);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }
h1, h2 { letter-spacing: -0.03em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.muted { color: var(--fg-muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: 14.5px;
  padding: 11px 18px;
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent; color: var(--fg);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn:hover { border-color: var(--fg-faint); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: oklch(0.22 0.03 130); border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
[data-theme="light"] .btn-primary { color: oklch(0.99 0 0); }
.btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* install command (copy-to-clipboard) */
.install {
  display: flex; align-items: stretch; width: 100%; max-width: 460px;
  margin-top: var(--s-5);
  border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--code-bg); overflow: hidden; font-family: var(--font-mono);
}
.install code {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; font-size: var(--t-meta); color: var(--fg);
  white-space: nowrap; overflow-x: auto; flex: 1; min-width: 0;
}
.install code .pr { color: var(--accent); user-select: none; flex: none; }
.install .copy {
  flex: none; border: 0; border-left: var(--border-w) solid var(--border);
  background: transparent; color: var(--fg-muted); padding: 0 14px; cursor: pointer;
  font: inherit; font-size: var(--t-meta); display: inline-flex; align-items: center; gap: 6px;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.install .copy:hover { color: var(--fg); background: var(--bg-1); }
.install .copy svg { width: 14px; height: 14px; }
.install .copy.done { color: oklch(0.74 0.13 150); }
.cta-final .install { margin-inline: auto; }

/* ============================================================
   Header
   ============================================================ */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklch, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: var(--border-w) solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: -0.02em; font-size: 16px; }
.brand .mark { width: 28px; height: 28px; flex: none; display: block; }
.brand .mark .ms { stroke: var(--accent); }
.brand .mark .mn { fill: var(--accent); }
.brand .mark .mf { fill: var(--fg); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a.navlink {
  padding: 8px 12px; font-size: 14px; color: var(--fg-muted); border-radius: 6px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav-links a.navlink:hover { color: var(--fg); background: var(--bg-1); }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border: var(--border-w) solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--fg-muted); cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

@media (max-width: 720px) { .nav-links { display: none; } }

/* ============================================================
   Section scaffolding
   ============================================================ */
section { position: relative; }
.section-pad { padding-block: clamp(64px, 9vw, 120px); }
.section-head { max-width: 680px; margin-bottom: 48px; }
.section-head h2 { font-size: var(--t-h2); margin-top: var(--s-4); }
.section-head p { color: var(--fg-muted); margin-top: var(--s-4); font-size: var(--t-lead); max-width: 60ch; }
.rule { border: 0; border-top: var(--border-w) solid var(--border); margin: 0; }

/* ============================================================
   Hero
   ============================================================ */
.hero { padding-top: clamp(48px, 7vw, 88px); padding-bottom: clamp(40px, 6vw, 72px); overflow: hidden; }
.hero-grid {
  display: grid; grid-template-columns: 1.02fr 1fr; gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero h1 { font-size: clamp(2.3rem, 1.5rem + 3.4vw, 4rem); letter-spacing: -0.035em; }
.hero .sub { color: var(--fg-muted); font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem); margin-top: var(--s-6); max-width: 32ch; }
.hero-cta { display: flex; gap: var(--s-3); margin-top: var(--s-8); flex-wrap: wrap; }
.hero-meta { margin-top: var(--s-8); display: flex; gap: var(--s-6); flex-wrap: wrap; color: var(--fg-faint); font-size: var(--t-meta); }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 14px; height: 14px; color: var(--accent); }

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero .sub { max-width: 46ch; }
  .hero-diagram-wrap { order: 2; }
}

/* diagram */
.hero-diagram-wrap {
  border: var(--border-w) solid var(--border); border-radius: var(--radius);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 28px 100%,
    var(--bg-1);
  padding: 22px;
}
.hero-diagram-wrap svg { width: 100%; height: auto; display: block; }

.flow-label { font-family: var(--font-mono); font-size: 11px; fill: var(--fg-faint); letter-spacing: 0.04em; }
.node-title { font-weight: 600; font-size: 14px; fill: var(--fg); font-family: var(--font-sans); }
.node-sub { font-size: 10.5px; fill: var(--fg-faint); font-family: var(--font-mono); }
.node-box { fill: var(--panel); stroke: var(--border-strong); stroke-width: 1; }
.node-box.vault { stroke: var(--accent); }
.flow-path { fill: none; stroke: var(--border-strong); stroke-width: 1.4; }
.flow-arrow { fill: var(--fg-faint); }
.dot { fill: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .dot { animation: flow 3.4s linear infinite; }
  .dot.d2 { animation-delay: 1.13s; }
  .dot.d3 { animation-delay: 2.26s; }
  .vault-pulse { animation: pulse 3.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
}
@keyframes flow {
  0%   { offset-distance: 0%;   opacity: 0; }
  8%   { opacity: 1; }
  88%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.0; }
  84%, 92% { opacity: 0.5; }
}

/* ============================================================
   Problem strip
   ============================================================ */
.problem { background: var(--bg-1); border-block: var(--border-w) solid var(--border); }
.problem .wrap { padding-block: clamp(52px, 7vw, 84px); }
.problem-line { font-family: var(--font-display); font-size: clamp(1.4rem, 1rem + 2vw, 2.3rem); font-weight: 900; letter-spacing: -0.03em; max-width: 20ch; }
.problem-line b { color: var(--accent); font-weight: 600; }
.problem-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-8); margin-top: var(--s-12); }
.problem-cols .pc { border-top: var(--border-w) solid var(--border-strong); padding-top: var(--s-4); }
.problem-cols .pc h3 { font-size: var(--t-sm); font-family: var(--font-mono); font-weight: 500; color: var(--fg); }
.problem-cols .pc p { color: var(--fg-muted); font-size: var(--t-body); margin-top: var(--s-2); }
@media (max-width: 720px) { .problem-cols { grid-template-columns: 1fr; gap: 22px; } }

/* ============================================================
   Feature grid
   ============================================================ */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.feature {
  padding: 28px;
  border-right: var(--border-w) solid var(--border);
  border-bottom: var(--border-w) solid var(--border);
  transition: background-color 0.18s var(--ease);
}
.feature:hover { background: var(--bg-1); }
.features-grid .feature:nth-child(3n) { border-right: 0; }
.features-grid .feature:nth-last-child(-n+3) { border-bottom: 0; }
.feature .ficon { width: 28px; height: 28px; color: var(--accent); margin-bottom: var(--s-5); }
.feature .ficon svg { width: 100%; height: 100%; }
.feature h3 { font-size: var(--t-h3); }
.feature p { color: var(--fg-muted); margin-top: var(--s-2); font-size: var(--t-body); }
.feature .ftag { font-family: var(--font-mono); font-size: var(--t-label); color: var(--fg-faint); margin-top: var(--s-4); display: block; }
@media (max-width: 860px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid .feature:nth-child(3n) { border-right: var(--border-w) solid var(--border); }
  .features-grid .feature:nth-child(2n) { border-right: 0; }
  .features-grid .feature:nth-last-child(-n+3) { border-bottom: var(--border-w) solid var(--border); }
  .features-grid .feature:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 560px) {
  .features-grid { grid-template-columns: 1fr; }
  .feature { border-right: 0 !important; border-bottom: var(--border-w) solid var(--border) !important; }
  .features-grid .feature:last-child { border-bottom: 0 !important; }
}

/* ============================================================
   Brain node-network
   ============================================================ */
.brain-section { background: var(--bg); border-block: var(--border-w) solid var(--border); padding-top: clamp(56px, 8vw, 104px); padding-bottom: 0; }
.brain-head { max-width: 640px; margin-inline: auto; text-align: center; padding-bottom: clamp(20px, 3vw, 36px); }
.brain-head h2 { font-size: var(--t-h2); margin-top: var(--s-4); }
.brain-head p { color: var(--fg-muted); margin-top: var(--s-4); font-size: var(--t-lead); }
.brain-stage { position: relative; width: 100%; height: clamp(440px, 60vw, 720px); overflow: hidden; }
.brain-stage canvas { display: block; width: 100%; height: 100%; }
.brain-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-family: var(--font-mono); font-size: var(--t-label); color: var(--fg-faint); pointer-events: none; }
.brain-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 24px; color: var(--fg-muted); font-size: var(--t-body); margin: 0; }

/* ============================================================
   Knowledge graph
   ============================================================ */
.graph-section { background: var(--bg-1); border-block: var(--border-w) solid var(--border); }
.graph-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: clamp(28px, 4vw, 56px); align-items: center; }
.graph-stage {
  position: relative; border: var(--border-w) solid var(--border); border-radius: var(--radius);
  background: var(--bg);
  aspect-ratio: 16 / 11; min-height: 320px; overflow: hidden;
}
.graph-stage svg { width: 100%; height: 100%; display: block; touch-action: none; }
.gedge { stroke: var(--border-strong); stroke-width: 1; transition: stroke 0.15s, stroke-width 0.15s; }
.gedge.hot { stroke: var(--accent); stroke-width: 1.6; }
.gnode circle { fill: var(--panel); stroke: var(--border-strong); stroke-width: 1.3; transition: fill 0.15s, stroke 0.15s, r 0.15s; cursor: grab; }
.gnode text { font-family: var(--font-mono); font-size: 10px; fill: var(--fg-muted); pointer-events: none; user-select: none; }
.gnode.hot circle { fill: var(--accent-soft); stroke: var(--accent); }
.gnode.hot text { fill: var(--fg); }
.gnode.dragging circle { cursor: grabbing; stroke: var(--accent); }
.graph-hint { position: absolute; bottom: 12px; right: 14px; font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-faint); }
@media (max-width: 860px) { .graph-layout { grid-template-columns: 1fr; } }

/* ============================================================
   How it works
   ============================================================ */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.step { background: var(--bg); padding: var(--s-6); }
.step .num { font-family: var(--font-mono); font-size: var(--t-meta); color: var(--accent); }
.step h3 { font-size: var(--t-h3); margin-top: var(--s-3); }
.step p { color: var(--fg-muted); font-size: var(--t-body); margin-top: var(--s-2); }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

.how-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 36px; }
@media (max-width: 820px) { .how-demo { grid-template-columns: 1fr; } }

/* terminal */
.terminal { border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; background: oklch(0.165 0.006 260); display: flex; flex-direction: column; }
.term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: var(--border-w) solid oklch(1 0 0 / 0.08); }
.term-bar .dot3 { width: 10px; height: 10px; border-radius: 50%; border: 1px solid oklch(1 0 0 / 0.22); }
.term-bar .tt { margin-left: 8px; font-family: var(--font-mono); font-size: 11px; color: oklch(0.60 0.01 260); }
.term-body { padding: 16px 18px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.85; overflow-x: auto; flex: 1; }
.term-body .pr { color: oklch(0.86 0.20 128); }
.term-body .cmd { color: oklch(0.95 0.004 260); }
.term-body .out { color: oklch(0.68 0.008 260); }
.term-body .ok { color: oklch(0.78 0.14 150); }
.term-body .cur { display: inline-block; width: 8px; height: 15px; background: oklch(0.86 0.20 128); vertical-align: text-bottom; }
@media (prefers-reduced-motion: no-preference) { .term-body .cur { animation: blink 1.1s steps(2) infinite; } }
@keyframes blink { 50% { opacity: 0; } }

/* note card */
.notecard { border: var(--border-w) solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; box-shadow: var(--shadow); }
.notecard .nc-bar { padding: 11px 16px; border-bottom: var(--border-w) solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notecard .nc-file { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-muted); }
.notecard .nc-badge { font-family: var(--font-mono); font-size: 10px; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 100px; padding: 2px 9px; }
.notecard .nc-fm { background: var(--code-bg); border-bottom: var(--border-w) solid var(--border); padding: 14px 16px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.85; }
.nc-fm .k { color: var(--fg-faint); }
.nc-fm .v { color: var(--fg); }
.nc-fm .acc { color: var(--accent); }
.notecard .nc-body { padding: 16px; }
.notecard .nc-body h4 { margin: 0 0 8px; font-size: var(--t-lead); }
.notecard .nc-body p { color: var(--fg-muted); font-size: var(--t-body); }
.notecard .nc-links { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.nc-links a { font-family: var(--font-mono); font-size: 11px; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 6px; padding: 3px 9px; transition: background 0.15s; }
.nc-links a:hover { background: var(--accent-soft); }

/* ============================================================
   Lifecycle band
   ============================================================ */
.lifecycle { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (max-width: 820px) { .lifecycle { grid-template-columns: 1fr; } }
.life-steps { display: flex; flex-direction: column; gap: 0; border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.life-step { padding: var(--s-5) var(--s-6); border-bottom: var(--border-w) solid var(--border); display: grid; grid-template-columns: 32px 1fr; gap: var(--s-4); align-items: start; }
.life-step:last-child { border-bottom: 0; }
.life-step .li { width: 28px; height: 28px; color: var(--accent); }
.life-step h3 { font-size: var(--t-h3); }
.life-step p { color: var(--fg-muted); font-size: var(--t-body); margin-top: var(--s-1); }
.life-step code { font-family: var(--font-mono); font-size: 0.84em; background: var(--code-bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--fg); }

/* ============================================================
   CTA + footer
   ============================================================ */
.cta-final { text-align: center; }
.cta-final h2 { font-size: clamp(1.8rem, 1.3rem + 2.2vw, 3rem); }
.cta-final p { color: var(--fg-muted); margin: 16px auto 0; max-width: 46ch; }
.cta-final .hero-cta { justify-content: center; margin-top: 30px; }

footer.site { border-top: var(--border-w) solid var(--border); background: var(--bg-1); }
footer.site .wrap { padding-block: 40px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-brand { max-width: 280px; }
.foot-brand .brand { margin-bottom: 12px; }
.foot-brand p { color: var(--fg-faint); font-size: 13px; }
.foot-frontmatters { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); transition: color 0.15s; }
.foot-frontmatters:hover { color: var(--fg); }
.foot-frontmatters span { transition: transform 0.15s var(--ease); }
.foot-frontmatters:hover span { transform: translateX(3px); }
.foot-support .nudge { display: inline-block; transition: transform 0.15s var(--ease); }
.foot-support:hover .nudge { transform: translateX(3px); }
.foot-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.foot-col h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-faint); font-family: var(--font-mono); font-weight: 500; margin-bottom: 12px; }
.foot-col a { display: block; color: var(--fg-muted); font-size: var(--t-sm); padding: 4px 0; transition: color 0.15s; }
.foot-col a:hover { color: var(--fg); }
.foot-bottom { border-top: var(--border-w) solid var(--border); }
.foot-bottom .wrap { padding-block: 18px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-faint); font-family: var(--font-mono); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

