:root {
  --bg: #f5efeb;
  --ink: #232846;
  --muted: #5e6180;
  --accent-text: #8a4a6e;
  --violet: #9b7fb0;
  --measure: 40rem;
  --wide: 60rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ink);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-text);
}

a:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 28px 24px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 26px;
  line-height: 1;
  text-decoration: none;
}

.top-links {
  display: flex;
  gap: 20px;
  font-size: 15px;
}

.article {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 72px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 112px;
}

.intro,
.step,
.honest,
.toc {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.intro > :not(.hero),
.step > :not(.wide):not(.pair):not(.table-wrap),
.honest > *,
.toc > * {
  max-width: var(--measure);
}

.kicker,
.label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(48px, 7vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead {
  font-size: 22px;
  line-height: 1.45;
}

h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(34px, 4.4vw, 48px);
  line-height: 1.05;
  text-wrap: balance;
}

h3 {
  margin-top: 24px;
  font-size: 18px;
  font-weight: 600;
}

.num {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 22px;
  line-height: 1;
  color: var(--accent-text);
}

.byline {
  font-size: 15px;
  color: var(--muted);
}

.hero {
  margin-top: 24px;
}

figure {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

figcaption {
  max-width: var(--measure);
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.pair figure {
  margin: 16px 0;
}

.aside {
  font-size: 16px;
  color: var(--muted);
}

.aside strong {
  color: var(--ink);
}

ul,
ol {
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toc ol {
  font-size: 17px;
  gap: 6px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

caption {
  margin-bottom: 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

th,
td {
  padding: 8px 16px 8px 0;
  text-align: left;
  vertical-align: baseline;
}

thead th {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.n {
  text-align: right;
  white-space: nowrap;
}

.downloads {
  list-style: none;
  padding: 0;
  gap: 28px;
}

.downloads li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 14px;
  row-gap: 4px;
}

.downloads a {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 28px;
  line-height: 1.1;
}

.downloads p {
  flex-basis: 100%;
  font-size: 16px;
  color: var(--muted);
}

.dl-meta {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

code {
  font-size: 0.9em;
}

.refs {
  list-style: none;
  padding: 0;
  font-size: 15px;
  color: var(--muted);
}

.refs a {
  color: var(--muted);
}

.foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 24px 56px;
  font-size: 15px;
  color: var(--muted);
}

@media (max-width: 700px) {
  body {
    font-size: 17px;
  }

  .article {
    padding-top: 48px;
    gap: 80px;
  }

  .lead {
    font-size: 20px;
  }

  .pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .top-links {
    gap: 14px;
    font-size: 14px;
  }

  th,
  td {
    padding-right: 10px;
    font-size: 15px;
  }

  caption {
    position: sticky;
    left: 0;
    max-width: calc(100vw - 48px);
  }

  .brand {
    font-size: 21px;
  }

  .brand img {
    width: 26px;
    height: auto;
  }
}

@media print {
  @page {
    size: A4;
    margin: 18mm 18mm 20mm;
  }

  :root {
    --bg: #ffffff;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.5;
  }

  .top-links,
  .toc,
  .foot,
  #downloads {
    display: none;
  }

  .top {
    padding: 0;
  }

  .article {
    padding: 12mm 0 0;
    gap: 10mm;
  }

  h1 {
    font-size: 40pt;
  }

  h2 {
    font-size: 22pt;
    break-after: avoid;
  }

  h3 {
    break-after: avoid;
  }

  .lead {
    font-size: 13pt;
  }

  .step {
    break-before: page;
  }

  figure,
  table {
    break-inside: avoid;
  }

  figcaption {
    font-size: 9pt;
  }

  a {
    text-decoration: none;
  }

  .refs a::after,
  .step p a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8.5pt;
    color: var(--muted);
  }
}
