/* Typefaces: --font-family and --font-weight pick the active face */
@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-ThinItalic.woff2') format('woff2');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-LightItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-MediumItalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Quantif;
  src: url('../fonts/Quantif-BlackItalic.woff2') format('woff2');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

/* Precept's italics, for its own specimen (and any italic in the site's text) */
@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-ThinItalic.woff2') format('woff2');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-LightItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-MediumItalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Precept;
  src: url('../fonts/Precept-BlackItalic.woff2') format('woff2');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

/* Geisel and Theoria, for their specimens */
@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-ThinItalic.woff2') format('woff2');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-LightItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-MediumItalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Geisel;
  src: url('../fonts/Geisel-BlackItalic.woff2') format('woff2');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: Theoria;
  src: url('../fonts/Theoria-Thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Theoria;
  src: url('../fonts/Theoria-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Theoria;
  src: url('../fonts/Theoria-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Theoria;
  src: url('../fonts/Theoria-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Theoria;
  src: url('../fonts/Theoria-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* How far a section has opened, 0 to 1. Box width, box height and every line's
   opacity are worked out from it, so a section reversed partway never stalls. */
@property --open {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  --font-family: Precept;
  --font-weight: 400;

  --bg: #fff;
  --fg: #000;
  --box: #e5e5e5;
  --box-link: #c2c2c2;
  --box-link-off: rgb(194 194 194 / 0);
  --box-soft: rgba(229, 229, 229, 0.3);
  --box-dim: rgba(229, 229, 229, 0.6);

  /* Grid: fixed-width columns, as many as fit between the side margins
     (--m is the least they can be), centred. --mv is the top and bottom
     margin. The column count and block positions come from the generated
     rules below. */
  --cw: 210px;
  --g: 24px;
  --m: 24px;
  --mv: 24px;

  /* Type: --cap is the trimmed height of one line (cap height, rounded). The
     vertical grid comes from the leading: rows sit one line apart, groups two. */
  --size: 14px;
  --lead: 20px;
  --cap: 10px;
  --indent: 48px;
  --gap-s: calc(var(--lead) - var(--cap));
  --gap-l: calc(2 * var(--lead) - var(--cap));

  /* Hangline: the two-line groups are centred, "work" keeps this position */
  --hang: max(var(--mv), calc(50vh - var(--lead) - var(--cap) / 2));
  --tag-x: 0;
  --nav-top: var(--hang);
  --project-top: var(--mv);

  --dur: 0.6s;
  --ease: cubic-bezier(0.65, 0, 0.2, 1);
  --dur-section: 0.9s;
  --fade: 0.8s;  /* between images in the viewer */
  /* Every fade on the site: one curve, easing at both ends; what comes in
     takes --fade-in, what goes out --fade-out, and a hover or selection
     showing itself --fade-quick. (js/site.js and js/viewer.js hold the same
     numbers for the fades they run.) */
  --fade-ease: cubic-bezier(0.45, 0, 0.55, 1);
  --fade-in: 0.5s;
  --fade-out: 0.35s;
  --fade-quick: 0.3s;
}

@supports (height: 1svh) {
  :root {
    --hang: max(var(--mv), calc(50svh - var(--lead) - var(--cap) / 2));
  }
}

/* Mobile: 163px columns, 16px gutters and margins. Everything stacks across
   the grid, four lines of leading below the name (more where the tagline wraps). */
@media (max-width: 899px) {
  :root {
    --cw: 163px;
    --g: 16px;
    --m: 16px;
    --mv: 16px;
    /* --tag-x: the lines the tagline runs to beyond its first, in its one
       163px column */
    --tag-x: 2;
    --hang: max(var(--mv), calc(50vh - (3 + var(--tag-x) / 2) * var(--lead) - var(--cap) / 2));
    --nav-top: calc(var(--hang) + (4 + var(--tag-x)) * var(--lead));
    --project-top: calc(var(--mv) + (4 + var(--tag-x)) * var(--lead));
  }

  @supports (height: 1svh) {
    :root {
      --hang: max(var(--mv), calc(50svh - (3 + var(--tag-x) / 2) * var(--lead) - var(--cap) / 2));
    }
  }
}

/* GENERATED column rules: one per column count, from the width at which that
   many columns first fit between the side margins. Desktop also places the
   blocks: the name takes the left half, the nav starts at the middle, and
   the project arrows sit at the end of the last column when the title shares it. */
@media (min-width: 900px) {
  body > * { --cols: 1; --grid-w: 210px; --half: 1; --third: 1; --two-thirds: 1; --id-span: 1; --nav-start: 1; --nav-span: 1; --pager: end; }
  @container (min-width: 492px) { body > * { --cols: 2; --grid-w: 444px; --half: 1; --third: 1; --two-thirds: 1; --id-span: 1; --nav-start: 2; --nav-span: 1; --pager: end; } }
  @container (min-width: 726px) { body > * { --cols: 3; --grid-w: 678px; --half: 1; --third: 1; --two-thirds: 2; --id-span: 1; --nav-start: 2; --nav-span: 2; --pager: end; } }
  @container (min-width: 960px) { body > * { --cols: 4; --grid-w: 912px; --half: 2; --third: 1; --two-thirds: 2; --id-span: 2; --nav-start: 3; --nav-span: 2; --pager: end; } }
  @container (min-width: 1194px) { body > * { --cols: 5; --grid-w: 1146px; --half: 2; --third: 1; --two-thirds: 3; --id-span: 2; --nav-start: 3; --nav-span: 2; --pager: start; } }
  @container (min-width: 1428px) { body > * { --cols: 6; --grid-w: 1380px; --half: 3; --third: 2; --two-thirds: 4; --id-span: 3; --nav-start: 4; --nav-span: 2; --pager: start; } }
  @container (min-width: 1662px) { body > * { --cols: 7; --grid-w: 1614px; --half: 3; --third: 2; --two-thirds: 4; --id-span: 3; --nav-start: 4; --nav-span: 2; --pager: start; } }
  @container (min-width: 1896px) { body > * { --cols: 8; --grid-w: 1848px; --half: 4; --third: 2; --two-thirds: 5; --id-span: 4; --nav-start: 5; --nav-span: 3; --pager: start; } }
  @container (min-width: 2130px) { body > * { --cols: 9; --grid-w: 2082px; --half: 4; --third: 3; --two-thirds: 6; --id-span: 4; --nav-start: 5; --nav-span: 3; --pager: start; } }
  @container (min-width: 2364px) { body > * { --cols: 10; --grid-w: 2316px; --half: 5; --third: 3; --two-thirds: 6; --id-span: 5; --nav-start: 6; --nav-span: 3; --pager: start; } }
  @container (min-width: 2598px) { body > * { --cols: 11; --grid-w: 2550px; --half: 5; --third: 3; --two-thirds: 7; --id-span: 5; --nav-start: 6; --nav-span: 4; --pager: start; } }
  @container (min-width: 2832px) { body > * { --cols: 12; --grid-w: 2784px; --half: 6; --third: 4; --two-thirds: 8; --id-span: 6; --nav-start: 7; --nav-span: 4; --pager: start; } }
  @container (min-width: 3066px) { body > * { --cols: 13; --grid-w: 3018px; --half: 6; --third: 4; --two-thirds: 8; --id-span: 6; --nav-start: 7; --nav-span: 4; --pager: start; } }
  @container (min-width: 3300px) { body > * { --cols: 14; --grid-w: 3252px; --half: 7; --third: 4; --two-thirds: 9; --id-span: 7; --nav-start: 8; --nav-span: 5; --pager: start; } }
  @container (min-width: 3534px) { body > * { --cols: 15; --grid-w: 3486px; --half: 7; --third: 5; --two-thirds: 10; --id-span: 7; --nav-start: 8; --nav-span: 5; --pager: start; } }
  @container (min-width: 3768px) { body > * { --cols: 16; --grid-w: 3720px; --half: 8; --third: 5; --two-thirds: 10; --id-span: 8; --nav-start: 9; --nav-span: 5; --pager: start; } }
  @container (min-width: 4002px) { body > * { --cols: 17; --grid-w: 3954px; --half: 8; --third: 5; --two-thirds: 11; --id-span: 8; --nav-start: 9; --nav-span: 6; --pager: start; } }
  @container (min-width: 4236px) { body > * { --cols: 18; --grid-w: 4188px; --half: 9; --third: 6; --two-thirds: 12; --id-span: 9; --nav-start: 10; --nav-span: 6; --pager: start; } }
  @container (min-width: 4470px) { body > * { --cols: 19; --grid-w: 4422px; --half: 9; --third: 6; --two-thirds: 12; --id-span: 9; --nav-start: 10; --nav-span: 6; --pager: start; } }
  @container (min-width: 4704px) { body > * { --cols: 20; --grid-w: 4656px; --half: 10; --third: 6; --two-thirds: 13; --id-span: 10; --nav-start: 11; --nav-span: 7; --pager: start; } }
  @container (min-width: 4938px) { body > * { --cols: 21; --grid-w: 4890px; --half: 10; --third: 7; --two-thirds: 14; --id-span: 10; --nav-start: 11; --nav-span: 7; --pager: start; } }
}
@media (max-width: 899px) {
  body > * { --cols: 1; --grid-w: 163px; --half: 1; --third: 1; --two-thirds: 1; }
  @container (min-width: 374px) { body > * { --cols: 2; --grid-w: 342px; --half: 1; --third: 1; --two-thirds: 1; } }
  @container (min-width: 553px) { body > * { --cols: 3; --grid-w: 521px; --half: 1; --third: 1; --two-thirds: 2; } }
  @container (min-width: 732px) { body > * { --cols: 4; --grid-w: 700px; --half: 2; --third: 1; --two-thirds: 2; } }
}
/* Browsers without container queries use the viewport width instead */
@supports not (container-type: inline-size) {
  @media (min-width: 900px) {
    body > * { --cols: 1; --grid-w: 210px; --half: 1; --third: 1; --two-thirds: 1; --id-span: 1; --nav-start: 1; --nav-span: 1; --pager: end; }
    @media (min-width: 492px) { body > * { --cols: 2; --grid-w: 444px; --half: 1; --third: 1; --two-thirds: 1; --id-span: 1; --nav-start: 2; --nav-span: 1; --pager: end; } }
    @media (min-width: 726px) { body > * { --cols: 3; --grid-w: 678px; --half: 1; --third: 1; --two-thirds: 2; --id-span: 1; --nav-start: 2; --nav-span: 2; --pager: end; } }
    @media (min-width: 960px) { body > * { --cols: 4; --grid-w: 912px; --half: 2; --third: 1; --two-thirds: 2; --id-span: 2; --nav-start: 3; --nav-span: 2; --pager: end; } }
    @media (min-width: 1194px) { body > * { --cols: 5; --grid-w: 1146px; --half: 2; --third: 1; --two-thirds: 3; --id-span: 2; --nav-start: 3; --nav-span: 2; --pager: start; } }
    @media (min-width: 1428px) { body > * { --cols: 6; --grid-w: 1380px; --half: 3; --third: 2; --two-thirds: 4; --id-span: 3; --nav-start: 4; --nav-span: 2; --pager: start; } }
    @media (min-width: 1662px) { body > * { --cols: 7; --grid-w: 1614px; --half: 3; --third: 2; --two-thirds: 4; --id-span: 3; --nav-start: 4; --nav-span: 2; --pager: start; } }
    @media (min-width: 1896px) { body > * { --cols: 8; --grid-w: 1848px; --half: 4; --third: 2; --two-thirds: 5; --id-span: 4; --nav-start: 5; --nav-span: 3; --pager: start; } }
    @media (min-width: 2130px) { body > * { --cols: 9; --grid-w: 2082px; --half: 4; --third: 3; --two-thirds: 6; --id-span: 4; --nav-start: 5; --nav-span: 3; --pager: start; } }
    @media (min-width: 2364px) { body > * { --cols: 10; --grid-w: 2316px; --half: 5; --third: 3; --two-thirds: 6; --id-span: 5; --nav-start: 6; --nav-span: 3; --pager: start; } }
    @media (min-width: 2598px) { body > * { --cols: 11; --grid-w: 2550px; --half: 5; --third: 3; --two-thirds: 7; --id-span: 5; --nav-start: 6; --nav-span: 4; --pager: start; } }
    @media (min-width: 2832px) { body > * { --cols: 12; --grid-w: 2784px; --half: 6; --third: 4; --two-thirds: 8; --id-span: 6; --nav-start: 7; --nav-span: 4; --pager: start; } }
    @media (min-width: 3066px) { body > * { --cols: 13; --grid-w: 3018px; --half: 6; --third: 4; --two-thirds: 8; --id-span: 6; --nav-start: 7; --nav-span: 4; --pager: start; } }
    @media (min-width: 3300px) { body > * { --cols: 14; --grid-w: 3252px; --half: 7; --third: 4; --two-thirds: 9; --id-span: 7; --nav-start: 8; --nav-span: 5; --pager: start; } }
    @media (min-width: 3534px) { body > * { --cols: 15; --grid-w: 3486px; --half: 7; --third: 5; --two-thirds: 10; --id-span: 7; --nav-start: 8; --nav-span: 5; --pager: start; } }
    @media (min-width: 3768px) { body > * { --cols: 16; --grid-w: 3720px; --half: 8; --third: 5; --two-thirds: 10; --id-span: 8; --nav-start: 9; --nav-span: 5; --pager: start; } }
    @media (min-width: 4002px) { body > * { --cols: 17; --grid-w: 3954px; --half: 8; --third: 5; --two-thirds: 11; --id-span: 8; --nav-start: 9; --nav-span: 6; --pager: start; } }
    @media (min-width: 4236px) { body > * { --cols: 18; --grid-w: 4188px; --half: 9; --third: 6; --two-thirds: 12; --id-span: 9; --nav-start: 10; --nav-span: 6; --pager: start; } }
    @media (min-width: 4470px) { body > * { --cols: 19; --grid-w: 4422px; --half: 9; --third: 6; --two-thirds: 12; --id-span: 9; --nav-start: 10; --nav-span: 6; --pager: start; } }
    @media (min-width: 4704px) { body > * { --cols: 20; --grid-w: 4656px; --half: 10; --third: 6; --two-thirds: 13; --id-span: 10; --nav-start: 11; --nav-span: 7; --pager: start; } }
    @media (min-width: 4938px) { body > * { --cols: 21; --grid-w: 4890px; --half: 10; --third: 7; --two-thirds: 14; --id-span: 10; --nav-start: 11; --nav-span: 7; --pager: start; } }
  }
  @media (max-width: 899px) {
    body > * { --cols: 1; --grid-w: 163px; --half: 1; --third: 1; --two-thirds: 1; }
    @media (min-width: 374px) { body > * { --cols: 2; --grid-w: 342px; --half: 1; --third: 1; --two-thirds: 1; } }
    @media (min-width: 553px) { body > * { --cols: 3; --grid-w: 521px; --half: 1; --third: 1; --two-thirds: 2; } }
    @media (min-width: 732px) { body > * { --cols: 4; --grid-w: 700px; --half: 2; --third: 1; --two-thirds: 2; } }
  }
}
/* END GENERATED */

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

html {
  background-color: var(--bg);
  /* One palette, whatever the system setting: white, grey and black */
  color-scheme: only light;
  /* Where scrollbars take up room, keep one so the column count doesn't
     change when a section opens and the page starts to scroll */
  overflow-y: scroll;
}

body {
  /* The column rules query the body's width, which leaves out the scrollbar */
  container-type: inline-size;
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-family), "Helvetica Neue", Arial, sans-serif;
  font-size: var(--size);
  font-weight: var(--font-weight);
  line-height: var(--size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

/* A single trimmed line: cap height tall, so lines sit on the leading grid */
.t {
  display: block;
  height: var(--cap);
  margin: 0;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

.copy {
  line-height: var(--lead);
}

/* The trim sits on the first and last paragraphs rather than on .copy:
   Safari otherwise also trims the first line of every justified or indented
   paragraph, which breaks the line pitch */
.copy > p:first-child { text-box: trim-start cap alphabetic; }
.copy > p:last-child { text-box: trim-end cap alphabetic; }
.copy > p:only-child { text-box: trim-both cap alphabetic; }

.copy p {
  margin: var(--lead) 0 0;
}

/* Paragraphs separated by an indent instead of a line space */
:root[data-para="indent"] .copy p {
  margin-top: 0;
}

:root[data-para="indent"] .copy p + p {
  text-indent: var(--indent);
}

.copy p:first-child {
  margin-top: 0;
}

/* Links in copy sit in a darker grey box (--box-link), 1px past cap height
   and baseline. On hover the box fades out completely, while the section's
   box softens (below). The links stay inline, so
   the text sets exactly as before and a link can still break across lines; the
   box is a background band placed from --link-base (the distance from the top
   of an inline box to its baseline, measured by js/site.js). */
@property --link-box {
  syntax: "<color>";
  inherits: false;
  initial-value: rgb(229 229 229 / 0);
}

.copy a {
  background: linear-gradient(var(--link-box), var(--link-box)) no-repeat
    0 calc(var(--link-base, 0.8em) - var(--cap) - 1px) / 100% calc(var(--cap) + 2px);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  --link-box: var(--box-link);
  transition: --link-box var(--fade-quick) var(--fade-ease);
}

.copy a:is(:active, :focus-visible, .is-hover) {
  --link-box: var(--box-link-off);
}

/* Lines set by the control panel's justification (js/panel.js) */
.tl {
  display: block;
  white-space: nowrap;
  text-indent: 0;
  transform-origin: 0 0;
}

/* A set paragraph is a stack of line blocks. Safari can carry a paragraph's
   trim onto a line in the middle of it when that line is re-spaced, so the
   trim goes on the first and last lines themselves. */
.copy > p[data-set] { text-box: normal; }
.copy > p[data-set]:first-child > .tl:first-child { text-box: trim-start cap alphabetic; }
.copy > p[data-set]:last-child > .tl:last-child { text-box: trim-end cap alphabetic; }
.copy > p[data-set]:only-child > .tl:only-child { text-box: trim-both cap alphabetic; }

/* Layout */
.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, var(--cw)));
  justify-content: center;
  column-gap: var(--g);
  align-items: start;
  min-height: 100vh;
  min-height: 100svh;
  padding: 0 var(--m) var(--mv);
}

.page > * {
  grid-row: 1;
}

.id {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--gap-l);
  margin-top: var(--hang);
  transition: margin-top var(--dur) var(--ease);
}

.nav {
  grid-column: var(--nav-start) / span var(--nav-span);
  display: flex;
  flex-direction: column;
  gap: var(--gap-l);
  margin-top: var(--nav-top);
  transition: opacity var(--fade-in) var(--fade-ease) 0.2s;
}

.project {
  grid-column: var(--nav-start) / span var(--nav-span);
  margin-top: var(--project-top);
  visibility: hidden;
  outline: none;
}

/* A project page ends with its footer at the bottom left: under the
   project, or at the foot of the window when the project is shorter. It
   comes in with the project and leaves with it; on the home page it's out
   of the way. */
.page > .site-foot {
  grid-row: 2;
  grid-column: 1 / -1;
  align-self: end;
  /* as far below the content as the page's margin is wide */
  margin-top: var(--mv);
  /* (gone at once on leaving a project, with no fade: it is lifted out of
     the layout to the top of the page at that moment, and a fade would
     show it there) */
  opacity: 0;
  visibility: hidden;
}

body:not([data-view="project"]) .page > .site-foot {
  position: absolute;
  grid-row: 1;
  top: 0;
}

/* (in after the project's introduction, with what follows it: see after-intro) */
body[data-view="project"] .site-foot {
  opacity: 1;
  visibility: visible;
  transition: none;
  animation: after-intro var(--fade-in) var(--fade-ease) 0.85s backwards;
}

.site-foot p {
  margin: 0;
}

/* Previous and next project: two arrows starting the last column, or ending
   it when the title reaches that column (--pager, from the column rules) */
.pager {
  position: relative;
  z-index: 1;
  grid-column: -2;
  justify-self: var(--pager, start);
  display: flex;
  gap: 12px;
  height: var(--cap);
  margin-top: var(--mv);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--fade-out) var(--fade-ease), visibility 0s linear var(--fade-out);
}

.pager a,
.viewer-arrows button {
  position: relative;
  display: block;
  height: var(--cap);
  text-box: trim-both cap alphabetic;
}

.pager a::after,
.viewer-arrows button::after,
.label::after {
  content: "";
  position: absolute;
  inset: -6px;
}

/* Hover on the top line: the section labels' grey box (2px above cap height,
   a pixel below the baseline) behind whatever can be clicked. "text : context"
   only counts once there is something to leave: a project or an open section. */
.id a,
.pager a,
.viewer-arrows button,
.viewer-close {
  position: relative;
  isolation: isolate;
}

.id a::before,
.pager a::before,
.viewer-arrows button::before,
.viewer-close::before {
  content: "";
  position: absolute;
  top: -2px;
  right: 0;
  bottom: -1px;
  left: 0;
  z-index: -1;
  background-color: var(--box);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade-quick) var(--fade-ease);
}

body[data-view="home"][data-open=""] .id a {
  cursor: default;
}

:is(body[data-view="project"], body:not([data-open=""])) .id a:is(:active, :focus-visible)::before,
.pager a:is(:active, :focus-visible)::before,
.viewer-arrows button:is(:active, :focus-visible)::before,
.viewer-close:is(:active, :focus-visible)::before {
  opacity: 1;
}

@media (hover: hover) {
  :is(body[data-view="project"], body:not([data-open=""])) .id a:hover::before,
  .pager a:hover::before,
  .viewer-arrows button:hover::before,
  .viewer-close:hover::before {
    opacity: 1;
  }
}

/* Sections: work, information */
.section {
  position: relative;
  isolation: isolate;
  display: grid;
  /* The section is as wide as its column, whatever its content */
  grid-template-columns: minmax(0, 1fr);
  /* The first third runs across, the rest runs down. --body-h comes from site.js. */
  --x: clamp(0, var(--open) * 3, 1);
  --y: clamp(0, var(--open) * 1.5 - 0.5, 1);
  --across: calc(var(--x) * var(--x) * (3 - 2 * var(--x)));
  --down: calc(1 - (1 - var(--y)) * (1 - var(--y)) * (1 - var(--y)));
  grid-template-rows: auto calc(var(--body-h, 0px) * var(--down));
  transition: --open var(--dur-section) linear;
  /* Also the closed value in browsers without @property, which then snap open */
  --open: 0;
}

.section.is-open {
  --open: 1;
}

.label {
  position: relative;
  width: fit-content;
}

/* The name, the office and the two section labels are set bold; everything
   else keeps the regular weight */
.id > .t,
.label > .t {
  font-weight: 700;
}

/* The line under the name is a sentence, so it wraps within the header's
   one column, a line of leading apart, split evenly. Its first line sits where
   a single line would. Below 900px, what follows it moves down by its extra
   lines (--tag-x, set with the grid above). */
.id > .tag {
  max-width: 100%;
  height: auto;
  line-height: var(--lead);
  white-space: normal;
  text-wrap: balance;
}

/* Grey box: hugs the label on hover (2px above cap height, a pixel below the baseline),
   then grows to the two-column section when open */
.box {
  position: absolute;
  top: -2px;
  bottom: -1px;
  left: 0;
  z-index: -1;
  width: calc(var(--label-w, 100%) + (100% - var(--label-w, 100%)) * var(--across));
  /* Stays lit until the section has fully closed */
  opacity: clamp(0, var(--open) * 1000, 1);
  transition: opacity var(--fade-quick) var(--fade-ease);
}

/* Two layers: the plain box, and the softened one shown while a row is
   hovered. Only their opacity changes, so the box dissolves from one to the
   other, and each layer keeps its own compositing layer so Safari runs the
   fade off the main thread instead of repainting it frame by frame.
   The soft layer isn't a CSS blur: Safari draws those differently while
   animating, and transitions their radius in whole pixels. It is the same
   picture made with masks: a 5px Gaussian blur of a rectangle is the product
   of one soft edge across and one down, each the Gaussian's cumulative curve
   (sampled every 5px, 15px either side of the edge). */
.box::before,
.box::after {
  content: "";
  position: absolute;
  inset: 0;
  will-change: opacity;
  transition: opacity var(--fade-quick) var(--fade-ease);
}

.box::before {
  background-color: var(--box);
}

.box::after {
  --soft:
    rgb(0 0 0 / 0) 0, rgb(0 0 0 / 0.023) 5px, rgb(0 0 0 / 0.159) 10px,
    rgb(0 0 0 / 0.5) 15px, rgb(0 0 0 / 0.841) 20px, rgb(0 0 0 / 0.977) 25px,
    #000 30px, #000 calc(100% - 30px),
    rgb(0 0 0 / 0.977) calc(100% - 25px), rgb(0 0 0 / 0.841) calc(100% - 20px),
    rgb(0 0 0 / 0.5) calc(100% - 15px), rgb(0 0 0 / 0.159) calc(100% - 10px),
    rgb(0 0 0 / 0.023) calc(100% - 5px), rgb(0 0 0 / 0) 100%;
  inset: -15px;
  background-color: var(--box-dim);
  opacity: 0;
  -webkit-mask-image: linear-gradient(to right, var(--soft)), linear-gradient(to bottom, var(--soft));
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, var(--soft)), linear-gradient(to bottom, var(--soft));
  mask-composite: intersect;
}

