/* ── LLM-Wiki: Lean Dark Theme ── */
:root {
  --bg: #0b0f1a; --bg-alt: #131a2e; --bg-card: #1a2240;
  --fg: #e2e8f0; --fg-dim: #94a3b8; --fg-faint: #64748b;
  --accent: #818cf8; --accent2: #c084fc; --green: #34d399; --red: #f87171; --yellow: #fbbf24;
  --border: #1e293b; --border-hi: #334155;
  --radius: .625rem; --font: 'JetBrains Mono', ui-monospace, monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--fg); line-height: 1.7; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* Header */
.site-header { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: .75rem 0; position: sticky; top: 0; z-index: 100; backdrop-filter: blur(8px); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.15rem; font-weight: 700; color: var(--fg); }
.logo span { color: var(--accent); }
.main-nav { display: flex; gap: 1.25rem; align-items: center; }
.main-nav a { color: var(--fg-dim); font-size: .85rem; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { color: var(--accent); text-decoration: none; }
.nav-live { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff !important; padding: .3rem .7rem; border-radius: var(--radius); font-size: .8rem; }

/* Layout */
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; padding: 2rem 1.5rem; flex: 1; max-width: 1280px; margin: 0 auto; width: 100%; }

/* Sidebar */
.sidebar { position: sticky; top: 4.5rem; align-self: start; max-height: calc(100vh - 5rem); overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 4px; } .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sidebar-nav h3 { font-size: .65rem; text-transform: uppercase; color: var(--fg-faint); margin: 1.25rem 0 .4rem; letter-spacing: .08em; font-weight: 600; }
.sidebar-nav h3:first-child { margin-top: 0; }
.sidebar-nav a { display: block; padding: .25rem 0; color: var(--fg-dim); font-size: .825rem; line-height: 1.4; }
.sidebar-nav a:hover { color: var(--accent); text-decoration: none; }
.sidebar-nav .section-link { font-weight: 600; color: var(--fg); }

/* Content */
main { min-width: 0; }
.content h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; line-height: 1.3; }
.content h2 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 .5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.content h3 { font-size: 1.05rem; font-weight: 600; margin: 1.25rem 0 .4rem; color: var(--accent); }
.content h4 { font-size: .95rem; font-weight: 600; margin: 1rem 0 .3rem; color: var(--fg-dim); }
.content p { margin-bottom: .75rem; color: var(--fg-dim); }
.content strong { color: var(--fg); }
.content ul, .content ol { margin: .4rem 0 .75rem 1.25rem; color: var(--fg-dim); }
.content li { margin-bottom: .25rem; }
.content li > ul, .content li > ol { margin-bottom: .25rem; }

/* Code */
.content code { background: var(--bg-alt); padding: .15rem .4rem; border-radius: .25rem; font-family: var(--font); font-size: .825em; color: var(--accent2); }
.content pre { background: var(--bg-alt); border: 1px solid var(--border); padding: 1rem; border-radius: var(--radius); overflow-x: auto; margin: .75rem 0; }
.content pre code { background: none; padding: 0; color: var(--fg); font-size: .825rem; }

/* Tables */
.content table { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .85rem; }
.content th { background: var(--bg-alt); color: var(--fg); font-weight: 600; text-align: left; padding: .5rem .75rem; border-bottom: 2px solid var(--border-hi); }
.content td { padding: .45rem .75rem; border-bottom: 1px solid var(--border); color: var(--fg-dim); }
.content tr:hover td { background: var(--bg-card); }

/* Tags / Badges */
.badge { display: inline-block; background: var(--bg-alt); border: 1px solid var(--border); padding: .15rem .5rem; border-radius: 1rem; font-size: .7rem; color: var(--fg-dim); font-weight: 500; }
.badge-green { border-color: var(--green); color: var(--green); }
.badge-red { border-color: var(--red); color: var(--red); }
.badge-yellow { border-color: var(--yellow); color: var(--yellow); }

/* Cards */
.page-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h2, .card h3 { font-size: 1rem; margin-bottom: .4rem; border: none; padding: 0; }
.card h2 a, .card h3 a { color: var(--fg); }
.card p { color: var(--fg-dim); font-size: .825rem; margin: 0; }

/* Hero */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2.25rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: .5rem; }
.hero p { color: var(--fg-dim); font-size: 1rem; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-block; padding: .5rem 1.25rem; border-radius: var(--radius); font-weight: 600; font-size: .85rem; cursor: pointer; border: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6366f1; text-decoration: none; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--fg-dim); }
.btn-ghost:hover { border-color: var(--fg-dim); color: var(--fg); text-decoration: none; }

/* TOC */
.toc { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; }
.toc h4 { margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; color: var(--fg-faint); letter-spacing: .05em; }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc li { margin: .2rem 0; }
.toc a { font-size: .825rem; }

/* Footer */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 1.25rem 0; margin-top: auto; text-align: center; }
.site-footer p { color: var(--fg-faint); font-size: .8rem; }

/* Responsive */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; padding: 1rem; }
  .sidebar { position: static; max-height: none; margin-bottom: 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .main-nav a:not(.nav-live) { display: none; }
}
