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

:root {
  --bg: #0f1117;
  --bg2: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent2: #79c0ff;
  --warn: #f0883e;
  --sidebar-w: 220px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar .logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar ul a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar ul a:hover, .sidebar ul a.active {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent);
}

/* Main content */
main {
  flex: 1;
  max-width: 900px;
  padding: 2.5rem 3rem;
  overflow-x: hidden;
}

header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

header .subtitle {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.1s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card h3 {
  color: var(--accent2);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.card p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Highlights */
.highlights h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.highlights ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.highlights li {
  padding: 0.75rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.highlights li strong {
  color: var(--text);
}

/* Prose (doc pages) */
.prose { line-height: 1.75; }

.prose h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.prose h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--accent2);
}

.prose h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.prose p { margin-bottom: 1rem; color: var(--muted); }
.prose p strong { color: var(--text); }

.prose ul, .prose ol {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--muted);
}

.prose li { margin-bottom: 0.25rem; }
.prose li strong { color: var(--text); }

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.prose pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
}

.prose pre code {
  background: none;
  color: var(--text);
  padding: 0;
  font-size: 0.82rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.875rem;
}

.prose th, .prose td {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
}

.prose td { color: var(--muted); }

.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: var(--muted);
  font-style: italic;
}

/* Warning banner */
.banner-warn {
  background: rgba(240, 136, 62, 0.1);
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--warn);
}

/* Responsive */
@media (max-width: 700px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .sidebar ul { flex-direction: row; flex-wrap: wrap; }
  main { padding: 1.25rem; }
}