.label:active ~ .box,
.label:focus-visible ~ .box {
  opacity: 1;
}

.section-body {
  min-height: 0;
  visibility: hidden;
  /* Lets descenders on the last line through without adding to the layout */
  clip-path: inset(0 -1px -8px -1px);
  transition: visibility 0s linear var(--dur-section);
}

/* (closed, its copy is cut off too: hidden text below the last open
   section would otherwise leave blank room to scroll into) */
.section:not(.is-open) > .section-body {
  overflow: hidden;
}

.section.is-open > .section-body {
  visibility: visible;
  transition-delay: 0s;
}

.section-inner {
  /* The bottom padding keeps last-line descenders inside the line mask;
     in em so it grows with the type (4px at 16px) */
  margin-bottom: -0.25em;
  padding: var(--gap-l) 0 0.25em;
}

.section .copy {
  max-width: 400px;
}

/* Work list */
.rows {
  display: flex;
  flex-direction: column;
  gap: var(--gap-s);
  margin: 0;
  padding: 0;
  list-style: none;
}

.row,
.project-row {
  display: grid;
  /* Two halves, but the title column never narrower than "HMCT Font Foundry" */
  grid-template-columns: minmax(0, 1fr) max(9.75em, calc(50% - var(--g) / 2));
  column-gap: var(--g);
}

