/* moonfont — the type case.
   Colour, type and space are declared once here. No component invents a value. */

:root {
  color-scheme: light dark;

  /* One ramp for the whole publication: warm paper by day, warm graphite by
     night. The specimen page declares the same ground and the same single
     red; a reader moving between the cover and these pages should not feel
     the temperature change underfoot. */
  --stock:        light-dark(#f4f1ea, #121110);
  --stock-deep:   light-dark(#eae6dc, #0b0a0a);
  --sheet:        light-dark(#fbf9f4, #1a1917);
  --solid:        light-dark(#1c1a17, #070707);
  --on-solid:     light-dark(#f6f2e9, #ece8df);
  --ink:          light-dark(#191715, #ecebe5);
  --ink-soft:     light-dark(#4a4642, #bab5ab);
  --ink-faint:    light-dark(#6d6862, #908a80);
  --rule:         light-dark(#c9c2b4, #0a0908);
  --rule-lip:     light-dark(transparent, #38352f);
  --rule-soft:    light-dark(#ded8cb, #242220);
  --mark:         light-dark(#a83418, #ff6f4c);
  --mark-strong:  light-dark(#7d2410, #ffab90);
  --mark-on-solid:light-dark(#ffb49b, #ffb49b);
  --on-mark:      light-dark(#fdf9f2, #1a0c08);
  --code:         light-dark(#efeadf, #181613);
  --code-ink:     light-dark(#1e1b17, #e8e4db);
  --code-dim:     light-dark(#5f584e, #a09a8f);
  --code-rule:    light-dark(#d8d1c3, #2c2925);
  --focus:        light-dark(#7d2410, #ffab90);
  --focus-halo:   light-dark(#f4f1ea, #121110);
  --impression:   light-dark(rgb(28 22 16 / 10%), rgb(0 0 0 / 55%));
  --edge:         light-dark(transparent, rgb(236 232 223 / 10%));

  --info:         light-dark(#2f5d70, #a3c3d2);
  --warning:      light-dark(#7a4e0f, #e3b46c);
  --danger:       light-dark(#8c2233, #f097a8);
  --success:      light-dark(#2e624f, #98cbb0);
  --info-wash:    light-dark(rgb(47 93 112 / 10%),   rgb(163 195 210 / 12%));
  --warning-wash: light-dark(rgb(122 78 15 / 10%),   rgb(227 180 108 / 12%));
  --danger-wash:  light-dark(rgb(140 34 51 / 10%),   rgb(240 151 168 / 12%));
  --success-wash: light-dark(rgb(46 98 79 / 10%),    rgb(152 203 176 / 12%));

  /* One face for the whole site, the same one the specimen page sets its own
     chrome in: a reader who types Chinese into a specimen sees the page's face
     rather than whatever their system happens to carry. */
  --font-display: "HarmonyOS Sans SC", "Helvetica Neue", "Arial Nova", Arial,
                  "Liberation Sans", "Nimbus Sans", "Segoe UI", system-ui, sans-serif;
  --font-body:    "HarmonyOS Sans SC", "Charter", "Bitstream Charter",
                  "Iowan Old Style", Georgia, "Liberation Serif", serif;
  --font-mono:    "JetBrains Mono", "Cascadia Mono", "SF Mono", Menlo, Consolas,
                  "Liberation Mono", "DejaVu Sans Mono", monospace;

  --t-caption: 12px;
  --t-label:   15px;
  --t-body:    18px;
  --t-lede:    24px;
  --t-h3:      32px;
  --t-h2:      48px;
  --t-display: 72px;
  --t-specimen:96px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;
  --s-12: 48px;
  --s-18: 72px;
  --s-24: 96px;
  --s-32: 128px;
  --s-44: 176px;

  --r-0: 0;
  --r-1: 3px;
  --r-2: 8px;

  --rail: 1120px;

  --z-base: 0;
  --z-rule: 1;
  --z-rail: 10;
  --z-top: 20;
  --z-popover: 30;
  --z-modal: 40;
  --z-skip: 50;

  --motion-press: 100ms ease-out;
  --motion-state: 150ms ease-out;
  --motion-swap:  200ms ease-out;

  --display-weight: 500;
  --pad: var(--s-12);
  --section: var(--s-32);
  --bar-h: var(--s-18);
}

/* Decisions that are not colours live here, and nowhere else. */
:root[data-theme="light"] {
  color-scheme: only light;
  --display-weight: 500;
  --impression: rgb(28 22 16 / 10%);
  --edge: transparent;
  --rule-lip: transparent;
}

:root[data-theme="dark"] {
  color-scheme: only dark;
  --display-weight: 600;
  --impression: rgb(0 0 0 / 55%);
  --edge: rgb(236 232 223 / 10%);
  --rule-lip: #38352f;
}

/* A browser without light-dark() still gets both designs, not a blank sheet. */
@supports not (color: light-dark(white, black)) {
  :root[data-theme="light"] {
    --stock: #f4f1ea;
    --stock-deep: #eae6dc;
    --sheet: #fbf9f4;
    --solid: #1c1a17;
    --on-solid: #f6f2e9;
    --ink: #191715;
    --ink-soft: #4a4642;
    --ink-faint: #6d6862;
    --rule: #c9c2b4;
    --rule-soft: #ded8cb;
    --mark: #a83418;
    --mark-strong: #7d2410;
    --mark-on-solid: #ffb49b;
    --on-mark: #fdf9f2;
    --code: #efeadf;
    --code-ink: #1e1b17;
    --code-dim: #5f584e;
    --code-rule: #d8d1c3;
    --focus: #7d2410;
    --focus-halo: #f4f1ea;
  }
  :root[data-theme="dark"] {
    --stock: #121110;
    --stock-deep: #0b0a0a;
    --sheet: #1a1917;
    --solid: #070707;
    --on-solid: #ece8df;
    --ink: #ecebe5;
    --ink-soft: #bab5ab;
    --ink-faint: #908a80;
    --rule: #0a0908;
    --rule-soft: #242220;
    --mark: #ff6f4c;
    --mark-strong: #ffab90;
    --mark-on-solid: #ffb49b;
    --on-mark: #1a0c08;
    --code: #181613;
    --code-ink: #e8e4db;
    --code-dim: #a09a8f;
    --code-rule: #2c2925;
    --focus: #ffab90;
    --focus-halo: #121110;
  }
}

/* --------------------------------------------------------------------------
   Ground, reading surface and browser furniture
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  background: var(--stock);
}

body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

::selection {
  background: color-mix(in srgb, var(--mark) 26%, transparent);
  color: var(--ink);
}

::placeholder { color: var(--ink-faint); opacity: 1; }

:where(input, textarea, [contenteditable]) { caret-color: var(--mark); }

/* The scrollbar is drawn, not inherited. The two standard properties live
   only in the branch that has no ::-webkit-scrollbar, because setting either of
   them makes Chrome drop the pseudo-element rules above. The track keeps its
   width at the top of the page and only the thumb fades, so the layout does not
   jump when it appears. */
@supports selector(::-webkit-scrollbar) {
  html::-webkit-scrollbar { width: 10px; height: 10px; }
  html::-webkit-scrollbar-track { background: transparent; }
  html::-webkit-scrollbar-thumb {
    border-radius: 99px;
    border: 3px solid transparent;
    background-clip: content-box;
    background-color: color-mix(in srgb, var(--ink) 24%, transparent);
  }
  html.at-top::-webkit-scrollbar-thumb { background-color: transparent; }
  pre::-webkit-scrollbar, .table-wrap::-webkit-scrollbar,
  .case-index::-webkit-scrollbar { width: 8px; height: 8px; }
  pre::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track,
  .case-index::-webkit-scrollbar-track { background: transparent; }
  pre::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb,
  .case-index::-webkit-scrollbar-thumb {
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: content-box;
    background-color: color-mix(in srgb, var(--ink) 14%, transparent);
  }
  pre:hover::-webkit-scrollbar-thumb, .table-wrap:hover::-webkit-scrollbar-thumb,
  .case-index:hover::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--ink) 32%, transparent);
  }
}
@supports not selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink) 26%, transparent) transparent;
  }
  html.at-top { scrollbar-color: transparent transparent; }
}

/* Code keeps the characters the reader has to type: no ligatures that turn
   `>=` into a single glyph. Form controls do not inherit, so they are named. */
html, button, input, textarea, select { font-variant-ligatures: no-contextual; }

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-halo);
}

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

a:hover { color: var(--mark-strong); }

a, button {
  transition:
    color var(--motion-state),
    background-color var(--motion-state),
    border-color var(--motion-state),
    transform var(--motion-press);
}

code, .sig, .case-index-count, .field-name, .field-type, .tok-num {
  font-variant-numeric: tabular-nums;
}

.wrap {
  max-width: var(--rail);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.skip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-skip);
  transform: translateY(-120%);
  padding: var(--s-3) var(--s-4);
  background: var(--solid);
  color: var(--on-solid);
  font-family: var(--font-display);
  font-size: var(--t-label);
  text-decoration: none;
}

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

/* --------------------------------------------------------------------------
   The label strip on the case. It is the same strip the specimen page wears:
   the ground seen through a sheet of glass, a hairline that fades in only once
   the page has moved, and the wordmark with the one red dot in front of it.
   -------------------------------------------------------------------------- */
.top {
  position: sticky;
  top: 0;
  z-index: var(--z-top);
  background: color-mix(in srgb, var(--stock) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.08) blur(14px);
  backdrop-filter: saturate(1.08) blur(14px);
}

.top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    color-mix(in srgb, var(--ink) 15%, transparent) 16%,
    color-mix(in srgb, var(--ink) 15%, transparent) 84%,
    transparent
  );
  opacity: 0;
  transition: opacity var(--motion-state);
}

html:not(.at-top) .top::after { opacity: 1; }

.top nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
  max-width: var(--rail);
  min-height: var(--bar-h);
  margin-inline: auto;
  /* The strip is exactly --bar-h tall, so a band or a heading that follows it
     starts where the cover's hero starts, and so every scroll-margin computed
     from that number is true. */
  padding: 0 var(--pad);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin-right: auto;
  font-family: var(--font-display);
  font-size: var(--t-lede);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

/* The mark exactly as the cover draws it: one filled circle of the red, then
   the name in spaced capitals. */
.brand::before {
  content: "";
  align-self: center;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mark);
  transform: translateY(-1px);
}

.brand b {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.brand span {
  font-family: var(--font-body);
  font-size: var(--t-caption);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-faint);
}

/* The current section is marked the way the cover marks it: two pixels of the
   one red, hung the same distance under the word. */
.link {
  position: relative;
  padding-block: var(--s-1);
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-faint);
  text-decoration: none;
}

.link:hover { color: var(--ink); }
.link[aria-current="page"] { color: var(--ink); }
.link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--mark);
}

.github,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}
.github { text-decoration: none; }
.github:hover,
.theme-toggle:hover { color: var(--ink); background: var(--stock-deep); }
.github:active,
.theme-toggle:active { transform: translateY(1px); }
.github svg { width: 19px; height: 19px; pointer-events: none; }

.theme-toggle svg { width: 19px; height: 19px; pointer-events: none; }
.theme-toggle .face, .theme-toggle .foot { transition: opacity var(--motion-state); }
:root[data-theme="light"] .theme-toggle .foot { opacity: 0; }
:root[data-theme="dark"] .theme-toggle .face { opacity: 0; }

/* Copy is copy; chrome is not. Selecting across the masthead, a drawer label or
   a table of contents leaves a highlight that means nothing, and an I-beam over
   a label says the label is text. Prose, code, tables and signatures keep their
   selection; the furniture does not. */
header,
nav,
footer,
button,
label,
canvas,
img,
svg,
.top,
.brand,
.link,
.github,
.theme-toggle,
.skip,
.case-index,
.case-index-item,
.stick,
.pick,
.pick__button,
.pick__option,
.field-label,
.pkg-kind,
.mark,
.rule-figure {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.case-index,
.stick,
.pick,
.field-label,
label,
.rule-figure {
  cursor: default;
}

/* The drawing is furniture; its caption is prose, and a reader may want it. */
.rule-figure figcaption {
  user-select: text;
  -webkit-user-select: text;
  cursor: auto;
}

/* --------------------------------------------------------------------------
   The case: drawer labels on the left, compartments on the right
   -------------------------------------------------------------------------- */

main {
  --main-pad: var(--s-18);
  padding-block: var(--main-pad) var(--s-32);
}

/* A band that opens a page is the page's cover: it meets the strip above it
   the way the specimen page's hero does, rather than floating on a shelf of
   paper. */
main > .band:first-child { margin-top: calc(-1 * var(--main-pad)); }

.case {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--s-8);
  align-items: start;
}

.case-index {
  position: sticky;
  top: calc(var(--bar-h) + var(--s-4));
  z-index: var(--z-rail);
  align-self: start;
}

.case-index-list { list-style: none; margin: 0; padding: 0; }
.case-index-item { margin: 0; border-bottom: 1px solid var(--rule-soft); }

.case-index-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  padding-block: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  line-height: 1.5;
  color: var(--ink-soft);
  text-decoration: none;
}

.case-index-link:hover { color: var(--mark-strong); }
.case-index-name { overflow-wrap: anywhere; }
.case-index-count { flex: none; color: var(--ink-faint); }

.case-body { min-width: 0; }

.case-title {
  margin: 0 0 var(--s-8);
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: var(--display-weight);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.case-intro {
  max-width: 65ch;
  margin: 0 0 var(--s-12);
  font-size: var(--t-lede);
  line-height: 1.55;
  color: var(--ink-soft);
}

.api-note {
  max-width: 65ch;
  margin: var(--s-12) 0 0;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------------------
   One drawer
   -------------------------------------------------------------------------- */

.pkg {
  margin-bottom: var(--s-18);
  scroll-margin-top: calc(var(--bar-h) + var(--s-4));
}

.pkg:last-of-type { margin-bottom: 0; }

.pkg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule);
}

.pkg-name {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-h3);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.pkg-kind {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
}

.pkg-doc { max-width: 65ch; margin-top: var(--s-4); color: var(--ink-soft); }
.pkg-doc p { margin: 0 0 var(--s-4); }
.pkg-doc p:last-child { margin-bottom: 0; }
.pkg-list { margin-top: var(--s-8); }

/* --------------------------------------------------------------------------
   One compartment
   -------------------------------------------------------------------------- */

.entry {
  position: relative;
  padding-block: var(--s-6);
  border-bottom: 1px solid var(--rule-soft);
  scroll-margin-top: calc(var(--bar-h) + var(--s-4));
}

.entry::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--rule-lip);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-4);
}

.entry-kind {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.entry-name {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-lede);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.sig {
  display: block;
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--code-rule);
  border-radius: var(--r-2);
  background: var(--code);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

.tok-kw { color: var(--code-ink); font-weight: 600; }
.tok-ty, .tok-fn, .tok-num, .tok-str { color: var(--code-ink); }
.tok-com, .tok-op { color: var(--code-dim); }

.entry-fields { list-style: none; margin: var(--s-4) 0 0; padding: 0; }

.entry-field {
  display: grid;
  grid-template-columns: minmax(0, 16ch) minmax(0, 1fr);
  gap: var(--s-2) var(--s-4);
  margin: 0;
  padding-block: var(--s-2);
  border-bottom: 1px solid var(--rule-soft);
}

.entry-field:last-child { border-bottom: 0; }

.field-name {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.field-type {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  color: var(--code-dim);
  overflow-wrap: anywhere;
}

.field-doc {
  grid-column: 2;
  font-family: var(--font-body);
  font-size: var(--t-label);
  color: var(--ink-soft);
}

.entry-doc { max-width: 65ch; margin-top: var(--s-4); color: var(--ink-soft); }
.entry-doc p { margin: 0 0 var(--s-4); }
.entry-doc p:last-child { margin-bottom: 0; }

.entry-doc code, .pkg-doc code, .field-doc code {
  padding: 0 var(--s-1);
  border-radius: var(--r-1);
  background: var(--code);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: var(--t-label);
}

.xref, .xref-pkg { color: var(--mark); }
.xref:hover, .xref-pkg:hover { color: var(--mark-strong); }

.empty {
  margin: 0;
  padding: var(--s-4);
  border: 1px solid var(--rule-soft);
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Colophon
   -------------------------------------------------------------------------- */

footer {
  margin-top: var(--section);
  padding-block: var(--s-8);
  border-top: 1px solid var(--rule);
}

footer .row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-4);
}

footer a, footer span {
  font-family: var(--font-body);
  font-size: var(--t-caption);
  color: var(--ink-faint);
}

footer .mark {
  margin-right: auto;
  font-family: var(--font-display);
  font-size: var(--t-label);
  font-weight: 600;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   The other four pages: the same tokens, the layout families from section 5
   -------------------------------------------------------------------------- */

h1, h2, h3 {
  margin: 0 0 var(--s-8);
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--t-h2); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); }

p { margin: 0 0 var(--s-4); }

ul { padding-left: var(--s-6); }
li { margin-bottom: var(--s-2); }

code {
  padding: 0 var(--s-1);
  border-radius: var(--r-1);
  background: var(--code);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: var(--t-label);
}

small { font-size: var(--t-caption); }

svg { max-width: 100%; height: auto; }
pre { overflow-x: auto; }

/* Full-bleed ink pull: one per page, reversed type, inner .wrap at --rail. */
.band {
  margin-bottom: var(--section);
  padding-block: var(--s-18);
  background: var(--solid);
  color: var(--on-solid);
}

.band h1 { max-width: 24ch; }
.band p { max-width: 65ch; color: var(--on-solid); }
.band a { color: var(--mark-on-solid); }
.band svg { display: block; width: 100%; margin-block: var(--s-8); }
/* The band is an inverted surface in either theme, so a code chip inside it
   cannot take the page's paper chip: it would be a pale box with pale letters.
   A little of the band's own text colour, laid over the band, keeps it legible
   in both impressions. */
.band code {
  background: color-mix(in srgb, var(--on-solid) 14%, transparent);
  color: var(--on-solid);
}

/* Two-column measure. */
.measure {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--s-12);
  align-items: start;
  margin-bottom: var(--section);
}

.measure h2 { font-size: var(--t-h3); }
.measure h3 { font-size: var(--t-lede); }
.measure > div { min-width: 0; }

/* Ruled figure: steel rule above and below, never a border box. */
.rule-figure {
  min-width: 0;
  margin: 0 0 var(--section);
  padding-block: var(--s-4);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.rule-figure > svg { display: block; width: 100%; }

.rule-figure figcaption,
.case-table caption {
  margin-bottom: var(--s-4);
  color: var(--ink-soft);
  text-align: left;
}

.rule-figure figcaption {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  line-height: 1.5;
  color: var(--ink-faint);
}

/* The alphabet of sorts: a ruled list, physically equal widths, never cards. */
.rule-figure ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
}

.rule-figure li {
  flex: 1 1 140px;
  min-width: 0;
  margin: 0;
  padding: var(--s-3);
  border-top: 1px solid var(--rule-soft);
  border-right: 1px solid var(--rule-soft);
}

.rule-figure li svg { display: block; width: 100%; max-height: var(--s-24); }
.rule-figure li code { display: block; margin-top: var(--s-2); font-size: var(--t-caption); }

/* Case table: one rule under the head, none between rows. */
.case-table {
  width: 100%;
  margin-bottom: var(--s-8);
  border-collapse: collapse;
  font-family: var(--font-body);
}

.case-table caption { font-size: var(--t-body); line-height: 1.7; }

.case-table th, .case-table td {
  padding: var(--s-2) var(--s-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.case-table thead th {
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
}

.case-table tbody th[scope="row"] { text-align: left; font-family: var(--font-mono); }
.case-table tbody td { font-family: var(--font-mono); font-size: var(--t-label); }
.case-table tbody tr { border-bottom: 0; }

/* A table of prose rather than numbers: left-aligned, and it scrolls inside
   its own frame instead of pushing the page sideways on a phone. */
.table-wrap { overflow-x: auto; margin: var(--s-6) 0 var(--s-8); }

/* A long identifier in running text or in a cell may break anywhere: a phone
   should never scroll sideways because of one word. A code block keeps its own
   no-wrap rule, because there a line break would change what is being shown. */
code, th, td { overflow-wrap: anywhere; }
pre code { overflow-wrap: normal; }

.fixture-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-label);
  line-height: 1.55;
}

.fixture-table caption {
  margin-bottom: var(--s-3);
  text-align: left;
  font-size: var(--t-body);
  color: var(--ink-soft);
}

.fixture-table th, .fixture-table td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.fixture-table thead th {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
}

.fixture-table tbody th { font-weight: 600; }

/* Numbered stick: real list items, step number in mono in the margin. */
.stick {
  counter-reset: step;
  list-style: none;
  margin: var(--s-12) 0 0;
  padding: 0;
}

.stick li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: var(--s-6) 0 var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--bar-h) + var(--s-4));
}

