:root {
  --bg: #f3efe6;
  --bg-raised: #fbf8f1;
  --ink: #1b1914;
  --muted: #5c564b;
  --line: #d8d0c0;
  --accent: #8a3b12;
  --accent-ink: #6e2d0c;
  --forest: #1f3f32;
  --forest-soft: #e4eee8;
  --warn-bg: #f4e6d2;
  --warn-ink: #3d2a12;
  --shadow: 0 1px 0 rgba(27, 25, 20, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", Times, serif;
  --sans: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --measure: 42rem;
  --wide: 58rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161411;
    --bg-raised: #1e1b17;
    --ink: #f3efe6;
    --muted: #b7b09f;
    --line: #3a342c;
    --accent: #e08a57;
    --accent-ink: #f0c2a3;
    --forest: #9ec9b0;
    --forest-soft: #24332c;
    --warn-bg: #322616;
    --warn-ink: #f3e1c4;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 0.12em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 1rem;
}
.skip:focus { left: 0.75rem; top: 0.75rem; z-index: 20; }

.wrap {
  width: min(var(--wide), calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1rem 0 0.95rem;
}
.wordmark { text-decoration: none; color: inherit; }
.wordmark-name {
  display: block;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.wordmark-tag {
  display: block;
  margin-top: 0.28rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.15rem; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

.hero { padding: 3rem 0 1.25rem; }
.hero h1, .article-header h1 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0.35rem 0 1rem;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.15rem); max-width: 20ch; }
.article-header h1 { font-size: clamp(1.85rem, 3.8vw, 2.55rem); }
.lede, .article-header .lede {
  max-width: 42rem;
  font-size: 1.15rem;
  color: var(--ink);
}
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.hero-cta { margin: 1.5rem 0 0; }
.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  padding: 0.7rem 1.05rem;
  border-radius: 2px;
  font-weight: 600;
}
.btn:hover { background: var(--accent); color: #fff; }

.home-grid { padding-bottom: 3.5rem; }
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2.5rem;
}
.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: var(--shadow);
}
.card h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 0.4rem; }
.card p { margin: 0 0 0.8rem; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }

.article { padding: 2.4rem 0 4rem; }
.article-header { margin-bottom: 1.75rem; max-width: var(--measure); }
.article-meta {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.prose { max-width: var(--measure); }
.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 2.1rem 0 0.7rem;
}
.prose h2 { font-size: 1.55rem; }
.prose h3 { font-size: 1.22rem; }
.prose p, .prose li { max-width: 42rem; }
.prose p { margin: 0.85rem 0; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li + li { margin-top: 0.35rem; }
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.25rem 0;
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-left: 3px solid var(--accent);
}
.prose blockquote p { margin: 0.4rem 0; max-width: none; }
.prose blockquote p:first-child { margin-top: 0; }
.prose blockquote p:last-child { margin-bottom: 0; }

.table-wrap {
  width: calc(100vw - 2rem);
  max-width: var(--wide);
  margin: 1.2rem 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  -webkit-overflow-scrolling: touch;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.4;
}
.prose th, .prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  min-width: 8.5rem;
}
.prose th:first-child, .prose td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-raised);
  font-weight: 600;
  min-width: 9.5rem;
}
.prose thead th {
  background: var(--forest-soft);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.prose thead th:first-child { background: var(--forest-soft); }
.prose tbody tr:last-child th, .prose tbody tr:last-child td { border-bottom: 0; }

.sources a { word-break: break-word; }
code, .aff-token {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--forest-soft);
  padding: 0.05em 0.3em;
}
a.aff {
  text-decoration-style: dashed;
}
.placeholder-note {
  background: var(--bg-raised);
  border: 1px dashed var(--line);
  padding: 1.1rem 1.2rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-disclosure { max-width: 48rem; margin: 0 0 0.8rem; }
.footer-meta { max-width: 48rem; margin: 0; }

.list-plain { list-style: none; padding: 0; }
.list-plain li {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
}
.list-plain li:last-child { border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .hero { padding-top: 2rem; }
  .table-wrap { width: calc(100vw - 2rem); }
}
