/* ─── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg:          #0f0f0f;
  --bg-2:        #161616;
  --bg-3:        #1e1e1e;
  --border:      rgba(255, 255, 255, 0.08);
  --text:        rgba(255, 255, 255, 0.90);
  --text-muted:  rgba(255, 255, 255, 0.50);
  --accent:      #3b82f6;
  --accent-dim:  rgba(59, 130, 246, 0.15);
  --accent-glow: rgba(59, 130, 246, 0.25);
  --green:       #22c55e;
  --red:         #ef4444;
  --yellow:      #eab308;

  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif;
  --font-mono:  "SFMono-Regular", Menlo, Consolas, "PT Mono", monospace;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  --max-w: 1100px;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg:         #ffffff;
  --bg-2:       #f7f6f3;
  --bg-3:       #eeede9;
  --border:     rgba(55, 53, 47, 0.12);
  --text:       #1a1a1a;
  --text-muted: rgba(55, 53, 47, 0.55);
  --accent:     #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.10);
  --accent-glow: rgba(37, 99, 235, 0.20);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* ─── Layout helpers ─────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
.delay-1 { transition-delay: 0.15s; }
.delay-2 { transition-delay: 0.30s; }
.delay-3 { transition-delay: 0.45s; }
.delay-4 { transition-delay: 0.60s; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */
#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition), border-color var(--transition), backdrop-filter var(--transition);
  border-bottom: 1px solid transparent;
}
#nav.scrolled {
  background: rgba(15, 15, 15, 0.85);
  border-bottom-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] #nav.scrolled {
  background: rgba(255, 255, 255, 0.85);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
}
.logo-bracket { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  font-size: 14px;
  color: var(--text-muted);
}
.nav-links a:hover { color: var(--text); }

.nav-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-github svg { flex-shrink: 0; }

.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: opacity var(--transition);
}
.nav-cta:hover { opacity: 0.85; color: #fff !important; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding: 96px 0 80px;
  overflow: hidden;
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
}

.hero-headline {
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.accent { color: var(--accent); }

.hero-sub {
  max-width: 600px;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.7;
  margin-bottom: 36px;
}

.hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 60px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); color: #fff; }

.btn-secondary {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 15px;
  transition: border-color var(--transition), transform var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ─── Terminal ───────────────────────────────────────────────────────────── */
.hero-terminal {
  width: 100%;
  max-width: 720px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-3);
  text-align: left;
  box-shadow: 0 0 60px var(--accent-glow);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-green  { background: var(--green); }
.terminal-label {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.terminal-body {
  padding: 20px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}
.terminal-body code { background: none; }

.t-comment { color: #6a9955; }
.t-cmd     { color: #569cd6; }
.t-str     { color: #ce9178; }
.t-tag     { color: #4ec9b0; }
.t-val     { color: #dcdcaa; }

/* ─── Stats ──────────────────────────────────────────────────────────────── */
.stats {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.stat {
  text-align: center;
  padding: 24px 16px;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }
.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Section shared ─────────────────────────────────────────────────────── */
.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.section-sub {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 540px;
  margin-bottom: 56px;
  line-height: 1.7;
}

/* ─── Features ───────────────────────────────────────────────────────────── */
.features {
  padding: 96px 0;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.feature-card {
  background: var(--bg);
  padding: 32px 28px;
  transition: background var(--transition);
}
.feature-card:hover { background: var(--bg-2); }
.feature-icon {
  font-size: 22px;
  margin-bottom: 14px;
  color: var(--accent);
}
.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Pipeline ───────────────────────────────────────────────────────────── */
.pipeline-section {
  padding: 96px 0;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.pipeline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
}
.pipeline-stage {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
  min-width: 88px;
  transition: border-color var(--transition);
}
.pipeline-stage:hover { border-color: var(--accent); }
.stage-name {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
  margin-bottom: 2px;
}
.stage-desc {
  font-size: 11px;
  color: var(--text-muted);
}
.pipeline-arrow {
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 2px;
}
.pipeline-note {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 560px;
  margin-top: 16px;
}

/* Colour-code stages by category */
.stage-receive  { border-color: rgba(148,163,184,0.3); }
.stage-detect   { border-color: rgba(59,130,246,0.4); }
.stage-align    { border-color: rgba(59,130,246,0.4); }
.stage-pad      { border-color: rgba(239,68,68,0.4); }
.stage-mad      { border-color: rgba(239,68,68,0.4); }
.stage-quality  { border-color: rgba(234,179,8,0.4); }
.stage-extract  { border-color: rgba(34,197,94,0.4); }
.stage-route    { border-color: rgba(148,163,184,0.3); }

/* ─── Use cases ──────────────────────────────────────────────────────────── */
.use-cases {
  padding: 96px 0;
}
.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.use-case-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  transition: border-color var(--transition), transform var(--transition);
}
.use-case-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.use-case-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}
.use-case-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Architecture ───────────────────────────────────────────────────────── */
.architecture {
  padding: 96px 0;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.arch-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
  max-width: 600px;
}
.arch-layer {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  background: var(--bg-3);
}
.arch-core { border-color: var(--accent); background: var(--accent-dim); }
.arch-layer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}
.arch-adapters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.arch-adapter {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  color: var(--text);
}
.arch-adapter.core {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.4);
  color: var(--accent);
}
.arch-arrow {
  font-size: 20px;
  color: var(--text-muted);
  margin: 4px 0;
}
.arch-principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 40px 0 32px;
}
.arch-principle {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.principle-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.principle-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tech-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  color: var(--text-muted);
}

/* ─── Waitlist ───────────────────────────────────────────────────────────── */
.waitlist-section {
  padding: 96px 0;
}
.waitlist-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.waitlist-card h2 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.waitlist-card > p {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 32px;
}
.waitlist-form { width: 100%; }
.waitlist-input-row {
  display: flex;
  gap: 8px;
}
.waitlist-input-row input[type="email"] {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition);
}
.waitlist-input-row input[type="email"]:focus { border-color: var(--accent); }
.waitlist-input-row input[type="email"]::placeholder { color: var(--text-muted); }

.waitlist-input-row button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition);
  font-family: var(--font-sans);
}
.waitlist-input-row button:hover:not(:disabled) { opacity: 0.85; }
.waitlist-input-row button:disabled { opacity: 0.55; cursor: not-allowed; }

.waitlist-message {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}
.waitlist-message.success { color: var(--green); }
.waitlist-message.error   { color: var(--red); }

.waitlist-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.footer-copy { color: var(--text-muted); }
.footer-links {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links a:hover { color: var(--accent); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .use-cases-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat { border-bottom: 1px solid var(--border); }
  .stat:nth-child(3), .stat:nth-child(4) { border-bottom: none; }
}

@media (max-width: 640px) {
  .nav-links a:not(.nav-cta):not(:last-of-type) { display: none; }
  .features-grid { grid-template-columns: 1fr; }
  .use-cases-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline { gap: 6px; }
  .waitlist-input-row { flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .hero-headline { font-size: 36px; }
}
