:root {
  --ink: #111;
  --ink-soft: #555;
  --ink-faint: #6f6f6f;
  --rule: #e5e5e5;
  --surface: #f4f4f4;
  --paper: #fff;
  --accent: #002fa7;
  --accent-brand: #BEBEFA;
  --muted-blue: #5b7ba8;
  --muted-sage: #6d966a;
  --muted-sand: #a08a47;
  --muted-clay: #b5614e;
  --measure: 680px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, ui-serif, Cambria, "Times New Roman", serif;
}

* { box-sizing: border-box; }

::selection {
  background: var(--accent-brand);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11", "calt";
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

.wordmark,
.intro h1,
.post-title,
.post-dek,
.post h1,
.post-lede,
.post-body,
.footnotes {
  font-family: var(--serif);
  font-feature-settings: normal;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 28px 0;
  margin-bottom: 40px;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; flex-direction: column; gap: 4px; }

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-mark { height: 44px; width: auto; display: block; }

.wordmark {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}

.wordmark .dot { color: var(--ink-faint); font-weight: 500; }

.brand-wrapper:hover .wordmark { color: var(--accent-brand); }

.tagline {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  gap: 24px;
  font-size: 15px;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Homepage ---------- */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li { border-bottom: 1px solid var(--rule); }

.post-list a {
  display: block;
  padding: 32px 0;
  text-decoration: none;
  color: var(--ink);
}

.post-list a:hover .post-title {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.post-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.post-title {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}

.post-dek {
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}

/* ---------- Post page ---------- */

.post {
  padding-bottom: 120px;
}

.post-header {
  margin-bottom: 48px;
}

.post-header .post-meta {
  margin-bottom: 16px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
}

.post h1 {
  font-size: 40px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
}

.post-lede {
  font-size: 20px;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

.post-body {
  font-size: 18px;
  line-height: 1.7;
}

.post-body > * { margin: 0 0 1.2em 0; }
.post-body > *:last-child { margin-bottom: 0; }

.post-body h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 2.4em 0 0.6em;
}

.post-body h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 2em 0 0.4em;
}

.post-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-body a:hover { color: var(--accent); }
.post-body a.wordmark-ref:hover { color: var(--accent-brand); }

.post-body blockquote {
  margin: 1.6em 0;
  padding-left: 20px;
  border-left: 2px solid var(--ink-soft);
  color: var(--ink-soft);
  font-style: italic;
}

.post-body ul, .post-body ol {
  padding-left: 24px;
}

.post-body li + li { margin-top: 0.4em; }

.post-body code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 3px;
}

.post-body pre {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.55;
  background: var(--surface);
  padding: 16px 20px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.6em 0;
}

.post-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.post-body figure {
  margin: 2.4em 0;
}

.post-body figure img {
  max-width: 100%;
  display: block;
}

.post-body figure.figure-small {
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.post > figure.figure-small {
  max-width: 280px;
  margin: 2.4em auto;
}

.post > figure.figure-small img {
  max-width: 100%;
  display: block;
}

.post-body figcaption {
  font-size: 14px;
  color: var(--ink-faint);
  margin-top: 10px;
  line-height: 1.5;
}

/* Charts */

.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart text { font-family: var(--sans); }

.chart-label {
  font-size: 12px;
  font-weight: 500;
  fill: var(--ink-faint);
  letter-spacing: 0.08em;
}

.chart-value {
  font-size: 14px;
  font-weight: 500;
  fill: var(--ink);
  font-variant-numeric: tabular-nums;
}

.chart-bar { fill: var(--ink-soft); }
.chart-bar-bg { fill: var(--rule); }

.chart-bar-blue { fill: var(--muted-blue); }
.chart-bar-sand { fill: var(--muted-sand); }
.chart-bar-sage { fill: var(--muted-sage); }
.chart-bar-clay { fill: var(--muted-clay); }

/* Tables */

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 16px;
}

.post-body thead th {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--ink-soft);
  vertical-align: bottom;
}

.post-body tbody td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.post-body tbody tr:last-child td { border-bottom: none; }

.post-body td.num, .post-body th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 16px;
  padding-right: 0;
}

/* Definition lists */

.post-body dl { margin: 1.6em 0; }
.post-body dt { font-weight: 600; }
.post-body dt + dd { margin-top: 0.2em; }
.post-body dd + dt { margin-top: 1.2em; }
.post-body dd { margin: 0; color: var(--ink-soft); }

/* Section breaks */

.post-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  width: 80px;
  margin: 3em auto;
}

.post-body .dinkus {
  text-align: center;
  margin: 3em 0;
  color: var(--ink-soft);
  letter-spacing: 0.6em;
}

/* Footnotes */

.fn-ref {
  font-size: 0.75em;
  vertical-align: super;
  text-decoration: none;
  line-height: 0;
  padding: 0 2px;
  font-weight: 600;
}

.footnotes {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.footnotes ol {
  padding-left: 20px;
  margin: 0;
}

.footnotes li + li { margin-top: 0.6em; }

.footnotes a { color: var(--ink); }

/* ---------- Post footer nav ---------- */

.post-nav {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 15px;
}

.post-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.post-nav a:hover { color: var(--accent); }

.post-nav .label {
  display: block;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ---------- Site footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0 48px;
  font-size: 14px;
  color: var(--ink-faint);
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 24px;
}

.site-footer .wrap > :nth-child(2) { justify-self: center; }
.site-footer .wrap > :nth-child(3) { justify-self: end; }

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  body { font-size: 17px; }
  .site-header { margin-bottom: 48px; padding: 20px 0; }
  .post h1 { font-size: 30px; }
  .post-lede { font-size: 18px; }
  .post-title { font-size: 22px; }
  .post-list a { padding: 24px 0; }
}
