:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --border: #2a2d3a;
  --accent: #7c6af7;
  --accent-dim: #4e46a0;
  --text: #e2e4ef;
  --text-muted: #8b8fa8;
  --code-bg: #12141e;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

/* ── Navigation ──────────────────────────────────────────── */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

.nav-cta {
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-dim);
  text-decoration: none;
  color: #fff;
}

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

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ── Layout ──────────────────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 5rem 0;
}

.section-sm {
  padding: 3rem 0;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  padding: 7rem 0 5rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

h1 .accent {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Features ────────────────────────────────────────────── */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: border-color 0.2s;
}

.feature-card:hover {
  border-color: var(--accent-dim);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Code block ──────────────────────────────────────────── */

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.code-block pre {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
}

.code-block code {
  color: var(--text);
  font-family: var(--font-mono);
}

.tok-comment { color: #6a7090; }
.tok-keyword { color: #c792ea; }
.tok-fn      { color: #82aaff; }
.tok-string  { color: #c3e88d; }
.tok-num     { color: #f78c6c; }
.tok-type    { color: #ffcb6b; }

/* ── Section headings ────────────────────────────────────── */

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

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

/* ── Reference page ──────────────────────────────────────── */

.ref-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
  padding: 3rem 0;
}

.ref-sidebar {
  position: sticky;
  top: 72px;
}

.ref-sidebar nav {
  position: static;
  background: none;
  backdrop-filter: none;
  border: none;
  padding: 0;
  display: block;
  height: auto;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li a {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-radius: 5px;
  transition: background 0.1s, color 0.1s;
}

.sidebar-links li a:hover,
.sidebar-links li a.active {
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
}

.ref-content h2 {
  font-size: 1.75rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ref-content h2:first-child {
  margin-top: 0;
}

.method-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.method-sig {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.method-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.param-table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.param-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.param-table td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
}

.param-table td:nth-child(2) {
  font-family: var(--font-mono);
  color: #ffcb6b;
}

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

/* ── Blog page ───────────────────────────────────────────── */

.blog-grid {
  display: grid;
  gap: 1.75rem;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: border-color 0.2s;
}

.blog-card:hover {
  border-color: var(--accent-dim);
}

.blog-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.blog-tag {
  background: rgba(124, 106, 247, 0.15);
  color: var(--accent);
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.blog-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.blog-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.read-more {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── Footer ──────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
}

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

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {
  .ref-layout {
    grid-template-columns: 1fr;
  }

  .ref-sidebar {
    position: static;
  }

  nav {
    padding: 0 1rem;
    gap: 1rem;
  }

  .container {
    padding: 0 1rem;
  }

  .nav-cta {
    display: none;
  }
}