.row {
  position: relative;
}

/* Row box: 1px past cap height and baseline */
.row::before {
  content: "";
  position: absolute;
  inset: -1px 0;
  z-index: -1;
  background-color: var(--box);
  opacity: 0;
  transition: opacity var(--fade-quick) var(--fade-ease);
}

/* Closes the gaps between rows so the pointer never falls between them */
.row::after {
  content: "";
  position: absolute;
  inset: calc(var(--gap-s) / -2) 0;
}

.row:active::before,
.row:focus-visible::before {
  opacity: 1;
}

.section:has(.row:active, .row:focus-visible, .copy a:active, .copy a:focus-visible, .copy a.is-hover) > .box::before {
  opacity: 0;
}

.section:has(.row:active, .row:focus-visible, .copy a:active, .copy a:focus-visible, .copy a.is-hover) > .box::after {
  opacity: 1;
}

@media (hover: hover) {
  .label:hover ~ .box {
    opacity: 1;
  }

  .row:hover::before {
    opacity: 1;
  }

  .copy a:hover {
    --link-box: var(--box-link-off);
  }

  .section:has(.row:hover, .copy a:hover) > .box::before {
    opacity: 0;
  }

  .section:has(.row:hover, .copy a:hover) > .box::after {
    opacity: 1;
  }
}

/* A project that isn't shown yet: its row keeps its number, its name is
   under a black bar (the grey boxes' size: 2px above cap height, a pixel
   below the baseline, as wide as the name was), and it can't be opened.
   The name isn't in the markup: the bar's width is set on it there;
   screen readers get "not yet shown". */
.row.is-off {
  pointer-events: none;
  cursor: default;
}

.row.is-off > .t:not(.lead) {
  position: relative;
  justify-self: start;
}

