/*
 * The blog's stylesheet. Copied to /blog/style.css by scripts/build-blog.mjs.
 *
 * The tokens are the front page's, repeated rather than imported: index.html
 * keeps its styles inline so it paints in one request with nothing to block
 * on, and a shared file would take that away from the page that needs it
 * most. Two copies of nine colours is the cheaper trade. Change one, change
 * the other.
 */
:root {
  --bg: #fdfaf4; --surface: #fff; --surface-2: #f7f2e8;
  --ink: #2c2419; --ink-soft: #5d5346; --muted: #8a7d6c;
  --line: #e7dece; --line-strong: #d6c9b3;
  --accent: #d97a1f; --accent-ink: #b8620f; --accent-soft: #fdf0e0;
  --main: #f59e0b; --fruit: #ef4444; --veg: #22a06b; --side: #8b5cf6; --snack: #0ea5e9;
  --shadow: 0 2px 4px rgba(64,48,24,.06), 0 10px 28px rgba(64,48,24,.10);
  --font: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120d; --surface: #1f1a14; --surface-2: #272119;
    --ink: #f3ece0; --ink-soft: #cec3b2; --muted: #9b8e7c;
    --line: #342c22; --line-strong: #463c2e;
    --accent: #f0a04b; --accent-ink: #f0a04b; --accent-soft: #33251380;
    --shadow: 0 2px 4px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ---- Chrome ------------------------------------------------------------- */

header { padding: 18px 0; }
header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-decoration: none; font-size: 18px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
header nav { display: flex; align-items: center; gap: 16px; }
header nav a { font-weight: 700; color: var(--ink-soft); text-decoration: none; }
header nav a:hover { color: var(--accent-ink); }

.btn {
  display: inline-block; padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none;
  border: 1.5px solid var(--line-strong); color: var(--ink); background: var(--surface); white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.big { padding: 14px 22px; font-size: 18px; border-radius: 12px; }

footer { padding: 28px 0 44px; margin-top: 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- Index and tag pages ------------------------------------------------ */

.masthead { padding: 28px 0 8px; }
.masthead h1 { font-size: clamp(32px, 5vw, 46px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 12px; }
.masthead .lede { font-size: 19px; color: var(--ink-soft); margin: 0 0 18px; max-width: 58ch; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.tag:hover { border-color: var(--accent); color: var(--accent-ink); }
.tag b { color: var(--muted); font-weight: 700; }

.post-list { display: grid; gap: 14px; padding: 12px 0 8px; }
.post-card {
  display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; transition: border-color .12s ease, transform .12s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.post-card .emoji {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: var(--accent-soft); font-size: 26px; line-height: 1;
}
.post-card-body { display: grid; gap: 4px; min-width: 0; }
.post-card-meta { color: var(--muted); font-size: 13.5px; letter-spacing: .01em; }
.post-card strong { font-size: 20px; letter-spacing: -.015em; line-height: 1.25; }
.post-card-desc { color: var(--ink-soft); font-size: 15.5px; }

/* ---- Pager -------------------------------------------------------------- */

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 20px 0 8px; }
.pg-nums { display: flex; align-items: center; gap: 6px; }
.pg {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: 15px; font-weight: 700; text-decoration: none;
}
a.pg:hover { border-color: var(--accent); color: var(--accent-ink); }
.pg.on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* A dead end is shown, not hidden: the row keeps its shape on the last page. */
.pg.off { opacity: .4; }
.pg-gap { color: var(--muted); padding: 0 2px; }

@media (max-width: 620px) {
  /* Prev and next are the only ones a thumb wants; the numbers are for a
     crawler and a mouse, and they are still in the HTML for both. */
  .pg-nums { display: none; }
  .pager { justify-content: space-between; }
}

.related-h { font-size: 22px; letter-spacing: -.02em; margin: 34px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }

/* ---- A post ------------------------------------------------------------- */

.prose { max-width: 720px; padding-top: 22px; }
.crumbs { margin: 0 0 14px; font-size: 14px; font-weight: 700; }
.crumbs a { text-decoration: none; }
.crumbs a::before { content: "← "; }
.prose h1 { font-size: clamp(30px, 4.4vw, 42px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 14px; }
.prose .lede { font-size: 20px; line-height: 1.5; color: var(--ink-soft); margin: 0 0 16px; }
.byline { color: var(--muted); font-size: 14px; margin: 0 0 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.byline a { color: var(--muted); }

.prose h2 { font-size: clamp(23px, 3vw, 29px); letter-spacing: -.02em; line-height: 1.2; margin: 42px 0 12px; }
.prose h3 { font-size: 20px; letter-spacing: -.01em; margin: 30px 0 8px; }
.prose h4 { font-size: 17px; margin: 22px 0 6px; }
.prose p { margin: 0 0 18px; color: var(--ink-soft); }
.prose strong { color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 24px; color: var(--ink-soft); }
.prose li { margin: 0 0 8px; }
.prose li > strong:first-child { color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }
.prose code {
  background: var(--surface-2); border-radius: 5px; padding: 1px 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; color: var(--ink);
}
.prose pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote {
  margin: 0 0 20px; padding: 2px 0 2px 16px; border-left: 3px solid var(--accent);
  color: var(--ink-soft); font-size: 17px;
}

/* A heading's anchor: there for a reader who wants to link to one answer. */
.anchor { margin-left: 8px; color: var(--line-strong); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }

.toc {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 20px; margin: 0 0 30px;
}
.toc b { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 0 0 5px; font-size: 15.5px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ---- Tables ------------------------------------------------------------- */

.scroller { overflow-x: auto; margin: 0 0 22px; -webkit-overflow-scrolling: touch; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--ink); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; border-bottom-color: var(--line-strong); }
.prose td { color: var(--ink-soft); }
.prose tbody tr:last-child td { border-bottom: 0; }

/* A phone is narrower than four columns. Each cell becomes its own labelled
   row rather than a column squeezed to three characters. */
@media (max-width: 620px) {
  .scroller { overflow-x: visible; }
  .prose table, .prose tbody, .prose tr, .prose td { display: block; width: 100%; }
  .prose thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .prose tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .prose td { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .prose tr td:last-child { border-bottom: 0; }
  .prose td::before {
    content: attr(data-label); display: block; font-size: 11.5px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px;
  }
}

/* ---- A drawn lunchbox --------------------------------------------------- */

/* Days written back to back are one board: they wrap rather than stack. */
.lunchbox { margin: 0 0 24px; display: flex; flex-wrap: wrap; gap: 12px; }
.lunchbox .day {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 11px; flex: 0 1 196px; min-width: 0; box-shadow: var(--shadow);
}
.lunchbox h4 { margin: 0 0 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.lunchbox .slot { height: 6px; border-radius: 3px; margin: 8px 0 5px; opacity: .55; }
.lunchbox .card {
  display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); min-width: 0;
}
.lunchbox .card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lunchbox .card i { font-style: normal; font-size: 15px; flex: none; }
.lunchbox .main { background: var(--main); }
.lunchbox .fruit { background: var(--fruit); }
.lunchbox .veg { background: var(--veg); }
.lunchbox .side { background: var(--side); }
.lunchbox .snack { background: var(--snack); }

/* ---- FAQ, standing note, call to action --------------------------------- */

.faq { margin: 0 0 22px; }
.faq h3 { font-size: 18px; margin: 22px 0 6px; }
.faq h3:first-child { margin-top: 0; }
.faq p { margin: 0 0 14px; }

/* The answer, before the essay: a reader skimming and a machine extracting
   want the same thing in the same place. */
.answer {
  background: var(--accent-soft); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent);
  border-radius: 12px; padding: 16px 20px; margin: 0 0 28px; font-size: 17px; color: var(--ink);
}
.answer p { margin: 0; }
.answer b { font-weight: 800; }

.sources { margin: 34px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.sources h2 { font-size: 15px !important; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px !important; }
.sources ol { margin: 0; padding-left: 20px; font-size: 15px; color: var(--ink-soft); }
.sources li { margin: 0 0 6px; }

.standing {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 20px; margin: 34px 0 0; font-size: 15px; color: var(--ink-soft);
}
.standing p { margin: 0 0 10px; }
.standing p:last-child { margin: 0; }
.standing strong { color: var(--ink); }

.cta-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 30px; margin: 22px 0 0; box-shadow: var(--shadow);
}
.cta-box h2 { font-size: clamp(22px, 3vw, 28px); letter-spacing: -.02em; margin: 0 0 8px; }
.cta-box p { margin: 0 0 16px; color: var(--ink-soft); }
.cta-box p:last-child { margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 620px) {
  .post-card { padding: 16px; gap: 12px; }
  .post-card .emoji { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; }
  .post-card strong { font-size: 18px; }
  .cta-box { padding: 22px; }
  header nav { gap: 12px; }
  .lunchbox { gap: 10px; }
  .lunchbox .day { flex: 1 1 140px; }
}
