:root {
  color-scheme: dark;
  --paper: #220f2a;
  --ink: #f2e7f1;
  --accent: #f19ec2;
  --muted: #c0a8c4;
  --band: #2d1c37;
  --rule: #4a2f55;
  --font-heading: Didot, Bodoni MT, Noto Serif Display, URW Palladio L, P052, Sylfaen, serif;
  --font-body: Iowan Old Style, Palatino Linotype, URW Palladio L, P052, serif;
  --font-meta: Hoefler Text, Baskerville, Baskerville Old Face, Garamond, Georgia, serif;
  --heading-weight: 400;
  --heading-tracking: 0em;
  --heading-style: normal;
  --text-small: 0.99rem;
  --text-base: 1.188rem;
  --text-lead: 1.425rem;
  --text-h3: 1.425rem;
  --text-h2: 1.71rem;
  --text-h1: 2.052rem;
  --text-display: 2.462rem;
  --text-hero: 2.955rem;
  --leading: 1.65;
  --measure: 33em;
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 1.75rem;
  --space-l: 3rem;
  --space-xl: 5.5rem;
  --radius: 4px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading);
  font-kerning: normal;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  font-style: var(--heading-style);
  letter-spacing: var(--heading-tracking);
  line-height: 1.15;
  text-wrap: balance;
}
p, ul, ol, dl, dd, figure { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--paper); }
time { font-variant-numeric: tabular-nums; }
.drawing { display: block; width: 100%; height: auto; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--accent);
}
.skip-link:focus { top: 1rem; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* A page's own header and its reading column. */
.article-head { margin-bottom: var(--space-m); }
.article-head h1 { font-size: clamp(var(--text-h2), 4.5vw, var(--text-h1)); line-height: 1.08; }
.lead { margin-top: var(--space-s); max-width: 34em; font-size: var(--text-lead); line-height: 1.45; }
.dateline, .filed-under {
  margin-bottom: var(--space-xs);
  font-family: var(--font-meta);
  font-size: var(--text-small);
  color: var(--muted);
}
.filed-under { margin: var(--space-s) 0 0; }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-s); }
.prose > h2 { margin-top: var(--space-l); font-size: var(--text-h2); }
.prose > h3 { margin-top: var(--space-m); font-size: var(--text-h3); }
.prose > h2 + *, .prose > h3 + * { margin-top: var(--space-xs); }
.prose p { text-wrap: pretty; hyphens: auto; }
.prose h2 a, .prose h3 a { color: inherit; }

/* Lists: bullets in the accent, steps numbered in rings, a checklist of empty boxes to tick on paper. */
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose ol.steps { list-style: none; padding-left: 0; counter-reset: step; }
ol.steps > li { position: relative; min-height: 1.9em; padding-left: 2.7em; counter-increment: step; }
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.85em;
  height: 1.85em;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-meta);
  font-size: 0.85em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.prose ul.checklist { list-style: none; padding-left: 0; }
ul.checklist > li { position: relative; padding-left: 1.9em; }
ul.checklist > li::before {
  content: "";
  position: absolute;
  left: 0.1em;
  top: 0.32em;
  width: 0.95em;
  height: 0.95em;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
}

/* Definitions: the term in the heading face, the definition hung from a rule. */
dl.definitions { display: grid; gap: var(--space-s); }
dl.definitions dt { font-family: var(--font-heading); font-weight: var(--heading-weight); font-style: var(--heading-style); }
dl.definitions dd { margin-top: 0.2em; padding-left: var(--space-s); border-left: 2px solid var(--rule); }

/* Tables scroll sideways inside their figure rather than squeeze. */
figure.table { overflow-x: auto; }
figure.table figcaption { margin-bottom: var(--space-xs); font-family: var(--font-meta); font-size: var(--text-small); color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 0.94em; line-height: 1.4; font-variant-numeric: tabular-nums; }
th, td { padding: 0.55em 1em 0.55em 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
thead th { font-family: var(--font-meta); font-weight: 600; border-bottom: 2px solid var(--ink); }
tbody th { font-weight: 600; }
th:last-child, td:last-child { padding-right: 0; }

/* An aside sits on the second surface, marked by an accent rule. */
aside.aside { padding: var(--space-s) var(--space-m); background: var(--band); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; }
.aside-label { margin-bottom: 0.25em; font-family: var(--font-heading); font-weight: var(--heading-weight); font-style: var(--heading-style); }

/* Questions open in place; the marker is a chevron drawn with borders that turns when open. */
.faq { border-bottom: 1px solid var(--rule); }
.faq details { border-top: 1px solid var(--rule); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-s);
  padding-block: var(--space-xs);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  font-style: var(--heading-style);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.2em;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-0.15em) rotate(45deg);
}
.faq details[open] summary::after { transform: translateY(0.15em) rotate(-135deg); }
.faq details > p { padding-bottom: var(--space-s); }

