/* ── Reset & base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f7f8fa;
  --surface:     #ffffff;
  --border:      #dde1e8;
  --text:        #2d3340;
  --muted:       #6b7385;
  --accent:      #4a7fa5;
  --accent-dim:  #d6e6f2;
  --link:        #3a6e93;
  --link-hover:  #e85d3a;   /* the occasional pop */
  --tag-bg:      #eef2f7;
  --code-bg:     #f0f3f7;
  --max-w:       680px;
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
}

html { font-size: 17px; scroll-behavior: smooth; }

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

/* ── Layout ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main { flex: 1; padding: 2.5rem 0 4rem; }

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { font-size: 1.85rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem;  margin: 1.75rem 0 0.5rem; }

p { margin-bottom: 1.25rem; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--link-hover); }

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

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

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

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.site-title a { color: inherit; }
.site-title a:hover { color: var(--accent); }

.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}
.site-nav a:hover,
.site-nav a.active { color: var(--link-hover); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* ── Article list (index / category / tag) ───────────────── */
.post-list { list-style: none; }

.post-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { padding-top: 0; }

.post-title {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.post-summary {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.read-more {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--accent);
}
.read-more:hover { color: var(--link-hover); }

/* ── Article page ────────────────────────────────────────── */
.article-header { margin-bottom: 2rem; }

.article-title {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-size: 0.825rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.article-body { margin-bottom: 2.5rem; }

.article-body h2 { font-size: 1.3rem; }
.article-body h3 { font-size: 1.05rem; }

.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem 1.5rem;
}
.article-body li { margin-bottom: 0.3rem; }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
  background: var(--accent-dim);
  border-radius: 0 4px 4px 0;
}

.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  line-height: 1.55;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.article-body img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin: 1.5rem auto;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.article-body th,
.article-body td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.article-body th {
  background: var(--code-bg);
  font-weight: 600;
}

/* ── Tags & categories ───────────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.2em 0.65em;
  border-radius: 20px;
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.tag:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Archives ────────────────────────────────────────────── */
.archive-year { margin: 2rem 0 0.5rem; color: var(--muted); font-size: 0.8rem; }

.archive-list { list-style: none; }
.archive-item {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.archive-date { color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }

/* ── Page header (categories, tags, archives pages) ─────── */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}
.page-header h1 { font-size: 1.4rem; color: var(--muted); }
.page-header span { color: var(--text); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2.5rem;
  font-size: 0.875rem;
}
.pagination a,
.pagination .current {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Utilities ───────────────────────────────────────────── */
.dot { color: var(--border); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .article-title { font-size: 1.5rem; }
  .site-nav { gap: 1rem; }
}
