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

:root {
  --bg: #faf9f7;
  --text: #1a1a1a;
  --text-muted: #666;
  --text-faint: #999;
  --accent: #2d6a4f;
  --border: #e5e2dc;
  --code-bg: #f3f1ed;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --measure: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --text: #e8e6e1;
    --text-muted: #8a8680;
    --text-faint: #5c5a56;
    --accent: #4e9a74;
    --border: #2a2825;
    --code-bg: #1e1c18;
  }
}

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.8;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* ---- Header / nav ---- */

.site-header {
  margin-bottom: 48px;
}

.home-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.home-link:hover {
  color: var(--accent);
}

/* ---- Blog index ---- */

h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 48px;
}

.post-list {
  list-style: none;
}

.post-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.post-item:first-child {
  border-top: 1px solid var(--border);
}

.post-item time {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.post-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 6px;
  transition: color 0.15s;
}

.post-title:hover {
  color: var(--accent);
}

.post-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---- Individual post ---- */

.post-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.post-header time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.post-tags li {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 2px;
}

/* ---- Prose typography ---- */

.prose h2 { font-size: 1.5rem; margin: 2.5em 0 0.75em; }
.prose h3 { font-size: 1.2rem; margin: 2em 0 0.5em; }
.prose h4 { font-size: 1rem; margin: 1.5em 0 0.5em; }
.prose p  { margin-bottom: 1.4em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover { opacity: 0.8; }

.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.25em;
  margin: 2em 0;
  color: var(--text-muted);
  font-style: italic;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
  margin-bottom: 1.4em;
}

.prose li { margin-bottom: 0.4em; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.prose pre {
  background: #0a0a0a;
  color: #c8ffd4;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 20px 24px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 2em 0;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

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

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 2em 0;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  html { font-size: 16px; }
  .page { padding: 32px 18px 64px; }
  .post-header h1 { font-size: 1.7rem; }
  h1 { font-size: 1.6rem; }
}
