/* ── Variables ─────────────────────────────── */
:root {
  --bg:       #f9f9f7;
  --fg:       #1a1a1a;
  --muted:    #888;
  --accent:   #0057ff;
  --border:   #e4e4e0;
  --mono:     "JetBrains Mono", "Fira Mono", ui-monospace, "Cascadia Code", "Menlo", "Consolas", monospace;
  --sans:     "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max-w:    680px;
  --radius:   4px;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── Layout ────────────────────────────────── */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ── Header ────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.nav {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-title {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--fg);
  text-decoration: none;
}

/* ── Footer ────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 100%;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }

/* ── Home ──────────────────────────────────── */
.home-intro {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.home-intro h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.home-intro p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Post list ─────────────────────────────── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.post-date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.post-link {
  font-size: 0.95rem;
  color: var(--fg);
  font-weight: 500;
}

.post-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Single post ───────────────────────────── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
}

.tags { display: flex; gap: 0.4rem; }

.tag {
  background: var(--border);
  color: var(--muted);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
}

/* ── Post content (Markdown) ───────────────── */
.post-content { font-size: 1rem; }

.post-content h2, .post-content h3, .post-content h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem;
}

.post-content h2 { font-size: 1.3rem; }
.post-content h3 { font-size: 1.1rem; }

.post-content p { margin-bottom: 1.25rem; }

.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-content li { margin-bottom: 0.3rem; }

.post-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--border);
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
}

.post-content pre {
  background: #1a1a1a;
  color: #e4e4e0;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.6;
}

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

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

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

.post-content img {
  max-width: 100%;
  border-radius: var(--radius);
}

.post-content a { text-decoration: underline; text-underline-offset: 3px; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 600px) {
  .post-item { grid-template-columns: 1fr; gap: 0.15rem; }
  .post-header h1 { font-size: 1.4rem; }
  .site-footer { flex-direction: column; gap: 0.25rem; }
}
