:root {
  --page: #fbfaf6;
  --surface: #f2efe8;
  --text: #242321;
  --muted: #68645e;
  --rule: #d9d4ca;
  --accent: #8b1d35;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover,
a:focus-visible {
  text-decoration-thickness: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.45rem 0.7rem;
  background: var(--text);
  color: white;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.site-footer,
.blog-index,
.article-shell {
  width: min(calc(100% - 3rem), 780px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.6rem 0 1.1rem;
  border-bottom: 1px solid var(--text);
}

.site-name {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1.15rem;
  font-size: 0.82rem;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.site-header nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
}

.blog-index {
  padding: 5rem 0 4rem;
}

.index-intro {
  max-width: 710px;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.index-intro h1,
.article-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.index-intro h1 {
  font-size: clamp(2.25rem, 7vw, 3.5rem);
}

.index-intro > p:last-child {
  max-width: 670px;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.16rem;
}

.post-archive {
  margin-top: 4.5rem;
}

.post-archive > h2 {
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--text);
  font-family: var(--serif);
  font-size: 1.5rem;
}

.post-entry {
  padding: 1.6rem 0 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.post-entry time,
.article-meta,
.update-note,
.figure-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.post-entry h3 {
  margin: 0.35rem 0 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.28;
}

.post-entry p {
  max-width: 690px;
  margin: 0.65rem 0 0;
  color: var(--muted);
}

.post-entry .post-hook {
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.5;
}

.post-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  font-size: 0.83rem;
}

.post-links a {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2.75rem;
}

.link-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.entry-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.15rem 0 0;
  border-top: 1px solid var(--text);
  border-bottom: 1px solid var(--rule);
}

.entry-results > div {
  min-width: 0;
  padding: 0.75rem 0.8rem;
  border-left: 1px solid var(--rule);
}

.entry-results > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.entry-results dt {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entry-results dd {
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-size: 1.13rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.post-entry .entry-result-note {
  margin-top: 0.45rem;
  font-size: 0.72rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.8rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.76rem;
  list-style: none;
}

.tag-list li::before {
  content: "#";
  color: var(--accent);
}

.article-shell {
  padding: 4.25rem 0 4.5rem;
}

.article-header {
  padding-bottom: 2.25rem;
  border-bottom: 1px solid var(--text);
}

.article-header h1 {
  max-width: 760px;
  font-size: clamp(2.2rem, 6vw, 3.45rem);
}

.dek {
  max-width: 720px;
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.58;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.7rem;
  margin: 1.2rem 0 0;
}

.article-meta span + span::before {
  content: "·";
  margin-right: 0.7rem;
  color: var(--rule);
}

.update-note {
  margin: 1rem 0 0;
  padding-left: 0.8rem;
  border-left: 2px solid var(--accent);
}

.article-source {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.9rem;
  margin: 0.8rem 0 0;
  font-size: 0.83rem;
}

.article-source > span {
  color: var(--muted);
  font-size: 0.76rem;
}

.article-source a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
}

.article-body {
  padding-top: 2.4rem;
}

.article-body > p,
.article-body > ul,
.article-body > ol,
.article-body > blockquote {
  max-width: 720px;
}

.article-body p {
  margin: 1rem 0;
}

.essay-body .essay-opening {
  margin-top: 0;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.4;
}

.source-card {
  margin-top: 3rem;
  padding: 1.4rem 1.5rem;
  border-left: 2px solid var(--accent);
  background: var(--surface);
}

.article-body .source-card .eyebrow {
  margin: 0 0 0.5rem;
}

.article-body .source-card h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.4rem;
}

.source-card > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.88rem;
}

.source-card > a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.article-body .source-card .source-meta {
  margin: 0.35rem 0 0;
  font-size: 0.76rem;
}

.article-body .measurement-note {
  max-width: none;
  margin: 0 0 2rem;
  padding: 0.9rem 1rem;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
}

.measurement-note strong {
  color: var(--text);
}

.article-body h2,
.article-body h3 {
  scroll-margin-top: 1.5rem;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
}

.article-body h2 {
  margin: 3.5rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--text);
  font-size: 1.85rem;
  letter-spacing: -0.015em;
}