.stick li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: var(--s-6);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.stick h3 { font-size: var(--t-lede); }

/* Colophon: a quotation and its attribution, no decorative quote marks. */
/* A note under a table or a figure: the proviso a reading needs, quieter than
   the body but not a footnote. */
.note {
  margin: var(--s-4) 0 0;
  max-width: 74ch;
  color: var(--ink-soft);
  font-size: var(--t-label);
  line-height: 1.6;
}
.note code { font-size: 0.92em; }

.colophon {
  max-width: 65ch;
  margin: var(--s-18) 0 0;
  padding: 0;
  font-size: var(--t-lede);
  line-height: 1.55;
  color: var(--ink-soft);
}

.colophon p { margin: 0 0 var(--s-4); }
.colophon small { font-family: var(--font-mono); color: var(--ink-faint); }

/* --------------------------------------------------------------------------
   Preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (prefers-contrast: more) {
  :root { --rule: var(--ink-soft); }
  .sig, .empty { border-color: var(--ink-soft); }
}

@media (forced-colors: active) {
  *, *::before, *::after { box-shadow: none !important; }
  .sig, .empty, .entry, .entry-field, .case-index-item, .pkg-head {
    border-color: CanvasText;
  }
  a, button { outline-color: Highlight; }
}

/* --------------------------------------------------------------------------
   Measure, then the case at narrower widths
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .case { gap: var(--s-6); }
  .pkg-name { font-size: var(--t-lede); }
}

@media (max-width: 980px) {
  :root { --pad: var(--s-6); --section: var(--s-18); }
  main { --main-pad: var(--s-12); padding-block: var(--main-pad) var(--s-18); }
}

@media (max-width: 700px) {
  /* The strip wraps to two rows here; every scroll-margin computed from
     --bar-h has to know that. */
  :root { --bar-h: 96px; }
  .case { grid-template-columns: minmax(0, 1fr); }
  .case-index { position: static; top: auto; }
  .case-index-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }
  .case-index-item { border: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }
  .case-index-link { min-height: 44px; align-items: center; padding-inline: var(--s-3); }
  .case-title { font-size: var(--t-h3); }
  .pkg-name { font-size: var(--t-lede); }
  .entry-name { font-size: var(--t-body); }
  .brand span { display: none; }
  .top nav { gap: var(--s-2); padding-block: var(--s-2); }
}