/* Months: the name in the margin, what happens beside it. */
dl.months { border-top: 1px solid var(--rule); }
dl.months > div { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: var(--space-s); padding-block: var(--space-xs); border-bottom: 1px solid var(--rule); }
dl.months dt { font-family: var(--font-meta); color: var(--accent); }
dl.months dd { margin: 0; }

/* Dated lists of notes. */
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list > li { padding-block: var(--space-s); border-top: 1px solid var(--rule); }
.note-list > li:last-child { border-bottom: 1px solid var(--rule); }
.note-list time { font-family: var(--font-meta); font-size: var(--text-small); color: var(--muted); }
.note-list h2, .note-list h3, .note-list h4 { margin-top: 0.15em; font-size: var(--text-h3); }
.note-list h2 a, .note-list h3 a, .note-list h4 a { color: var(--ink); text-decoration: none; }
.note-list h2 a:hover, .note-list h3 a:hover, .note-list h4 a:hover { color: var(--accent); text-decoration: underline; }
.note-list p { margin-top: 0.25em; max-width: 36em; color: var(--muted); }
.note-figure { max-width: 36rem; margin-bottom: var(--space-m); overflow: hidden; border-radius: var(--radius); background: var(--band); }

/* Previous and next. */
.pager { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--space-s); margin-top: var(--space-l); }
.pager-link { display: block; padding: var(--space-s) var(--space-m); color: var(--ink); text-decoration: none; border: 1px solid var(--rule); border-radius: var(--radius); }
.pager-link:hover { border-color: var(--accent); }
.pager-next { text-align: right; }
.pager-label { display: block; font-family: var(--font-meta); font-size: var(--text-small); color: var(--muted); }
.pager-title { display: block; color: var(--accent); font-family: var(--font-heading); font-weight: var(--heading-weight); font-style: var(--heading-style); }
.back { margin-top: var(--space-m); font-family: var(--font-meta); font-size: var(--text-small); }
.divider { display: flex; justify-content: center; margin-block: var(--space-l); }
.divider .drawing { width: 12rem; }
.page-list { display: grid; gap: 0.4em; padding-left: 1.25em; }
.page-list li::marker { color: var(--accent); }
.contact { font-style: italic; }

/* The footer every page carries. */
.site-footer { margin-top: var(--space-xl); border-top: 1px solid var(--rule); font-family: var(--font-meta); font-size: var(--text-small); }
.site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-s) var(--space-m); padding-block: var(--space-m) var(--space-l); }
.site-footer-name a { color: var(--ink); text-decoration: none; font-family: var(--font-heading); font-weight: var(--heading-weight); font-style: var(--heading-style); }
.site-footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-m); }
.site-footer-links a { color: var(--muted); }
.site-footer-links a[aria-current] { color: var(--ink); }
/* Handbook */
.handbook { --wrap: 64rem; counter-reset: upto; }
.handbook .bar-inner,
.handbook .page,
.handbook .book,
.handbook .site-footer-inner { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.handbook .bar { border-bottom: 3px solid var(--ink); }
.handbook .bar-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-xs) var(--space-m); padding-block: var(--space-s); }
.handbook .site-name { font-family: var(--font-heading); font-weight: var(--heading-weight); font-style: var(--heading-style); letter-spacing: var(--heading-tracking); font-size: var(--text-lead); }
.handbook .site-name a { color: var(--ink); text-decoration: none; }
.handbook .site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-m); font-family: var(--font-meta); font-size: var(--text-small); }
.handbook .site-nav a { color: var(--ink); }
.handbook .site-nav a[aria-current] { color: var(--accent); }

