/*
 * docs.mdpt.ai: public documentation.
 *
 * Printed in one ink, with one signal, reversed: the ground is a deep spruce ink, and
 * every word is set in a pale paper tone, with dimmer tints for secondary text and
 * hairlines. Literata, at its display optical size, carries titles, names and the mission;
 * Hanken Grotesk carries text and interface. A twelve-column grid: titles hang at the
 * left edge, reading text starts at column five, and rules appear only where they divide
 * something.
 *
 * The home page is built around one figure, a plate: the top 0.01% of a field, drawn to
 * scale as one position in 10,000, with a magnified inset. It appears nowhere else.
 *
 * Colour strategy: Restrained. One brand ink (spruce, hue 170) for type and rules;
 * neutrals (paper, wash, hairlines, the plate's field) tinted toward that hue at chroma
 * 0.01 or less; one accent, canopy green (hue 153), on well under 2% of any page. The
 * accent marks exactly one kind of thing: what is singled out. The one position on the
 * plate, the arrow that takes you to a brand, the page you are on, the link under the
 * pointer, the element with focus. The only other colour is a proofreader's red, and only
 * unpublished drafts ever show it.
 */

@font-face {
  font-family: 'Literata';
  src: url('/fonts/literata-latin-opsz-normal.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
 * Size-adjusted fallbacks, so the swap from a system face to the webfont doesn't reflow
 * the page on a slow connection. Measured against Times New Roman and Arial (Liberation
 * Serif / Sans and Tinos / Arimo are metric-compatible): width over a sample of this
 * site's own copy, vertical metrics from the webfont's line box.
 */
@font-face {
  font-family: 'Literata Fallback';
  src: local('Times New Roman'), local('TimesNewRomanPSMT'), local('Liberation Serif'), local('Tinos');
  size-adjust: 114.35%;
  ascent-override: 102.93%;
  descent-override: 26.93%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Hanken Grotesk Fallback';
  src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('Arimo');
  size-adjust: 101.14%;
  ascent-override: 98.87%;
  descent-override: 29.96%;
  line-gap-override: 0%;
}

/*
 * One theme, dark: the spruce ink, deepened, is the ground; type is the paper, slightly
 * greyed so it doesn't glare; the signal is lifted but kept low in chroma so it reads as
 * the same green and never as neon. Weights sit a step lighter than a light theme would
 * use, because light type on a dark ground reads heavier.
 */
:root {
  color-scheme: dark;

  /* Ground, ink and the one signal. Every neutral leans toward the ink's hue. */
  --paper: oklch(0.21 0.009 170);
  --wash: oklch(0.25 0.01 170);
  --field: oklch(0.31 0.01 170);
  --ink: oklch(0.93 0.01 170);
  --ink-2: oklch(0.8 0.02 170);
  --ink-3: oklch(0.72 0.024 170);
  --rule: oklch(0.34 0.01 170);
  --rule-link: oklch(0.52 0.02 170);
  --signal: oklch(0.74 0.105 153);

  /* Drafts only. */
  --proof: oklch(0.76 0.13 40);
  --proof-wash: oklch(0.26 0.045 40);

  --serif: 'Literata', 'Literata Fallback', serif;
  --sans: 'Hanken Grotesk', 'Hanken Grotesk Fallback', ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --w-display: 350;
  --w-text: 370;
  --w-strong: 560;
  --w-serif-strong: 480;

  /*
   * Type scale. Every step is 1.25x the one below it or more, at every width from 360px
   * up: the reading steps are one modular scale on the text size, so their ratios never
   * change, and the display steps are sized to clear the step beneath them at both ends.
   *   phone  (390):     17 / 21 / 27 / 33 / 42 mission / 52 title
   *   desktop (1440): 16 / 20 / 25 / 31 / 39 / 64 mission / 112 title
   * Under 60rem the small step folds into the text step, so nothing on a phone is set
   * below the reading size.
   */
  --t-text: clamp(1.0625rem, 0.9342rem + 0.5263vw, 1.25rem);
  --t-small: var(--t-text);
  --t-large: calc(var(--t-text) * 1.25);
  --t-h2: calc(var(--t-text) * 1.5625);
  --t-name: calc(var(--t-text) * 1.953125);
  --t-mission: clamp(2.6rem, 2.08rem + 2.1333vw, 4rem);
  --t-title: clamp(3.25rem, 1.857rem + 5.714vw, 7rem);

  --measure: 32em; /* prose, measured at its own size: about 68 characters */
  --measure-list: 29em; /* ruled rows, set larger: about 60 characters */
  --max: 82rem;
  --margin: clamp(1.25rem, 5vw, 5rem);
  --gutter: clamp(1rem, 0.6rem + 1vw, 1.5rem);
  --frame: max(var(--margin), calc((100% - var(--max)) / 2));

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 60rem) {
  :root {
    --t-small: 1rem;
  }
}

/* ------------------------------------------------------------------ base */

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

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

/* The footer sits at the foot of the screen when a page is shorter than the screen. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-text);
  font-weight: var(--w-text);
  line-height: 1.6;
  font-kerning: normal;
  font-optical-sizing: auto;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--rule-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 300ms var(--ease);
}
a:hover {
  text-decoration-color: var(--signal);
}

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

strong {
  font-weight: var(--w-strong);
}

.skip {
  position: absolute;
  top: 0.75rem;
  left: var(--frame);
  z-index: 10;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-small);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus-visible {
  transform: none;
}

/* Visually hidden, still read aloud and still in the text an agent extracts. */
.vh,
.sep {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Hyphenated compounds, kept whole by the build so they never break at the hyphen. */
.nw {
  white-space: nowrap;
}

/* The arrows are drawn, not typed. */
.arrow {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.12em;
}

/* --------------------------------------------------------------- drafts */

.draft-banner {
  padding: 0.625rem var(--frame);
  background: var(--proof-wash);
  border-bottom: 1px solid var(--proof);
  color: var(--proof);
  font-size: var(--t-small);
  font-weight: 500;
}

/*
 * Unconfirmed facts, drafts only. Marked like a proof correction: the whole block is
 * boxed in the proof colour, so it can't be mistaken for finished copy.
 */
.doc .verify {
  max-width: var(--measure);
  padding: 0.875rem 1rem;
  background: var(--proof-wash);
  border: 1px solid var(--proof);
  border-radius: 2px;
  color: var(--ink);
  font-size: var(--t-small);
}
.verify-tag {
  margin-right: 0.375rem;
  color: var(--proof);
  font-weight: 650;
}

/* --------------------------------------------------------------- header */

header.site {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: baseline;
  margin-inline: var(--frame);
  padding-top: clamp(1.25rem, 2.5vw, 2rem);
}

/* The only mark on any page. */
.wordmark {
  grid-column: 1 / 5;
  justify-self: start;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
}

header.site nav {
  grid-column: 5 / -1;
}
header.site nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
header.site nav a {
  display: inline-block;
  padding-block: 0.25rem;
  color: var(--ink-2);
  font-size: var(--t-small);
  letter-spacing: 0.005em;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5em;
}
header.site nav a:hover {
  color: var(--ink);
  text-decoration-color: var(--rule-link);
}
header.site nav a[aria-current='page'] {
  color: var(--ink);
  font-weight: 550;
  text-decoration-color: var(--signal);
}

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

main {
  flex: 1 0 auto;
  margin-inline: var(--frame);
}

.doc {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}
.doc > * {
  grid-column: 1 / -1;
  min-width: 0;
}

/*
 * The title stands on a single rule of full ink that runs the width of the grid. The
 * text is pulled left by the capitals' side bearing so the stems, not the glyph boxes,
 * line up with the grid edge.
 */
.doc > h1 {
  margin: clamp(3rem, 7vw, 6rem) 0 0;
  padding-bottom: 0.26em;
  border-bottom: 1px solid var(--ink);
  font-family: var(--serif);
  font-size: var(--t-title);
  font-weight: var(--w-display);
  line-height: 0.98;
  letter-spacing: -0.032em;
  text-indent: -0.04em;
  text-wrap: balance;
}

h2,
h3 {
  font-family: var(--serif);
  font-weight: var(--w-display);
  letter-spacing: -0.015em;
}

.doc p {
  max-width: var(--measure);
  margin: 1.25rem 0 0;
  text-wrap: pretty;
}

/* The lede is one step above the H2s on a desktop; on a phone it shares their step, so a
   long lede doesn't fill the screen. It is always exactly on a step, never between. */
.doc .lede {
  max-width: 21em;
  margin-top: clamp(2rem, 4vw, 3rem);
  font-family: var(--serif);
  font-size: var(--t-h2);
  line-height: 1.22;
  letter-spacing: -0.014em;
  text-wrap: pretty;
}
.lede strong {
  font-weight: var(--w-serif-strong);
}
.doc .lede + p {
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
}

/* --------------------------------------------------------------- lists */

.doc ul,
.doc ol {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

/*
 * Plain lists, ordered or not, are ruled rows: the rule does the separating, so there
 * are no bullets and no printed numerals. An ordered list keeps its order in the markup.
 */
.doc ol li,
.doc ul:not([class]) li {
  max-width: var(--measure-list);
  padding-block: 0.875rem;
  border-top: 1px solid var(--rule);
  font-size: var(--t-large);
  line-height: 1.42;
  text-wrap: pretty;
}
.doc ol li:first-child,
.doc ul:not([class]) li:first-child {
  padding-top: 0;
  border-top: 0;
}
.doc ol li:last-child,
.doc ul:not([class]) li:last-child {
  padding-bottom: 0;
}

/* Term lists (a bold lead-in, then an explanation): the term hangs left in the serif. */
.doc .terms li {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: baseline;
  padding-block: 1.5rem 1.625rem;
  border-top: 1px solid var(--rule);
}
.doc .terms li:last-child {
  border-bottom: 1px solid var(--rule);
}
.terms .term {
  grid-column: 1 / 5;
  font-family: var(--serif);
  font-size: var(--t-h2);
  font-weight: var(--w-display);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.terms .term-desc {
  grid-column: 5 / 12;
  max-width: var(--measure);
  text-wrap: pretty;
}
.doc > .terms {
  margin-top: clamp(2.75rem, 5vw, 4.5rem);
}
.doc .terms + p {
  margin-top: clamp(2rem, 4vw, 3rem);
}

/*
 * Definition rows: the path on the left, what it is on the right. The rows share one
 * grid, so the left column is exactly as wide as the longest path and no path breaks.
 */
.doc .defs {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: calc(var(--gutter) * 2);
  max-width: 42rem;
}
.doc .defs li {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  padding-block: 0.875rem;
  border-top: 1px solid var(--rule);
}
.def-term a {
  white-space: nowrap;
}
.doc .defs li:first-child {
  padding-top: 0;
  border-top: 0;
}
.doc .defs li:last-child {
  padding-bottom: 0;
}
.def-desc {
  color: var(--ink-2);
}

code {
  padding: 0.05em 0.3em;
  background: var(--wash);
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: max(1rem, 0.84em);
}

hr {
  height: 1px;
  margin: 3rem 0 0;
  border: 0;
  background: var(--rule);
}

/* Wide tables scroll in their own box; the page never scrolls sideways. */
.table-scroll {
  overflow-x: auto;
  margin-top: 1.5rem;
  border-top: 1px solid var(--ink);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-small);
}
th,
td {
  padding: 0.625rem 0.75rem 0.625rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 600;
}

.note {
  color: var(--ink-2);
  font-size: var(--t-small);
}

/* An external link that stands alone: set in the serif, with the arrow it earns. */
.doc .outbound {
  margin-top: clamp(2.25rem, 4.5vw, 3.5rem);
}
.outbound a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--ink);
  font-family: var(--serif);
  font-size: var(--t-large);
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 300ms var(--ease);
}
.outbound a:hover {
  border-bottom-color: var(--signal);
}
.outbound .arrow {
  width: 0.7em;
  height: 0.7em;
  align-self: center;
  color: var(--signal);
  transition: transform 450ms var(--ease);
}
.outbound a:hover .arrow {
  transform: translate(0.12em, -0.12em);
}

/* ------------------------------------------------------- sectioned pages */

.doc > .part {
  display: grid;
  grid-template-columns: subgrid;
  margin-top: clamp(3.5rem, 7vw, 6rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.part > h2 {
  grid-column: 1 / 5;
  margin: 0;
  font-size: var(--t-h2);
  font-weight: var(--w-serif-strong);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.part-body {
  grid-column: 5 / -1;
  min-width: 0;
}
.part-body > :first-child {
  margin-top: 0;
}
/* A heading and the first row of its section share a cap line under the section rule. */
@supports (text-box: trim-both cap alphabetic) {
  .part > h2,
  .part-body > :first-child > li:first-child {
    text-box: trim-start cap alphabetic;
  }
  .doc > .part {
    padding-top: 1.75rem;
  }
}
/* A closing sentence after a list is an instruction, set as one. */
.part-body > :is(ul, ol) + p {
  margin-top: 2.25rem;
  font-family: var(--serif);
  font-size: var(--t-large);
  line-height: 1.35;
  letter-spacing: -0.008em;
}

/* --------------------------------------------- brand pages: Maple Drive */

/*
 * Three plain statements after the lede are ruled rows, like every other list on the
 * site, and the outbound link hangs in the left track level with the first of them.
 */
.page-maple-drive .doc > p:not(.lede, .outbound) {
  max-width: var(--measure-list);
  margin-top: 0;
  padding-block: 0.875rem;
  border-top: 1px solid var(--rule);
  font-size: var(--t-large);
  line-height: 1.42;
}
.page-maple-drive .doc > .lede + p {
  margin-top: clamp(2.25rem, 4.5vw, 3.5rem);
  padding-top: 0;
  border-top: 0;
}

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

.colophon {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  margin: clamp(4rem, 7vw, 5.5rem) var(--frame) 0;
  padding-block: 1.25rem clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--ink);
  color: var(--ink-2);
  font-size: var(--t-small);
  line-height: 1.55;
}
.colophon p {
  margin: 0;
}
.colophon-text {
  grid-column: 5 / -1;
  max-width: var(--measure);
  text-wrap: balance;
}

/* --------------------------------------------------------------- home */

/* The mission is the hero, in the serif at the title size, hanging at the left edge. */
.page-index .doc > .lede {
  max-width: 11em;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  font-size: var(--t-title);
  line-height: 1;
  letter-spacing: -0.03em;
  text-indent: -0.04em;
  text-wrap: balance;
}
/* What the lab does: one line, a step above the reading size, in the secondary ink. */
.page-index .doc > .sub {
  max-width: 24em;
  margin-top: clamp(1rem, 2vw, 1.5rem);
  color: var(--ink-2);
  font-size: var(--t-large);
  line-height: 1.4;
  text-wrap: pretty;
}

/*
 * The plate. The field is one quiet tint; its lattice shows only in the rulers and in
 * the magnified inset. Hairlines stay one device-independent pixel at any size.
 */
.doc > .plate {
  margin: clamp(2rem, 4vw, 2.5rem) 0 0;
}
/*
 * The drawing is 254 units wide: a 6-unit ruler, then 248 units from the field's left edge
 * to the inset's right edge. Those 248 fill the column exactly; the ruler hangs outside,
 * in the gutter, so the field's edge, not the ruler's, stands on the text axis.
 */
.plate-draw {
  padding: 0 0 1.5rem 2rem; /* room for the scale numerals: rows on the left, columns below */
}
.plate-box {
  position: relative;
}
.plate-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.p-field,
.p-cell {
  fill: var(--field);
}
.p-one {
  fill: var(--signal);
}
.p-finder,
.p-frame,
.p-leader,
.p-tick {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}
.p-leader {
  stroke: var(--ink-2);
  shape-rendering: geometricPrecision;
}
.p-tick {
  stroke: var(--ink-3);
}
.p-finder,
.p-inset {
  stroke-width: 1.5px;
}
/* The fine scale needs room: drawn only where one position is at least 2px. */
.p-fine {
  display: none;
}
.p-measure {
  fill: none;
  stroke: var(--rule-link);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}
.p-read {
  fill: none;
  stroke: var(--signal);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}
.p-nums {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.p-num {
  position: absolute;
  color: var(--ink-3);
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}
.p-num-x {
  translate: -50% 0.4em;
}
.p-num-y {
  translate: calc(-100% - 0.4em) -50%;
}
.p-mag {
  fill: var(--ink-2);
  text-anchor: middle;
  dominant-baseline: central;
  font-family: var(--sans);
  font-size: 11.5px; /* user units: 16px on a 390px phone */
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.plate figcaption {
  margin-top: 0.75rem;
  color: var(--ink-2);
  font-size: var(--t-small);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.plate figcaption strong {
  color: var(--ink);
}

/*
 * The brands as an index: each name hangs at the left edge in the serif, its line of
 * description starts at the text column, and the whole row is the link.
 */
.doc > .index {
  margin-top: clamp(2.5rem, 5vw, 3rem);
  border-top: 1px solid var(--ink);
}
.index li {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: baseline;
  padding-block: clamp(1.25rem, 2.4vw, 1.875rem) clamp(1.5rem, 2.8vw, 2.125rem);
  border-bottom: 1px solid var(--rule);
  transition: border-color 500ms var(--ease);
}
/* Hover inks the row's rule and moves the arrow; nothing else changes. */
.index li:hover {
  border-bottom-color: var(--ink);
}
.index-name {
  grid-column: 1 / 5;
  font-family: var(--serif);
  font-size: var(--t-name);
  font-weight: var(--w-display);
  line-height: 1.04;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.index-name a {
  text-decoration: none;
}
/* Stretch the link over the whole row. */
.index-name a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.index-desc {
  grid-column: 5 / 12;
  max-width: 30em;
  font-size: var(--t-large);
  line-height: 1.4;
  text-wrap: pretty;
}
.index-desc::first-letter {
  text-transform: uppercase;
}
/* The arrow sits on the name's first line, centred on its x-height band. */
.index .arrow {
  grid-column: 12;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  width: 0.72em;
  height: 0.72em;
  margin-top: 0.2em;
  color: var(--signal);
  font-size: var(--t-name);
  transition: transform 500ms var(--ease);
}
.index li:hover .arrow {
  transform: translateX(0.2em);
}
@supports selector(:has(*)) {
  .index-name a:focus-visible {
    outline: none;
  }
  .index li:has(a:focus-visible) {
    outline: 2px solid var(--signal);
    outline-offset: 4px;
  }
}

/* ------------------------------------------------------- the grid opens */

@media (min-width: 60rem) {
  .doc > :not(h1, .part, .index, .terms) {
    grid-column: 5 / -1;
  }
  .doc .lede {
    font-size: var(--t-name);
    line-height: 1.2;
  }

  /* Home: the mission and the supporting line span the page; the plate takes the text
     column below them, and its caption sits in the left track, level with the foot of
     the field, the way a journal sets a plate's legend in the margin. */
  .page-index .doc > .lede {
    grid-column: 1 / -1;
    grid-row: 1;
    text-wrap: balance;
  }
  .page-index .doc > .sub {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .page-index .doc > .plate {
    display: grid;
    grid-column: 1 / 12;
    grid-row: 3;
    grid-template-columns: subgrid;
  }
  .plate-draw {
    grid-column: 5 / -1;
    grid-row: 1;
  }
  .plate figcaption {
    grid-column: 1 / 5;
    grid-row: 1;
    align-self: end;
    max-width: 17em;
    margin: 0 0 1.5rem; /* level with the field's foot, above the column numerals */
    padding-right: var(--gutter);
    font-size: var(--t-text);
    line-height: 1.4;
  }
  .p-mag {
    font-size: 5.33px; /* user units: 16px at the plate's full width */
  }
  .p-fine {
    display: inline;
  }
  /* The ruler and its numerals hang into the gutter, so the field's edge, not the
     ruler's, stands on the text axis. */
  .plate-draw {
    padding-left: 0;
  }
  .plate-box {
    width: calc(100% * 254 / 248);
    translate: calc(-6 / 254 * 100%) 0;
  }
}

/*
 * Once the left track is wide enough to hold it above the caption, the supporting line
 * moves into the margin beside the plate, its cap height level with the top of the field.
 * The right padding clears the row numerals that hang into the gutter.
 */
@media (min-width: 80rem) {
  /* Line and plate share a row; the line is lifted above the plate's box so it can still
     be selected and copied. */
  .page-index .doc > .sub {
    z-index: 1;
    grid-column: 1 / 5;
    align-self: start;
    max-width: none;
    margin-top: clamp(2rem, 4vw, 2.5rem); /* the plate's own top margin */
    padding-right: 3.5rem;
  }
  .page-index .doc > .plate {
    grid-row: 2;
  }
  @supports (text-box: trim-start cap alphabetic) {
    .page-index .doc > .sub {
      text-box: trim-start cap alphabetic;
    }
  }
}

/* At full width one position is exactly 3 CSS px, so every edge lands on a whole pixel. */
@media (min-width: 90rem) {
  .plate-box {
    width: 762px;
  }
}

@media (min-width: 75rem) {
  /* Maple Drive: the outbound link hangs in the left track, level with the first row. */
  .page-maple-drive .doc > .outbound {
    grid-column: 1 / 5;
    grid-row: 3;
    margin-top: 0;
  }
  .page-maple-drive .doc > .outbound,
  .page-maple-drive .doc > .lede + p {
    align-self: baseline;
  }
}

/* ------------------------------------------------------ narrow screens */

@media (max-width: 59.99rem) {
  header.site {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1rem;
  }
  .wordmark,
  header.site nav {
    grid-column: 1;
  }
  /* The nav is a ruled two-by-two grid; every cell is a 48px target. */
  header.site nav ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--gutter);
  }
  header.site nav li {
    border-top: 1px solid var(--rule);
  }
  header.site nav li:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--rule);
  }
  header.site nav a {
    display: flex;
    align-items: center;
    min-height: 3rem;
    padding-block: 0.375rem;
    text-underline-offset: 0.4em;
  }

  .index li,
  .doc .terms li {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.625rem;
  }
  .index-name,
  .terms .term,
  .terms .term-desc {
    grid-column: 1;
  }
  .index-desc {
    grid-column: 1 / -1;
    max-width: none;
  }
  .index .arrow {
    grid-column: 2;
  }

  .part > h2,
  .part-body {
    grid-column: 1 / -1;
  }
  .part > h2 {
    margin-bottom: 1.25rem;
  }

  .colophon-text {
    grid-column: 1 / -1;
  }
}

@media (max-width: 30rem) {
  .doc .defs {
    grid-template-columns: minmax(0, 1fr);
  }
  .doc .defs li {
    row-gap: 0.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