.row.is-off > .t:not(.lead)::after {
  content: "";
  position: absolute;
  top: -2px;
  right: 0;
  bottom: -1px;
  left: 0;
  background-color: var(--fg);
}

.off-note {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.row.is-flying {
  visibility: hidden;
}

/* Leader: number plus twelve dots. Dots that don't fit wrap out of the clipped
   line, so narrow columns simply get fewer of them. The clip reaches 6px past
   the line so round figures and dots keep their overshoot. */
.lead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  height: calc(var(--cap) + 12px);
  margin: -6px 0;
  padding: 6px 0;
  overflow-x: visible;
  overflow-y: clip;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

.lead > span {
  height: var(--cap);
  text-box: trim-both cap alphabetic;
}

/* Project view */
.page-box {
  position: fixed;
  /* The grid's edges, wherever centring puts them */
  top: calc(var(--mv) - 2px);
  right: max(var(--m), calc(50% - var(--grid-w) / 2));
  bottom: var(--mv);
  left: max(var(--m), calc(50% - var(--grid-w) / 2));
  background-color: var(--box-soft);
  filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade-out) var(--fade-ease);
}

.project-row.is-flying {
  visibility: visible;
}

.project-copy {
  margin-top: var(--gap-l);
  opacity: 0;
  transition: opacity var(--fade-out) var(--fade-ease);
}

/* Project images: below the copy, across the whole grid. Each row is its own
   grid so a row's images start on the first column and whatever is left over
   stays empty. Widths are whole columns (--half and --third come from the
   column rules); heights follow from the image's ratio: 16:9, 1:1 or 2:3,
   or, for a strip, the width and height it was cut to. */
.gallery {
  display: flex;
  flex-direction: column;
  gap: var(--g);
  /* The project sits in the nav's columns; the gallery reaches back to the first */
  width: var(--grid-w);
  margin: calc(2 * var(--lead)) 0 0 calc((1 - var(--nav-start, 1)) * (var(--cw) + var(--g)));
  opacity: 0;
  transition: opacity var(--fade-out) var(--fade-ease);
}

.gallery-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, var(--cw)));
  gap: var(--g);
  align-items: start;
}

.gallery figure {
  position: relative;
  isolation: isolate;
  grid-column: span var(--cols, 1);
  margin: 0;
  overflow: clip;
}

/* Until its image has loaded, a figure shows a tiny copy of it (--lqip,
   in the page), heavily blurred and reaching past the edges so they stay
   sharp; the image then fades in over it as it comes into focus
   (js/site.js marks the figure .is-loaded). The copy goes once the image
   is in, so a cut-out's transparency stays clear. */
.gallery figure::before {
  content: "";
  position: absolute;
  inset: -40px;
  z-index: -1;
  background: var(--lqip) center / cover no-repeat;
  filter: blur(20px);
  transition: opacity 0.4s var(--fade-ease) 0.6s;
}

.gallery figure.is-loaded::before {
  opacity: 0;
}

.js .gallery :is(img, video) {
  opacity: 0;
  filter: blur(20px);
  transition: opacity 0.6s var(--fade-ease), filter 0.8s var(--fade-ease);
}

.js .gallery .is-loaded :is(img, video) {
  opacity: 1;
  filter: none;
}

.gallery .half { grid-column: span var(--half, 1); }
.gallery .third { grid-column: span var(--third, 1); }
.gallery .two-thirds { grid-column: span var(--two-thirds, 1); }

.gallery img,
.gallery video {
  display: block;
  width: 100%;
  height: auto;
}

.gallery .wide :is(img, video) { aspect-ratio: 16 / 9; }
.gallery .square :is(img, video) { aspect-ratio: 1; }
.gallery .tall :is(img, video) { aspect-ratio: 2 / 3; }

.gallery video {
  object-fit: cover;
}

/* Between two projects (js/site.js sets data-swap): every part of the
   project fades out, the content changes while nothing shows, and the new
   parts fade in. The parts themselves fade, not the project around them
   (see swapProject). What follows the introduction still waits its turn:
   its own timing takes over as the forced zero is lifted. */
body[data-swap="out"] .project > * {
  opacity: 0 !important;
  transition: opacity var(--fade-out) var(--fade-ease) !important;
}

body[data-swap="in"] .project > :is(.project-row, .project-copy) {
  transition: opacity var(--fade-in) var(--fade-ease) !important;
}

/* What follows a project's introduction (its gallery or its specimen, and
   the page's footer) comes in once the introduction has: the copy fades in
   from 0.35s to 0.85s, then these. An animation, so it also runs when a
   project is swapped in or its page is opened directly. */
@keyframes after-intro {
  from { opacity: 0; }
  to { opacity: 1; }
}

body[data-view="project"] .gallery {
  opacity: 1;
  transition: none;
}

body[data-view="project"] .project-copy ~ .gallery {
  animation: after-intro var(--fade-in) var(--fade-ease) 0.85s backwards;
}

@media (hover: hover) {
  .gallery :is(img, video) { cursor: zoom-in; }
}

/* Image viewer (js/viewer.js): the image takes as many whole columns as it
   can without running past the bottom margin, from the top left of the grid,
   below the bullets, "close" and the arrows on the top line.
   Images crossfade over --fade. The two halves of the screen also step back
   and on, with no cursor of their own. */
.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--fg);
  outline: none;
  overscroll-behavior: contain;
}

.viewer[open] {
  animation: viewer-in var(--fade-in) var(--fade-ease);
}

/* The project page's soft grey, behind the image as it is behind the page:
   the same box (.page-box), from the grid's edges */
.viewer::before {
  content: "";
  position: absolute;
  top: calc(var(--mv) - 2px);
  right: max(var(--m), calc(50% - var(--grid-w) / 2));
  bottom: var(--mv);
  left: max(var(--m), calc(50% - var(--grid-w) / 2));
  background-color: var(--box-soft);
  filter: blur(5px);
  pointer-events: none;
}

.viewer::backdrop {
  background: none;
}

@keyframes viewer-in {
  from { opacity: 0; }
}

.viewer-stage {
  position: absolute;
  top: calc(var(--mv) + 2 * var(--lead));
  right: max(var(--m), calc(50% - var(--grid-w) / 2));
  bottom: var(--mv);
  left: max(var(--m), calc(50% - var(--grid-w) / 2));
}

.viewer-stage > * {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  /* Width and height come from js/viewer.js; cover takes up the odd pixel
     between a file's size and its nominal ratio */
  object-fit: cover;
  opacity: 0;
  /* the blur stays inside the image's own edges */
  clip-path: inset(0);
  transition: opacity var(--fade) var(--fade-ease), filter 0.8s var(--fade-ease);
}

.viewer-stage > .is-on {
  opacity: 1;
}

/* An image not loaded yet shows its tiny copy (from the gallery's --lqip),
   heavily blurred, and comes into focus once it's in (js/viewer.js) */
.viewer-stage > .is-blur {
  background: center / cover no-repeat;
  filter: blur(20px);
}

.viewer-step {
  position: absolute;
  cursor: default;
  top: 0;
  bottom: 0;
  width: 50%;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.viewer-prev { left: 0; }
.viewer-next { right: 0; }

/* The top line follows the page's grid: the count where the name is,
   "close" where the project title is and the arrows where the project
   arrows are */
.viewer-bar {
  position: absolute;
  top: var(--mv);
  right: 0;
  left: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, var(--cw)));
  justify-content: center;
  column-gap: var(--g);
  padding: 0 var(--m);
  pointer-events: none;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

.viewer-count {
  grid-area: 1 / 1;
}

/* The count: a bullet (Precept's own) for each image, the one on show in
   the text colour, the rest grey, fading between them as the paragraphs'
   bullets do; for screen readers, "image 2 of 21". The bullets are 6px
   apart on desktop and 3px on phones, as in the paragraphs: the most a
   gallery has, 21, fit the first column either way. */
.viewer-said {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.viewer-dots {
  display: flex;
  column-gap: 6px;
}

@media (max-width: 899px) {
  .viewer-dots {
    column-gap: 3px;
  }
}

.viewer-dots > span {
  height: var(--cap);
  text-box: trim-both cap alphabetic;
  color: var(--box);
  transition: color var(--fade-quick) var(--fade-ease);
}

.viewer-dots > .is-on {
  color: var(--fg);
}

@media (forced-colors: active) {
  .viewer-dots > span {
    color: GrayText;
  }

  .viewer-dots > .is-on {
    color: CanvasText;
  }
}

.viewer-row {
  grid-area: 1 / var(--nav-start, 1) / auto / span var(--nav-span, 1);
  display: grid;
  grid-template-columns: minmax(0, 1fr) max(9.75em, calc(50% - var(--g) / 2));
  column-gap: var(--g);
}

.viewer-arrows {
  grid-area: 1 / -2;
  justify-self: var(--pager, start);
  display: flex;
  gap: 12px;
}

.viewer-close {
  position: relative;
  grid-area: 1 / 2;
  justify-self: start;
}

.viewer-arrows,
.viewer-close {
  pointer-events: auto;
}

.viewer-close::after {
  content: "";
  position: absolute;
  inset: -6px;
}

/* Phones: halves and two-thirds go full width, thirds go two to a row.
   .phone-full takes any figure full width on phones. */
@media (max-width: 899px) {
  .gallery .half { grid-column: span var(--cols, 1); }
  .gallery .third { grid-column: span var(--half, 1); }
  .gallery .two-thirds { grid-column: span var(--cols, 1); }
  .gallery .phone-full { grid-column: span var(--cols, 1); }
}

body[data-view="project"] .id {
  margin-top: var(--mv);
}

/* The tagline belongs to the landing (and its open sections): on a project
   only the name stays. (A filter, as below: the landing's fade-in holds the
   lines' opacity.) */
.id > .tag {
  transition: filter var(--fade-in) var(--fade-ease), visibility 0s;
}

body[data-view="project"] .id > .tag {
  filter: opacity(0);
  visibility: hidden;
  transition: filter var(--fade-out) var(--fade-ease), visibility 0s linear var(--fade-out);
}

/* Project pages: the name, the title and the arrow stay at the top while the
   copy and images scroll under them, with nothing behind them */
body[data-view="project"] .id,
body[data-view="project"] .project-row,
body[data-view="project"] .pager {
  position: sticky;
  z-index: 2;
}

body[data-view="project"] .id,
body[data-view="project"] .pager {
  top: var(--mv);
}

body[data-view="project"] .project-row {
  top: var(--project-top);
}

/* Scrolling down a project fades out the name and the office; scrolling
   back up, or reaching the top, brings them back (js/site.js sets
   data-head). So does keyboard focus reaching the name. Each line fades on
   its own (a filter, since the landing's fade-in holds their opacity), so
   on phones each can wait for the title to move out of its way. */
body[data-view="project"] .id > * {
  transition: filter var(--fade-out) var(--fade-ease);
}

body[data-view="project"][data-head="hidden"] .id {
  pointer-events: none;
}

body[data-view="project"][data-head="hidden"] .id > * {
  filter: opacity(0);
  transition-duration: 0.2s;
}

/* (clipped too: a closed section's hidden copy would otherwise reach past
   the foot of the page, leaving room to scroll under the footer) */
body[data-view="project"] .nav {
  overflow: clip;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--fade-out) var(--fade-ease), visibility 0s linear var(--fade-out);
}