.handbook .chapters { list-style: none; margin: 0; padding: 0; counter-reset: chapter; }
.handbook .chapters > li { counter-increment: chapter upto; }
.handbook .chapters > li.is-current ~ li { counter-increment: chapter; }
.handbook .chapters > li::before { content: counter(chapter); font-variant-numeric: tabular-nums; }
.numerals-upper-roman .chapters > li::before { content: counter(chapter, upper-roman); }
.handbook .chapter-label::after { content: " " counter(upto); }
.numerals-upper-roman .chapter-label::after { content: " " counter(upto, upper-roman); }

.handbook .title-page { padding-block: var(--space-xl) var(--space-l); border-bottom: 1px solid var(--rule); }
.handbook .title-mark { display: block; width: 3.5rem; }
.handbook .title-page h1 { margin-top: var(--space-m); font-size: clamp(var(--text-h1), 10vw, calc(var(--text-hero) * 1.35)); line-height: 0.92; }
.handbook .title-tagline { max-width: 26em; margin-top: var(--space-s); font-size: var(--text-lead); color: var(--muted); }
.handbook .intro { margin-top: var(--space-l); }
.handbook .contents, .handbook .home-notes { max-width: 48rem; margin-top: var(--space-xl); }
.handbook .contents > h2, .handbook .home-notes > h2 { margin-bottom: var(--space-s); font-size: var(--text-h2); }
.handbook .contents .chapters > li { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); column-gap: var(--space-s); align-items: baseline; padding-block: var(--space-s); }
.handbook .contents .chapters > li::before { grid-row: span 2; font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: var(--text-display); line-height: 1; color: var(--accent); }
.handbook .contents .chapters a { font-family: var(--font-heading); font-weight: var(--heading-weight); font-style: var(--heading-style); font-size: var(--text-h3); color: var(--ink); text-decoration: none; }
.handbook .contents .chapters a:hover { color: var(--accent); text-decoration: underline; }
.handbook .contents .chapters p { grid-column: 2; margin-top: 0.2em; color: var(--muted); }
.contents-ruled .contents .chapters > li { border-top: 1px solid var(--rule); }
.contents-ruled .contents .chapters > li:last-child { border-bottom: 1px solid var(--rule); }
.contents-blocks .contents .chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: var(--space-s); }
.contents-blocks .contents .chapters > li { grid-template-columns: 2.6rem minmax(0, 1fr); padding: var(--space-s) var(--space-m); background: var(--band); border-radius: var(--radius); }
.handbook .appendix { list-style: none; margin: var(--space-s) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-m); font-family: var(--font-meta); }

.handbook .book { display: grid; gap: var(--space-l); padding-top: var(--space-l); }
.handbook .toc { font-size: var(--text-small); }
.handbook .toc-heading { margin-bottom: var(--space-xs); font-family: var(--font-meta); color: var(--muted); }
.handbook .toc .chapters { border-top: 1px solid var(--rule); }
.handbook .toc .chapters > li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); padding-block: 0.45em; border-bottom: 1px solid var(--rule); }
.handbook .toc .chapters > li::before { font-family: var(--font-meta); color: var(--muted); }
.handbook .toc a { color: var(--ink); text-decoration: none; }
.handbook .toc a:hover { text-decoration: underline; }
.handbook .toc li.is-current::before, .handbook .toc li.is-current a { color: var(--accent); }
.handbook .toc li.is-current a { font-weight: 600; }
.handbook .chapter-main { min-width: 0; }
.handbook .chapter-label { margin-bottom: var(--space-xs); font-family: var(--font-meta); color: var(--accent); }
.handbook .chapter h1 { font-size: clamp(var(--text-h2), 5vw, var(--text-display)); line-height: 1.02; }
.handbook .in-chapter { max-width: var(--measure); margin-bottom: var(--space-m); padding: var(--space-s) var(--space-m); background: var(--band); border-left: 3px solid var(--accent); }
.handbook .in-chapter-heading { font-family: var(--font-meta); font-size: var(--text-small); color: var(--muted); }
.handbook .in-chapter ul { list-style: none; margin: 0.3em 0 0; padding: 0; display: grid; gap: 0.25em; }
.handbook .page > .article { max-width: 46rem; padding-top: var(--space-l); }

@media (min-width: 58rem) {
  .handbook .book { grid-template-columns: 15rem minmax(0, 1fr); }
  .handbook .toc { position: sticky; top: var(--space-m); align-self: start; }
}
