/* ============================================
   Vibe Docs — Black & White Theme
   ============================================ */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #ebebeb;
  --bg-code: #f5f5f5;
  --bg-code-block: #111111;
  --border-color: #d4d4d4;
  --border-light: #e5e5e5;
  --text-primary: #0a0a0a;
  --text-secondary: #525252;
  --text-tertiary: #8a8a8a;
  --text-code: #0a0a0a;
  --text-code-block: #e5e5e5;
  --accent: #0a0a0a;
  --accent-light: #404040;
  --accent-bg: rgba(0, 0, 0, 0.05);
  --accent-border: rgba(0, 0, 0, 0.15);
  --nav-bg: #ffffff;
  --nav-border: #d4d4d4;
  --sidebar-bg: #fafafa;
  --card-bg: #ffffff;
  --card-border: #d4d4d4;
  --card-hover: #f5f5f5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --kbd-bg: #f5f5f5;
  --kbd-border: #d4d4d4;
  --callout-note-bg: #f0f0f0;
  --callout-note-border: #888;
  --callout-tip-bg: #f0f0f0;
  --callout-tip-border: #888;
  --callout-warn-bg: #f5f5f0;
  --callout-warn-border: #999;
  --search-bg: #ffffff;
  --hero-gradient-start: #0a0a0a;
  --hero-gradient-end: #404040;
  --link-color: #0a0a0a;
  --badge-bg: rgba(0,0,0,0.06);
  --badge-color: #333;
}

[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1a1a1a;
  --bg-code: #1a1a1a;
  --bg-code-block: #141414;
  --border-color: #2a2a2a;
  --border-light: #1f1f1f;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;
  --text-code: #f0f0f0;
  --text-code-block: #e0e0e0;
  --accent: #f0f0f0;
  --accent-light: #cccccc;
  --accent-bg: rgba(255, 255, 255, 0.06);
  --accent-border: rgba(255, 255, 255, 0.12);
  --nav-bg: #0f0f0f;
  --nav-border: #2a2a2a;
  --sidebar-bg: #0a0a0a;
  --card-bg: #141414;
  --card-border: #2a2a2a;
  --card-hover: #1a1a1a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
  --kbd-bg: #1a1a1a;
  --kbd-border: #2a2a2a;
  --callout-note-bg: rgba(255,255,255,0.04);
  --callout-note-border: #555;
  --callout-tip-bg: rgba(255,255,255,0.04);
  --callout-tip-border: #555;
  --callout-warn-bg: rgba(255,255,255,0.04);
  --callout-warn-border: #666;
  --search-bg: #141414;
  --hero-gradient-start: #ffffff;
  --hero-gradient-end: #999999;
  --link-color: #e0e0e0;
  --badge-bg: rgba(255,255,255,0.08);
  --badge-color: #ccc;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Navigation ──────────────────────────── */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  z-index: 100;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--nav-bg) 85%, transparent);
}

.nav-container {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
}

.nav-left { display: flex; align-items: center; }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
}

.logo-svg { color: var(--text-primary); }

.logo-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--badge-bg);
  color: var(--badge-color);
  border: 1px solid var(--border-color);
}

.nav-center {
  display: flex;
  gap: 4px;
  margin-left: 32px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-link:hover { color: var(--text-primary); background: var(--bg-secondary); }
.nav-link.active { color: var(--text-primary); background: var(--bg-secondary); }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 200px;
}

