:root {
  --bg: #fbfaf8;
  --fg: #1b1b18;
  --muted: #6b6a66;
  --line: #e4e2dd;
  --accent: #b34700;
  --code-bg: #f1efe9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --fg: #ece9e2;
    --muted: #9b988f;
    --line: #322f27;
    --accent: #ff9955;
    --code-bg: #1f1d17;
  }
}

* { box-sizing: border-box; }
[hidden], [hidden="true"] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

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

code, pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: var(--code-bg);
  border-radius: 4px;
}
code { padding: 0.1em 0.35em; font-size: 0.9em; }
pre { padding: 1rem; overflow-x: auto; border: 1px solid var(--line); }
pre code { padding: 0; background: none; }

table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; }
th, td { border: 1px solid var(--line); padding: 0.5rem 0.75rem; text-align: left; font-size: 0.95em; }
th { background: var(--code-bg); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.3rem; color: var(--fg); letter-spacing: -0.02em; }
.brand-dim { color: var(--muted); }
.topnav a { color: var(--muted); font-size: 0.9rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.layout {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  gap: 2.5rem;
  align-items: flex-start;
}

.sidebar { flex: 0 0 200px; position: sticky; top: 1.5rem; }
.sidenav { display: flex; flex-direction: column; gap: 0.4rem; }
.navlink {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.25rem 0;
}
.navlink.active, .navlink:hover { color: var(--accent); }

.content { flex: 1 1 auto; min-width: 0; }
.prose { max-width: 680px; }
.prose h1 { font-size: 1.8rem; margin-top: 0; }
.prose h2 { font-size: 1.3rem; margin-top: 2.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.prose h3 { font-size: 1.05rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }

.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  text-align: left;
}
.hero h1 { font-size: 2.6rem; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
.tagline { color: var(--muted); font-size: 1.1rem; max-width: 560px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 2.5rem;
}
.card {
  display: block;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.95rem;
}
.card:hover { border-color: var(--accent); text-decoration: none; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; }
  .hero h1 { font-size: 2rem; }
}