body[data-view="project"] .project,
.project.is-leaving {
  visibility: visible;
}

body[data-view="project"] .project-copy {
  opacity: 1;
  transition: opacity var(--fade-in) var(--fade-ease) 0.35s;
}

body[data-view="project"] .page-box {
  opacity: 1;
  transition: none;
}

/* Opening a project, the arrows come in once the title has flown into
   place (--dur); between projects they stay (the third delay is the
   phones' move with the name, which doesn't wait) */
body[data-view="project"] .pager {
  opacity: 1;
  visibility: visible;
  transition-delay: var(--dur), var(--dur), 0s;
}

@media (max-width: 899px) {
  .nav,
  .project {
    grid-column: 1 / -1;
  }

  /* On a project only the name is above the title, which sits two lines
     below it */
  body[data-view="project"] {
    --project-top: calc(var(--mv) + 2 * var(--lead));
  }

  /* The arrows: on the line under the project, "←" under its number and
     "→" under its title (the columns of .project-row). When the name and
     the office fade out, the number, title and arrows move up into their
     place. */
  .pager {
    grid-column: 1 / -1;
    justify-self: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max(9.75em, calc(50% - var(--g) / 2));
    column-gap: var(--g);
    justify-items: start;
    margin-top: calc(var(--project-top) + var(--lead));
    pointer-events: none;
  }

  .pager a {
    pointer-events: auto;
  }

  body[data-view="project"] .pager {
    top: calc(var(--project-top) + var(--lead));
  }

  body[data-view="project"][data-head="hidden"] .project-row {
    top: var(--mv);
  }

  body[data-view="project"][data-head="hidden"] .pager {
    top: calc(var(--mv) + var(--lead));
  }

  /* Coming back, both lines of the name wait until the title, on its way
     down (16px to 96px over --dur), has passed the lower one, the office
     (about 0.3s), then come on together */
  body[data-view="project"] .id > * {
    transition-delay: 0.3s;
  }

  body[data-view="project"][data-head="hidden"] .id > * {
    transition-delay: 0s;
  }

  @media (prefers-reduced-motion: no-preference) {
    .project-row {
      transition: top var(--dur) var(--ease);
    }

    .pager {
      transition: opacity var(--fade-out) var(--fade-ease), visibility 0s linear var(--fade-out), top var(--dur) var(--ease);
    }
  }

  /* The copy starts a line further down, below the arrows */
  .project-copy {
    margin-top: calc(var(--gap-l) + var(--lead));
  }

  /* The count keeps the left, "close" starts the title column and the
     arrows sit on the line below, "←" under the count and "→" under
     "close", as on the page; the image starts a line further down */
  .viewer-row {
    grid-column: 1 / -1;
  }

  .viewer-arrows {
    grid-area: 2 / 1 / auto / -1;
    justify-self: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max(9.75em, calc(50% - var(--g) / 2));
    column-gap: var(--g);
    justify-items: start;
    margin-top: var(--gap-s);
    pointer-events: none;
  }

  .viewer-arrows button {
    pointer-events: auto;
  }

  .viewer-stage {
    top: calc(var(--mv) + 3 * var(--lead));
  }

  .section .copy {
    max-width: none;
  }

  /* One column (under 374px): a project's number and its title don't fit
     side by side, so each row is two lines, the number and its dots across
     the column, the title under them, and a line's room after. In a
     project's header the arrows take the third line, side by side, and
     everything under them moves down a line. The image viewer's bullets
     take the top line; the arrows, side by side, and "close", at the
     column's end, the second. */
  @container (max-width: 373px) {
    .row,
    .project-row {
      grid-template-columns: minmax(0, 1fr);
      row-gap: var(--gap-s);
    }

    /* a line's room between two projects, so each title stays with its
       number; the pointer's bridge spans it */
    .rows {
      gap: calc(var(--lead) + var(--gap-s));
    }

    .row::after {
      inset: calc((var(--lead) + var(--gap-s)) / -2) 0;
    }

    .pager {
      grid-template-columns: auto auto;
      justify-content: start;
      column-gap: 12px;
      margin-top: calc(var(--project-top) + 2 * var(--lead));
    }

    body[data-view="project"] .pager {
      top: calc(var(--project-top) + 2 * var(--lead));
    }

    body[data-view="project"][data-head="hidden"] .pager {
      top: calc(var(--mv) + 2 * var(--lead));
    }

    .project-copy {
      margin-top: calc(var(--gap-l) + 2 * var(--lead));
    }

    .viewer-row {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    /* the bullets take the top line to themselves; "close" ends the
       second, after the arrows, which sit side by side */
    .viewer-row {
      grid-row: 2;
      margin-top: var(--gap-s);
    }

    .viewer-arrows {
      grid-template-columns: auto auto;
      justify-content: start;
      column-gap: 12px;
    }
  }
}

/* Nothing is drawn until the site's own two faces are in (js/site.js marks
   the document .ready; they are preloaded, so this is brief): otherwise the
   text appears in a stand-in font and is redrawn, shifting what's below it.
   Should the script never run, the page shows itself after three seconds. */
@keyframes late-reveal {
  to { opacity: 1; }
}

html.js body {
  transition: opacity var(--fade-in) var(--fade-ease);
}

html.js:not(.ready) body {
  opacity: 0;
  animation: late-reveal 0s 3s forwards;
}

/* Load sequence: blocks fade in top to bottom */
.intro .id > *,
.intro .label {
  opacity: 0;
}

.intro.go .id > *,
.intro.go .label {
  animation: fade-in var(--fade-in) var(--fade-ease) forwards;
  animation-delay: calc(var(--i, 0) * 200ms);
}

.intro .id > :nth-child(2) { --i: 1; }
.intro [data-section="work"] .label { --i: 2; }
.intro [data-section="information"] .label { --i: 3; }

@keyframes fade-in {
  to { opacity: 1; }
}

.no-anim, .no-anim *, .no-anim *::before, .no-anim *::after {
  transition: none !important;
}

/* The clock's figures: tabular lining figures with case-sensitive colons, so
   the time holds its width as the seconds change. Only the time, not the
   zone, since the tabular set also spaces out the full stops. */
.clock {
  font-feature-settings: "case" 1, "lnum" 1, "tnum" 1;
}

/* Without JavaScript the sections stay open and the clock line is dropped */
html:not(.js) .section {
  grid-template-rows: auto auto;
}

html:not(.js) .section-body {
  visibility: visible;
}

html:not(.js) .clock-line {
  display: none;
}

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










/* ==== Type specimen ("workbench"), for the typeface projects ====
   Sits after the description, where a case study's gallery would be. Every
   section is a tool: a label in the first column (the rail) with its
   settings on the same line, then the samples. Blocks are whole lines of
   leading tall and every line is trimmed to its cap height, so the page stays
   on the 20px grid. js/specimen.js makes it work: editable lines, the size
   and tracking fields (the leading follows the size), the toggles, glyph selection. Three layouts:
   phones, desktop below six columns, and six columns and up (the design). */

/* Spans the whole grid from column 1, as the gallery does */
.wb-full {
  width: var(--grid-w);
  margin-left: calc((1 - var(--nav-start, 1)) * (var(--cw) + var(--g)));
}
/* A row on the site's column grid */
.wb-cols {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, var(--cw)));
  column-gap: var(--g);
}
.wb-num { font-feature-settings: "lnum" 1, "tnum" 1; }
.wb-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* (the page's footer keeps its distance below it) */
.wb { margin-top: calc(4 * var(--lead) - var(--cap)); }
.wb-sec + .wb-sec { margin-top: calc(5 * var(--lead)); }
.wb p { margin: 0; }
/* The specimen stays out of sight until its own faces are in, and the
   introduction above it has appeared (js/specimen.js marks it .is-in), then
   fades in once. If the script never runs it shows itself after four seconds. */
.js .wb { opacity: 0; animation: late-reveal 0s 4s forwards; }
.js .wb.is-in { opacity: 1; animation: none; transition: opacity var(--fade-in) var(--fade-ease); }
.wb-m { display: none; }

/* The face being shown */
.wb-tl, .wb-pt, .wb-cells, .wb-x { font-family: var(--wb-family), sans-serif; }
/* The glyphs' weight toggles set --wb-w on their section, and the roman and
   italic toggles --wb-s; only the glyphs follow them, the labels around them
   stay regular */
.wb-cells { font-weight: var(--wb-w, 400); font-style: var(--wb-s, normal); }

/* ---- the control strip: rail, then the settings on the column grid ---- */
.wb-strip { align-items: start; row-gap: var(--gap-s); padding-bottom: calc(2 * var(--lead) - var(--cap)); }
.wb-rail { grid-column: 1; grid-row: 1; }
.wb-ctls {
  grid-column: 2 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--cw));
  column-gap: var(--g);
  row-gap: var(--gap-s);
}
.wb-ctl {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: var(--gap-s);
  white-space: nowrap;
}
.wb-c-feat, .wb-c-weights { grid-column: span 2; }
/* reset: the end of the first line, over the settings' last column */
.wb-reset { grid-column: -2; grid-row: 1; justify-self: end; }

