/* hide raw article until docs.js rebuilds the layout */
article { display: none; }

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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1f2428;
  --border: #30363d;
  --accent: #7c6aff;
  --accent-dim: rgba(124,106,255,0.15);
  --text: #e6edf3;
  --muted: #8b949e;
  --code-bg: #161b22;
  --code-text: #a5f3fc;
  --nav-h: 56px;
  --sidebar-w: 240px;
}

html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px; }

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

code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--code-text);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  margin: 1.25rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.83rem;
  color: #cdd6f4;
  display: block;
  padding: 1.25rem 1.5rem;
  line-height: 1.7;
}

.pre-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.pre-dot { width: 11px; height: 11px; border-radius: 50%; }
.pre-dot-r { background: #ff5f57; }
.pre-dot-y { background: #febc2e; }
.pre-dot-g { background: #28c840; }

.pre-label {
  margin-left: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, monospace;
}

/* ── Shared Nav ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(13,17,23,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo:hover { text-decoration: none; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-right a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.nav-gh {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 11px;
  background: var(--surface);
  font-size: 0.8rem;
  color: var(--text) !important;
}

.nav-gh:hover { border-color: var(--accent) !important; background: var(--surface2) !important; }

/* ── Syntax highlights ── */
.t-comment { color: #6c7086; }
.t-key { color: #89b4fa; }
.t-str { color: #a6e3a1; }
.t-num { color: #fab387; }
.t-cmd { color: #a5f3fc; }
.t-flag { color: #cba6f7; }
.t-kw { color: #cba6f7; }

/* ── Landing Page ── */
.lp-hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
  text-align: center;
}

.lp-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.1rem;
}

.lp-hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.lp-ctas {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; text-decoration: none; }

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

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

/* landing diagram */
.lp-diagram {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 2rem 1.5rem;
  margin: 0 auto;
  max-width: 640px;
  overflow-x: auto;
}

/* landing features */
.lp-features {
  max-width: 840px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--border);
}

.lp-feature {
  background: var(--bg);
  padding: 2rem 1.75rem;
}

.lp-feature-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.lp-feature-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
}

.lp-feature-icon {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

/* landing footer */
.lp-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.lp-footer a { font-size: 0.85rem; color: var(--muted); }
.lp-footer a:hover { color: var(--text); text-decoration: none; }

.lp-footer-copy { font-size: 0.8rem; color: #484f58; }

/* ── Docs Layout ── */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--nav-h));
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 1.25rem;
  margin-bottom: 0.35rem;
}

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

.sidebar-links a {
  display: block;
  padding: 6px 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  margin: 0 0;
}

.sidebar-links a:hover {
  color: var(--text);
  background: var(--surface);
}

.sidebar-links a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
  font-weight: 500;
}

/* Main content */
.docs-main {
  max-width: 760px;
  padding: 2.5rem 3rem 5rem;
}

.docs-main h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.docs-main h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
  padding-top: 0.5rem;
}

.docs-main h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
  color: var(--text);
}

.docs-main p { margin-bottom: 1rem; color: #c9d1d9; }

.docs-main ul, .docs-main ol {
  margin: 0.75rem 0 1rem 1.5rem;
  color: #c9d1d9;
}

.docs-main li { margin-bottom: 0.35rem; }

.docs-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.875rem;
}

.docs-main th {
  text-align: left;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-main td {
  padding: 8px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
}

.docs-main td:first-child code { color: var(--accent); }

/* Callout */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

.callout-title {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* Prev / Next navigation */
.docs-nav-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}

.docs-nav-link {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s;
  min-width: 140px;
}

.docs-nav-link:hover { border-color: var(--accent); text-decoration: none; }

.docs-nav-link-label { font-size: 0.75rem; color: var(--muted); margin-bottom: 3px; }
.docs-nav-link-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }

.docs-nav-link.next { text-align: right; margin-left: auto; }

/* Mobile */
@media (max-width: 768px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .docs-main { padding: 1.5rem 1.25rem 4rem; }
  .lp-hero { padding: 4rem 1.25rem 3rem; }
  .lp-features { grid-template-columns: 1fr; }
}
