/* ------------------------------------------------------------------
   Design tokens — change these to restyle the whole site.
   ------------------------------------------------------------------ */
:root {
  --bg: #fdfcf9;
  --text: #1f1d1a;
  --muted: #6b665e;
  --accent: #8a3b12;      /* link color */
  --rule: #e4e0d8;
  --code-bg: #f3f0ea;

  --font-body: "Sentient", "Iowan Old Style", "Charter", "Palatino Linotype", Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --measure: 40rem;       /* width of the text column */
  --size: 1.1875rem;      /* body text size (19px) */
  --leading: 1.6;
}

/* Dark mode: follows the reader's system setting, unless they click the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1618;          /* night: a breath off black, blue-green */
    --text: #dfe8e5;
    --muted: #8ea4a0;
    --accent: #f2b48c;      /* warm peach, like the last light of sunset */
    --rule: #1d2d2f;
    --code-bg: #142224;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1618;          /* night: a breath off black, blue-green */
  --text: #dfe8e5;
  --muted: #8ea4a0;
  --accent: #f2b48c;      /* warm peach, like the last light of sunset */
  --rule: #1d2d2f;
  --code-bg: #142224;
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size);
  line-height: var(--leading);
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; font-weight: 600; }
h1 { font-size: 2rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }

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

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

code { font-size: 0.85em; background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; }

/* ------------------------------------------------------------------
   Header & footer
   ------------------------------------------------------------------ */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 3rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
/* Homepage only: a thin line under the header to set it apart */
.home .site-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.site-name { color: var(--text); font-weight: 600; text-decoration: none; font-size: 1.05rem; }
.site-header nav { display: flex; align-items: baseline; gap: 1.25rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}
.site-footer a { color: inherit; }

/* ------------------------------------------------------------------
   Homepage
   ------------------------------------------------------------------ */
.intro p:first-child { margin-top: 0; }

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { margin-bottom: 1.25rem; }
.post-list .meta { color: var(--muted); font-size: 0.9em; }
.post-list .summary { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.95em; }
h2.year { font-size: 1rem; color: var(--muted); font-family: var(--font-ui); font-weight: 500; }
.more { font-family: var(--font-ui); font-size: 0.9rem; }

/* ------------------------------------------------------------------
   Essays
   ------------------------------------------------------------------ */
.essay header { margin-bottom: 2rem; }
.essay .meta { margin: 0; color: var(--muted); font-family: var(--font-ui); font-size: 0.9rem; }

figure { margin: 2rem 0; }
img, picture { display: block; max-width: 100%; height: auto; border-radius: 3px; }
figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  text-align: center;
}

.essay-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.essay-nav span:last-child { text-align: right; }