.article-body h3 {
  margin: 2.2rem 0 0.7rem;
  font-size: 1.3rem;
}

.article-body li + li {
  margin-top: 0.35rem;
}

.article-body code {
  font-family: var(--mono);
  font-size: 0.88em;
}

.article-body :not(pre) > code {
  padding: 0.08em 0.28em;
  background: var(--surface);
  overflow-wrap: anywhere;
}

pre {
  margin: 1.2rem 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
}

pre code {
  font-size: inherit;
}

pre.formula {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toc {
  margin: 0 0 2.4rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.toc summary {
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 600;
}

.toc ol {
  margin: 0.7rem 0 0;
  padding-left: 1.3rem;
  columns: 2;
  column-gap: 2rem;
  font-size: 0.86rem;
}

.toc li {
  break-inside: avoid;
  margin: 0.18rem 0;
}

.key-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.6rem 0;
  padding: 1.05rem 0;
  border-top: 1px solid var(--text);
  border-bottom: 1px solid var(--text);
}

.key-results > div {
  min-width: 0;
  padding: 0 1rem;
  border-left: 1px solid var(--rule);
}

.key-results > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.key-results dt {
  color: var(--muted);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.key-results dd {
  margin: 0.25rem 0 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.table-wrap {
  max-width: 100%;
  margin: 1.25rem 0;
  overflow-x: auto;
  border-top: 1px solid var(--text);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.82rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

table.story-table {
  min-width: 0;
  table-layout: fixed;
}

.story-table th:not(:first-child),
.story-table td:not(:first-child) {
  text-align: left;
  white-space: normal;
}

.story-table.numeric th:last-child,
.story-table.numeric td:last-child {
  text-align: right;
}

.story-table.numeric td:last-child {
  white-space: nowrap;
}

.story-table-copy th:first-child,
.story-table-copy td:first-child {
  width: 34%;
}

th,
td {
  padding: 0.62rem 0.55rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 650;
}

td:not(:first-child),
th:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.note {
  margin: 1.3rem 0;
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.note strong {
  font-family: var(--serif);
}

.architecture {
  margin: 1.4rem 0;
  padding: 1rem;
  border: 1px solid var(--rule);
  background: var(--surface);
}

.architecture > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}

.architecture span,
.architecture strong {
  padding: 0.55rem 0.4rem;
  border: 1px solid var(--rule);
  background: var(--page);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.architecture strong {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--rule));
  color: var(--accent);
}

.architecture p {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

caption {
  padding: 0.55rem 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.88rem;
  text-align: left;
}

tbody th[scope="row"] {
  width: 36%;
  font-weight: 600;
  text-align: left;
}

tbody th[scope="row"] + td {
  text-align: left;
  white-space: normal;
}

blockquote {
  margin: 1.3rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.06rem;
}

.references {
  padding-left: 1.35rem;
  font-size: 0.86rem;
}

.citation-box {
  margin-top: 1.25rem;
}

.article-end {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--text);
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
  border-top: 1px solid var(--text);
  color: var(--muted);
  font-size: 0.76rem;
}

@media (max-width: 620px) {
  .site-header,
  .site-footer,
  .blog-index,
  .article-shell {
    width: min(calc(100% - 2rem), 780px);
  }

  .site-header {
    align-items: flex-start;
  }

  .site-header nav a {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
  }

  .blog-index,
  .article-shell {
    padding-top: 2.8rem;
  }

  .toc ol {
    columns: 1;
  }

  .table-wrap caption {
    position: sticky;
    left: 0;
    width: calc(100vw - 3rem);
    max-width: calc(100vw - 3rem);
    white-space: normal;
  }

  .key-results {
    grid-template-columns: 1fr;
  }

  .entry-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry-results > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .entry-results > div:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }

  .key-results > div,
  .key-results > div:first-child {
    padding: 0.7rem 0;
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .key-results > div:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .article-meta {
    display: block;
  }

  .article-meta span {
    display: block;
  }

  .article-meta span + span::before {
    content: none;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media print {
  body {
    background: white;
  }

  .site-header nav,
  .toc,
  .site-footer {
    display: none;
  }
}