@media (max-width: 640px) {
  :root { --pad: var(--s-4); --section: var(--s-12); }
  .entry-field { grid-template-columns: minmax(0, 1fr); }
  .field-doc { grid-column: 1; }
  .case-intro { font-size: var(--t-body); }
  .pkg-head { gap: var(--s-2); }
  .band h1 { font-size: var(--t-h3); }
  .measure { grid-template-columns: minmax(0, 1fr); gap: var(--s-8); }
  .measure h2 { font-size: var(--t-lede); }
  .case-table th, .case-table td { padding: var(--s-2) var(--s-1); }
  .case-table tbody td { font-size: var(--t-caption); }
  .stick li { padding-left: var(--s-8); }
  /* A note under a table or a figure: the proviso a reading needs, quieter than
   the body but not a footnote. */
.note {
  margin: var(--s-4) 0 0;
  max-width: 74ch;
  color: var(--ink-soft);
  font-size: var(--t-label);
  line-height: 1.6;
}
.note code { font-size: 0.92em; }

.colophon { font-size: var(--t-body); }
}

/* The dropdown, made of the case file's parts: a ruled field, a squared menu,
   and the mark's blue for the chosen row. A native select would arrive in the
   platform's type and colour and undo the sheet around it. */
.field-label {
  display: block;
  margin: var(--s-4) 0 var(--s-2);
  font-family: var(--font-body);
  font-size: var(--t-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.pick { position: relative; max-width: 100%; }
.pick__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-width: min(100%, 22rem);
  padding: var(--s-2) var(--s-3);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pick__button:hover { border-color: var(--mark); }
.pick__button[aria-expanded="true"] {
  border-color: var(--mark);
  box-shadow: inset 0 0 0 1px var(--mark);
}
.pick__mark { width: 10px; height: 6px; flex: none; color: var(--ink-faint); transition: transform 160ms ease; }
.pick__button[aria-expanded="true"] .pick__mark { transform: rotate(180deg); }
.pick__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  box-shadow: 0 14px 30px var(--impression);
}
.pick__option {
  padding: var(--s-2) var(--s-3);
  border-top: 1px solid var(--rule-soft);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}
.pick__option:first-child { border-top: 0; }
.pick__option:hover,
.pick__option:focus { background: var(--mark); color: var(--on-mark); outline: none; }
.pick__option[aria-selected="true"] { color: var(--mark-strong); font-weight: 600; }
.pick__option[aria-selected="true"]:hover,
.pick__option[aria-selected="true"]:focus { color: var(--on-mark); }

/* The slider is the sheet's too. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 22rem;
  height: 20px;
  margin: var(--s-2) 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--ink-faint);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 2px;
  background: var(--mark);
  border: 1px solid var(--sheet);
  box-shadow: 0 0 0 1px var(--mark);
}
input[type="range"]::-moz-range-track { height: 1px; background: var(--ink-faint); }
input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--mark); border: 1px solid var(--sheet);
}

/* The fixture table has three columns and long prose in the second; on a phone
   it is fixed to the width and the cells break where they must, because a
   horizontal scrollbar under a paragraph is not a table. */
.fixture-table th,
.fixture-table td { overflow-wrap: anywhere; }
@media (width <= 760px) {
  .fixture-table { table-layout: fixed; width: 100%; }
}

/* A table of prose rather than of figures reads left to right; only a column
   of values belongs in the right margin. */
.case-table--prose th,
.case-table--prose td { text-align: left; }
.case-table--prose tbody th[scope="row"] { width: 24%; }
.case-table--prose th:nth-child(2),
.case-table--prose td:nth-child(2) { width: 12%; }

/* The ruler figures are drawn in font units, so their labels shrink with the
   figure: at three hundred pixels a twelve-unit label is three pixels high.
   The labels take a size that survives the reduction. */
@media (max-width: 760px) {
  .rule-figure svg text { font-size: 36px; }
}
