/* Dense analytical prose. Everything here serves the measure and the type scale. */

:root {
  --ink: #16161a;
  --ink-dim: #5c5c66;
  --bg: #fbfaf7;
  --bg-soft: #f2f0ea;
  --rule: #dedbd2;
  --accent: #8c2f18;
  --measure: 38rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e6e1;
    --ink-dim: #9b978e;
    --bg: #14140f;
    --bg-soft: #1e1e18;
    --rule: #33332b;
    --accent: #e8875f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

main { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem 5rem; }
a { color: inherit; }

/* Masthead ---------------------------------------------------------------- */

.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-size: 1.25rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 600;
}
.masthead nav { display: flex; gap: 1.25rem; font-family: var(--sans); font-size: 0.82rem; }
.masthead nav a { color: var(--ink-dim); text-decoration: none; }
.masthead nav a:hover { color: var(--accent); }

/* Lede and featured ------------------------------------------------------- */

.lede { padding: 3rem 0 2rem; }
.lede h1 { font-size: clamp(1.85rem, 4.8vw, 2.45rem); line-height: 1.18; margin: 0 0 0.9rem; text-wrap: balance; }
.lede p { color: var(--ink-dim); margin: 0; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.featured {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.6rem;
  margin-bottom: 3rem;
}
.featured h2 { margin: 0 0 0.7rem; font-size: 1.5rem; line-height: 1.25; }
.featured h2 a { text-decoration: none; }
.featured h2 a:hover { color: var(--accent); }
.summary { color: var(--ink-dim); font-size: 0.92rem; margin: 0 0 0.6rem; }
.featured .meta { margin: 0 0 1rem; }
.more { font-family: var(--sans); font-size: 0.85rem; text-decoration: none; color: var(--accent); }
.more:hover { text-decoration: underline; }

.section-head {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin: 0 0 0.5rem;
}

/* Archive list ------------------------------------------------------------ */

.archive { list-style: none; margin: 0; padding: 0; }
.archive li { border-bottom: 1px solid var(--rule); }
.archive a {
  display: block;
  padding: 1.05rem 0;
  text-decoration: none;
}
.archive a:hover { color: var(--accent); }
.archive time {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.archive span { color: var(--ink-dim); font-size: 0.92rem; }

/* Brief body -------------------------------------------------------------- */

.brief header { padding: 2.75rem 0 1.25rem; margin-bottom: 1.75rem; }
.brief h1 { font-size: clamp(1.6rem, 4.2vw, 2.15rem); line-height: 1.2; margin: 0 0 0.6rem; text-wrap: balance; }
.meta {
  font-family: var(--sans);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  margin: 0;
}

/* The frontmatter summary runs ~340 words — it is written to be machine-
   scannable in the archive, not read first. Collapsed by default so the brief
   itself starts above the fold. */
.tldr {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg-soft);
  margin-bottom: 1.75rem;
}
.tldr summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tldr summary::-webkit-details-marker { display: none; }
.tldr summary::before {
  content: "+";
  font-size: 0.95rem;
  line-height: 1;
  color: var(--accent);
}
.tldr[open] summary::before { content: "\2212"; }
.tldr summary:hover { color: var(--accent); }
.tldr p {
  margin: 0;
  padding: 0 1rem 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.toc {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.1rem 0;
  margin-bottom: 2.5rem;
}
.toc-head {
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 0.6rem;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
.toc li { counter-increment: toc; margin-bottom: 0.3rem; }
.toc li::before {
  content: counter(toc);
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--accent);
  margin-right: 0.6rem;
}
.toc a {
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--ink);
  text-underline-offset: 2px;
}
.toc a:hover { color: var(--accent); text-decoration: underline; }

.prose > :first-child { margin-top: 0; }
.prose h2 {
  font-size: 1.3rem;
  line-height: 1.3;
  margin: 3rem 0 0.9rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1.5rem;
  text-wrap: balance;
}
.prose h3 { font-size: 1.1rem; margin: 2rem 0 0.6rem; }
.prose p { margin: 0 0 1.15rem; }
.prose ul, .prose ol { padding-left: 1.2rem; margin: 0 0 1.15rem; }
.prose li { margin-bottom: 0.6rem; }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose a { color: var(--accent); text-underline-offset: 2px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.prose blockquote {
  margin: 0 0 1.15rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-dim);
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}
.prose pre { background: var(--bg-soft); padding: 1rem; border-radius: 3px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
/* Wide content scrolls inside its own box; the page never scrolls sideways. */
.prose table { display: block; overflow-x: auto; border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 0.45rem 0.7rem; text-align: left; font-size: 0.9rem; }
.prose img { max-width: 100%; height: auto; }

/* Pager and footer -------------------------------------------------------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.82rem;
}
.pager a { color: var(--accent); text-decoration: none; display: flex; flex-direction: column; gap: 0.15rem; }
.pager .dim { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }
.pager a:hover { text-decoration: underline; }
.pager .next { text-align: right; margin-left: auto; }

footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-dim);
}
footer p { margin: 0 0 0.4rem; }
.dim { color: var(--ink-dim); }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .masthead { padding-top: 1.5rem; }
}
