:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --max-width: 720px;
}

*, *::before, *::after { box-sizing: border-box }
html, body { height: 100% }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  margin: 0;
}

/* ── Layout ───────────────────────────────────────────────── */
.site-wrap { display: flex; min-height: 100vh }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 40px 24px;
  background: #fafafa;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 48px;
  max-width: calc(var(--max-width) + 96px);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.nav { display: flex; flex-direction: column; height: 100% }
.nav-inner { display: flex; flex-direction: column; height: 100% }

.portrait {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  display: block;
}

.nav-name { font-weight: 600; font-size: 0.95rem; margin: 0 0 3px }
.nav-bio { color: var(--muted); font-size: 0.8rem; margin: 0 0 14px; line-height: 1.4 }

.social-links { display: flex; gap: 12px; margin-bottom: 0 }
.social-icon { width: 18px; height: 18px; color: var(--muted); transition: color 0.2s }
.social-links a { display: flex; align-items: center }
.social-links a:hover .social-icon { color: var(--text) }

.nav-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0 }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.nav-list { list-style: none; padding: 0; margin: 0 }
.nav-list li { margin: 5px 0 }
.nav-list a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-list a:hover { color: var(--accent) }
.nav-list a.active { color: var(--accent) }

.nav-post-date {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}

.nav-footer { margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 0.78rem }
.nav-footer p { margin: 0 }

/* ── Post list (home) ─────────────────────────────────────── */
.post-list { list-style: none; padding: 0; margin: 0 }
.post-list-item { padding: 28px 0; border-bottom: 1px solid var(--border) }
.post-list-item:first-child { padding-top: 0 }
.post-list-item:last-child { border-bottom: none }

.post-list-title {
  font-family: Merriweather, serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.35;
}
.post-list-title a { color: var(--text); text-decoration: none }
.post-list-title a:hover { color: var(--accent) }

.post-meta { font-size: 0.8rem; color: var(--muted); margin: 0 0 10px; display: block }
.post-excerpt { color: #374151; font-size: 0.95rem; margin: 0 0 12px }
.read-more { font-size: 0.875rem; font-weight: 500; color: var(--accent); text-decoration: none }
.read-more:hover { color: var(--accent-hover); text-decoration: underline }

/* ── Article ──────────────────────────────────────────────── */
.post { padding-top: 8px }

.post h1 {
  font-family: Merriweather, serif;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 12px;
}
.post h2 {
  font-family: Merriweather, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 2em 0 0.5em;
  line-height: 1.3;
}
.post h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin: 1.5em 0 0.4em }

.post p { color: #1f2937; margin: 0 0 1.1em; font-size: 1rem }

.post a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px }
.post a:hover { color: var(--accent-hover) }

.post ul, .post ol { margin: 0 0 1.1em; padding-left: 1.5em }
.post li { margin-bottom: 0.4em; color: #1f2937 }

.post blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5em 0;
  padding: 0.4em 0 0.4em 1.25em;
  color: var(--muted);
  font-style: italic;
}
.post blockquote p { color: var(--muted); margin-bottom: 0 }

.post code {
  font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.post pre {
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1em 1.25em;
  overflow-x: auto;
  margin: 0 0 1.25em;
}
.post pre code { background: none; border: none; padding: 0; font-size: 0.875rem }

.post img { max-width: 100%; height: auto; border-radius: 4px }
.post hr { border: none; border-top: 1px solid var(--border); margin: 2em 0 }

/* ── Dark mode ────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1f2937;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
  }

  .sidebar { background: #141820 }

  .post p,
  .post li { color: #d1d5db }
  .post-excerpt { color: #9ca3af }

  .post code,
  .post pre { background: #1e2330; border-color: var(--border) }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 800px) {
  .site-wrap { flex-direction: column }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 20px;
  }
  .nav-post-list { display: none }
  .content { padding: 24px 20px }
}
