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

:root {
  --bg: #000000;
  --bg-1: #0a0a0a;
  --bg-2: #111111;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);
  --text: #e6edf3;
  --text-muted: #7d8590;
  --text-faint: #484f58;
  --accent: #39d353;
  --accent-dim: #26a641;
  --accent-glow: rgba(57,211,83,0.18);
  --blue: #58a6ff;
  --purple: #bc8cff;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --nav-h: 60px;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 99px; }

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
code { font-family: var(--mono); font-size: 0.875em; }
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }
p { color: var(--text-muted); }
strong { color: var(--text); font-weight: 600; }

/* ─── Layout ────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.section-narrow { max-width: 780px; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 6rem 0; }
section:nth-child(even) { background: #080808; }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.section-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 580px;
  margin-bottom: 2.5rem;
}

/* ─── Nav ───────────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}
#navbar.scrolled { border-color: var(--border); }
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo strong { color: var(--accent); }
.logo-icon { color: var(--accent); font-size: 0.7em; }
.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--bg-2); }
.nav-links { margin-right: auto; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-primary {
  background: var(--accent);
  color: #0d1117;
}
.btn-primary:hover { background: #4de868; opacity: 1; transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-2); border-color: var(--border-hover); opacity: 1; }
.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--border-hover); background: var(--bg-2); opacity: 1; }

/* ─── Hero ──────────────────────────────────────────────────── */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 4rem) 0 5rem;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* dark gradient shields the left text area; heatmap shows through on the right */
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #000 0%, #000 40%, rgba(0,0,0,0.6) 60%, transparent 80%);
  z-index: 1;
  pointer-events: none;
}
#hero-canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.7;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: rgba(57,211,83,0.1);
  border: 1px solid rgba(57,211,83,0.25);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
#hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #e6edf3 30%, #39d353 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.8;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.hero-install {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
}

/* ─── Features ──────────────────────────────────────────────── */
#features { padding: 4rem 0; background: var(--bg); }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-glow);
  border: 1px solid rgba(57,211,83,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 1rem;
}
.feature-card h3 { color: var(--text); font-size: 1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.9rem; line-height: 1.65; }

