:root {
  --bg: #fdfaf5;
  --fg: #2b2118;
  --muted: #8a7a68;
  --accent: #b4541a;
  --border: #e8dccb;
  --code-bg: #f5efe4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --fg: #c9c2b8;
    --muted: #8a837a;
    --accent: #d98a5a;
    --border: #302d29;
    --code-bg: #232120;
  }
}

* { box-sizing: border-box; }

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

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.site-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-header nav a:hover { color: var(--accent); }

main.wrap { padding-top: 2rem; padding-bottom: 3rem; }

.site-description { color: var(--muted); }

.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: 1.75rem; }
.post-list h2 { margin: 0.2rem 0 0.4rem; font-size: 1.3rem; }
.post-list h2 a { color: var(--fg); text-decoration: none; }
.post-list h2 a:hover { color: var(--accent); }
.post-meta { color: var(--muted); font-size: 0.85rem; }
.post-excerpt { color: var(--muted); margin: 0.4rem 0 0; }

.post-header h1 { margin: 0 0 0.4rem; font-size: 1.8rem; }
.post-content { margin-top: 1.5rem; }
.post-content h2 { margin-top: 2rem; }

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}
.post-content code {
  background: var(--code-bg);
  border-radius: 3px;
  padding: 0.1em 0.3em;
  font-size: 0.9em;
}
.post-content pre code { padding: 0; background: none; }

.post-content img { max-width: 100%; height: auto; }
.post-content a { color: var(--accent); }

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .wrap {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer .socials {
  display: flex;
  gap: 0.9rem;
}
.site-footer .socials a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-footer .socials a:hover { color: var(--accent); }

.page-shell {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: flex-start;
}
.page-shell main {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2rem;
  padding-bottom: 3rem;
}
.outline {
  flex: 0 0 13rem;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  font-size: 0.9rem;
  margin-left: 2rem
}

@media (max-width: 56rem) {
  .page-shell { display: block; }
  .outline { display: none; }
}
.outline-header {
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#toc-nav ul { list-style: none; margin: 0; padding: 0; }
#toc-nav li { margin: 0.25rem 0; }
#toc-nav .toc-level-3 { margin-left: 1rem; }
#toc-nav .toc-level-4 { margin-left: 2rem; }
#toc-nav a {
  color: var(--muted);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0.5rem;
  border-left: 2px solid transparent;
  line-height: 1.35;
}
#toc-nav a:hover { color: var(--accent); }
#toc-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}
