/* Eshkol Website — Production Styles */
:root {
  --bg-0: #060610;
  --bg-1: #09090b;
  --bg-2: #111113;
  --bg-3: #18181b;
  --bg-code: #0a0a14;
  --text-0: #fafafa;
  --text-1: #d4d4d8;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: #a78bfa;
  --accent-glow: rgba(124, 58, 237, 0.12);
  --green: #22c55e;
  --green-dim: #16a34a;
  --border: #27272a;
  --border-hover: #3f3f46;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 1200px;
  --nav-height: 64px;
  --radius: 12px;
  --radius-sm: 6px;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-1);
  color: var(--text-1);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Loading Screen ── */
#loading {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--bg-1); z-index: 9999;
  font-family: var(--font-sans); color: var(--text-3);
}
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
.loading-sub { font-size: 0.85rem; color: var(--text-3); margin-top: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Typography ── */
a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }
code, pre { font-family: var(--font-mono); }
::selection { background: var(--accent); color: white; }

/* ── Layout ── */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px;
}
.section-narrow { max-width: 800px; margin: 0 auto; padding: 80px 24px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
/* Prevent grid items from overflowing their column */
.grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 20px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section, .section-narrow { padding: 48px 16px; }
  .card { padding: 16px; }
}

/* ── Cards ── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 30px var(--accent-glow);
}
.card-highlight {
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 0 40px var(--accent-glow);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: white;
}
.btn-primary:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); }
.btn-secondary {
  background: transparent; color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-light); }

/* ── Code Blocks ── */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-1);
}
pre code { background: none; padding: 0; color: inherit; }
code {
  background: var(--bg-code);
  padding: 2px 6px; border-radius: 4px;
  font-size: 0.85em; color: var(--accent-light);
}

/* ── Install Command ── */
.install-cmd {
  background: var(--bg-code);
  border: 1px solid var(--green-dim);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--green);
  overflow-x: auto;
}

/* ── Stats ── */
.stat-box { text-align: center; padding: 20px; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--accent-light); }
.stat-label { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-stable { background: var(--green-dim); color: white; }
.badge-pre { background: var(--accent); color: white; }

/* ── Hero ── */
.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-0) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.2rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 600px;
  margin-top: 16px;
}

/* ── Docs Layout ── */
.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 80px;
  min-height: calc(100vh - var(--nav-height));
}
.docs-sidebar {
  position: sticky; top: calc(var(--nav-height) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--nav-height) - 48px);
  overflow-y: auto;
}
.docs-sidebar-group { margin-bottom: 20px; }
.docs-sidebar-group-title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-3);
  margin-bottom: 8px; padding-left: 12px;
}
.docs-sidebar-item {
  display: block;
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--text-2);
  border-left: 2px solid transparent;
  transition: all 0.15s; cursor: pointer;
  text-decoration: none;
}
.docs-sidebar-item:hover { color: var(--text-0); background: var(--bg-3); }
.docs-sidebar-item.active {
  color: var(--accent-light);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}

@media (max-width: 768px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: static;
    display: flex; flex-wrap: wrap; gap: 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px; margin-bottom: 16px;
  }
  .docs-sidebar-group { margin-bottom: 8px; }
  .docs-sidebar-group-title { display: none; }
  .docs-sidebar-item { border-left: none; font-size: 0.78rem; padding: 4px 10px; }
}

/* ── Comparison Table ── */
.comparison-table { width: 100%; border-collapse: collapse; margin: 2em 0; }
.comparison-table th, .comparison-table td {
  border: 1px solid var(--border);
  padding: 10px 16px; text-align: left;
  font-size: 0.9rem;
}
.comparison-table th { background: var(--bg-3); color: var(--text-0); font-weight: 600; }
.comparison-table td { color: var(--text-2); }
.comparison-table td strong { color: var(--accent-light); }

/* ── Document Content (loaded from GitHub markdown) ── */
.doc-content h1, .doc-content h2, .doc-content h3, .doc-content h4 {
  color: var(--text-0); margin-top: 2em; margin-bottom: 0.5em;
}
.doc-content h1 { font-size: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.doc-content h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.doc-content h3 { font-size: 1.2rem; }
.doc-content h4 { font-size: 1rem; color: var(--text-2); }
.doc-content p { margin: 0.8em 0; color: var(--text-2); }
.doc-content ul, .doc-content ol { margin: 0.8em 0; padding-left: 1.5em; color: var(--text-2); }
.doc-content li { margin: 0.3em 0; }
.doc-content code { background: var(--bg-code); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; color: var(--accent-light); }
.doc-content pre code { background: none; padding: 0; color: var(--text-1); }
.doc-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.doc-content th, .doc-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.doc-content th { background: var(--bg-3); color: var(--text-0); font-weight: 600; }
.doc-content td { color: var(--text-2); }
.doc-content blockquote { border-left: 3px solid var(--accent); padding-left: 16px; margin: 1em 0; color: var(--text-3); }
.doc-content a { color: var(--accent-light); }
.doc-content a:hover { text-decoration: underline; }
.doc-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.doc-content img { max-width: 100%; border-radius: var(--radius-sm); }

/* ── Chapter / Lesson ── */
.chapter { margin-bottom: 64px; }
.chapter-number {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--accent); margin-bottom: 8px;
}
.chapter-title { font-size: 1.5rem; font-weight: 700; color: var(--text-0); margin-bottom: 12px; }
.chapter-desc { color: var(--text-2); margin-bottom: 20px; line-height: 1.7; }

/* ── REPL Terminal ── */
.repl-terminal {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.repl-titlebar {
  background: var(--bg-3);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.repl-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-accent { color: var(--accent-light); }
.text-muted { color: var(--text-3); }
.text-small { font-size: 0.85rem; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.gap-16 { gap: 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 48px 0; }