/* ─── Code ──────────────────────────────────────────────────── */
.code-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.tab {
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.tab.active, .tab:hover {
  background: var(--bg-1);
  border-color: var(--border);
  color: var(--text);
}
.tab.active { color: var(--accent); border-bottom-color: var(--bg-1); }

.code-blocks { position: relative; max-width: 100%; min-width: 0; overflow: hidden; }
.code-block {
  display: none;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  /* overflow:hidden alone isn't enough when parent has no constrained width;
     max-width ensures the block never exceeds its container */
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}
.code-block.active { display: block; }
.code-block:not(:first-child) { border-radius: var(--radius); }

/* standalone code block (not preceded by tabs) */
.usage-step .code-block,
.token-card .code-block,
.demo-code-preview {
  display: block;
  border-radius: var(--radius);
  margin-top: 1.25rem;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.code-header span {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-transform: lowercase;
}
pre {
  padding: 1.25rem;
  /* pre must scroll, not expand its parent */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* prevent pre from blowing out a flex/grid cell */
  max-width: 100%;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.75;
  /* keep code on one line so it scrolls rather than wraps */
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}
pre code { color: var(--text); background: none; font-size: inherit; }

/* Syntax highlighting tokens */
.token-keyword { color: #ff7b72; }
.token-string { color: var(--accent); }
.token-comment { color: var(--text-faint); font-style: italic; }
.token-fn { color: #d2a8ff; }
.token-tag { color: #7ee787; }
.token-attr { color: #79c0ff; }
.token-op { color: var(--text-muted); }

/* ─── Copy button ────────────────────────────────────────────── */
.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.3rem 0.45rem;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.copy-btn:hover { background: var(--bg-2); color: var(--text); border-color: var(--border-hover); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* ─── Usage Steps ────────────────────────────────────────────── */
.usage-steps { display: flex; flex-direction: column; gap: 3rem; }
.usage-step {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1.25rem;
  align-items: start;
  /* prevent the grid itself from overflowing the section */
  min-width: 0;
  max-width: 100%;
}
.step-num {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(57,211,83,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
/* THE KEY FIX: grid child must have min-width:0 or it
   ignores the 1fr constraint and lets pre overflow */
.step-body {
  min-width: 0;
  overflow: hidden;
}
.step-body h3 { color: var(--text); margin-bottom: 0.4rem; }
.step-body p { font-size: 0.95rem; line-height: 1.7; margin-bottom: 0; }
.step-body p code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.85em;
  color: var(--text);
}

/* ─── API ────────────────────────────────────────────────────── */
#api { padding: 6rem 0; }
.api-grid { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 2.5rem; }
.api-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  overflow: hidden;
}
.api-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.api-name {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--accent);
  background: rgba(57,211,83,0.1);
  padding: 0.25em 0.6em;
  border-radius: 6px;
  border: 1px solid rgba(57,211,83,0.18);
}
.api-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.2);
  padding: 0.2em 0.6em;
  border-radius: 99px;
}
.api-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.api-desc code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--text);
  font-size: 0.85em;
}
.api-returns {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  font-family: var(--mono);
}
.api-returns code {
  background: var(--bg-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: var(--purple);
  font-size: inherit;
}

/* Table */
.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.api-table th, .api-table td {
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.api-table th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(255,255,255,0.02);
}
.api-table td:first-child code { color: var(--accent); }
.api-table td { color: var(--text-muted); }
.api-table td code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--text);
  font-size: 0.85em;
  white-space: nowrap;
}
.api-table tr:last-child td { border-bottom: none; }
.api-table tr:hover td { background: rgba(255,255,255,0.015); }

/* Types card */
.type-list { display: flex; flex-direction: column; gap: 0; }
.type-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.type-item:last-child { border-bottom: none; }
.type-item code {
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(57,211,83,0.08);
  padding: 0.15em 0.5em;
  border-radius: 4px;
}
.type-item span { font-size: 0.85rem; color: var(--text-muted); font-family: var(--mono); }

/* ─── Token section ──────────────────────────────────────────── */
#token { padding: 4rem 0; background: var(--bg); }
.token-card {
  background: linear-gradient(135deg, rgba(57,211,83,0.06) 0%, rgba(88,166,255,0.04) 100%);
  border: 1px solid rgba(57,211,83,0.2);
  border-radius: var(--radius);
  padding: 2.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.token-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--accent-glow);
  border: 1px solid rgba(57,211,83,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
/* flex child: must have min-width:0 or the code block inside will overflow */
.token-body { min-width: 0; overflow: hidden; flex: 1; }
.token-body h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.token-body p { font-size: 0.95rem; }
.token-body p code {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--text);
  font-size: 0.85em;
}

/* ─── Demo ───────────────────────────────────────────────────── */
#demo { background: #080808; }
.demo-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto auto;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
.demo-controls {
  grid-row: 1 / 3;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-self: start;
}
.demo-control label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
}
.demo-control label strong { color: var(--accent); text-transform: none; letter-spacing: 0; }
.toggle-group { display: flex; gap: 4px; }
.toggle-btn {
  flex: 1;
  padding: 0.45rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-btn.active, .toggle-btn:hover {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--border-hover);
}
.toggle-btn.active { color: var(--accent); border-color: rgba(57,211,83,0.3); }
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: var(--bg-2);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}
.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.demo-chart-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 180px;
}
#demo-canvas { width: 100%; display: block; }
.demo-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}
.legend-cells { display: flex; gap: 3px; }
.legend-cell { width: 12px; height: 12px; border-radius: 3px; }

.demo-code-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.demo-code-preview pre { max-height: 200px; overflow-y: auto; font-size: 0.8rem; }
#demo-code-output { display: block; }