.search-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.search-btn kbd {
  margin-left: auto;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  color: var(--text-tertiary);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.theme-toggle:hover { color: var(--text-primary); border-color: var(--text-primary); }

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon, :root:not([data-theme="dark"]) .sun-icon { display: none; }
[data-theme="light"] .moon-icon, :root:not([data-theme="dark"]) .moon-icon { display: block; }

.github-link {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.github-link:hover { color: var(--text-primary); }

/* ── Search Modal ────────────────────────── */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.search-modal.active { display: block; }

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.search-dialog {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 640px;
  background: var(--search-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper svg { flex-shrink: 0; color: var(--text-tertiary); }

.search-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text-primary);
  font-family: inherit;
}

.search-input-wrapper kbd {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
  color: var(--text-tertiary);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.search-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

.search-result {
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.search-result:hover,
.search-result.selected { background: var(--bg-secondary); }

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.search-result-snippet mark {
  background: rgba(255,255,0,0.25);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.search-hint {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.search-hint-item { display: flex; align-items: center; gap: 6px; }
.search-hint .kbd {
  font-family: monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--kbd-bg);
  border: 1px solid var(--kbd-border);
}

/* ── Layout ──────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr 200px;
  max-width: 1440px;
  margin: 0 auto;
  padding-top: 64px;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 24px 16px;
  border-right: 1px solid var(--border-light);
  background: var(--sidebar-bg);
  scrollbar-width: thin;
}

.sidebar-section { margin-bottom: 24px; }

.sidebar-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 0 12px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.1s;
  font-weight: 450;
  cursor: pointer;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.sidebar-link.active {
  color: var(--text-primary);
  background: var(--accent-bg);
  font-weight: 600;
}

/* ── Content ─────────────────────────────── */
.content {
  padding: 40px 48px 80px;
  max-width: 800px;
  min-width: 0;
}

.content h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.content h2 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  letter-spacing: -0.01em;
}

.content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.75;
}

.content .lead {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.content ul, .content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content li {
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.content a {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.content a:hover { opacity: 0.7; }

.content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-code);
  color: var(--text-primary);
  font-weight: 500;
  border: 1px solid var(--border-light);
}

.content pre {
  margin-bottom: 24px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.content pre code {
  display: block;
  padding: 20px 24px;
  background: var(--bg-code-block);
  color: var(--text-code-block);
  font-size: 13.5px;
  line-height: 1.65;
  overflow-x: auto;
  border-radius: 0;
  font-weight: 400;
  border: none;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

/* ── Callouts ────────────────────────────── */
.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  border-left: 3px solid;
  font-size: 14px;
}

.callout p { margin: 0; color: var(--text-primary); font-size: 14px; }

.callout-title {
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout.note { background: var(--callout-note-bg); border-color: var(--callout-note-border); }
.callout.tip { background: var(--callout-tip-bg); border-color: var(--callout-tip-border); }
.callout.warning { background: var(--callout-warn-bg); border-color: var(--callout-warn-border); }

/* ── Cards ───────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  padding: 20px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card-bg);
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  border-color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-icon {
  font-size: 28px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
}

.card-icon svg { width: 22px; height: 22px; color: var(--text-primary); }

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── Table of Contents ───────────────────── */
.toc {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 24px 16px;
  scrollbar-width: thin;
}

.toc.hidden { display: none; }

.toc h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.toc ul { list-style: none; }

.toc-link {
  display: block;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.1s;
  line-height: 1.5;
}

.toc-link:hover { color: var(--text-primary); }
.toc-link.active {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.toc-link.toc-sub { padding-left: 24px; }

/* ── Feature table ───────────────────────── */
.feature-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

.feature-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 13px;
}

.feature-table td {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.feature-table code { font-size: 12px; }

/* ── Hero section ────────────────────────── */
.hero {
  text-align: center;
  padding: 48px 0 40px;
  margin-bottom: 32px;
}

.hero-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.hero-logo svg {
  width: 72px;
  height: 72px;
  color: var(--text-primary);
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.hero .lead {
  font-size: 20px;
  max-width: 560px;
  margin: 0 auto 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--text-primary);
  color: var(--bg-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover { border-color: var(--text-primary); }

/* ── Syntax highlighting (the ONLY colors) ── */
.token-keyword { color: #ff7b72; }
.token-string { color: #a5d6ff; }
.token-number { color: #79c0ff; }
.token-comment { color: #6a737d; font-style: italic; }
.token-function { color: #d2a8ff; }
.token-type { color: #7ee787; }
.token-operator { color: #ff7b72; }
.token-builtin { color: #ffa657; }
.token-boolean { color: #79c0ff; }

/* ── Badge ───────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--badge-bg);
  color: var(--badge-color);
}

/* ── Mobile sidebar toggle ───────────────── */
.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  align-items: center;
  justify-content: center;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 1200px) {
  .toc { display: none; }
  .layout { grid-template-columns: 260px 1fr; }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 64px;
    width: 280px;
    z-index: 90;
    transition: left 0.3s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .mobile-sidebar-toggle { display: flex; }
  .content { padding: 24px 16px 80px; }
  .nav-center { display: none; }
  .search-btn span { display: none; }
  .search-btn { min-width: auto; }
  .hero h1 { font-size: 32px; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ── Animations ──────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.content > * { animation: fadeIn 0.3s ease-out; }
