:root {
  --ink: #1c1917;
  --muted: #57534e;
  --faint: #78716c;
  --paper: #fafaf9;
  --panel: #ffffff;
  --accent: #1d4e4a;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --font-display: "Source Serif 4", "Iowan Old Style", Palatino, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Source Code Pro", monospace;
  --measure: 68ch;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 16.5px;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
}

.atmosphere { display: none; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  padding: 0.85rem 5vw;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(10px);
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
nav { display: flex; align-items: baseline; gap: 1.35rem; font-size: 0.92rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid transparent;
}
nav a:hover { color: var(--ink); }
nav a.is-active { color: var(--ink); border-bottom-color: var(--ink); }

main {
  padding: 2.75rem 5vw 5rem;
  max-width: 980px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.85rem, 3.4vw, 2.55rem);
  line-height: 1.18;
  margin: 0.35rem 0 0.85rem;
  letter-spacing: -0.025em;
  max-width: 22ch;
}
.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.lede {
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: var(--measure);
  color: var(--muted);
}
.meta { color: var(--faint); font-size: 0.88rem; }

h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
h2 { font-size: 1.45rem; margin: 2.4rem 0 0.6rem; }
h3 { font-size: 1.12rem; }

.status-grid, .highlights, .figure-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin: 1.25rem 0 0.5rem;
}
.status-grid article, .highlights article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.9rem 1rem 1rem;
}
.stat {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 0.15rem 0 0;
  font-variant-numeric: tabular-nums lining-nums;
}

.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--ink); }
.prose code, .code-meta code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: #f5f5f4;
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
}
.prose ol, .prose ul { padding-left: 1.2rem; }
.prose li { margin: 0.35rem 0; }
.prose table { margin: 1rem 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
}
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--faint);
  background: #fafaf9;
}
td { font-variant-numeric: tabular-nums lining-nums; }
tr:last-child td { border-bottom: 0; }

.figure-grid figure { margin: 0; }
.figure-grid img, .fig img {
  width: 100%;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: white;
  display: block;
}
figcaption { color: var(--muted); font-size: 0.88rem; line-height: 1.5; margin-top: 0.55rem; }
.empty {
  padding: 1.1rem 0;
  color: var(--faint);
}

.site-footer {
  padding: 1.25rem 5vw 2rem;
  color: var(--faint);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  max-width: none;
}
.site-footer p { max-width: 980px; margin: 0 auto; }
.site-footer code { font-family: var(--font-mono); font-size: 0.9em; }

@media (max-width: 760px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.55rem; }
  nav { flex-wrap: wrap; gap: 0.85rem 1.1rem; }
  .hero h1 { max-width: none; }
}

.nav-studies { position: relative; }
.nav-studies summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  list-style: none;
}
.nav-studies summary::-webkit-details-marker { display: none; }
.nav-studies[open] summary { color: var(--ink); }
.nav-studies .dropdown {
  position: absolute;
  right: 0;
  top: 1.6rem;
  z-index: 30;
  width: min(28rem, 80vw);
  max-height: 70vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0.35rem;
}
.nav-studies .dropdown a {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 2px;
  font-weight: 400;
  color: var(--ink);
  border-bottom: 0;
}
.nav-studies .dropdown a:hover { background: #f5f5f4; }
.num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-right: 0.45rem;
}

.highlights { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hl h4 { margin: 0.2rem 0 0; font-size: 0.98rem; font-weight: 600; }
.hl .stat { font-size: 1.2rem; }
.hl-kind {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.hl-detail { color: var(--muted); font-size: 0.86rem; margin: 0.45rem 0 0; }
.hl-link { font-size: 0.82rem; font-weight: 500; color: var(--accent); text-decoration: none; }
.hl-significant { box-shadow: inset 2px 0 0 var(--accent); }
.hl-trend { box-shadow: inset 2px 0 0 #a16207; }
.hl-null { box-shadow: inset 2px 0 0 #a8a29e; }
.hl-info { box-shadow: inset 2px 0 0 #57534e; }
.hl-caution { box-shadow: inset 2px 0 0 #9a3412; }

.study-list { display: grid; gap: 0; border-top: 1px solid var(--line); margin-top: 0.5rem; }
.study-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 1.15rem 0.15rem 1.2rem;
}
.study-card:hover h3 { color: var(--accent); }
.study-card h3 { margin: 0.25rem 0 0.3rem; font-size: 1.2rem; }
.study-card p { margin: 0.25rem 0; }
.question { color: var(--muted); font-size: 0.95rem; max-width: var(--measure); }
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; }
.pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.01em;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  background: #f5f5f4;
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill-significant { color: #1d4e4a; border-color: #c5d5d2; background: #f3f7f6; }
.pill-trend { color: #854d0e; border-color: #ead9b0; background: #fbf8f1; }
.pill-caution { color: #9a3412; border-color: #f0d2c6; background: #fdf6f3; }
.pill-info { color: var(--muted); }

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 1.5rem 0 0.25rem;
  font-size: 0.82rem;
  position: sticky;
  top: 3.15rem;
  background: rgba(250, 250, 249, 0.94);
  z-index: 5;
}
.toc a { color: var(--muted); text-decoration: none; font-weight: 500; }
.toc a:hover { color: var(--ink); }
.study section { margin: 2rem 0; scroll-margin-top: 6.5rem; }
.callout {
  background: transparent;
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 0;
  padding: 0.1rem 0 0.1rem 1rem;
  font-size: 1.05rem;
  max-width: var(--measure);
}
.callout h2 { font-size: 0.95rem; margin: 0 0 0.25rem; }
.callout p { margin: 0.2rem 0 0; }
.fig { margin: 0 0 2rem; background: transparent; border: 0; padding: 0; }
.tbl { margin-bottom: 1.8rem; }
.tbl h3 { margin-bottom: 0.25rem; font-size: 1.02rem; }
.refs { font-size: 0.9rem; color: var(--muted); padding-left: 1.2rem; }
.refs li { margin: 0.4rem 0; }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  font-weight: 500;
}
.pager a { color: var(--accent); text-decoration: none; }
a { color: var(--accent); }
a:hover { color: #163c39; }

.pipeline-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  position: sticky;
  top: 3.15rem;
  z-index: 4;
  padding: 0.65rem 0;
  background: rgba(250, 250, 249, 0.94);
}
.pipeline-jump a {
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.12rem 0.45rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
}
.pipeline-jump a:hover { border-color: var(--ink); color: var(--ink); }
.pipeline-group { margin: 2.75rem 0 0.2rem; }
.code-section { scroll-margin-top: 7rem; margin: 2.25rem 0 2.6rem; }
.code-head h2 { margin: 0.2rem 0 0.35rem; }
.code-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  color: var(--faint);
  font-size: 0.84rem;
  margin-top: 0.45rem;
}
.src-wrap {
  margin-top: 0.85rem;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #fbfbfa;
}
.src-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.7rem;
  background: #f5f5f4;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}
.src-bar span { margin-right: auto; }
.src-bar button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--ink);
  border-radius: 2px;
  padding: 0.12rem 0.5rem;
  font: inherit;
  cursor: pointer;
}
.src-bar button:hover { border-color: var(--ink); }
.src-scroll { max-height: 26rem; overflow: auto; }
.src-wrap.is-open .src-scroll { max-height: none; }
.src {
  margin: 0;
  padding: 0.85rem 0 1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  font-family: var(--font-mono);
}
.src .linenos {
  user-select: none;
  color: #a8a29e;
  padding: 0 0.85rem 0 0.7rem;
}