/* ─── Footer ─────────────────────────────────────────────────── */
#footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  background: #000000;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: auto;
}
.footer-copy { font-size: 0.85rem; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-links a:hover { color: var(--text); }

/* ─── Hamburger ──────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}
.hamburger:hover { background: var(--bg-2); border-color: var(--border-hover); }
.hamburger span {
  display: block;
  height: 2px;
  border-radius: 99px;
  background: var(--text-muted);
  transition: transform 0.25s ease, opacity 0.25s ease, background 0.2s;
  transform-origin: center;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: var(--accent); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--accent); }

/* ─── Hero install scroll ────────────────────────────────────── */
.hero-install {
  max-width: 100%;
}
.hero-install-scroll {
  overflow-x: auto;
  min-width: 0;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.hero-install-scroll::-webkit-scrollbar { height: 3px; }
.hero-install-scroll::-webkit-scrollbar-thumb { background: var(--border-hover); }

/* ─── Table overflow ─────────────────────────────────────────── */
.api-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

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

/* Tablet (≤ 960px) */
@media (max-width: 960px) {
  section { padding: 4.5rem 0; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Small tablet / large phone (≤ 860px) */
@media (max-width: 860px) {
  section { padding: 4rem 0; }

  /* Hero */
  #hero { padding-top: calc(var(--nav-h) + 3rem); }
  .hero-bg { display: none; }
  .hero-content { max-width: 100%; }

  /* Demo */
  .demo-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .demo-controls { grid-row: auto; }

  /* Types table */
  .type-item { grid-template-columns: 1fr; gap: 0.25rem; }

  /* API table scroll */
  .api-table { min-width: 520px; }
  .api-card { overflow: hidden; }
  .api-card > .api-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Token card */
  .token-card { flex-direction: column; gap: 1rem; }
  .token-icon { width: 44px; height: 44px; }
}

/* Mobile (≤ 640px) */
@media (max-width: 640px) {
  section { padding: 3rem 0; }
  .container, .section-narrow { padding: 0 1rem; }

  /* Nav — show hamburger, hide desktop links + npm btn */
  .nav-inner { gap: 0.75rem; }
  #nav-npm-btn { display: none; }
  .hamburger { display: flex; }

  /* Nav mobile dropdown */
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(10,10,10,0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    color: var(--text-muted);
  }
  .nav-links a:hover { background: var(--bg-2); color: var(--text); }

  /* Hero */
  #hero { padding: calc(var(--nav-h) + 2rem) 0 3rem; }
  #hero h1 { font-size: clamp(1.9rem, 9vw, 2.8rem); }
  .hero-sub { font-size: 0.95rem; }
  .hero-actions { flex-direction: column; gap: 0.6rem; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-install {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.5rem 0.75rem;
  }

  /* Features */
  .feature-grid { grid-template-columns: 1fr; }

  /* Usage steps */
  .usage-step { grid-template-columns: 1fr; }
  .step-num { display: none; }

  /* Code blocks */
  pre {
    padding: 1rem;
    font-size: 0.78rem;
  }
  .code-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0; }
  .tab { white-space: nowrap; }

  /* API */
  .api-card { padding: 1.25rem; }
  .api-card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .api-name { font-size: 0.82rem; word-break: break-all; }
  .api-table { min-width: 440px; font-size: 0.8rem; }
  .api-card { overflow-x: auto; }

  /* Demo controls */
  .demo-controls { padding: 1.25rem; gap: 1.25rem; }
  .slider::-webkit-slider-thumb { width: 20px; height: 20px; }

  /* Footer */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .footer-brand { margin-right: 0; }
  .footer-links { gap: 1rem; }
}

/* Very small (≤ 380px) */
@media (max-width: 380px) {
  #hero h1 { font-size: 1.7rem; }
  .hero-install { font-size: 0.72rem; }
}

/* ─── Scroll-reveal animations ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