/* A control word: a button, or a label holding a number field. On is the
   grey box, 2px over cap height and a pixel under the baseline, as the work
   and information boxes end when open; hover is the same box. A tap shows
   nothing of its own (the phone's tap highlight would darken it). Keyboard
   focus keeps the site's own outline, so it can't be mistaken for on. */
.wb-tg, .wb-tx {
  position: relative;
  isolation: isolate;
  display: inline-block;
  height: var(--cap);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: var(--lead);
  text-box: trim-both cap alphabetic;
  white-space: nowrap;
}
.wb-tg { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.wb-tg::before {
  content: "";
  position: absolute;
  inset: -2px -3px -1px;
  z-index: -1;
  background: var(--box);
  opacity: 0;
  transition: opacity var(--fade-quick) var(--fade-ease);
}
.wb-tg[aria-pressed="true"]::before,
.wb-field:focus-within::before { opacity: 1; }
@media (hover: hover) {
  .wb-tg:hover::before { opacity: 1; }
}
.wb-field { cursor: ew-resize; touch-action: pan-y; }   /* drag sideways; scroll still works */
.wb-in {
  width: 3ch;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-feature-settings: "lnum" 1, "tnum" 1;
  line-height: inherit;
  cursor: text;
  outline: none;
  vertical-align: baseline;
}

/* ---- 1. tester ---- */
.wb-tester {
  --ts: 112px;           /* size */
  --tlh: 120px;          /* leading: the row pitch */
  --tt: 0;               /* tracking, thousandths of an em */
  --tf: "ss01" 1;
}
.wb-trow { height: var(--tlh); align-items: start; }
.wb-w { grid-column: 1; display: flex; }
.wb-tl {
  grid-column: 2 / -1;
  min-width: 0;
  font-size: var(--ts);
  line-height: 1;
  letter-spacing: calc(var(--tt) * 0.001em);
  font-feature-settings: var(--tf);
  white-space: pre;
  overflow-x: clip;          /* runs off the grid's edge, like a real tester */
  overflow-clip-margin: 0;
  /* Safari on iOS clips a trimmed line's descenders with it: the padding
     takes them in, and the margins give the room back (nothing moves; the
     margins are below, over .wb p's) */
  padding-block: 0.5em;
  text-box: trim-both cap alphabetic;
  caret-color: var(--fg);
  outline: none;
  cursor: text;
}
.wb-tester .wb-tl { margin-block: -0.5em; }
/* the line being edited marks its weight in the rail */
.wb-trow:has(.wb-tl:focus) .wb-w .wb-tg::before { opacity: 1; }

/* ---- 2. paragraphs: a row for each cut, named in the rail, its three
   settings beside it under their sizes (js/specimen.js rounds each block up
   to whole lines) ---- */
.wb-paras { display: grid; row-gap: calc(2 * var(--lead)); }
.wb-prow { align-items: start; }
/* (no wider than the grid: its strip scrolls inside it on phones) */
.wb-pgroup { position: relative; isolation: isolate; min-width: 0; }
.wb-dots { display: none; }
.wb-cut { grid-column: 1; }
.wb-p0 { grid-column: 2 / span 2; }
.wb-p1 { grid-column: 4 / span 2; }
.wb-p2 { grid-column: 6; }
.wb-pt { text-box: trim-both cap alphabetic; hyphens: manual; }

/* ---- 3. glyphs ----
   A large glyph on the left, held in view while the sets scroll past on its
   right: the selected glyph, or the one under the pointer, drawn against the
   face's ascender, cap height, x-height, baseline and descender. The panel
   takes the rail (where the lines are named) and the next columns; its glyph
   size, baseline and height round to whole lines, so the panel's text and
   everything after it stay on the 20px grid. The sets stack on the right, a
   rule between two sets, each set's name across its top and each of its
   glyphs in a box. */
.wb-glyphs {
  /* the face's metrics in ems come with the markup: --asc, --cap-h, --desc,
     --ink (the deepest any glyph reaches) and --xh, which the weight toggles
     change with the weight */
  --stick: calc(var(--mv) + 4 * var(--lead));   /* clear of the page's name */
  --pc: 3;    /* columns the panel takes, the rail's among them */
  --pl: 1;    /* of those, the ones naming the lines */
  /* the lines: 0.5px, which is one device pixel on a 2x screen. On a 1x
     screen a half-pixel line is dropped or drawn grey depending on where it
     falls (Safari drops it, Chrome greys it), so it gets 1px there. */
  --hair: 1px;
}
@media (min-resolution: 2dppx) { .wb-glyphs { --hair: 0.5px; } }
.wb-glyphs { display: flow-root; }   /* holds .wb-sets' bottom margin, see below */
/* (js/specimen.js reads where the page's name ends from this, to scroll a
   glyph picked with the keys clear of it) */
.wb-glyphs { scroll-margin-top: var(--stick); }
.wb-body { align-items: start; }
.wb-panel {
  /* the widest glyph is 1.32 em: the size it fits the glyph's columns at, or
     the window's height if that's less, to a whole 10px, and never under 80px
     (the lines' names need 15px between lines). The glyph is centred on the
     lines' full width, so it's also kept small enough that no glyph's ink
     reaches a line's name: the markup gives, for each line, how far left of
     its centre any glyph reaches at the name's height (--e-*, in ems) and
     how wide the name is (--l-*), and 8px stay between them. */
  --gw: calc((var(--pc) - var(--pl)) * (var(--cw) + var(--g)) - var(--g));
  --w: calc(var(--pc) * (var(--cw) + var(--g)) - var(--g));
  --clear: min(
    (var(--w) / 2 - var(--l-asc, 0px) - 8px) / var(--e-asc, 0.001),
    (var(--w) / 2 - var(--l-cap, 0px) - 8px) / var(--e-cap, 0.001),
    (var(--w) / 2 - var(--l-x, 0px) - 8px) / var(--e-x, 0.001),
    (var(--w) / 2 - var(--l-base, 0px) - 8px) / var(--e-base, 0.001),
    (var(--w) / 2 - var(--l-desc, 0px) - 8px) / var(--e-desc, 0.001));
  --gs: max(80px, round(down, min(var(--gw) / 1.32, var(--clear), (100svh - var(--stick) - var(--strip-h, 0px) - 6 * var(--lead)) / (var(--asc) + var(--ink))), 10px));
  /* the baseline and the panel's height, from the panel's top */
  --base: round(up, calc(var(--lead) + var(--asc) * var(--gs)), var(--lead));
  --stage: round(up, calc(var(--base) + var(--ink) * var(--gs) + var(--gap-s)), var(--lead));
  grid-column: 1 / span var(--pc);
  position: sticky;
  top: calc(var(--stick) + var(--strip-h, 0px));
  z-index: 1;   /* under the page's name, over the sets (their own layer) */
  display: grid;
  grid-template-columns: repeat(var(--pc), minmax(0, var(--cw)));
  column-gap: var(--g);
  align-items: start;
}
.wb-stage { grid-column: 1 / -1; position: relative; height: var(--stage); }
/* one line per metric, named above it at the left */
.wb-metric {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--base) - var(--v) * var(--gs));
  height: var(--hair);
  background: var(--fg);
}
.wb-metric > span {
  position: absolute;
  left: 0;
  bottom: calc(4px + var(--hair));   /* from below the line: 4px clear of it */
  height: var(--cap);
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}
.wb-m-asc { --v: var(--asc); }
.wb-m-cap { --v: var(--cap-h); }
.wb-m-x { --v: var(--xh); }
.wb-m-base { --v: 0; }
.wb-m-desc { --v: calc(-1 * var(--desc)); }
/* the glyph, sitting on the baseline, centred on the lines */
.wb-big {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--stage) - var(--base));
  font-family: var(--wb-family), sans-serif;
  font-size: var(--gs);
  font-weight: var(--wb-w, 400);
  font-style: var(--wb-s, normal);
  line-height: 1;
  text-align: center;
  white-space: pre;
  text-box: trim-both cap alphabetic;
}
/* below it, its code point and its name (which may take two lines) */
.wb-read { grid-column: 1; grid-row: 2; }
.wb-read.wb-gname { font-feature-settings: "lnum" 1; }
.wb-name {
  grid-column: 2 / -1;
  grid-row: 2;
  margin: 0;
  line-height: var(--lead);
  text-box: trim-both cap alphabetic;
}

