/* ---- Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;1,6..72,400&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ---- Tokens ---- */
:root {
  --bg: #fbfaf7;
  --fg: #1f1d1a;
  --muted: #6b665e;
  --rule: #e5e1d8;
  --accent: #b5532a;       /* terracotta */
  --accent-soft: #f3e7df;
  --code-bg: #f3f1ec;
  --max: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---- Header / footer ---- */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; padding-top: 22px; padding-bottom: 22px;
}
.site-title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.4rem; font-weight: 600; color: var(--fg); text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav a {
  color: var(--muted); text-decoration: none; margin-left: 20px; font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }

main.wrap { padding-top: 48px; padding-bottom: 64px; }

.site-footer {
  border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem;
}
.site-footer .wrap { padding-top: 28px; padding-bottom: 40px; }

/* ---- Headings ---- */
h1, h2, h3, h4 {
  font-family: 'Newsreader', Georgia, serif;
  line-height: 1.2; letter-spacing: -0.012em; font-weight: 600;
}
h1 { font-size: 2.25rem; margin: 0 0 0.3em; }
h2 { font-size: 1.6rem; margin: 2.2em 0 0.6em; }
h3 { font-size: 1.25rem; margin: 1.8em 0 0.5em; }

/* ---- Body text ---- */
p { margin: 0 0 1.2em; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration: none; }
strong { font-weight: 600; }

/* ---- Post header ---- */
.post-header { margin-bottom: 2.2em; }
.post-title { font-size: 2.5rem; margin-bottom: 0.2em; }
.post-meta { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ---- Images & figures ---- */
.post-content img {
  display: block; max-width: 100%; height: auto; margin: 1.8em auto 0.4em;
  border-radius: 6px;
}
/* The paragraph immediately after an image acts as a caption */
.post-content img + em,
.figure-caption {
  display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.5;
  text-align: center; max-width: 90%; margin: 0 auto 2em; font-style: italic;
}

/* ---- Blockquote / callout ---- */
blockquote {
  margin: 1.8em 0; padding: 0.6em 1.2em; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 6px 6px 0;
}
blockquote p { margin: 0.3em 0; }

/* ---- Code ---- */
code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.86em; background: var(--code-bg); padding: 0.12em 0.36em; border-radius: 4px;
}
pre {
  background: var(--code-bg); padding: 16px 18px; border-radius: 8px; overflow-x: auto;
  border: 1px solid var(--rule); line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: 0.82rem; }

/* ---- Tables ---- */
table { border-collapse: collapse; width: 100%; margin: 1.8em 0; font-size: 0.95rem; }
th, td { padding: 9px 14px; border-bottom: 1px solid var(--rule); text-align: left; }
th { font-weight: 600; border-bottom: 2px solid var(--rule); }
tbody tr:first-child td { font-weight: 500; }

/* ---- Horizontal rule ---- */
hr { border: none; border-top: 1px solid var(--rule); margin: 2.6em 0; }

/* ---- Post list (home) ---- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 1.4em 0; border-bottom: 1px solid var(--rule); }
.post-list li:first-child { padding-top: 0; }
.post-list h2 { margin: 0 0 0.2em; font-size: 1.5rem; }
.post-list h2 a { color: var(--fg); text-decoration: none; }
.post-list h2 a:hover { color: var(--accent); }
.post-list .post-meta { margin-bottom: 0.4em; }
.post-list .excerpt { color: var(--muted); margin: 0; }

.intro { font-size: 1.05rem; color: var(--muted); margin-bottom: 2.4em; }

/* ---- References (smaller, hanging) ---- */
.post-content ol { padding-left: 1.4em; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .post-title { font-size: 2rem; }
  h1 { font-size: 1.9rem; }
}
