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

:root {
  --bg:        #f9f9f7;
  --surface:   #ffffff;
  --border:    #e4e4e0;
  --text:      #1a1a18;
  --muted:     #888882;
  --accent:    #2563eb;
  --accent-bg: #eff4ff;
  --code-bg:   #f3f3f0;
  --radius:    6px;
  --max-w:     680px;
  --mono:      "SF Mono", "Fira Code", "Fira Mono", "Menlo", monospace;
  --sans:      "Inter", system-ui, -apple-system, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.site-name {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-name span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-nav a:hover { color: var(--text); }

/* ─── Page Hero (index) ───────────────────────────────────────────────────── */
.page-hero {
  padding: 64px 0 48px;
}

.page-hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 10px;
}

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

/* ─── Post List ───────────────────────────────────────────────────────────── */
.post-list {
  list-style: none;
  padding-bottom: 96px;
}

.post-list li + li {
  border-top: 1px solid var(--border);
}

.post-card {
  display: block;
  padding: 28px 0;
  text-decoration: none;
  color: inherit;
}

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

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

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

.post-card-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 99px;
}

.post-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 8px;
  transition: color 0.15s;
}

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

/* ─── Article (post page) ─────────────────────────────────────────────────── */
.post-header {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border);
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.post-header-date {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
}

.post-header-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 99px;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.post-header .subtitle {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 560px;
}

/* ─── Article Body ────────────────────────────────────────────────────────── */
.post-body {
  padding: 48px 0 96px;
}

.post-body > * + * { margin-top: 1.4em; }

.post-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.8em;
  margin-bottom: 0.4em;
  padding-top: 2.8em;
  border-top: 1px solid var(--border);
}

.post-body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.post-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2em;
}

.post-body p {
  font-size: 0.97rem;
  line-height: 1.75;
  color: #2e2e2c;
}

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

.post-body ul, .post-body ol {
  padding-left: 1.4em;
  font-size: 0.97rem;
  line-height: 1.75;
  color: #2e2e2c;
}

.post-body li + li { margin-top: 0.35em; }

.post-body code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: #b0390d;
}

.post-body pre {
  background: #1e1e1e;
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-x: auto;
  margin-top: 1.4em;
}

.post-body pre code {
  font-family: var(--mono);
  font-size: 0.83rem;
  background: none;
  border: none;
  padding: 0;
  color: #d4d4d4;
  line-height: 1.7;
}

/* syntax highlight colours (manual) */
.kw { color: #569cd6; }   /* keyword */
.cm { color: #6a9955; }   /* comment */
.st { color: #ce9178; }   /* string */
.nm { color: #9cdcfe; }   /* name */
.nb { color: #4ec9b0; }   /* built-in / class */
.nu { color: #b5cea8; }   /* number */

/* ─── Callout ─────────────────────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #1d3f7a;
}

/* ─── Back link ───────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--muted);
  text-decoration: none;
  margin-top: 48px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text); }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-footer p {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .page-hero h1 { font-size: 1.4rem; }
  .post-header h1 { font-size: 1.5rem; }
  .site-nav { gap: 16px; }
}
