/* ── Variables ── */
:root {
  --bg: #07070d;
  --bg-surface: #0d0d16;
  --bg-card: #111122;
  --bg-card-hover: #16162a;
  --border: #1e1e3a;
  --border-bright: #2a2a55;
  --text: #e4e4ef;
  --text-muted: #8888a8;
  --text-dim: #555570;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-2: #06b6d4;
  --gradient: linear-gradient(135deg, #6366f1, #06b6d4);
  --gradient-text: linear-gradient(135deg, #818cf8, #22d3ee);
  --good: #22c55e;
  --bad: #ef4444;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 1120px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #818cf8; }

/* ── Nav ── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(7, 7, 13, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

.logo-icon { font-size: 22px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 40px var(--accent-glow);
  color: white;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(99, 102, 241, 0.05);
}

/* ── Hero ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 32px 80px;
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: 680px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-bright);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
  background: rgba(99, 102, 241, 0.06);
}

#hero h1 {
  font-size: clamp(42px, 7vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.install-block {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 100%;
  overflow-x: auto;
}

.install-block code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.install-block.large {
  padding: 16px 20px;
}

.install-block.large code {
  font-size: 14px;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.copy-btn:hover { color: var(--accent); background: rgba(99, 102, 241, 0.1); }
.copy-btn.copied { color: var(--good); }

.install-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 8px;
}

.tab-btn {
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--text-muted); }

.tab-btn.active {
  background: var(--accent);
  color: white;
}

.hero-hint {
  font-size: 13px;
  color: var(--text-dim);
}

/* Hero graph background */
.hero-graph {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.35;
}

#graph-canvas {
  width: 100%;
  height: 100%;
}

/* ── Stats bar ── */
#stats-bar {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.stats-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px;
  display: flex;
  justify-content: space-around;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Sections ── */
.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 120px 32px;
}

.section-header {
  text-align: center;
  margin-bottom: 64px;
}

.section-inner > h2,
.section-header h2 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.section-sub {
  font-size: 18px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ── Problem ── */
#problem {
  background: var(--bg-surface);
}

#problem .section-inner > h2 {
  text-align: center;
}

#problem .section-sub {
  text-align: center;
}

.problem-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
}

.problem-card {
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.problem-card .card-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.problem-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.problem-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.problem-card li {
  font-size: 14px;
  color: var(--text-muted);
  padding-left: 24px;
  position: relative;
}

.problem-card.bad li::before {
  content: "\2717";
  position: absolute;
  left: 0;
  color: var(--bad);
  font-weight: 700;
}

.problem-card.good li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--good);
  font-weight: 700;
}

.problem-card.good {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.04);
}

/* ── Features ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.25s;
}

.feature-card:hover {
  border-color: var(--border-bright);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── How it works ── */
#how-it-works {
  background: var(--bg-surface);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 48px;
  max-width: 640px;
  margin: 0 auto;
}

.step {
  display: flex;
  gap: 24px;
}

.step-num {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--border-bright);
  line-height: 1;
  flex-shrink: 0;
  width: 64px;
}

.step-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.step-content p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.7;
}

.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 8px;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-2);
}

/* ── Architecture ── */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.arch-card {
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
}

.arch-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.arch-card:hover::before { opacity: 1; }

.arch-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.arch-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.arch-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Compare ── */
#compare {
  background: var(--bg-surface);
}

.compare-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.compare-table th,
.compare-table td {
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.compare-table thead th {
  background: var(--bg-card);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
}

.compare-table tbody td {
  color: var(--text-muted);
}

.compare-table tbody tr:last-child td { border-bottom: none; }

.compare-table .highlight {
  color: var(--text);
  font-weight: 600;
  background: rgba(99, 102, 241, 0.04);
}

.compare-table thead .highlight {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.compare-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Entities ── */
.entity-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

.pill {
  padding: 8px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--mono);
  border: 1px solid color-mix(in srgb, var(--pill-color) 40%, transparent);
  color: var(--pill-color);
  background: color-mix(in srgb, var(--pill-color) 8%, transparent);
  transition: all 0.2s;
}

.pill:hover {
  background: color-mix(in srgb, var(--pill-color) 15%, transparent);
  transform: translateY(-2px);
}

.relation-examples {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.relation-examples code {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
}

.relation-examples .rel {
  color: var(--accent);
  font-weight: 500;
}

/* ── CTA ── */
#cta {
  background: var(--bg-surface);
}

#cta .section-inner {
  text-align: center;
}

.cta-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

/* ── Footer ── */
#footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.footer-right {
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Fade-in animations ── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links a:not(.btn) { display: none; }

  #hero { padding: 100px 20px 60px; }
  .hero-sub { font-size: 16px; }

  .install-block code { font-size: 11px; }

  .stats-inner { gap: 16px; }
  .stat-number { font-size: 28px; }

  .section-inner { padding: 80px 20px; }

  .problem-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .arch-grid { grid-template-columns: 1fr; }

  .step { flex-direction: column; gap: 8px; }
  .step-num { font-size: 32px; }

  .compare-table { font-size: 12px; }
  .compare-table th, .compare-table td { padding: 10px 12px; }

  .cta-links { flex-direction: column; align-items: center; }

  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}