/* browsers without round(): fixed sizes that fit the narrowest layouts */
@supports not (width: round(down, 1px, 1px)) {
  .wb-panel { --gs: 300px; --base: 340px; --stage: 440px; }
}

/* ---- the sets ---- */
.wb-sets {
  --cy: -10px;    /* a cell starts this far above its glyph's cap height */
  --bx: 4px;      /* between two boxes */
  grid-column: 4 / -1;
  display: flow-root;   /* keeps the last set's margin inside, see below */
  position: relative;
  /* the padding takes in the cells' overhang (nothing moves) */
  margin: var(--cy) 0 calc(-1 * var(--cy));
  padding-top: calc(-1 * var(--cy));
  overflow: clip;
  isolation: isolate;   /* the cells stay under the panel */
}
.wb-set {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.wb-set > * { grid-column: 1; }
.wb-set:last-child { margin-bottom: var(--cy); }
/* a line's room between two sets, and a rule across it, its name's gap above
   the next set's name */
.wb-set + .wb-set { margin-top: var(--lead); }
.wb-set + .wb-set::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--gap-s) - var(--hair));
  left: 0;
  right: 0;
  height: var(--hair);
  background: var(--fg);
  pointer-events: none;
}
/* the set's name (and, on phones, how many more there are) runs across the
   top, a line's room above its glyphs */
.wb-setname { grid-row: 1; display: flex; }
.wb-setname > span { height: var(--cap); text-box: trim-both cap alphabetic; }
.wb-cells {
  grid-row: 2;
  display: grid;
  /* at least 38px a cell, and no more than 40 cells to a row */
  grid-template-columns: repeat(auto-fill, minmax(max(38px, (100% - 39 * var(--bx)) / 40), 1fr));
  column-gap: var(--bx);
  grid-auto-rows: calc(2 * var(--lead));
  margin-top: calc(var(--gap-s) + var(--lead) + var(--cy));
  padding-top: calc(-1 * var(--cy));
  font-size: 26px;
  line-height: 1;
}
.wb-cells > span {
  position: relative;
  isolation: isolate;
  align-self: start;
  text-align: center;
  text-box: trim-both cap alphabetic;
  cursor: default;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
/* each glyph in its own box: its cell, less half the room between boxes on
   each side, the glyph's cap height centred in it */
.wb-cells > span::before {
  content: "";
  position: absolute;
  top: calc(var(--cy) + var(--bx) / 2);
  left: 0;
  right: 0;
  height: calc(2 * var(--lead) - var(--bx));
  z-index: -1;
  /* a shadow, not a border: Chrome draws a border at least 1px wide */
  box-shadow: inset 0 0 0 var(--hair) var(--fg);
  /* hover and selection fade in and out, as the toggles' boxes do */
  transition: background-color var(--fade-quick) var(--fade-ease);
}
@media (hover: hover) {
  .wb-cells > span:hover::before { background: var(--box-dim); }
}
.wb-cells > [aria-selected="true"]::before { background: var(--box); }
/* keyboard focus: a ring inside the box, 3px clear of its edge */
.wb-cells > span:focus-visible::before { outline: 1px solid var(--fg); outline-offset: -4px; }
/* forced colours would drop the fills and shadows the lines are drawn with:
   keep them, in the text colour, at the same place and width. The box colours
   go with them, so the selected glyph gets a ring in the highlight colour;
   the backplate behind the glyph would hide the focus ring, so that's drawn
   above it. */
@media (forced-colors: active) {
  .wb-metric, .wb-set + .wb-set::before { forced-color-adjust: none; background: CanvasText; }
  .wb-dots > span { forced-color-adjust: none; color: GrayText; }
  .wb-dots > .is-on { color: CanvasText; }
  .wb-cells > span::before { forced-color-adjust: none; box-shadow: inset 0 0 0 var(--hair) CanvasText; background: none; }
  .wb-cells > span:hover::before { background: none; }
  .wb-cells > [aria-selected="true"]::before { background: none; box-shadow: inset 0 0 0 3px Highlight; }
  .wb-cells > span:focus-visible::before { z-index: 0; outline-color: CanvasText; }
}

/* ---- 4. features ---- */
.wb-strip .wb-off, .wb-x.wb-off { grid-column: 2 / span 2; }
.wb-strip .wb-on, .wb-x.wb-on { grid-column: 4 / -1; }
.wb-xrow { height: calc(4 * var(--lead)); align-items: start; }
.wb-tag { grid-column: 1; display: grid; row-gap: var(--gap-s); height: auto; }
.wb-tag > span { height: var(--cap); text-box: trim-both cap alphabetic; }
.wb-x {
  min-width: 0;
  font-size: 48px;
  line-height: 1;
  white-space: nowrap;
  overflow-x: clip;
  overflow-clip-margin: 0;
  text-box: trim-both cap alphabetic;
}

/* ---- 5. details, in the description's columns ---- */
.wb-detrow { align-items: start; }
.wb-det {
  grid-column: var(--nav-start, 2) / -1;
  display: grid;
  row-gap: var(--gap-s);
  margin: 0;
}
.wb-drow {
  display: grid;
  grid-template-columns: var(--cw) minmax(0, 1fr);
  column-gap: var(--g);
}
.wb-drow dd { margin: 0; overflow-wrap: anywhere; }
/* a wrapped value's trimmed block is (lines - 1) leads plus the font's own cap
   height; pad it up to --cap so the rows below stay on the leading */
.wb-drow dd p { padding-bottom: calc(var(--cap) - 1cap); }

/* ==== desktop: the glyphs' header stays in view with the large glyph, under
   the page's name, so the weight can be changed anywhere in the set. It
   keeps to the large glyph's columns, clear of the sets: its name, the
   weights beneath that on one line from the first column (into the second
   as they need), and roman or italic in the third column on five columns
   and up, or under the weights on four and fewer. js/specimen.js gives its height
   (--strip-h), which the large glyph is held below. ==== */
@media (min-width: 900px) {
  .wb-glyphs {
    --strip-h: calc(2 * var(--lead));
    scroll-margin-top: calc(var(--stick) + var(--strip-h));
  }
  /* (the header lets go when the large glyph does, at the end of the sets:
     its bottom margin is the glyph panel's height, --panel-h from
     js/specimen.js, so it reaches the section's end at the same moment;
     the body's negative margin takes the room back) */
  .wb-glyphs > .wb-strip {
    position: sticky;
    top: var(--stick);
    z-index: 2;
    margin-bottom: var(--panel-h, 0px);
  }
  .wb-glyphs > .wb-body { margin-top: calc(-1 * var(--panel-h, 0px)); }
  /* Held beside the sets, the large glyph lets go with the baseline of its
     code point and name on the bottom edge of the last boxes: its margin is
     how far the sets' container runs past them (the 10px a cell's box
     starts above its glyph, --cy on the sets, and half the 4px between
     boxes). */
  .wb-panel { margin-bottom: 12px; }
  .wb-glyphs .wb-ctls {
    grid-column: 1 / span 3;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, var(--cw)));
  }
  .wb-glyphs .wb-c-weights { grid-column: 1 / span 2; flex-wrap: nowrap; }
  .wb-glyphs .wb-c-style { grid-column: 3; }
  @container (max-width: 1193px) {
    .wb-glyphs .wb-ctls { grid-column: 1 / span 2; grid-template-columns: repeat(2, minmax(0, var(--cw))); }
    .wb-glyphs .wb-c-style { grid-column: 1; }
  }
}

/* ==== desktop: the tester's controls sit under its name, from the first
   column: size, tracking, the features (two columns) and reset, each
   starting its column, wrapping to another line where the grid has fewer
   columns. (The controls' wrapper steps aside so reset flows with them.) ==== */
@media (min-width: 900px) {
  .wb-tester .wb-rail { grid-column: 1 / -1; }
  .wb-tester .wb-ctls { display: contents; }
  .wb-tester .wb-reset { grid-column: auto; grid-row: auto; justify-self: start; }
}

/* ==== desktop below six columns: the samples fold like on phones ==== */
@media (min-width: 900px) {
  @container (max-width: 1427px) {
    .wb-tester { --ts: 72px; --tlh: 80px; }

    /* each row's three settings stack beside its name, each under its size */
    .wb-strip .wb-cap.wb-d { display: none; }
    .wb-cap.wb-m { display: block; margin-bottom: var(--gap-s); }
    .wb-cn { display: none; }
    .wb-prow { row-gap: var(--lead); }
    .wb-p0, .wb-p1, .wb-p2 { grid-column: 2 / span 2; }

    .wb-strip .wb-off { grid-column: 1 / span var(--half); grid-row: 2; }
    .wb-strip .wb-on { grid-column: span var(--half) / -1; grid-row: 2; }
    .wb-xrow { grid-template-rows: var(--lead) auto; }
    .wb-tag { grid-column: 1 / -1; grid-template-columns: var(--cw) minmax(0, 1fr); column-gap: var(--g); }
    .wb-x { font-size: 36px; grid-row: 2; }
    .wb-x.wb-off { grid-column: 1 / span var(--half); }
    .wb-x.wb-on { grid-column: span var(--half) / -1; }
  }
  /* four columns or fewer: the glyph panel takes the rail and one column */
  @container (max-width: 1193px) {
    .wb-glyphs { --pc: 2; }
    .wb-sets { grid-column: 3 / -1; }
    @supports not (width: round(down, 1px, 1px)) {
      .wb-panel { --gs: 150px; --base: 180px; --stage: 240px; }
    }
  }
  @container (max-width: 959px) {
    .wb-tester { --ts: 54px; --tlh: 60px; }
    .wb-x { font-size: 28px; }

    /* three columns: the glyph panel goes across the top, as on phones, so
       the sets keep the width; here it's still held in view while they
       scroll up beneath it */
    .wb-glyphs { --pc: var(--cols); }
    .wb-panel {
      --gs: max(80px, round(down, min(var(--gw) / 1.32, var(--clear), (45svh - var(--stick) / 2) / (var(--asc) + var(--ink))), 10px));
      grid-column: 1 / -1;
      padding-bottom: var(--lead);
      margin-bottom: calc(var(--gap-l) - var(--lead));
    }
    /* (without round(), as above: this block's own --gs would undo it) */
    @supports not (width: round(down, 1px, 1px)) {
      .wb-panel { --gs: 150px; --base: 180px; --stage: 240px; }
    }
    /* (the tone reaches up behind the header too: here the sets pass
       under both) */
    .wb-panel::before {
      content: "";
      position: absolute;
      inset: calc(-1 * var(--strip-h, 0px) - var(--gap-s)) calc(var(--g) / -2) 0;
      z-index: -1;
      background: linear-gradient(var(--box-soft), var(--box-soft)), var(--bg);
    }
    .wb-sets { grid-column: 1 / -1; }
  }
}

/* ==== phones: the rail folds into a line above each row ==== */
@media (max-width: 899px) {
  .wb-sec + .wb-sec { margin-top: calc(4 * var(--lead)); }
  .wb-d { display: none; }
  .wb-m { display: block; }

  /* reset in the second column, over tracking */
  .wb-reset { grid-column: 2; justify-self: start; }
  .wb-ctls { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(var(--cols), var(--cw)); }
  .wb-ctls > .wb-ctl { grid-column: 1 / -1; }
  /* size in the first column, tracking in the second (under reset) */
  .wb-ctls > .wb-c-num { grid-column: 1; }
  .wb-ctls > .wb-c-track { grid-column: 2 / -1; grid-row: 1; }

  /* tester: weight and number above each line */
  .wb-tester { --ts: 54px; --tlh: 60px; }
  .wb-trow { height: calc(2 * var(--lead) + var(--tlh)); grid-template-rows: var(--lead) auto; }
  .wb-w { grid-column: 1 / -1; }
  .wb-tl { grid-column: 1 / -1; grid-row: 2; }

  /* paragraphs: the cuts stack; each cut's three settings sit side by side
     in a strip that scrolls sideways, out to the screen's edges, each the
     grid's width and captioned with its cut and size. They settle on the
     grid, a gutter apart. The strip's padding above and below takes in
     the ascenders and descenders past the trimmed lines, and its margins
     give the room back. No scrollbar, as for the glyphs. */
  .wb-cut { display: none; }
  .wb-prow {
    --bleed: calc((100cqw - var(--grid-w)) / 2);
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: var(--grid-w);
    margin: calc(-1 * var(--lead)) calc(-1 * var(--bleed));
    padding: var(--lead) var(--bleed);
    scroll-padding-inline: var(--bleed);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .wb-prow::-webkit-scrollbar { display: none; }
  /* three bullets (Precept's own) in the second column, on the captions'
     line, holding still while the strip scrolls: the one for the
     paragraph in view fades to the text colour, the others grey
     (js/specimen.js). They sit under the strip, so the captions pass over
     them. */
  .wb-dots {
    position: absolute;
    z-index: -1;
    top: 0;
    left: calc(var(--cw) + var(--g));
    display: flex;
    column-gap: 3px;   /* as the image viewer's on phones */
    pointer-events: none;
  }
  .wb-dots > span {
    height: var(--cap);
    text-box: trim-both cap alphabetic;
    color: var(--box);
    transition: color var(--fade-quick) var(--fade-ease);
  }
  .wb-dots > .is-on { color: var(--fg); }
  .wb-p0, .wb-p1, .wb-p2 { grid-column: auto; scroll-snap-align: start; }
  .wb-cap.wb-m { margin-bottom: var(--gap-s); }

  /* glyphs: the panel across the top, in its place on the page, on the
     page's own tone; the lines are named at its left, and the glyph is
     centred across it, kept clear of their names (--clear). Its glyph is no
     taller than about a third of the window. */
  .wb-glyphs {
    --stick: calc(var(--mv) + 6 * var(--lead));   /* clear of the page's name */
    --pc: var(--cols);
    --pl: 0;
  }
  .wb-panel {
    --gs: max(80px, round(down, min(var(--gw) / 1.32, var(--clear), (40svh - 4 * var(--lead)) / (var(--asc) + var(--ink))), 10px));
    grid-column: 1 / -1;
    position: relative;
    top: auto;
    padding-bottom: var(--lead);
    margin-bottom: calc(var(--gap-l) - var(--lead));
  }
  @supports not (width: round(down, 1px, 1px)) {
    .wb-panel { --gs: 80px; --base: 120px; --stage: 160px; }
  }
  .wb-read { grid-column: 1 / -1; }
  .wb-panel > .wb-name { grid-column: 1 / -1; grid-row: 3; margin-top: var(--gap-s); min-height: calc(var(--lead) + var(--cap)); }
  /* below it, the sets side by side in one strip that scrolls sideways, out
     to the screen's edges. Boxes step at --pitch: four boxes to a column
     fill the grid's width edge to edge, and the strip settles with whole
     boxes from one edge of the grid to the other. Each set's
     glyphs run in rows of --gc (from the markup), so no set is more than
     five rows tall. A set is a whole number of boxes wide (js/specimen.js
     widens one whose name is wider than its glyphs), an empty box's room
     between two sets. No scrollbar: it would take room under the
     strip on some systems and push what follows off the grid. */
  .wb-sets {
    --bleed: calc((100cqw - var(--grid-w)) / 2);   /* the side margin */
    --pitch: calc((var(--grid-w) + var(--bx)) / (4 * var(--cols)));   /* a box and the room after it */
    grid-column: 1 / -1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: start;   /* every set hangs from the same line */
    column-gap: calc(var(--pitch) + var(--bx));
    margin-inline: calc(-1 * var(--bleed));
    padding-inline: var(--bleed);
    scroll-padding-inline: var(--bleed);
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .wb-sets::-webkit-scrollbar { display: none; }
  .wb-set, .wb-set:last-child { margin-bottom: var(--cy); }
  .wb-set + .wb-set { margin-top: 0; }
  .wb-set + .wb-set::before { display: none; }
  .wb-cells {
    grid-template-columns: repeat(var(--gc, 9), calc(var(--pitch) - var(--bx)));
    font-size: 24px;
  }
  .wb-cells > span { scroll-snap-align: start; }

  /* features: tag line, then off and on side by side, each in half the
     columns (the samples' size, 20px, fits the longest in one column); the
     tag sits over off and the feature's name over on */
  .wb-strip .wb-off { grid-column: 1 / span var(--half); grid-row: 2; }
  .wb-strip .wb-on { grid-column: span var(--half) / -1; grid-row: 2; }
  .wb-xrow { grid-template-rows: auto auto; align-content: start; height: auto; min-height: calc(4 * var(--lead)); }
  .wb-tag { grid-column: 1 / -1; grid-template-columns: repeat(var(--cols), var(--cw)); column-gap: var(--g); padding-bottom: var(--gap-s); }
  .wb-tag > span:first-child { grid-column: 1 / span var(--half); }
  /* a name too long for its columns (the narrowest phones) takes a second
     line; the samples move down a line and the row stays four lines. Its
     trimmed block is padded up to --cap, as the details' values are. */
  .wb-tag > span:last-child { grid-column: span var(--half) / -1; height: auto; padding-bottom: calc(var(--cap) - 1cap); line-height: var(--lead); white-space: normal; }
  .wb-x { font-size: 20px; grid-row: 2; }
  .wb-x.wb-off { grid-column: 1 / span var(--half); }
  .wb-x.wb-on { grid-column: span var(--half) / -1; }

  /* details */
  .wb-detrow { grid-template-rows: calc(2 * var(--lead)) auto; }
  .wb-det { grid-column: 1 / -1; grid-row: 2; }
  /* each detail's name in the first column, its value across the rest */
}

/* phones with one column (under 374px): the tester's default size is one
   at which its longest word, "Singularity" in black italic, fits the
   column; reset at the end of the first line, tracking on a line of its
   own. Each feature stacks: its tag, off, then its name, on, a line's room
   between the two; the off and on headings go (the tag and name say
   which). Each detail's name sits over its value, a line's room between
   one detail and the next, as in the work list. The paragraphs' bullets
   end the captions' line. */
@media (max-width: 899px) {
  @container (max-width: 373px) {
    .wb-reset { grid-column: 1; justify-self: end; }
    .wb-ctls > .wb-c-track { grid-column: 1 / -1; grid-row: auto; }
    .wb-tester { --ts: 28px; --tlh: 40px; }

    .wb-strip .wb-off, .wb-strip .wb-on { display: none; }
    .wb-xrow {
      grid-template-rows: var(--lead) calc(2 * var(--lead)) var(--lead) auto;
      min-height: calc(7 * var(--lead));
    }
    .wb-tag { display: contents; }
    .wb-tag > span:first-child, .wb-tag > span:last-child { grid-column: 1 / -1; grid-row: 1; }
    .wb-tag > span:last-child { grid-row: 3; }
    .wb-x.wb-off, .wb-x.wb-on { grid-column: 1 / -1; }
    .wb-x.wb-on { grid-row: 4; }

    .wb-det { row-gap: calc(var(--lead) + var(--gap-s)); }
    /* no second column: the bullets end the captions' line */
    .wb-dots { left: auto; right: 0; }
    .wb-drow { grid-template-columns: minmax(0, 1fr); row-gap: var(--gap-s); }
  }
}
