/* Each rule sits in one cascade layer, and the line below orders them.
   A later layer wins over an earlier one at any specificity: a class
   rule in components wins over a tag rule in base. ui.Sheet appends
   chart.css, whose rules sit in components after these. */
@layer reset, tokens, base, components, utilities, print;

@layer tokens {
  :root {
    /* Named because two rules have to agree on it: the sidebar's grid
       track and the checkout box above it, which lines up with the column
       or reads as a fourth edge on a page with three. */
    --side-w: 320px;

    /* The settings rail's track. In ch, unlike --side-w, because what has
       to fit is a list of words in the page's own font rather than a diff
       and a set of boxes: 22 is the longest entry plus its indent. */
    --rail-w: 22ch;

    /* The sticky bar's height: its own box, and the offset the things
       below it park at. Spelled out rather than left to the content,
       because a height the browser works out is not a value another rule
       can name. Taller than the tallest thing in the bar, which centers in
       what is left -- a claim about this number that nothing checks, so
       anything added to the bar is measured against it by hand.

       Pixels, not em: em resolves against each element's own font-size, so
       the bar and the box below it agree only while nothing between them
       changes it, and its base is the browser's monospace default rather
       than the document's. One literal number has neither indirection. */
    --head-h: 48px;

    /* The gutter between the page and the window, on every page. Each
       top-level box pads itself by this rather than the body padding
       once, so the sticky bar's background reaches the window's edges
       instead of leaving two strips the diff scrolls through.

       Pixels for the same reason --head-h is: 0.5em was a different
       number on a box in monospace than on one that had not set it yet,
       so the left edge moved from one page to the next.

       16px, the margin the sports site shares (Dan 10/4;
       it was 8 here and 24 on sports). Boxes keep their own 8px of cell
       padding inside it. */
    --gutter: 16px;

    /* The spacing scale. A margin, a padding, or a gap spends a step of
       it, so two rules that name a step stay the same size. A value off
       the scale keeps its literal: 1, 3, 5, 6, and 10px line a control up
       with a 1px border or a 14px glyph, and an em or ch value scales
       with its element's own font on purpose. */
    --spacing--xx-small: 2px;
    --spacing--x-small: 4px;
    --spacing--small: 8px;
    --spacing--medium-small: 12px;
    --spacing--medium: 16px;
    --spacing--large: 24px;

    /* Every color on the site is named here and used nowhere else as a
       literal, so the dark block at the bottom of this file is a second
       set of these values rather than a second copy of the rules. A rule
       that writes a hex code of its own is a rule dark mode does not
       reach, and nothing checks for one.

       The names say what the color is for, not what it looks like:
       --color--text-light is the gray a note is in and --color--text-faint the one an age
       sinks to, and in neither theme is either a gray. Both are Catppuccin -- Latte here, Frappe below -- so
       the page is the same design at two weights, and the same one as the
       terminal it is read beside.

       The two are the same roles filled from each palette: base is the
       page, mantle the tinted row, crust the hover, surface0 the rules
       between rows, surface2 a control's edge, text the words, subtext0
       the notes and ages, overlay1 the faintest thing still read. The
       accents are blue for a link, green for good, red for bad. */
    --color--bg: #fafbfc;
    --color--bg-secondary: #f1f3f7;
    --color--bg-hover: #e6e9ef;
    --color--border-base: #dde0e8;
    --color--border-dark: #acb0be;
    --color--text: #24273a;
    --color--text-light: #6c6f85;
    --color--text-faint: #8c8fa1;
    --color--link: #1e66f5;
    --color--good: #40a02b;
    --color--bad: #d20f39;
    /* Yellow mixed into the page, flat rather than an alpha over it: the
       bar is fixed over the text, and text showing through the one thing
       on the page saying the page is stale is worse than one more hex. */
    --color--bg-warn: #f3e8d6;

    --color--diff-add: rgba(64, 160, 43, 0.14);
    --color--diff-del: rgba(210, 15, 57, 0.12);
    --color--diff-hunk: rgba(30, 102, 245, 0.12);

    --color--overlay-bg: rgba(20, 22, 30, 0.9);
    --color--overlay-text: #fafbfc;

    --color--tok-k: #8839ef;
    --color--tok-n: #1e66f5;
    --color--tok-s: #40a02b;
    --color--tok-m: #fe640b;
    --color--tok-c: #8c8fa1;

    /* One family at two sizes: text is what is read, code is what is
       pasted, typed or diffed and the chrome around it. On a laptop,
       build output and a diff take the text size. */
    --font-mono:
      ui-monospace,
      SFMono-Regular,
      "SF Mono",
      Menlo,
      Consolas,
      "Liberation Mono",
      monospace;
    --font-size--base: 16px;
    --font-size--small: 14px;
    --line-height--base: 1.45;
    --line-height--tight: 1.4;
    --font-weight--normal: 400;
    --font-weight--bold: 600;

    /* The corner of a chart mark, a legend swatch, and the tip. */
    --border-radius--base: 2px;

    /* What the browser draws itself -- form controls, scrollbars, the
       focus ring -- follows this rather than staying light under a dark
       page. */
    color-scheme: light dark;
  }

  /* Dark mode: the same roles, filled from Frappe instead of Latte. Only
     the tokens above are restated, since every rule reads one of them --
     a page that looks wrong here is a rule that wrote a color of its
     own.

     Frappe is one step darker than base for its tinted row where Latte is
     one step lighter, so --color--bg-secondary is surface0 here and mantle there. The
     rest line up.

     The diff tints are their accents at low alpha rather than flat fills:
     neither palette has near-base backgrounds that read as "added" and
     "removed", and a tint mixed with whatever is under it is right on the
     box and on the sticky header both. */
  @media (prefers-color-scheme: dark) {
    :root {
      --color--bg: #303446;
      --color--bg-secondary: #414559;
      --color--bg-hover: #51576d;
      --color--border-base: #51576d;
      --color--border-dark: #626880;
      --color--text: #d5dbf0;
      --color--text-light: #a5adce;
      --color--text-faint: #838ba7;
      --color--link: #8caaee;
      --color--good: #a6d189;
      --color--bad: #e78284;
      --color--bg-warn: #514f53;

      --color--diff-add: rgba(166, 209, 137, 0.14);
      --color--diff-del: rgba(231, 130, 132, 0.14);
      --color--diff-hunk: rgba(140, 170, 238, 0.14);

      --color--overlay-bg: rgba(20, 22, 30, 0.92);
      --color--overlay-text: #d5dbf0;

      --color--tok-k: #ca9ee6;
      --color--tok-n: #8caaee;
      --color--tok-s: #a6d189;
      --color--tok-m: #ef9f76;
      --color--tok-c: #838ba7;
    }
  }

  /* The charts come from github.com/croaky/chart: Go builds them, its
     views write them, and chart.css paints them. ui.Sheet serves that
     sheet after this one. It reads the tokens above, so a chart wears
     the dashboard's colors and type, and these, which only a chart
     spends: the accent of a focused mark, the tip's shadow and stack
     order, the series and ramp colors, and the chart sizes. */
  :root {
    --color--accent: var(--color--link);
    --box-shadow--base: 0 4px 12px rgba(0, 0, 0, 0.15);
    --z-index--component: 10;

    --color--series-1: #1e66f5;
    --color--series-2: #fe640b;
    --color--series-3: #40a02b;
    --color--series-4: #8839ef;
    --color--series-5: #df8e1d;
    --color--series-6: #ea76cb;
    --color--series-7: #179299;
    --color--series-8: #dd7878;
    --color--series-9: #04a5e5;
    --color--series-10: #7287fd;

    /* The ramp the status classes of the requests chart take. */
    --color--ramp-1: #e6e9ef;
    --color--ramp-2: #bcc0cc;
    --color--ramp-3: #8caaee;
    --color--ramp-4: #7287fd;
    --color--ramp-5: #ea76cb;
    --color--ramp-6: #fe640b;
    --color--ramp-7: #e78284;
    --color--ramp-8: #d20f39;

    --chart-height: 12rem;
    --chart-x-label-height: 24px;
    --chart-y-axis-width: 48px;
    --chart-bar-share: 60%;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --color--series-1: #8caaee;
      --color--series-2: #ef9f76;
      --color--series-3: #a6d189;
      --color--series-4: #ca9ee6;
      --color--series-5: #e5c890;
      --color--series-6: #f4b8e4;
      --color--series-7: #81c8be;
      --color--series-8: #ea999c;
      --color--series-9: #85c1dc;
      --color--series-10: #babbf1;

      --color--ramp-1: #303446;
      --color--ramp-2: #414559;
      --color--ramp-3: #51576d;
      --color--ramp-4: #8caaee;
      --color--ramp-5: #ca9ee6;
      --color--ramp-6: #ef9f76;
      --color--ramp-7: #ea999c;
      --color--ramp-8: #e78284;
    }
  }
}

@layer base {
  /* iOS Safari inflates the text of a block wider than the screen, and the
     diff patch is one (SOC-6S made it as wide as its longest line). Pinning
     the size keeps every page at the size the CSS says. */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* The gutter is the pages', so the body has none of its own. */
  body {
    /* Figures of equal width, so columns of counts line up. */
    font-variant-numeric: tabular-nums;
    margin: 0;
    background: var(--color--bg);
    color: var(--color--text);
    font-family: var(--font-mono);
    font-size: var(--font-size--base);
    line-height: var(--line-height--base);
    text-wrap: pretty;
  }

  /* The UA's link blue is a fixed color, so it survives the dark palette
     and is the one thing on the page still drawn for a white background.
     A rule in components wins over this one, so a link that wants the
     row's color says color: inherit there. */
  a:link,
  a:visited {
    color: var(--color--link);
  }

  /* A form's UA margin would stack on the gap between sections. */
  form {
    margin: 0;
  }

  /* A box in the page's font, not the platform's pill in the system
     font -- the one thing on a page that lines up with nothing. */
  button,
  input[type="submit"] {
    font: inherit;
    color: inherit;
    background: var(--color--bg);
    border: 1px solid var(--color--border-dark);
    border-radius: 0;
    padding: var(--spacing--x-small) 10px;
    cursor: pointer;
  }

  button:hover,
  input[type="submit"]:hover {
    background: var(--color--bg-hover);
  }

  /* A field dresses like the button beside it, in the page's colors: the
     browser's default white slab is the loudest thing on a gray page,
     and the key form was three of them. */
  input[type="text"],
  input:not([type]) {
    font: inherit;
    color: inherit;
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    border-radius: 0;
    padding: var(--spacing--x-small) 6px;
  }

  /* A select dresses like the field beside it for the same reason: the
     platform's own dropdown reads as a control from another page. */
  select {
    font: inherit;
    color: inherit;
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    border-radius: 0;
    padding: var(--spacing--x-small) 6px;
  }

  /* An age sinks to the faint gray wherever it prints: when a thing
     happened answers a rarer question than the thing itself, and the one
     number that earns the eye on a check row is how long it took. */
  time {
    color: var(--color--text-faint);
  }

  /* One family, two sizes. Text and navigation are --font-size--base; what is
     pasted, typed or diffed, and dense data, is --font-size--small. The stack names
     real faces: the bare generic "monospace" makes Safari shrink code
     and pre below the buttons around them. Weights are 400 and 600. */
  code,
  pre,
  kbd,
  samp,
  button,
  input,
  select,
  textarea {
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    line-height: var(--line-height--tight);
    font-weight: var(--font-weight--normal);
  }

  /* On a phone the file row is the name, then one right-aligned cluster of
     the two counts. The five-character stat columns on the left held a
     pair of numbers and took width the filename wants, and a path on a
     phone cannot be pasted into a terminal, so the copy buttons go too.
     The command boxes copy on a tap instead (script.js). Where a pointer
     hovers, the table and the buttons stay. */
  @media (width < 48em) {
    button[data-copy] {
      display: none;
    }
  }

  [data-perf-plot] {
    cursor: crosshair;
    user-select: none;
  }
}

@layer components {
  /* On a phone the header of a page with a clone or checkout command,
     or with service tabs, is a 40px sticky row. Every sticky offset
     reads --head-h, so it follows. These set a token, but they hang off
     a class, so they sit here: a rule in components beats the default
     in tokens. */
  @media (width < 48em) {
    .checkout {
      :root:has(&) {
        --head-h: 40px;
      }
    }

    .page-head {
      :root:is(:has(& > .checkout), :has(.service-nav)) {
        --crumb-h: 40px;
        --head-h: 40px;
      }
    }
  }

  /* The logs page keeps the reader's line itself when it adds older
     lines above. The browser's own scroll anchoring would move the page
     by the same amount a second time. */
  .logs {
    html:has(&) {
      overflow-anchor: none;
    }
  }

  /* The gate's code field is the page's one job, so it is the biggest
     target on it: six spaced digits, readable from the phone held up to
     the screen. letter-spacing spreads them; the width counts the five
     gaps along. */
  .otp {
    font-size: 1.6em;
    font-family: var(--font-mono);
    letter-spacing: 0.6em;
    padding: 6px var(--spacing--x-small) 6px
      var(--spacing--medium-small);
    width: 10.2ch;
  }

  /* An image viewer for comment screenshots.
     The dialog fills the viewport.
     The backdrop dims the page behind the image. */
  .image-viewer {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    padding: var(--spacing--medium-small);
    box-sizing: border-box;
    background: transparent;
    border: none;
    outline: none;
    overflow: hidden;
  }

  .image-viewer[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing--small);
  }

  .image-viewer::backdrop {
    background: var(--color--overlay-bg);
  }

  @media (width < 48em) {
    .image-viewer {
      padding: var(--spacing--small);
    }
  }

  /* The instance's logo, where the word sockeye was. One line high, so the
     header keeps its height whatever size the operator uploaded. */
  .brand {
    display: inline-block;
    vertical-align: middle;
    height: 24px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
  }

  /* The UA's 1em on a pre would double the header's gap, and live output
     arrives in a second pre, whose margin would read as a hole in the
     middle of the text. */
  .output {
    margin: 0;
    padding: 0 var(--gutter);
  }

  /* Build output and a diff are read line by line, as a description is.
     At code size they read smaller than the description above them. So
     on a laptop they take the text size. A phone keeps the code size,
     so more of each line fits the narrow screen. .output is also the
     fenced code in a rendered document. */
  @media (width >= 800px) {
    .output,
    .diff-patch {
      font-size: var(--font-size--base);
    }
  }

  /* Every page's text, spaced by padding since there are no blank lines
     to do it with. The sides are the shared gutter, so the left edge is
     the same on every page. The top is the header's above it: every page
     opens with one, and its margin is the space below the breadcrumb. */
  .page-text {
    margin: 0;
    padding: 0 var(--gutter) 1em;
    font-family: var(--font-mono);
  }

  .page-text > * + * {
    margin-top: 1.5em;
  }

  .page-text section > b {
    display: block;
    margin-bottom: 0.4em;
  }

  /* Prose wraps to the window, up to the 72 columns it was written for. */
  /* A paragraph is read, so it takes the prose voice; the rows and ids
     around it stay monospace. */
  .page-text p {
    line-height: var(--line-height--base);
    max-width: 72ch;
    margin: 0 0 0.4em;
  }

  .page-text p:last-child {
    margin-bottom: 0;
  }

  /* A command to copy, in the box the checkout command uses, so a reader
     can tell what to paste from what to read. As wide as the command: a
     border out to the window's edge is a rule through empty space. */
  .cmd {
    width: fit-content;
    max-width: 72ch;
    margin: 0.4em 0;
    padding: var(--spacing--x-small) var(--spacing--small);
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
    overflow-x: auto;
  }

  /* The logged-out page is read on a phone, where a command that runs off
     the screen cannot be read to be typed. Its commands wrap, breaking
     anywhere, in the box that holds them. */
  .steps .cmd {
    max-width: 100%;
    box-sizing: border-box;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: var(--font-size--small);
  }

  /* A copy button on the corner of a command box, as on the public site.
     The box holds the margin, so the button sits on the command, and the
     command leaves room on its right for the button. Transparent until
     the box is hovered, in the same hover-only block as .copy-path. A
     phone hides button[data-copy], and a tap on the command copies it
     (script.js). */
  .copy-box {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0.4em 0;
  }

  .copy-box > .cmd {
    margin: 0;
    padding-right: 8ch;
  }

  /* A full commit range must scroll inside the diff column on a phone. */
  .diff-section .copy-box > .cmd {
    max-width: 100%;
    box-sizing: border-box;
  }

  .copy-box > button {
    position: absolute;
    top: 3px;
    right: 3px;
    padding: 1px var(--spacing--small);
  }

  @media (width < 48em) {
    .copy-box > .cmd {
      padding-right: var(--spacing--small);
    }
  }

  /* Beside a line of text rather than standing on its own. */
  .rows button,
  .rows input[type="submit"] {
    padding: 1px var(--spacing--small);
  }

  /* A repo card on /settings holds one repo, its deploy targets, and
     the commands that set the repo up on a machine. The border shows
     which commands belong to which repo. One column on a phone; at
     800px and wider, as many 360px columns as the page holds, so a wide
     screen shows more repos and less empty space. */
  .repo-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing--small);
  }

  @media (width >= 800px) {
    .repo-cards {
      grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
      gap: var(--spacing--medium-small);
    }
  }

  .repo-card {
    border: 1px solid var(--color--border-base);
    padding: var(--spacing--small) 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--color--bg);
  }

  .repo-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
  }

  .repo-card-title {
    display: flex;
    align-items: baseline;
    gap: 1ch;
    min-width: 0;
  }

  .repo-card-name {
    font-weight: var(--font-weight--bold);
    overflow-wrap: anywhere;
  }

  .repo-card-meta {
    display: flex;
    align-items: baseline;
    gap: 1ch;
    color: var(--color--text-light);
    white-space: nowrap;
  }

  .repo-card-why {
    color: var(--color--text-light);
    overflow-wrap: anywhere;
  }

  .repo-card-state {
    color: var(--color--bad);
  }

  .repo-card-service {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    color: var(--color--text-light);
    font-size: var(--font-size--small);
    line-height: var(--line-height--tight);
    padding-left: 1ch;
  }

  .repo-card-service .service-name {
    overflow-wrap: anywhere;
  }

  .repo-card-service .service-live {
    white-space: nowrap;
    text-align: right;
  }
  /* The setup disclosure is the card's last line. A rule divides it
     from the facts above it, and the card's border holds both. A command
     wider than the card scrolls sideways inside its own box. */
  .repo-card-setup {
    margin-top: var(--spacing--xx-small);
    padding-top: 6px;
    border-top: 1px solid var(--color--border-base);
  }

  .repo-card-setup > summary {
    cursor: pointer;
    color: var(--color--text-light);
    width: fit-content;
    padding: var(--spacing--xx-small) var(--spacing--x-small);
    margin-left: -4px;
    font-size: var(--font-size--small);
  }

  .repo-card-setup[open] > summary {
    color: var(--color--text);
  }

  .repo-card-setup .cmd {
    margin-top: var(--spacing--x-small);
    margin-bottom: 0;
    max-width: 100%;
    box-sizing: border-box;
    font-size: var(--font-size--small);
  }

  /* A table in markup and a grid in layout. The columns line up down the
     page, which a per-row grid would not do, and table layout gives a
     drag its granularity: a selection leaving a cell snaps to whole cells
     and then to whole rows. display: contents hands every cell to one
     grid spanning the list, so it lines up and selects like text.

     A grid must be told its column count, so each table names its
     tracks in a class of its own, such as .repo-cols or .set-cols. The
     last column takes the slack and wraps, so a long title ends at the
     window.

     The gap is the grid's rather than padding on a cell, so the space
     between two columns belongs to neither and a drag starting there
     begins in neither. */
  .rows {
    display: grid;
    width: fit-content;
    column-gap: 1.5em;
    row-gap: var(--spacing--x-small);
    align-items: baseline;
  }

  .rows tbody,
  .rows tr {
    display: contents;
  }

  .rows td {
    padding: 0;
  }

  .row-time,
  .row-id {
    white-space: nowrap;
  }

  .row-title,
  .row-name {
    overflow-wrap: anywhere;
  }

  /* An id is a word, not a sentence: any click inside it takes the whole
     id, so a reader need not land on both of its edges. */
  .row-id a {
    -webkit-user-select: all;
    user-select: all;
  }

  /* A repo's section in four columns -- the change, its title, the refs
     pointing at it, and when it landed. The title takes the slack, so the
     two columns on the right sit against the page's edge however long a
     title is.

     The time is last, so the one column a reader scans for "when" is in
     one place: with the refs after it the times stepped left and right
     down the page as rows carried one or did not.

     Each section is a table of its own, so a track sized to its own
     contents would put every section's times at a different place across a
     page of them. The width is the page's and the id and time tracks have
     a floor, so the columns line up from one section to the next: 8ch is a
     change id or a short sha, and 9ch the longest "115m ago". Either grows
     past it if something longer turns up.

     One bordered box with a rule between rows, the way the change page
     draws its checks, its deploys, and its files: a section is a list of
     the same kind, and a page of loose lines beside a page of boxes read
     as two designs. The space between columns is the cells' padding
     rather than a grid gap, since a gap would break the rule between two
     rows.

     The cells stretch rather than sit on their baselines: the rule between
     two rows is drawn on the tops of four cells, and a cell only as tall as
     its own text puts its share of that rule at its own height. */
  .rows.repo-cols {
    width: 100%;
    column-gap: 0;
    row-gap: 0;
    align-items: stretch;
    border: 1px solid var(--color--border-base);
    grid-template-columns:
      minmax(8ch, max-content) minmax(0, 1fr)
      max-content minmax(9ch, max-content);
  }

  .rows.repo-cols td {
    padding: 6px var(--spacing--small);
  }

  .rows.repo-cols tr + tr td {
    border-top: 1px solid var(--color--border-base);
  }
  /* Against the box's edge, so the ages read as one column rather than
     one ragged on the right because "2h" is shorter than "29h". */
  .rows.repo-cols .row-time {
    text-align: right;
  }

  /* The whole row is the target, the way a check, a deploy, or a file in
     the diff is: a reader aiming at a line should not have to hit the
     eight characters at its left edge. script.js follows the id's link
     for a click anywhere else on the row.

     A commit no change here produced has nowhere to go, so it gets
     neither the tint nor the cursor: a row that lights up under the
     pointer and does nothing when clicked is worse than one that never
     offered. The tint is on the cells rather than the row, since a row
     in this grid is display: contents and paints nothing.

     With the row clickable the id no longer has to carry the click, so
     it drops the blue and the underline for the gray the ages and the
     notes are in. What is left in the row's own color is the subject,
     which is what a reader is scanning for. */
  .rows.repo-cols .row-link:hover td {
    background: var(--color--bg-secondary);
    cursor: pointer;
  }

  .rows.repo-cols .row-id,
  .rows.repo-cols .row-time {
    color: var(--color--text-light);
  }

  .rows.repo-cols .row-id a {
    color: inherit;
    text-decoration: none;
  }

  .rows.repo-cols .row-id a:hover {
    text-decoration: underline;
  }

  .rows.repo-cols .row-title a {
    color: inherit;
    text-decoration: none;
  }

  .rows.repo-cols .row-title a:hover {
    text-decoration: underline;
  }

  /* A repo's errors in the same box as its changes, so the two tabs read
     as one design: id, title, the service, the count, and when the group
     was last seen, the time against the edge as a change's is. */
  .rows.repo-cols.err-cols {
    grid-template-columns:
      minmax(8ch, max-content) minmax(0, 1fr)
      max-content minmax(4ch, max-content) minmax(9ch, max-content);
  }

  .rows.repo-cols .row-svc,
  .rows.repo-cols .row-count,
  .rows.repo-cols .row-who {
    color: var(--color--text-light);
    white-space: nowrap;
  }

  /* A repo's deploys in the same box: the range it shipped, the changes
     in that range, who sent it, the service, and when. The changes take
     the slack, so who and where line up against the right edge. */
  .rows.repo-cols.dep-cols {
    grid-template-columns:
      minmax(8ch, max-content) minmax(0, 1fr)
      max-content max-content minmax(9ch, max-content);
  }

  .rows.repo-cols.dep-cols .dep-sha {
    display: none;
  }

  .rows.repo-cols .row-count {
    text-align: right;
  }

  /* What points at a commit, in one column down the page, so a reader
     scanning it sees where the branch and each service are. Right-aligned,
     since the column is as wide as the busiest row in the section and the
     time is against the edge on its other side.

     The pills sit on the row's first line rather than stretching: the cell
     is as tall as the tallest of the four, and a pill grown to fill it is a
     box around empty space. */
  .row-refs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: var(--spacing--x-small);
    white-space: nowrap;
    text-align: right;
  }

  /* Four columns need a window wide enough for four. Below that the title
     track is the only one that can give -- the refs are nowrap and the id
     and the time have floors -- so it gave until a title was one letter
     per line and the page was mostly rules.

     So a narrow window gets a row per row instead of a grid per section:
     the id and the age on a line, then the title, then the refs under it,
     each row a grid of its own. The columns no longer line up from one
     section to the next, which was the point of the shared grid, but on a
     phone there is one column of anything and nothing to line up with.

     The rule between two rows moves to the row, since a row is a box here
     rather than four cells in a grid, and a border on each of the four
     would draw three rules through the middle of one row. */
  @media (width < 48em) {
    .rows.repo-cols,
    .rows.repo-cols tbody {
      display: block;
    }

    .rows.repo-cols tr {
      display: grid;
      grid-template-columns: max-content minmax(0, 1fr);
      padding: 6px var(--spacing--small);
      /* The code size, the one a diff's file names are drawn in: a
         row of id, title, and refs is a list of names, and at the text
         size a title took two or three lines of a phone. */
      font-size: var(--font-size--small);
      line-height: var(--line-height--tight);
    }

    .rows.repo-cols tr + tr {
      border-top: 1px solid var(--color--border-base);
    }
    /* A row is a box of its own here, so it holds the tint itself rather
       than handing it to four cells. */
    .rows.repo-cols .row-link:hover {
      background: var(--color--bg-secondary);
      cursor: pointer;
    }

    .rows.repo-cols .row-link:hover td {
      background: none;
    }

    .rows.repo-cols tr + tr td {
      border-top: 0;
    }

    .rows.repo-cols td {
      padding: 0;
    }
    /* Source order is id, title, refs, time; the age belongs beside the id
       it dates, and a grid item is placed in order. */
    .rows.repo-cols .row-id {
      order: 1;
    }

    .rows.repo-cols .row-time {
      order: 2;
    }

    .rows.repo-cols .row-title {
      order: 3;
    }

    .rows.repo-cols .row-refs {
      order: 4;
    }

    .rows.repo-cols .row-title,
    .rows.repo-cols .row-refs {
      grid-column: 1 / -1;
    }
    /* Under the title now, not against the page's right edge. */
    .rows.repo-cols .row-refs {
      justify-content: flex-start;
      text-align: left;
    }
    /* Between the lines of one row, not around them: the row's own
       padding is the space at its edges. A cell with nothing in it --
       a change with no title yet, a commit nothing points at -- is not
       a line, so it gets no gap above it. */
    .rows.repo-cols .row-title:not(:empty),
    .rows.repo-cols .row-refs:not(:empty) {
      margin-top: var(--spacing--x-small);
    }
    /* An error row's service and count share the line under its title,
       the service in the id's column and the count beside it. */
    .rows.repo-cols .row-svc {
      order: 4;
      margin-top: var(--spacing--x-small);
    }

    .rows.repo-cols .row-count {
      order: 5;
      margin-top: var(--spacing--x-small);
      text-align: left;
    }
    /* A deploy row's sender leads the line under its changes, the
       service beside it. Source order breaks the tie with the service.
       A restart has no sender, so its empty cell takes no place. */
    .rows.repo-cols .row-who {
      order: 4;
      margin-top: var(--spacing--x-small);
      padding-right: 1.5ch;
    }

    .rows.repo-cols .row-who:empty {
      display: none;
    }
    /* The sha alone: the range is a laptop's, where it fits on the
       line and a reader can paste it into git. */
    .rows.repo-cols.dep-cols .dep-range {
      display: none;
    }

    .rows.repo-cols.dep-cols .dep-sha {
      display: inline;
    }
  }

  /* A ref is drawn the way `git log` decorates a commit: a name on the one
     commit it points at, and where everything else sits relative to it is
     the order the rows are already in. One shape for both kinds, so they
     read as one family.

     The branch is in the gray the notes and the ages are in, and the
     service is in the green that means live everywhere else on the site,
     so the column has one color and it means the same thing there as it
     does beside a check. This page has four -- green for good, red for
     bad, gray for a fact, blue for a link -- and a fifth for the branch
     would be a color a reader has to be taught.

     The two used to be a left edge on the row instead, both of them, which
     put two bars of near enough the same weight in one column and asked a
     reader to tell them apart by hue. A name in a box does not need the
     hue to say which it is. */
  /* A ref that links carries no underline: the box is already the thing
     a pointer aims at, and a rule under a name inside one draws a second
     edge through it. It answers to the pointer the way a button does
     instead, with the same tint. */
  .ref {
    text-decoration: none;
    padding: 0 0.5em;
    border: 1px solid currentcolor;
    border-radius: 1em;
    font-size: var(--font-size--small);
    /* Shorter than the row's own line, so a pill never makes its row
       taller: at 1.5 the pill plus its border outgrew the text line and
       every row with a ref stood higher than the rows beside it. */
    line-height: 1.2;
  }

  .ref:is(a):hover {
    background: var(--color--bg-hover);
  }

  .ref-branch {
    color: var(--color--text-light);
  }

  .ref-deploy {
    color: var(--color--good);
  }

  /* /settings: a contents rail and the groups beside it.

     One column by default, so a phone gets the page and not the index of
     it; two once there is room. The rail is written first, being the index,
     and order puts it back under the reading in one column -- a screen that
     opens on a table of contents is one where the reader scrolls past it
     every time.

     The gutter is the grid's here, so the main column drops the padding
     .page-text gives every other page: the two would stack, and the left
     edge of this page would not be the left edge of the one before it. */
  .settings {
    display: grid;
    margin: 0 0 1em;
    padding: 0 var(--gutter);
    font-family: var(--font-mono);
    row-gap: 1.5em;
  }

  .settings > .page-text {
    padding: 0;
  }

  .settings-rail {
    order: 0;
  }
  /* In one column the rail is first (Dan 10/4: a phone opens on the index
     and taps to a section), so it is drawn small: its links flow in a
     wrapped line instead of a list of eleven rows that would push the
     first section a screen down. The nesting is flattened, since a
     wrapped line has no room for an indent. Two columns restore the list
     below. */
  @media (width < 800px) {
    .settings-rail > ul {
      display: flex;
      flex-wrap: wrap;
      gap: 0 1.2em;
    }

    .settings-rail li,
    .settings-rail ul ul {
      display: contents;
    }
  }
  /* min-width: 0 because a grid item otherwise refuses to shrink below its
     content: a token, a DSN, or a regexp is as wide as somebody made it,
     and a column grown to fit one would push the rail off screen. What is
     too wide scrolls in its own .cmd box. */
  .settings-main {
    order: 1;
    min-width: 0;
  }
  /* A command box is as wide as its text up to 72ch, which on a phone is
     wider than the screen: a long commit-subject pattern pushed the whole
     page sideways. The box stops at the column and scrolls inside
     itself. */
  .settings-main .cmd {
    max-width: 100%;
  }

  /* The rail is anchors into this page, so every target needs the sticky
     bar's height cleared: without it the browser scrolls the heading to
     the top of the window, which is under the bar. */
  .set-group,
  .settings-main section {
    scroll-margin-top: calc(var(--head-h) + 8px);
  }

  /* A group is two or three sections under one word. The same size and
     weight as everything else on the page -- there is one type size on this
     site, and a heading that broke it would be the only one -- so what says
     it is a group is the rule under it and the room above it. The sections
     inside already open with a bold word, and a group told apart from them
     by weight alone read as one more section. */
  .set-group {
    font: inherit;
    font-weight: var(--font-weight--bold);
    margin: 0 0 0.4em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid var(--color--border-dark);
  }
  /* More room above a group than between the sections inside it, so the
     boundary a reader is looking for is the wider gap. Not the first,
     which would leave a hole under the breadcrumb. */
  .settings-main > .set-group {
    margin-top: 2.5em;
  }

  .settings-main > .set-group:first-child {
    margin-top: 0;
  }

  /* A section's name and its count on one line, the count against the
     right edge of the box below it: what a scan of this page is after is
     the number, and a column of them reads as a column only if they line
     up with something. The gray the ages and the notes are in, since it is
     a fact about the list and not a heading. */
  .set-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 2em;
    margin-bottom: 0.4em;
  }

  .set-head > b {
    margin: 0;
  }

  .set-more {
    margin: 0.4em 0 0;
  }

  .set-count {
    color: var(--color--text-light);
    white-space: nowrap;
  }

  /* The rail. A list of words, so it drops the bullets and the indent a
     browser gives one; the nesting is the left edge instead. Sticky beside
     the reading, which is longer than a screen and the reason the rail
     exists.

     The links are gray until hovered. A column of eleven blue underlines
     beside the page is a second page, where what is wanted is a map of
     this one. */
  .settings-rail ul {
    list-style: none;
    margin: 0.4em 0 0;
    padding: 0;
  }

  .settings-rail ul ul {
    margin: 0;
    padding-left: 2ch;
  }

  .settings-rail li {
    line-height: 1.6;
  }

  .settings-rail a {
    color: var(--color--text-light);
    text-decoration: none;
  }

  .settings-rail a:hover {
    color: var(--color--link);
    text-decoration: underline;
  }

  /* Every explanation on the page, and every form that adds something.
     The whole line is the target, not the triangle a browser draws at the
     start of it, so the marker stays and the row gets the tint a button
     does: the prose is worth reading once and worth not reading again on
     the way to a control.

     Gray while closed, since a stack of them under a table is a list of
     things a reader may ignore. Open, the words are the page's own color:
     somebody is reading them. */
  .settings-main details {
    margin-top: 0.4em;
  }

  .settings-main summary {
    cursor: pointer;
    width: fit-content;
    padding: var(--spacing--xx-small) var(--spacing--x-small);
    margin-left: -4px;
    color: var(--color--text-light);
  }

  .settings-main summary:hover {
    background: var(--color--bg-secondary);
  }

  .settings-main details[open] > summary {
    color: var(--color--text);
  }
  /* The contents indented under the line that opened them, so an open
     disclosure is a block a reader can see the extent of rather than text
     that resumes the page. */
  .settings-main details[open] > :not(summary) {
    margin-top: 0.4em;
    padding-left: 2ch;
  }

  /* Space between a section's controls and the table above them, and
     between the fields of a form that has more than one line of them. */
  .settings-main section > * + :not(details) {
    margin-top: 0.4em;
  }

  .settings-main form > div + div {
    margin-top: 0.4em;
  }

  .settings-main form > div + input {
    margin-top: 0.4em;
    display: block;
  }

  /* Every list on /settings in one grid: an id, a name that takes the
     slack, a state, and what can be done about the row. The width is the
     page's and three of the four tracks are a fixed number of characters,
     so the id, the state, and the action are each in one column from the
     top of the page to the bottom.

     That alignment is the whole reason this class exists. The lists were
     .cols-N tables sized to their own contents -- fit-content, a track per
     column count -- so six sections meant six column rhythms down one page
     and nothing lined up with the section above it.

     Fixed rather than the minmax(Nch, max-content) the home page's
     .repo-cols uses, which is the difference between them and the reason
     for it: a grid sizes its tracks from its own rows, so max-content there
     still lets a busy section set a width no other section shares. On the
     home page every section holds the same kind of row and they come out
     near enough alike. Here they do not -- "remove service" is a third
     wider than "revoke", and one long button pulled a whole table's state
     column left of every other one. So the numbers are said once: 10ch is
     an age or a slug, 15ch the longest state -- "(not deployed)" -- and
     19ch the widest button, "remove service" plus what a button and a cell
     pad themselves by.
     Anything longer than its track overflows the cell rather than widening
     it, which is the trade: a control that does not fit is a number to
     change here, where the other three tables can be looked at at the same
     time. A button's label is also the "do" its form posts, so the label is
     not the thing to shorten.

     The box is the shape every other list on the site is drawn in: one
     border, a rule between rows, the cells stretching rather than sitting
     on their baselines, since the rule is drawn on the tops of four cells
     and a cell only as tall as its own text puts its share of it at its own
     height.

     A row with nothing to say in a track leaves the cell empty rather than
     spanning past it, so the columns hold. The exception is a row whose id
     is its name -- an account -- which spans the first two: a person's name
     belongs at the box's left edge, and the two columns a reader scans are
     untouched either way. */
  .rows.set-cols {
    width: 100%;
    column-gap: 0;
    row-gap: 0;
    align-items: stretch;
    border: 1px solid var(--color--border-base);
    grid-template-columns: 10ch minmax(0, 1fr) 15ch 19ch;
  }

  .rows.set-cols td {
    padding: 6px var(--spacing--small);
  }

  /* The token rows carry five facts to the account and key rows'
     three: four tracks against five cells shifts every row one
     cell sideways. The count is in the class, so a row and its tracks
     drift only when both change. */
  .rows.set-cols.set-cols-5 {
    grid-template-columns: 10ch minmax(0, 1fr) 15ch 15ch 19ch;
  }

  .rows.set-cols tr + tr td {
    border-top: 1px solid var(--color--border-base);
  }

  .rows.set-cols .row-wide {
    grid-column: 1 / 3;
  }
  /* An error group's row on /errors is a click target, as a change's row
     on home is: script.js follows the link in .row-name. The tint says so
     before the click. */
  .rows.set-cols .row-link:hover td {
    background: var(--color--bg-secondary);
    cursor: pointer;
  }
  /* The error list's status filter. The current status is bold text
     rather than a link, so the reader sees which list this is. */
  .error-evidence {
    overflow-wrap: anywhere;
    margin-block: 1rem;
  }

  .err-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1em;
    margin-bottom: 0.4em;
  }
  /* A fact about the row, in the gray the ids and the ages are in, and
     against its track's right edge for the reason .repo-cols right-aligns
     its times: the column is as wide as the longest thing any section puts
     in it, and left-aligned it read as one column ragged on the right
     because "master" is longer than "main" and "(not deployed)" longer than
     a short sha. */
  .rows.set-cols .row-state {
    color: var(--color--text-light);
    white-space: nowrap;
    text-align: right;
  }
  /* Against the box's edge, so the buttons read as one column rather than
     one ragged on the left because "deactivate" is longer than "revoke". */
  .rows.set-cols .row-act {
    text-align: right;
    white-space: nowrap;
  }

  /* Four tracks need a window wide enough for four, and below that a row
     is two lines in the four corners, like a check on a change: what the
     row is and what can be done to it on the first line, what it says
     about itself on the second. The name is top left and the action is top
     right; the facts are on the second line, the last one against the right
     edge. The columns no longer line up from one section to the next,
     which was the point of the shared grid, but on a phone there is one
     column of anything and nothing to line it up with.

     The code size, the one the home page's rows and a diff's file names
     are drawn in (Dan 10/4): a row of names at the text size took two or
     three lines of a phone. */
  @media (width < 48em) {
    .repo-card {
      padding: 6px var(--spacing--small);
      font-size: var(--font-size--small);
      line-height: var(--line-height--tight);
    }

    .rows.set-cols,
    .rows.set-cols tbody {
      display: block;
    }

    .rows.set-cols tr {
      display: grid;
      grid-template-columns: max-content minmax(0, 1fr) max-content;
      gap: var(--spacing--xx-small) 1.5ch;
      padding: 6px var(--spacing--small);
      font-size: var(--font-size--small);
      line-height: var(--line-height--tight);
    }

    .rows.set-cols tr + tr {
      border-top: 1px solid var(--color--border-base);
    }

    .rows.set-cols tr + tr td {
      border-top: 0;
    }

    .rows.set-cols td {
      padding: 0;
    }
    /* An empty cell is not a line, so it gets no row of its own. */
    .rows.set-cols td:empty {
      display: none;
    }

    .rows.set-cols .row-name {
      grid-column: 1 / 3;
      grid-row: 1;
      overflow-wrap: anywhere;
    }

    .rows.set-cols .row-act {
      grid-column: 3;
      grid-row: 1;
      text-align: right;
    }

    .rows.set-cols .row-time,
    .rows.set-cols .row-id,
    .rows.set-cols .row-state {
      grid-row: 2;
      text-align: left;
    }
    /* The last fact is the right-hand corner of the second line. */
    .rows.set-cols .row-state:nth-last-child(2) {
      grid-column: 3;
      text-align: right;
    }
    /* A button at the code size, tight, so it does not make the first
       line taller than its name. */
    .rows.set-cols input[type="submit"] {
      padding: 0 0.6ch;
      line-height: var(--line-height--tight);
    }
    /* A box's short id leads its line, the host after it. */
    .rows.set-cols .row-id {
      grid-row: 1;
    }

    .rows.set-cols .row-id + .row-name {
      grid-column: 2 / 4;
    }
  }

  /* The notes and the more... link sit below the table rather than in it,
     so they need its cells' left padding said again: without it the
     section has two left edges, and the one a reader follows down the page
     is the column of ids. */
  .repo-notes,
  .repo-more {
    padding-left: var(--spacing--small);
  }

  /* The same thing on /settings: a fact about a repo too long for its
     card. A seed error is a sentence with a URL in it, so it wraps at
     the page's width under the cards. */
  .set-notes {
    padding-left: var(--spacing--small);
    color: var(--color--text-light);
  }

  .repo-notes {
    color: var(--color--text-light);
  }

  /* Each repo is a page of its own: its changes, its history, its notes,
     and a link to more of it. More room between two of them than between
     the parts of one, so a reader sees where a repo ends. */
  .repo-sec + .repo-sec {
    margin-top: 2em;
  }

  /* A way further down the same history, not one of its rows: gray, so
     the column of change ids is the only blue in the section. The same
     gray the notes above it are in, and the sidebar's facts elsewhere, so
     the page has one gray rather than two a reader has to tell apart. */
  .repo-more {
    margin-top: 0.4em;
  }

  .repo-more a {
    color: var(--color--text-light);
  }

  /* The one page with something beside its text. One column by default,
     so a phone gets the text first; two once there is room.

     The sidebar is written first, so the facts a reader glances at do not
     wait on a long diff. order puts the text back on top in one column
     and the grid areas put the sidebar beside it in two, so neither
     layout reads in source order. */
  .change {
    display: grid;
    margin: 0 0 1em;
    padding: 0 var(--gutter);
    font-family: var(--font-mono);
    /* In one column the sidebar is a second row, and the comments above
       it end in text: without this the author's label sits against the
       last comment. Inert in two columns, which are one row. */
    row-gap: 1.5em;
  }

  .change-side {
    order: 2;
  }

  /* min-width: 0 because a grid item otherwise refuses to shrink below
     its content, whatever the track says: the diff is as wide as the
     longest line anybody committed, and a column grown to fit one runs
     under the sidebar and covers the checks. Anything too wide for the
     track scrolls in its own box. */
  .change-main {
    order: 1;
    min-width: 0;
  }

  .change-text {
    margin: 0;
  }

  .change-text > b {
    display: block;
    margin-bottom: 0.4em;
  }

  .change-main > * + * {
    margin-top: 1em;
  }

  /* A description, a commit message, a comment: text somebody wrote
     hard-wrapped, which keeps its own whitespace and wraps when a line is
     too long for the column. A pre, not a div told to preserve
     whitespace: a parser drops a pre's leading newline, and hml writes a
     multi-line element's text on the line below the tag, so the div read
     a blank line lower than everything beside it. */
  .change-body {
    margin: 0;
    font: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    /* Measure and leading for reading: about 72 characters a line, the
       line a little looser than the dense lists around it, ragged right
       and never justified or hyphenated. */
    max-width: 72ch;
    line-height: var(--line-height--base);
    text-align: left;
    hyphens: none;
  }

  /* A rendered document: headings under their own sizes, code fenced or
     inline, lists with their markers. Paragraphs and blocks space by the
     same 1em the change page uses, so a document reads like the rest of
     the site and not like pasted source. */
  .doc {
    padding: 0 var(--gutter);
  }

  .doc > * + * {
    margin-top: 1em;
  }
  /* Prose takes the same measure as a change's text; code and tables
     keep the room they need and scroll. */
  .doc > p,
  .doc > ul,
  .doc > ol {
    max-width: 72ch;
    line-height: var(--line-height--base);
  }

  /* A heading opens a section of the document, so it stands off the
     block above it by more than a paragraph's gap. */
  .doc > * + h1,
  .doc > * + h2,
  .doc > * + h3,
  .doc > * + h4,
  .doc > * + h5,
  .doc > * + h6 {
    margin-top: 2em;
  }

  .doc h1,
  .doc h2,
  .doc h3,
  .doc h4,
  .doc h5,
  .doc h6 {
    margin: 0;
  }

  .doc h1,
  .doc h2 {
    font-size: var(--font-size--base);
  }

  .doc code {
    font-family: var(--font-mono);
  }

  .doc pre.output {
    margin: 0;
  }

  .doc ul,
  .doc ol {
    margin: 0;
    padding-left: 2em;
  }

  /* Who and when on a line above what they said. */
  .comment + .comment {
    margin-top: 1em;
  }

  .comment-head {
    margin-bottom: 0.4em;
  }

  .comment-head time,
  .comment-head .edited,
  .comment-head .relation,
  .change-edited {
    color: var(--color--text-light);
  }

  /* Screenshots under a comment's words. Three across at desktop width,
     which is the usual set (phone, laptop, desktop), and they wrap to
     one a row on a phone. The height cap keeps a full-page capture from
     pushing the next comment off the screen; the link opens the whole
     image. */
  .comment-images {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--small);
    margin-top: 0.6em;
  }

  .comment-images a {
    display: block;
    flex: 0 1 calc((100% - 16px) / 3);
    min-width: 160px;
    border: 1px solid var(--color--border-base);
  }

  .comment-images img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: cover;
    object-position: top;
  }

  .image-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing--medium);
    width: 100%;
    flex: none;
    color: var(--color--overlay-text);
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    line-height: var(--line-height--tight);
  }

  .image-viewer-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .image-viewer-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing--small);
    flex: none;
  }

  .image-viewer-count {
    white-space: nowrap;
  }

  .image-viewer-bar button {
    color: var(--color--text);
    background: var(--color--bg);
  }

  .image-viewer-bar button:disabled {
    opacity: 0.5;
    cursor: default;
  }

  .image-viewer-img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 56px);
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
  }

  /* The breadcrumb, and whatever the page offers beside it: the checkout
     command on a change, retry on a run. What is below is longer than a
     screen. Opaque and above the text, which tints its own diff rows.

     Outside the change page's grid rather than a cell in it: a grid item
     sticks only within its own grid area, and would unstick as soon as
     row one scrolled past. */
  .page-head {
    font-family: var(--font-mono);
    margin: 0 0 0.8em;
    padding: 0 var(--gutter);
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    gap: 2em;
    align-items: center;
    justify-content: space-between;
    background: var(--color--bg);
    box-sizing: border-box;
    height: var(--head-h);
  }
  /* The name in the header is a link home, and it is the page's title
     first: no link blue, no underline, so a logo does not sit on a line
     that runs on to the slash beside it. */
  .page-head > b > a:first-child:link,
  .page-head > b > a:first-child:visited {
    color: inherit;
    text-decoration: none;
  }

  .checkout {
    display: flex;
    gap: var(--spacing--small);
    align-items: center;
    min-width: 0;
  }
  /* One line, always: a wrapped shell command reads as two. The box takes
     what the button leaves, so a longer change id gets a wider box. */
  .checkout code {
    flex: 1;
    min-width: 0;
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
    padding: var(--spacing--x-small) var(--spacing--small);
    white-space: nowrap;
    overflow-x: auto;
  }

  .checkout button {
    flex: none;
  }

  /* On a phone the breadcrumb and the command cannot share a line: the
     command takes its own full-width row under the breadcrumb, so it stays
     one line at code size. The bar is taller there, and every sticky
     offset reads --head-h, so they follow. */
  @media (width < 48em) {
    .page-head:has(.checkout) {
      flex-wrap: wrap;
      align-content: center;
      gap: var(--spacing--small) 2em;
    }

    .page-head .checkout {
      display: none;
    }
    /* A page with a clone or checkout command in its header, or with
       service tabs, reads one way: the breadcrumb sticks, and the command
       scrolls away. A command that stayed stuck covered the page's title.
       The tab row, where a page has one, sticks under the breadcrumb.
       The header's box dissolves here, so its breadcrumb is a child of
       the page and can stick for the whole page; inside the header it
       would unstick as soon as the header scrolled past. --head-h is the
       height of the sticky rows, so every offset below them follows. */
    .page-head {
      :root:is(:has(.page-head > .checkout), :has(.service-nav)) & {
        display: contents;
      }
    }

    .page-head {
      :root:is(:has(.page-head > .checkout), :has(.service-nav)) & > b {
        display: block;
        background: var(--color--bg);
        box-sizing: border-box;
        height: var(--crumb-h);
        line-height: var(--crumb-h);
        padding: 0 var(--gutter);
        position: sticky;
        top: 0;
        z-index: 3;
      }
    }

    .page-head {
      :root:is(:has(.page-head > .checkout), :has(.service-nav))
        & > .checkout {
        padding: 0 var(--gutter) var(--spacing--small);
      }
    }
  }

  /* Who is logged in and the way out, in the header's second slot. It was
     a section of /settings, which spent a heading and three lines on two
     facts and put the way out of the page in the middle of it. The name is
     gray, being a fact: what is worth a click here is the link. */
  .page-you {
    display: flex;
    gap: 1.5em;
    align-items: baseline;
    min-width: 0;
  }

  .page-you span {
    color: var(--color--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  @media (width >= 800px) {
    .change {
      grid-template-columns: minmax(0, 1fr) var(--side-w);
      column-gap: 2em;
      align-items: start;
    }

    .change-main {
      grid-area: 1 / 1;
    }

    .change-side {
      grid-area: 1 / 2;
    }

    /* The checkout takes the sidebar's column exactly, so its edges
       are the edges of the boxes below it and the top of the page
       reads as two columns rather than a bar with something in the
       corner. Only here: in one column there is nothing to line up
       with. */
    .checkout {
      flex: none;
      width: var(--side-w);
    }

    /* The rail on the left, unlike the change page's sidebar: it is an
       index into the reading beside it, and an index is read before the
       thing it indexes. It sticks at the bar's height, the page being
       several screens long and the rail being the way around it. */
    .settings {
      grid-template-columns: var(--rail-w) minmax(0, 1fr);
      column-gap: 3em;
      align-items: start;
    }

    .settings-rail {
      grid-area: 1 / 1;
      position: sticky;
      top: calc(var(--head-h) + 8px);
    }

    .settings-main {
      grid-area: 1 / 2;
    }
    /* A page with no rail, such as /errors or /settings/tokens, is one
       column. Without this the rail's track stays empty, and the page
       starts 22ch in from the left edge of every other page. */
    .settings:not(:has(> .settings-rail)) {
      grid-template-columns: minmax(0, 1fr);
    }

    .settings:not(:has(> .settings-rail)) > .settings-main {
      grid-area: auto;
    }
  }

  /* The word under the output, which is its own element rather than part
     of the pre, so it needs the gutter said again. Padding, not margin:
     it is inline while hidden, and display would fight the attribute. */
  .live-eof {
    padding-left: var(--gutter);
  }

  /* A label above its value. Bold and lowercase, as every section header
     here is. An empty section is plain text -- "(no checks)" -- since a
     box around it announces the ordinary state of a change under
     review. */
  .side-section {
    margin-bottom: 1.5em;
  }

  .side-section label {
    display: block;
    font-weight: var(--font-weight--bold);
    margin-bottom: 0.4em;
  }

  /* A deploy's restarts sit in the sidebar: the unit and its time, the
     previous instance's line, and the new instance's first lines. The
     blocks of one restart sit close; two restarts take the wider gap. */
  .restart > * + * {
    margin-top: 0.4em;
  }

  .restart + .restart {
    margin-top: 1em;
  }

  /* A block, so the description starts on its own line, the gap being a
     label's rather than the blank line that read as two sections.

     On a deploy page the title is the way to the change, the reader
     being on neither. Unstyled, as the hashes in the sidebar are: a
     stack of them in blue and underlined reads as a menu, where what is
     wanted is a heading that happens to be a link. */
  .change-title {
    display: block;
    margin-bottom: 0.4em;
  }

  .change-title a {
    color: inherit;
    text-decoration: none;
  }

  .change-title a:hover {
    text-decoration: underline;
  }

  /* Only a deploy page stacks these: a change has one set of its own
     words, and its comments are separated from them by the diff. More
     room between two changes than between a title and its description,
     so the boundary a reader is looking for is the wider gap and not the
     weight of a line. Enough to beat the blank line inside a description
     and the 1em above the diff, and no more: a deploy carries two or
     three of these, and every extra half-em pushes the diff down. */
  .change-text + .change-text {
    margin-top: 2em;
  }

  /* An outcome carries a color, as a check's state does. In progress is
     the ordinary case and reads as text. */
  .status-merged {
    color: var(--color--good);
  }

  .status-closed {
    color: var(--color--bad);
  }

  /* An error group's status, on the same terms: open is bad news that
     waits on somebody, and resolved is the verdict a reader wants. */
  .status-open {
    color: var(--color--bad);
  }

  .status-resolved {
    color: var(--color--good);
  }

  /* Why a form was refused, in the red the other bad news is in. */
  .error {
    color: var(--color--bad);
  }

  /* A minted token's one showing. It outranks everything else on the
     page for exactly one render, so it is boxed rather than folded into
     the flow: an operator who misses it holds an unusable row and has to
     revoke and mint again. */
  .new-token {
    border: 2px solid var(--color--border-dark);
    background: var(--color--bg-secondary);
    padding: 1em;
    margin: 0 0 1.5em 0;
  }

  .new-token b {
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* The page has stopped keeping up: a region's fetch failed, the page
     render could not fill one, or the bell went quiet and no region will
     hear that it should ask again. One sentence for all of it, which is
     why nothing here marks the regions themselves -- a wake asks for them
     together, so the same trouble marks most of them and the page filled
     up with one fact repeated.

     Centered at the top, over the sticky header, where a reader about to
     trust an old number meets it first. A pill rather than a full-width
     bar: it is one line, and a rule across the page reads as chrome the
     page always had. */
  .live-down {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: var(--spacing--x-small) 10px;
    font-family: var(--font-mono);
    color: var(--color--bad);
    background: var(--color--bg-warn);
    border: 1px solid var(--color--border-base);
    border-radius: 4px;
  }

  /* A change that no longer applies to its base branch: red, because it
     is the same kind of news as a closed status, and first in the column
     because nothing below it can happen until it is fixed. */
  .conflict {
    color: var(--color--bad);
    margin-bottom: 0.4em;
  }

  .paths {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--color--border-base);
  }

  .paths li + li {
    border-top: 1px solid var(--color--border-base);
  }

  .paths li {
    padding: 6px var(--spacing--small);
    overflow-wrap: anywhere;
  }

  /* Beside the status but not part of the verdict, so it drops the status
     color. Unstyled link, like every hash in this column: it is a list of
     facts, and blue underlines down it read as decoration. */
  .merge-sha {
    color: var(--color--text-light);
  }

  .merge-sha a {
    color: inherit;
  }

  .merge-sha a:hover {
    text-decoration: underline;
  }

  /* The sidebar's lists -- checks, commits, and where a change is
     running -- are one design: the same bordered box, a rule between
     rows, the age or the state at the right edge, so the column reads as
     one column, at the code size the diff rows use. That state carries
     the color, being the word a reader came for.

     A service the change has not reached is a row without a link, so its
     line is a span laid out like the anchor beside it rather than a
     second design. */
  .checks,
  .hashes,
  .deploys {
    font-size: var(--font-size--small);
    line-height: var(--line-height--tight);
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--color--border-base);
  }

  .check + .check,
  .deploy + .deploy {
    border-top: 1px solid var(--color--border-base);
  }

  .check a,
  .deploy a,
  .deploy-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.3em var(--spacing--small);
    padding: 6px var(--spacing--small);
    color: inherit;
    text-decoration: none;
  }

  .check a:hover,
  .deploy a:hover {
    background: var(--color--bg-secondary);
  }

  .check-name,
  .deploy-name {
    overflow-wrap: anywhere;
  }

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

  .deploy-state {
    color: var(--color--text-light);
    text-align: right;
    white-space: nowrap;
  }

  .check-ok .check-state,
  .deploy-live .deploy-state {
    color: var(--color--good);
  }

  .check-fail .check-state,
  .deploy-no .deploy-state {
    color: var(--color--bad);
  }

  .check-pending .check-state {
    color: var(--color--text-light);
  }

  .hashes li + li {
    border-top: 1px solid var(--color--border-base);
  }
  /* A commit no change here produced has nowhere to go, so its line is a
     div laid out like the anchor beside it rather than a row that lights
     up under the pointer and does nothing when clicked. */
  .hashes a,
  .hash-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--spacing--small);
    padding: 6px var(--spacing--small);
    color: inherit;
    text-decoration: none;
  }

  .hashes a:hover {
    background: var(--color--bg-secondary);
  }

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

  /* One box per changed file, in the same bordered box -- except that the
     lines across it belong to the headers rather than to the list: every
     header draws its own top edge, so the first is the list's top edge
     and the rest are the rules between files. The header is the thing
     that sticks, and an edge owned by the list or by the file above it
     scrolls away from the box that needs it.

     A plain block, not a grid with a gap: a grid's implicit column sizes
     to max-content and nothing clamps it to the container, so one long
     line in one patch widened every box on the page.

     The header is the whole target, not the disclosure triangle, which
     list-style and the WebKit marker drop. Fixed columns for the stats,
     so the filenames start in one place; the name takes the rest and
     wraps rather than pushing the box wide; the button's column holds its
     width whether or not the button shows, so a filename does not shift
     on hover. */
  /* A closed file can sit above the browser's scroll anchor. Opening it
     must not keep the content below the file at the same screen position.
     History and hash navigation still use the browser's normal behavior. */
  .diff-files {
    html:has(&) {
      overflow-anchor: none;
    }

    border: 1px solid var(--color--border-base);
    border-top: 0;
  }

  .diff-file > summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    /* The two counts sit in 5ch columns, a pair, and the name takes the
       rest of the row. 5ch holds the longest label statCount makes, such
       as "+9999" or "-999k". The 1ch gap keeps two full labels apart; a
       label wider than its column runs into its neighbor. */
    grid-template-columns: 5ch 5ch minmax(0, 1fr) auto;
    column-gap: 1ch;
    align-items: center;
    border-top: 1px solid var(--color--border-base);
    /* The copy button sits the same distance from the row's top, bottom
       and right edges: 5px, between the 2px the rows had above and
       below and the 8px at the right. Left stays 8px, the gutter the
       other lists use. */
    padding: 5px 5px 5px var(--spacing--small);
  }

  /* The path, for the terminal open beside the diff. Transparent until
     the row is hovered, so a list of files is not a column of buttons.
     Only where hover exists: on a touch screen a tap that reveals a
     hover-only control is taken as the hover, so the first tap on a
     filename showed the button and never opened the file. There the
     button is always drawn.
     Opacity rather than hiding it: a hidden element takes no focus, and
     Tab reaching the button is the only way to copy a path mouseless. */
  .copy-path {
    padding: 3px 10px;
  }

  @media (hover: hover) {
    .copy-path {
      opacity: 0;
    }

    .diff-file > summary:hover .copy-path,
    .copy-path:focus-visible {
      opacity: 1;
    }

    .copy-box > button {
      opacity: 0;
    }

    .copy-box:hover > button,
    .copy-box > button:focus-visible {
      opacity: 1;
    }
  }

  .diff-file > summary::-webkit-details-marker {
    display: none;
  }

  /* An error event's header is a line of facts, not a diff's three
     columns: when, the commit, the deploy, the instance and request.
     It wraps on a phone rather than pushing the row wider. The time and
     the place are muted, as a row's id and age are on the repo page. */
  .err-event > summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1ch;
    padding: 5px var(--spacing--small);
  }

  .err-event > summary time,
  .err-event-where {
    color: var(--color--text-light);
  }

  .err-event-where {
    overflow-wrap: anywhere;
  }
  /* A trace has no highlighted lines to carry their own padding, as a
     patch does, so the pre takes it. */
  .err-trace {
    padding: var(--spacing--small);
  }

  .diff-file > summary:hover {
    background: var(--color--bg-secondary);
  }

  /* An error group's description, frequency chart, and latest event
     attributes. The frequency chart is a strip, so it keeps a short
     plot. Its columns take the error color: chart.css paints a series
     from --chart-mark. */
  .err-frequency {
    --chart-height: 6rem;
    margin: var(--spacing--small) 0;
    padding: 6px var(--spacing--small);
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
  }

  .err-events {
    --chart-mark: var(--color--bad);
  }
  /* One series, which the section heading names already. */
  .err-frequency .chart-legend {
    display: none;
  }

  .err-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--x-small) var(--spacing--small);
    margin: var(--spacing--small) 0;
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--normal);
  }

  .err-attr {
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
    padding: var(--spacing--xx-small) 6px;
  }

  .err-attr-k {
    color: var(--color--text-light);
  }

  /* An open header keeps the tint and rules itself off from the patch,
     becoming its lid rather than a line in a list, and takes space below
     so the next filename reads as the next thing. Not the last file's,
     which would leave a gap above the list's own edge.

     It sticks while the patch scrolls past, a diff longer than the screen
     being read with nothing on it saying which file this is. Only when
     open: a list of closed headers stacking at the top would push the
     reading off screen.

     It parks at the bar's height exactly, so the bar's bottom edge meets
     this box's top border, the lid an open file is drawn with. An overlap
     would spend that border to absorb a pixel of rounding; flush keeps it,
     and pays at a zoom where two independently positioned edges round
     apart and a row of scrolling diff shows through the seam.

     Below the bar, not above it: a header sticks only within its own
     file's box, so a file scrolled past pushes its header up through the
     bar, and one that paints over the bar covers the breadcrumb on the way
     out. */
  .diff-file[open] > summary {
    background: var(--color--bg-secondary);
    border-bottom: 1px solid var(--color--border-base);
    position: sticky;
    top: var(--head-h);
    z-index: 1;
  }

  .diff-file[open]:not(:last-child) {
    margin-bottom: var(--spacing--small);
  }

  /* The ring inside the header rather than straddling its border, where
     it reads as a line on one file instead of a rectangle over the page.
     Only a keyboard puts it there -- a click on a summary is refused
     focus in script.js -- and it stays: Tab and Enter are the only way to
     read a diff mouseless. */
  .diff-file > summary:focus-visible {
    outline-offset: -2px;
  }

  /* The padding the header gave the button, back on the text, so a
     filename long enough to wrap is not pressed against the box's edge.
     Nothing changes on a row that fits: the button is taller either
     way. */
  .diff-name {
    overflow-wrap: anywhere;
    padding: 3px 0 3px var(--spacing--medium-small);
  }

  /* A wrapped diff line is two rows of one tint, and moves the column a
     reader is comparing. */
  .diff-patch {
    margin: 0;
    overflow-x: auto;
  }
  /* highlight.Diff wraps the whole patch in one span.diff, and the tinted
     lines inside it are blocks, as wide as that span. An inline span is as
     wide as the box, so a long line scrolled sideways left every tint
     ending at the first screen's edge. The span is a block as wide as its
     longest line and never narrower than the box, and the tints stretch to
     it. (A grid column on the pre did not: measured in Chrome, the lines
     stayed the box's width.) */
  .diff-patch > .diff {
    display: block;
    width: max-content;
    min-width: 100%;
  }

  /* Gray for a zero, since the color says "lines changed" and a green +0
     contradicts its own number. Foreground only: the list is dense and a
     tint would compete with the filename. Right-aligned, so the digits
     line up down the list. */
  .diff-stat {
    text-align: right;
  }

  .adds {
    color: var(--color--good);
  }

  .dels {
    color: var(--color--bad);
  }

  .zero {
    color: var(--color--text-faint);
  }

  /* Per-line tints: gi inserted, gd deleted, gu a hunk header, gc
     context. Each line is a span from highlight.Diff, made a block here
     so the tint reaches the full width of the pre; the marker char
     inherits the row's color and the tokens below override it. Scoped
     under .diff, which wraps each patch. */
  .diff .gi,
  .diff .gd,
  .diff .gu,
  .diff .gc {
    display: block;
  }

  .diff .gi {
    background-color: var(--color--diff-add);
    color: var(--color--good);
  }

  .diff .gd {
    background-color: var(--color--diff-del);
    color: var(--color--bad);
  }

  .diff .gu {
    background-color: var(--color--diff-hunk);
    color: var(--color--link);
  }

  .diff .gc {
    color: var(--color--text);
  }

  /* Five tokens, which is what github.com/croaky/highlight emits: k
     keywords, n names, s strings, m numbers, c comments. Subtle enough to
     stay legible on the row tints. Operators and punctuation carry no
     class and take the row's color. The doc-code twin is the same palette
     on a document's fenced code. */
  .diff .k,
  .doc-code .k {
    color: var(--color--tok-k);
  }

  .diff .n,
  .doc-code .n {
    color: var(--color--tok-n);
  }

  .diff .s,
  .doc-code .s {
    color: var(--color--tok-s);
  }

  .diff .m,
  .doc-code .m {
    color: var(--color--tok-m);
  }

  .diff .c,
  .doc-code .c {
    color: var(--color--tok-c);
    font-style: italic;
  }

  .page-head,
  .diff-stat,
  .diff-name,
  .copy-path,
  .ref,
  .steps .cmd {
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    line-height: var(--line-height--tight);
    font-weight: var(--font-weight--normal);
  }

  .page-head b,
  .page-head b a {
    font-weight: var(--font-weight--bold);
  }

  .doc p code,
  .doc li code {
    font-size: 1em;
    font-weight: var(--font-weight--bold);
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
    padding: 0 0.3em;
  }

  .side-section label {
    font-size: var(--font-size--base);
  }

  @media (width < 48em) {
    .diff-file > summary {
      grid-template-columns: minmax(0, 1fr) auto auto;
      padding-right: var(--spacing--small);
    }

    .diff-file > summary .diff-name {
      grid-column: 1;
      grid-row: 1;
      padding-left: 0;
    }

    .diff-file > summary .diff-stat:nth-of-type(1) {
      grid-column: 2;
      grid-row: 1;
    }

    .diff-file > summary .diff-stat:nth-of-type(2) {
      grid-column: 3;
      grid-row: 1;
    }

    .copy-path {
      display: none;
    }

    .image-viewer-img {
      max-height: calc(100vh - 52px);
    }
  }

  /* The box a tap copied, for as long as the script says "copied". */
  .copied {
    outline: 1px solid var(--color--text-light);
  }

  .logs-toolbar {
    position: sticky;
    top: calc(var(--head-h) + var(--repo-tabs-h, 0px));
    z-index: 20;
    background: var(--color--bg-secondary);
    border-bottom: 1px solid var(--color--border-base);
    padding: 0.5em var(--gutter);
  }

  .logs-form {
    display: flex;
    align-items: center;
    gap: 0.5em;
  }

  .logs-search {
    flex: 1 1 0;
    min-width: 0;
  }

  .logs-range,
  .logs-service {
    flex: none;
  }
  /* On a phone the switch, the search, and the range do not fit on one
     row: the search shrank to one character. The switch takes a row of
     its own, and the search keeps the width of the second row. */
  @media (width < 48em) {
    .logs-form {
      flex-wrap: wrap;
    }

    .logs-service {
      flex: 1 1 100%;
    }
  }

  .logs-form input[type="text"],
  .logs-form select,
  .logs-form > .logs-menu-wrap > button,
  .logs-picker-btn {
    box-sizing: border-box;
    height: 36px;
    font: inherit;
    line-height: 1.25;
    border: 1px solid var(--color--border-base);
    padding: 6px 10px;
  }

  .logs-form select[hidden] {
    display: none;
  }

  .logs-picker,
  .logs-menu-wrap {
    position: relative;
    flex: none;
  }

  .logs-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    white-space: nowrap;
  }

  .logs-picker-btn::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    flex: none;
    margin-right: var(--spacing--xx-small);
  }

  .logs-menu-wrap {
    margin-left: auto;
  }

  .logs-menu-btn {
    min-width: 36px;
  }

  .logs-picker-panel,
  .logs-menu-dropdown {
    box-sizing: border-box;
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    z-index: 100;
    min-width: 200px;
    max-width: calc(100vw - 32px);
    max-height: min(440px, 60vh);
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: var(--spacing--x-small);
  }

  .logs-service-picker .logs-picker-panel {
    left: 0;
    right: auto;
    min-width: 100%;
  }

  .logs-picker.open .logs-picker-panel,
  .logs-menu-wrap.open .logs-menu-dropdown {
    display: flex;
    flex-direction: column;
  }

  .logs-picker-panel button,
  .logs-menu-dropdown button,
  .logs-menu-dropdown a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: var(--spacing--small) 10px;
    border: 0;
    background: none;
    text-decoration: none;
    font: inherit;
    line-height: var(--line-height--tight);
    white-space: nowrap;
  }

  .logs-picker-panel button {
    padding-left: 28px;
    position: relative;
  }

  .logs-picker-panel [aria-checked="true"]::before {
    content: "✓";
    position: absolute;
    left: 8px;
  }

  .logs-picker-panel button:hover,
  .logs-menu-dropdown button:hover,
  .logs-menu-dropdown a:hover,
  .logs-picker-panel button:focus-visible,
  .logs-menu-dropdown :is(button, a):focus-visible {
    background: var(--color--bg-hover);
  }

  .logs-menu-group + .logs-menu-group {
    border-top: 1px solid var(--color--border-base);
    margin-top: var(--spacing--x-small);
    padding-top: var(--spacing--x-small);
  }

  .logs-menu-heading {
    padding: var(--spacing--x-small) 10px;
    font-size: var(--font-size--small);
    color: var(--color--text-light);
  }

  @media (width < 48em) {
    .logs-service-picker {
      flex: 1 1 100%;
      min-width: 0;
    }

    .logs-form {
      gap: var(--spacing--small);
    }
  }

  .logs-banner {
    padding: 0.5em var(--gutter);
    background: var(--color--bg-warn);
    border-bottom: 1px solid var(--color--border-base);
    display: flex;
    gap: 1em;
    align-items: center;
    font-size: var(--font-size--small);
  }

  .logs-drop {
    margin-left: auto;
    opacity: 0.7;
    padding: 0.25em var(--gutter);
    font-size: var(--font-size--small);
  }

  .logs-lines {
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
  }
  /* What the read covers: each service and the source of its lines, and
     any loss. A loss is in the error color, since a reader must see it. */
  .logs-read {
    padding: 0 var(--gutter);
    color: var(--color--text-light);
    font-size: var(--font-size--small);
  }

  .logs-read:empty {
    display: none;
  }

  .logs-read .logs-read-loss,
  .log-gap {
    color: var(--color--bad);
  }

  .log-gap {
    padding: 0.25em var(--gutter);
    font-size: var(--font-size--small);
  }

  .log-date {
    padding: 0.5em var(--gutter) 0.25em;
    font-weight: var(--font-weight--bold);
    color: var(--color--text-light);
    border-top: 1px solid var(--color--border-base);
    font-size: var(--font-size--small);
  }

  .log summary {
    display: flex;
    gap: 0.75em;
    padding: 0.15em 1em;
    cursor: pointer;
  }

  .log summary > * {
    flex: none;
  }

  .log-time {
    color: var(--color--text-light);
  }

  .log-raw {
    color: var(--color--text-light);
    overflow-wrap: anywhere;
    padding: 0.25em 1em 0;
  }

  .log-inst {
    font-weight: var(--font-weight--bold);
  }

  .inst-0 {
    color: #1e66f5;
  }

  .inst-1 {
    color: #179299;
  }

  .inst-2 {
    color: #40a02b;
  }

  .inst-3 {
    color: #df8e1d;
  }

  .inst-4 {
    color: #fe640b;
  }

  .inst-5 {
    color: #d20f39;
  }

  .inst-6 {
    color: #e64553;
  }

  .inst-7 {
    color: #8839ef;
  }

  .inst-8 {
    color: #ea76cb;
  }

  .inst-9 {
    color: #00a3c4;
  }
  /* One event per line, never wrapped. A long line clips at the right
     edge; opening it shows the whole entry in .log-raw. */
  .log summary > .log-msg {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* levelClass in server/handlelogs names a line's level: warn for warn
     and warning, error for error, err, and fatal. */
  .log.warn .log-msg {
    color: #b9770e;
  }

  .log.error .log-msg {
    color: #c0392b;
  }

  .log-kv {
    padding: 0.25em 1em 0.5em 1em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
  }

  .log-field {
    text-decoration: none;
    padding: var(--spacing--xx-small) 6px;
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--normal);
  }

  .log-field:hover {
    background: var(--color--bg-hover);
  }

  .log-grouped {
    display: flex;
    gap: 0.75em;
    padding: 0.25em 1em;
    border-bottom: 1px solid var(--color--border-base);
  }

  .log-grouped-count {
    font-weight: var(--font-weight--bold);
    min-width: 3ch;
    text-align: right;
  }

  .log-grouped-time {
    color: var(--color--text-light);
  }

  .logs-empty {
    padding: 1em;
    opacity: 0.7;
  }

  @media (width < 48em) {
    .log summary {
      gap: 0.5em;
      padding: 0.1em var(--gutter);
    }

    .log-inst {
      display: none;
    }
    /* In the logs of all services the tag is the service, which the row
       needs to say which service wrote it. */
    .logs-all .log-inst {
      display: inline;
    }
  }

  /* A column chart is taller than a line chart: its plot holds the
     labels under the columns too. */
  .chart-bars {
    --chart-height: 14rem;
  }

  /* Service tabs */
  .service-nav {
    position: sticky;
    top: var(--head-h);
    z-index: 22;
    background: var(--color--bg);
    border-bottom: 1px solid var(--color--border-base);
    margin-bottom: var(--spacing--medium-small);
    padding: 0 var(--gutter);
  }
  /* The tabs are one line. When they do not fit, the row scrolls sideways
     inside the page, so the page itself never grows wider than the
     screen. The bar is hidden: a swipe or the arrow keys move it, and
     script.js brings the active tab into view on load. */
  .service-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0 var(--spacing--medium);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .service-tabs::-webkit-scrollbar {
    display: none;
  }

  .service-tab {
    flex: none;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: var(--font-size--base);
    font-weight: var(--font-weight--normal);
    padding: var(--spacing--x-small) 0 var(--spacing--small);
    text-decoration: none;
  }

  .service-tab:hover {
    color: var(--color--text);
  }

  .service-tab.active {
    border-bottom: 2px solid var(--color--text);
    color: var(--color--text);
    font-weight: var(--font-weight--bold);
  }

  /* Performance page layout */
  .perf-page {
    display: flex;
    flex-direction: column;
    gap: var(--spacing--medium-small);
    /* Hidden tips sit past the right edge; clip them rather than scroll. */
    overflow-x: clip;
    padding: 0 var(--gutter) 1em;
  }

  .perf-toolbar {
    background: var(--color--bg);
    position: sticky;
    top: calc(var(--head-h) + var(--repo-tabs-h, 0px));
    z-index: 20;
    border-bottom: 1px solid var(--color--border-base);
    padding: var(--spacing--small) 0;
  }

  .perf-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--small);
  }

  /* The field dresses as every text field in base does. */
  .perf-search {
    flex: 1;
    min-width: 12rem;
  }

  .perf-range {
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    border-radius: 3px;
    color: var(--color--text);
    font-family: var(--font-mono);
    font-size: var(--font-size--base);
    font-weight: var(--font-weight--normal);
    padding: var(--spacing--x-small) var(--spacing--small);
  }

  .perf-body {
    display: flex;
    gap: var(--spacing--medium);
  }

  .perf-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--spacing--large);
    min-width: 0;
  }

  .perf-chart-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing--small);
    min-width: 0;
  }

  /* Perf summaries and chart headings */
  .perf-summary {
    align-items: baseline;
    display: flex;
    gap: var(--spacing--small);
  }

  .perf-summary-title,
  .perf-chart-title {
    color: var(--color--text);
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--bold);
  }

  .perf-summary-val {
    color: var(--color--text);
    font-family: var(--font-mono);
    font-size: var(--font-size--base);
    font-weight: var(--font-weight--bold);
  }

  .perf-chart-head {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--x-small) var(--spacing--small);
  }

  .perf-chart-sub {
    color: var(--color--text-light);
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--normal);
  }

  /* Route table */
  /* The wrap is the scroll box: the table scrolls sideways inside it and
     the page does not. A sticky header sticks to its nearest scroll box,
     so the wrap also scrolls up and down, capped to the screen below the
     page header. The header then pins at the top of the wrap. */
  .perf-routes-wrap {
    overflow: auto;
    max-height: calc(100dvh - var(--head-h) - 2rem);
  }

  .perf-routes {
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--normal);
    width: 100%;
  }

  .perf-routes th,
  .perf-routes td {
    border-bottom: 1px solid var(--color--border-base);
    padding: 6px var(--spacing--small);
    text-align: left;
  }

  .perf-routes th {
    font-weight: var(--font-weight--bold);
  }
  /* The header row stays under the page header while the rows scroll.
     The background hides the rows that pass under it, and the rule is a
     shadow because a collapsed border does not travel with a sticky
     cell. */
  .perf-routes thead th {
    background: var(--color--bg);
    box-shadow: inset 0 -1px 0 var(--color--border-base);
    border-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .perf-routes td:first-child {
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .perf-routes th.r,
  .perf-routes td.r {
    text-align: right;
  }

  .perf-routes tr.selected td {
    background: var(--color--bg-secondary);
  }

  .perf-routes tr:hover td {
    background: var(--color--bg-secondary);
  }

  .perf-sparkline {
    display: block;
    fill: none;
    height: 16px;
    stroke: var(--color--link);
    stroke-width: 1.5;
    width: 50px;
  }
  /* The wall split: four shares of a request's time that add up to the
     whole, in the colors of the "where the wall time goes" chart. */
  .perf-split-bar {
    background: var(--color--bg-secondary);
    border-radius: 2px;
    display: flex;
    height: 12px;
    overflow: hidden;
    width: 80px;
  }

  .perf-split-seg {
    height: 100%;
  }

  .perf-split-seg--q {
    background: var(--color--series-1);
    width: var(--q);
  }

  .perf-split-seg--w {
    background: var(--color--series-2);
    width: var(--w);
  }

  .perf-split-seg--b {
    background: var(--color--series-4);
    width: var(--b);
  }

  .perf-split-seg--n {
    background: var(--color--series-3);
    width: var(--n);
  }

  .perf-split-dash {
    color: var(--color--text-light);
  }
  /* Each chart has a reserved inspection row. Nothing overlays its data. */
  .page-head {
    :root:is(:has(.perf-page), :has(.logs)) & {
      z-index: 30;
    }
  }

  .perf-main .chart-tip {
    display: none;
  }
  /* A drag selects a range with a mouse or a finger. The finger keeps
     vertical panning, so scrolling the page still works over a chart. */
  .perf-main [data-perf-plot] {
    touch-action: pan-y;
  }

  .perf-readout {
    box-sizing: border-box;
    color: var(--color--text-light);
    font-size: var(--font-size--small);
    height: 3em;
    overflow: auto;
    overflow-wrap: anywhere;
  }

  @media (width < 48em) {
    .perf-readout {
      height: 4.5em;
    }
  }

  .perf-dot {
    border: 1px solid var(--color--bg);
    border-radius: 50%;
    height: 7px;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, -50%);
    width: 7px;
    z-index: 5;
  }

  .perf-xhair {
    background: var(--color--text-light);
    bottom: 0;
    display: none;
    opacity: 0.6;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 1px;
    z-index: 5;
  }

  .perf-selection {
    background: var(--color--link);
    bottom: 0;
    opacity: 0.2;
    pointer-events: none;
    position: absolute;
    top: 0;
    z-index: 6;
  }

  @media (width < 48em) {
    .perf-body {
      flex-direction: column;
    }
  }

  /* Jump to latest on the logs page: shown while the reader is scrolled
     up from the tail and new lines arrive below. */
  .logs-latest {
    position: fixed;
    right: 16px;
    bottom: 24px;
    z-index: 5;
  }

  .logs-latest[hidden] {
    display: none;
  }

  /* Jump to top on the logs page. Older chunks keep the reader's line,
     so the toolbar is further away each time one joins. It sits at the
     right edge just under the sticky bar: the direction it goes, clear of
     Safari's bottom bar and of the latest button below. */
  .logs-top {
    position: fixed;
    right: 16px;
    top: calc(
      var(--head-h) + var(--repo-tabs-h, 0px) +
        var(--logs-controls-h, 0px) +
        8px
    );
    z-index: 5;
  }

  .logs-top[hidden] {
    display: none;
  }

  /* A change the deploy queue skipped is live, but under a deploy that
     names a newer sha. The line says why its own sha has no deploy. */
  .deploy-note {
    color: var(--color--text-light);
    display: block;
    font-size: var(--font-size--small);
    padding-inline: var(--spacing--small);
  }

  /* The runs table has seven columns, and a phone is about 390 px wide.
     The table keeps one line per row and a gap between columns, and the
     box around it scrolls sideways, so no value is cut off and the page
     itself never grows wider than the screen. */
  .check-runs-scroll {
    max-width: 100%;
    overflow-x: auto;
  }

  .check-runs-table {
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    width: 100%;
  }

  .check-runs-table th,
  .check-runs-table td {
    border-bottom: 1px solid var(--color--border-base);
    padding: 6px 1.5ch 6px 0;
    text-align: left;
    white-space: nowrap;
  }

  .check-runs-table th {
    font-weight: var(--font-weight--bold);
  }

  .check-runs-table th.r,
  .check-runs-table td.r {
    text-align: right;
  }

  .check-runs-table tbody tr:hover td {
    background: var(--color--bg-secondary);
  }

  /* One card for each check: its name and state, what it watches, the
     recent runs, and the command that runs it once. The page's own text
     gutter holds it off the screen edge. */
  .service-checks-page {
    padding-top: var(--spacing--small);
  }

  .check-card {
    border-bottom: 1px solid var(--color--border-base);
    margin-bottom: 20px;
    padding-bottom: var(--spacing--medium);
  }

  .check-card:last-child {
    border-bottom: 0;
  }

  .check-header {
    align-items: baseline;
    display: flex;
    gap: var(--spacing--medium-small);
    margin-bottom: var(--spacing--x-small);
  }

  .check-header .check-name {
    font-weight: var(--font-weight--bold);
  }

  .check-meta {
    color: var(--color--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--xx-small) var(--spacing--medium);
    margin-bottom: 10px;
    overflow-wrap: anywhere;
  }

  .check-card .checkout {
    max-width: 72ch;
    width: 100%;
  }

  .check-meta {
    font-size: var(--font-size--small);
  }
  /* A phone hides the copy button everywhere else and copies on a tap of
     the box, which nothing on screen says. A check's command is the thing
     this page offers, so its button stays, at a size a thumb can hit. */
  @media (width < 48em) {
    .check-card button[data-copy] {
      display: inline-block;
      min-height: 44px;
      min-width: 44px;
    }
    /* The box is as tall as the button beside it, its text centered, so
       the two read as one row. */
    .check-card .checkout {
      align-items: stretch;
    }

    .check-card .checkout code {
      align-items: center;
      box-sizing: border-box;
      display: flex;
      min-height: 44px;
    }
  }

  .check-card .check-runs-scroll {
    margin-bottom: var(--spacing--medium-small);
  }

  .check-alert-banner {
    border: 1px solid var(--color--bad);
    color: var(--color--bad);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--x-small) var(--spacing--medium-small);
    margin-bottom: var(--spacing--medium-small);
    padding: 6px var(--spacing--small);
  }

  .status-ok {
    color: var(--color--good);
  }

  .status-error {
    color: var(--color--bad);
  }

  /* A sortable column head is a link that reads as a head, not as a
     link: the bold text stays, the arrow marks the sorted column. */
  .perf-sort,
  .perf-sort:link,
  .perf-sort:visited {
    color: var(--color--text);
    font-weight: var(--font-weight--bold);
    text-decoration: none;
    white-space: nowrap;
  }

  .perf-sort:hover {
    text-decoration: underline;
  }

  .perf-logs {
    margin-left: var(--spacing--small);
    font-size: var(--font-size--small);
  }

  .perf-readout > span {
    display: block;
  }

  .perf-range-btn {
    align-items: center;
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    border-radius: 3px;
    color: var(--color--text);
    cursor: pointer;
    display: flex;
    font-family: var(--font-mono);
    font-size: var(--font-size--base);
    font-weight: var(--font-weight--normal);
    gap: var(--spacing--small);
    max-width: 100%;
    padding: var(--spacing--x-small) var(--spacing--small);
  }

  /* The button sets its own background, so it sets its own hover too:
     button:hover in base does not reach it. */
  .perf-range-btn:hover {
    background: var(--color--bg-hover);
  }

  .perf-range-btn::after {
    border-bottom: 2px solid var(--color--text-light);
    border-right: 2px solid var(--color--text-light);
    content: "";
    flex: none;
    height: 6px;
    margin-bottom: 3px;
    transform: rotate(45deg);
    width: 6px;
  }

  .perf-range-btn[aria-expanded="true"]::after {
    margin-bottom: -3px;
    transform: rotate(225deg);
  }

  .perf-range-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* The panel hangs from the button's right edge, so it opens under the
     cursor and not at the far left of the toolbar. A phone toolbar can
     wrap the button to the left, so there the panel keeps the toolbar's
     full width. */
  .perf-picker {
    position: relative;
  }

  .perf-range-pop {
    background: var(--color--bg);
    border: 1px solid var(--color--border-dark);
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 70vh;
    max-width: calc(100vw - 2 * var(--gutter));
    overflow-y: auto;
    padding: var(--spacing--small);
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    width: 22rem;
    z-index: 20;
  }

  @media (width < 40rem) {
    .perf-picker {
      position: static;
    }

    .perf-range-pop {
      left: 0;
      right: auto;
      width: min(22rem, 100%);
    }
  }

  .perf-range-pop[hidden] {
    display: none;
  }

  .perf-range-presets {
    display: grid;
    gap: var(--spacing--x-small);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .perf-range-opt {
    background: var(--color--bg-secondary);
    border: 1px solid var(--color--border-base);
    border-radius: 3px;
    color: var(--color--text);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--normal);
    min-height: 36px;
    padding: var(--spacing--x-small) var(--spacing--small);
    text-align: left;
  }

  .perf-range-opt:hover {
    background: var(--color--bg-hover);
  }

  .perf-range-opt[aria-current] {
    border-color: var(--color--link);
  }

  .perf-range-custom {
    grid-column: 1 / -1;
  }

  .perf-range-pop .perf-window-fields {
    margin-top: var(--spacing--small);
  }

  @media (pointer: coarse) {
    .perf-range-opt {
      min-height: 44px;
    }
  }

  .perf-window-fields {
    display: grid;
    flex-basis: 100%;
    gap: var(--spacing--small);
    grid-template-columns: auto minmax(0, 1fr);
  }

  .perf-window-fields[hidden] {
    display: none;
  }

  .perf-window-fields label {
    align-items: center;
    color: var(--color--text-light);
    display: grid;
    gap: var(--spacing--small);
    grid-column: 1 / -1;
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }

  .perf-window-fields input {
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    border-radius: 3px;
    color: var(--color--text);
    font-family: var(--font-mono);
    font-size: var(--font-size--small);
    font-weight: var(--font-weight--normal);
    min-width: 0;
    padding: var(--spacing--x-small) var(--spacing--small);
  }

  .perf-window-fields button {
    grid-column: 1 / -1;
    justify-self: start;
    margin-left: calc(2.5rem + 8px);
    min-height: 44px;
  }

  /* Safari zooms the page when a field under 16px takes focus, and the
     zoom stays after the keyboard closes. */
  @media (pointer: coarse) {
    .perf-form .perf-search,
    .perf-form .perf-window-fields input {
      font-size: var(--font-size--base);
    }
  }

  .domains-scroll {
    max-width: 100%;
    overflow-x: auto;
  }

  .domains th,
  .domains td {
    padding: var(--spacing--x-small) var(--spacing--medium-small)
      var(--spacing--x-small) 0;
    text-align: left;
    white-space: nowrap;
  }

  /* Repo tabs stay between the breadcrumb and view controls. A measured
     height includes a phone's tab row without guessing the current font. */
  .page-head {
    :root:has(.service-nav) &,
    :root:has(.service-nav) & > b {
      z-index: 23;
    }
  }

  /* Shared service choices retain the same control size across views. */
  .perf-form .logs-service-picker {
    flex: none;
  }

  .service-choice[hidden] {
    display: none;
  }

  .service-filter-note {
    color: var(--color--text-light);
    font-size: var(--font-size--small);
  }

  .perf-page {
    overflow-x: visible;
  }

  @media (width < 48em) {
    .perf-form .logs-service-picker {
      flex: 1 1 100%;
    }
  }

  .job-history {
    padding: var(--spacing--medium);
    max-width: 1000px;
  }

  .job-history h2 {
    font-size: 1em;
    margin: 28px 0 var(--spacing--small);
  }

  .job-history p {
    margin: var(--spacing--small) 0;
  }

  .operation-list {
    list-style: none;
    padding: 0;
  }

  .operation-list > li {
    border-top: 1px solid var(--color--border-base);
    padding: var(--spacing--medium-small) 0;
  }

  .operation-list pre,
  .job-history > pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .operation-list b {
    overflow-wrap: anywhere;
  }

  /* The scope lives above tabs. Its menu uses links, not a write form. */
  .scope-picker {
    display: inline-block;
    position: relative;
    font-weight: var(--font-weight--bold);
  }

  .scope-picker summary {
    cursor: pointer;
    display: inline-block;
    border-bottom: 1px dotted currentColor;
  }

  .scope-picker summary::after {
    content: " ▾";
  }

  .scope-picker ul {
    position: absolute;
    z-index: 90;
    top: 100%;
    left: 0;
    min-width: 14rem;
    max-width: calc(100vw - 2rem);
    padding: 0.5rem;
    margin: 0.25rem 0;
    list-style: none;
    background: var(--color--bg);
    border: 1px solid var(--color--border-base);
    box-shadow: 0 3px 8px #0002;
  }

  .scope-picker li a {
    display: block;
    padding: 0.3rem 0.5rem;
    overflow-wrap: anywhere;
  }

  /* Match the mobile sticky breadcrumb's selector so its menu stays above tabs. */
  .page-head {
    :root:is(:has(.page-head > .checkout), :has(.service-nav)) & > b {
      z-index: 23;
    }
  }

  .scope-picker ul {
    line-height: 1.5;
  }

  @media (width < 48em) {
    .scope-picker ul {
      position: fixed;
      top: var(--crumb-h, var(--head-h));
      left: var(--gutter);
      right: var(--gutter);
      min-width: 0;
      max-width: none;
    }
  }

  /* The log toolbar meets the tab row before and after either row sticks. */
  .service-nav:has(+ .logs) {
    margin-bottom: 0;
  }
}

/*
  The stylesheet for the views of github.com/croaky/chart.

  Go computes each position. This sheet reads it from a custom property
  that a view sets inline: --chart-at, --chart-top, --chart-left,
  --chart-width, --chart-pct, --chart-x, and --chart-y. A media query
  then decides how to spend the number, as a height on a wide screen or
  as a width on a narrow one.

  Each rule spends a token from the app's own scale, with a fallback,
  so a chart is the same size and color as the page around it. The
  sheet works with no token set. The tokens it reads:

    --color--text, --color--text-light         labels, and quiet labels
    --color--border-base, --color--border-dark rules, and crosshairs
    --color--bg-secondary                      the tip panel
    --color--accent                            scatter dots and focus
    --color--series-1 to --color--series-10    the series palette
    --color--ramp-1 to --color--ramp-8         the heatmap ramp
    --font-size--small                         axis, legend, and tip text
    --font-weight--normal, --font-weight--bold
    --line-height--tight                       a tip, and an end label
    --spacing--x-small, --spacing--small
    --border-radius--base, --box-shadow--base
    --z-index--component                       an open tip's host
    --chart-height                             the plot of a chart
    --chart-sparkline-height                   the plot of a sparkline
    --chart-y-axis-width                       the y axis
    --chart-x-label-height                     a label under a column
    --chart-bar-share                          a bar's share of its column
    --chart-quadrant-shade                     the top right scatter quadrant

  A size that is not a step of spacing keeps a literal: a 1px rule, a
  dot, a swatch, and the width of a row label.
*/

@layer components {
  .chart-lines,
  .chart-xy-lines,
  .chart-scatter,
  .chart-sparkline,
  .chart-bars,
  .chart-heatmap,
  .chart-legend,
  .chart-axis-dates,
  .chart-note {
    color: var(--color--text, CanvasText);
    font-size: var(--font-size--small, 0.8rem);
  }

  /* The series palette: categorical, so neighbors look unrelated.
     Each class sets --chart-mark once, and one rule spends it on the
     stroke of a line, the fill of a bar, and the swatch of a key. */
  .chart-series {
    background-color: var(--chart-mark);
    fill: var(--chart-mark);
    stroke: var(--chart-mark);
  }

  .chart-series--1 {
    --chart-mark: var(--color--series-1, light-dark(#1e66f5, #8caaee));
  }

  .chart-series--2 {
    --chart-mark: var(--color--series-2, light-dark(#fe640b, #ef9f76));
  }

  .chart-series--3 {
    --chart-mark: var(--color--series-3, light-dark(#40a02b, #a6d189));
  }

  .chart-series--4 {
    --chart-mark: var(--color--series-4, light-dark(#8839ef, #ca9ee6));
  }

  .chart-series--5 {
    --chart-mark: var(--color--series-5, light-dark(#df8e1d, #e5c890));
  }

  .chart-series--6 {
    --chart-mark: var(--color--series-6, light-dark(#ea76cb, #f4b8e4));
  }

  .chart-series--7 {
    --chart-mark: var(--color--series-7, light-dark(#179299, #81c8be));
  }

  .chart-series--8 {
    --chart-mark: var(--color--series-8, light-dark(#dd7878, #ea999c));
  }

  .chart-series--9 {
    --chart-mark: var(--color--series-9, light-dark(#04a5e5, #85c1dc));
  }

  .chart-series--10 {
    --chart-mark: var(--color--series-10, light-dark(#7287fd, #babbf1));
  }

  /* The heatmap ramp: ordered, so neighbors look related. */
  .chart-ramp {
    background-color: var(--chart-mark);
  }

  .chart-ramp--1 {
    --chart-mark: var(--color--ramp-1, light-dark(#e3f2fd, #303446));
  }

  .chart-ramp--2 {
    --chart-mark: var(--color--ramp-2, light-dark(#cbe7f8, #414559));
  }

  .chart-ramp--3 {
    --chart-mark: var(--color--ramp-3, light-dark(#a7d1ee, #51576d));
  }

  .chart-ramp--4 {
    --chart-mark: var(--color--ramp-4, light-dark(#709ec5, #8caaee));
  }

  .chart-ramp--5 {
    --chart-mark: var(--color--ramp-5, light-dark(#3b658d, #ca9ee6));
  }

  .chart-ramp--6 {
    --chart-mark: var(--color--ramp-6, light-dark(#f6a89e, #ef9f76));
  }

  .chart-ramp--7 {
    --chart-mark: var(--color--ramp-7, light-dark(#ea796f, #ea999c));
  }

  .chart-ramp--8 {
    --chart-mark: var(--color--ramp-8, light-dark(#cc4844, #e78284));
  }

  /* A plot with a continuous axis: the y axis, the plot area, and a
     row of labels under the plot area. A plot with end labels adds a
     third track for them. An empty third track would still take a
     column gap, so a line plot would end short of a bar plot above
     it, and a crosshair linked across the two would miss. */
  .chart-plot {
    column-gap: var(--spacing--small, 0.5rem);
    display: grid;
    grid-template-columns: var(--chart-y-axis-width, 2.25rem) minmax(0, 1fr);
    grid-template-rows: var(--chart-height, 12rem) auto;

    &:has(> .chart-lines-labels) {
      grid-template-columns: var(--chart-y-axis-width, 2.25rem) minmax(0, 1fr) auto;
    }
  }

  .chart-axis-y {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    text-align: right;

    .chart-axis-y-tick {
      bottom: var(--chart-at);
      line-height: 1;
      position: absolute;
      right: 0;
      transform: translateY(50%);
      white-space: nowrap;
    }
  }

  /* A bar chart's y axis spaces its labels evenly from the top of the
     axis to zero, so the labels need no positions. */
  .chart-axis-y--even {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: var(--chart-height, 12rem);
    justify-content: space-between;
    padding-bottom: var(--chart-x-label-height, 1.5rem);
    width: var(--chart-y-axis-width, 2.25rem);

    .chart-axis-y-tick {
      position: static;
      transform: translateY(50%);
    }
  }

  .chart-plot-area {
    grid-column: 2;
    grid-row: 1;
    position: relative;
  }

  .chart-plot-svg {
    display: block;
    height: 100%;
    inset: 0;
    overflow: visible;
    position: absolute;
    width: 100%;
  }

  .chart-plot-zero {
    stroke: var(--color--border-dark, GrayText);
    stroke-dasharray: 4 3;
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
  }

  .chart-rule {
    background-color: var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent));
    position: absolute;
  }

  .chart-rule--across {
    bottom: var(--chart-at);
    height: 1px;
    left: 0;
    right: 0;
  }

  .chart-rule--down {
    bottom: 0;
    left: var(--chart-at);
    top: 0;
    width: 1px;
  }

  .chart-rule--mark {
    background-color: transparent;
    border-left: 1px dashed var(--color--border-dark, GrayText);
    bottom: 0;
    left: var(--chart-at);
    top: 0;
    width: 0;
  }

  .chart-axis-dates {
    display: flex;
    grid-column: 2;
    grid-row: 2;
    justify-content: space-between;
    margin-top: var(--spacing--x-small, 0.25rem);
    white-space: nowrap;
  }

  /* Under a bar chart the dates sit outside the grid, so they step past
     the y axis themselves. */
  .chart-axis-dates--bars {
    margin-left: calc(var(--chart-y-axis-width, 2.25rem) + var(--spacing--small, 0.5rem));
  }

  .chart-axis-x-ticks {
    grid-column: 2;
    grid-row: 2;
    height: var(--chart-x-label-height, 1.5rem);
    position: relative;

    .chart-axis-x-tick {
      left: var(--chart-at);
      position: absolute;
      top: var(--spacing--x-small, 0.25rem);
      transform: translateX(-50%);
      white-space: nowrap;
    }
  }

  /* After .chart-series, so a line is a stroke and not a filled
     polygon. non-scaling-stroke keeps the width even where the SVG
     stretches. */
  .chart-lines-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-opacity: 0.9;
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
  }

  /* A single-point series draws as a dot larger than the line stroke. */
  .chart-lines-line--dot {
    stroke-width: 4px;
  }

  /* A zero-length line with a round cap draws a dot that stays round
     when the SVG stretches. */
  .chart-lines-end {
    fill: none;
    stroke-linecap: round;
    stroke-width: 7px;
    vector-effect: non-scaling-stroke;
  }

  .chart-lines-labels {
    grid-column: 3;
    grid-row: 1;
    min-width: 4rem;
    position: relative;
  }

  /* After .chart-series: an end label wears the series color as text,
     not as a background. --chart-top keeps two labels one line apart in
     units of 1lh, so the line height here is the gap between them. */
  .chart-lines-label {
    background-color: transparent;
    color: var(--chart-mark);
    display: flex;
    gap: var(--spacing--x-small, 0.25rem);
    left: 0;
    line-height: var(--line-height--tight, 1.2);
    position: absolute;
    top: var(--chart-top);
    transform: translateY(-50%);
    white-space: nowrap;

    .chart-lines-label-name {
      font-weight: var(--font-weight--normal, 400);
    }

    .chart-lines-label-value {
      font-variant-numeric: tabular-nums;
      font-weight: var(--font-weight--bold, 600);
    }
  }

  /* A tip host holds its tip. Its position: relative is the default,
     and a host that a chart places, such as a band, a dot, or an event
     mark, sets position: absolute in a later rule. The later rule wins
     at the same specificity, so this rule stays above each of them. */
  .chart-tip-host {
    position: relative;

    &:is(:hover, :focus-visible, :focus-within) {
      z-index: var(--z-index--component, 10);

      > .chart-tip,
      > .chart-col-line {
        opacity: 1;
        visibility: visible;
      }
    }

    &:focus-visible {
      outline: 2px solid var(--color--accent, Highlight);
      outline-offset: -2px;
    }
  }

  /* Hover bands: one for each date, placed by Go. */
  .chart-cols {
    inset: 0;
    position: absolute;
  }

  .chart-col {
    bottom: 0;
    left: var(--chart-left);
    position: absolute;
    top: 0;
    width: var(--chart-width);
  }

  .chart-col-line {
    background-color: var(--color--border-dark, color-mix(in srgb, CanvasText 40%, transparent));
    bottom: 0;
    left: var(--chart-at);
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    transition: opacity 100ms ease;
    width: 1px;
  }

  /* The tip. visibility and not display, so the panel can fade, and so
     it leaves the accessibility tree while hidden. The delay keeps a
     pointer that crosses two columns from flashing a panel at each. */
  .chart-tip {
    background-color: var(--color--bg-secondary, Canvas);
    border: 1px solid var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent));
    border-radius: var(--border-radius--base, 3px);
    box-shadow: var(--box-shadow--base, 0 4px 12px rgb(0 0 0 / 15%));
    color: var(--color--text, CanvasText);
    font-size: var(--font-size--small, 0.8rem);
    line-height: var(--line-height--tight, 1.2);
    margin-top: var(--spacing--x-small, 0.25rem);
    max-width: min(20rem, 80vw);
    opacity: 0;
    padding: var(--spacing--x-small, 0.25rem) var(--spacing--small, 0.5rem);
    pointer-events: none;
    position: absolute;
    text-align: left;
    top: 100%;
    transition: opacity 100ms ease 120ms, visibility 100ms ease 120ms;
    visibility: hidden;
    width: max-content;

    .chart-tip-title {
      align-items: center;
      display: flex;
      font-weight: var(--font-weight--bold, 600);
      gap: var(--spacing--x-small, 0.25rem);
      margin-bottom: var(--spacing--x-small, 0.25rem);
      white-space: nowrap;
    }

    .chart-tip-image {
      border-radius: var(--border-radius--base, 3px);
      height: 1rem;
      object-fit: contain;
      width: 1rem;
    }

    .chart-tip-line {
      display: flex;
      gap: var(--spacing--small, 0.5rem);
      justify-content: space-between;
      white-space: nowrap;
    }

    .chart-tip-line--sub {
      padding-left: var(--spacing--small, 0.5rem);
    }

    .chart-tip-label {
      color: var(--color--text-light, GrayText);
    }

    .chart-tip-value {
      font-variant-numeric: tabular-nums;
    }

    .chart-tip-line-names,
    .chart-tip-names {
      color: var(--color--text-light, GrayText);
      white-space: normal;
    }

    .chart-tip-names {
      border-top: 1px solid var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent));
      margin-top: var(--spacing--x-small, 0.25rem);
      padding-top: var(--spacing--x-small, 0.25rem);
    }
  }

  .chart-tip--left {
    left: 0;
  }

  .chart-tip--right {
    right: 0;
  }

  .chart-tip--center {
    left: 50%;
    transform: translateX(-50%);
  }

  /* Categorical bars: columns on a wide screen, rows on a narrow one,
     from the same markup. */
  .chart-bars {
    display: flex;
    gap: var(--spacing--small, 0.5rem);
  }

  .chart-bars-plot {
    display: flex;
    flex: 1;
    height: var(--chart-height, 12rem);
    min-width: 0;
    /* The event marks place themselves in the plot. */
    position: relative;
  }

  .chart-bars-col {
    align-items: center;
    background: linear-gradient(
      var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent)),
      var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent))
    ) left 0 bottom var(--chart-x-label-height, 1.5rem) / 100% 1px no-repeat;
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 100%;
    min-width: 0;
  }

  .chart-bars-track {
    align-items: flex-end;
    display: flex;
    flex: 1;
    justify-content: center;
    min-height: 0;
    width: 100%;
  }

  .chart-bars-bar {
    border-radius: var(--border-radius--base, 3px) var(--border-radius--base, 3px) 0 0;
    height: var(--chart-pct);
    min-height: 1px;
    transition: opacity 150ms ease;
    width: var(--chart-bar-share, 60%);
  }

  .chart-bars-group {
    display: flex;
    flex: 1;
    gap: 1px;
    min-height: 0;
    width: var(--chart-bar-share, 60%);

    .chart-bars-bar {
      width: 100%;
    }
  }

  .chart-bars-stack {
    display: flex;
    flex-direction: column-reverse;
    height: 100%;
    width: var(--chart-bar-share, 60%);
  }

  .chart-bars-segment {
    height: var(--chart-pct);
    min-height: 1px;
    transition: opacity 150ms ease;
  }

  .chart-tip-host:is(:hover, :focus-within) :is(.chart-bars-bar, .chart-bars-segment) {
    opacity: 0.8;
  }

  a:is(.chart-bars-bar, .chart-bars-segment):hover {
    filter: brightness(0.85);
  }

  .chart-bars-plot:has(.chart-bars-col--selected) .chart-bars-col:not(.chart-bars-col--selected) .chart-bars-segment {
    opacity: 0.35;
  }

  .chart-bars-col--selected .chart-axis-x {
    font-weight: var(--font-weight--bold, 600);
  }

  .chart-bars-count {
    display: none;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }

  .chart-axis-x {
    height: var(--chart-x-label-height, 1.5rem);
    line-height: var(--chart-x-label-height, 1.5rem);
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
  }

  /* A long run prints no label under its columns, so its baseline and
     its axis reach the bottom of the plot. */
  .chart-bars--long {
    .chart-axis-y--even {
      padding-bottom: 0;
    }

    .chart-bars-col {
      background-position: left 0 bottom 0;
    }
  }

  /* The grouped and the stacked views add these to name the chart, so
     an app can add a rule for one of them. They need nothing beyond
     what .chart-bars gives. */
  .chart-bars--grouped,
  .chart-bars--stacked {
    min-width: 0;
  }

  /* Rows below 70em. A strict width < query, so a screen exactly 70em
     wide gets one layout and not both. The query leaves out a long run
     and a run with .chart-bars--columns, so each keeps its columns and
     no rule has to undo this one. */
  @media (width < 70em) {
    .chart-bars:not(.chart-bars--long, .chart-bars--columns) {
      display: block;

      .chart-axis-y--even {
        display: none;
      }

      .chart-bars-plot {
        flex-direction: column;
        gap: var(--spacing--x-small, 0.25rem);
        height: auto;
      }

      .chart-bars-col {
        background: none;
        flex-direction: row;
        gap: var(--spacing--small, 0.5rem);
        height: auto;
        min-height: 1.25rem;
      }

      .chart-axis-x {
        flex-shrink: 0;
        height: auto;
        line-height: var(--line-height--tight, 1.2);
        order: -1;
        overflow: visible;
        text-align: left;
        white-space: normal;
        width: 7rem;
      }

      .chart-bars-count {
        display: block;
      }

      .chart-bars-track,
      .chart-bars-group,
      .chart-bars-stack {
        align-items: center;
        flex-direction: row;
        height: auto;
        justify-content: flex-start;
        min-width: 0;
        width: 100%;
      }

      .chart-bars-group {
        flex-direction: column;
        gap: 2px;
      }

      .chart-bars-bar {
        border-radius: var(--border-radius--base, 3px);
        height: 0.75rem;
        min-width: 1px;
        width: var(--chart-pct);
      }

      .chart-bars-group .chart-bars-bar {
        width: var(--chart-pct);
      }

      .chart-bars-segment {
        height: 0.75rem;
        min-width: 1px;
        width: var(--chart-pct);
      }
    }
  }

  .chart-scatter-dot {
    background-color: var(--color--accent, light-dark(#1e66f5, #8caaee));
    border: 1px solid var(--color--bg-secondary, Canvas);
    border-radius: 50%;
    bottom: var(--chart-y);
    height: 0.5rem;
    left: var(--chart-x);
    opacity: 0.85;
    position: absolute;
    transform: translate(-50%, 50%);
    width: 0.5rem;

    &:is(:hover, :focus-visible) {
      opacity: 1;
    }
  }

  .chart-xy-dot {
    background-color: var(--chart-mark, var(--color--accent, light-dark(#1e66f5, #8caaee)));
    border: 1px solid var(--color--bg-secondary, Canvas);
    border-radius: 50%;
    bottom: var(--chart-y);
    height: 0.55rem;
    left: var(--chart-x);
    position: absolute;
    transform: translate(-50%, 50%);
    width: 0.55rem;
  }

  .chart-xy-dot--highlight {
    box-shadow: 0 0 0 2px var(--color--bg-secondary, Canvas), 0 0 0 3.5px var(--color--text, CanvasText);
  }

  /* One box for the four quadrants of a scatter, painted as three
     background layers: the shaded quarter at the top right, then the
     two dividers at the middle of each axis. The dividers are the edges
     of the shade, so the plot needs no element for each quadrant. */
  .chart-scatter-quadrants {
    --chart-divider: var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent));
    --chart-shade: var(--chart-quadrant-shade, color-mix(in srgb, var(--color--accent, Highlight) 12%, transparent));
    background-image:
      linear-gradient(var(--chart-shade), var(--chart-shade)),
      linear-gradient(var(--chart-divider), var(--chart-divider)),
      linear-gradient(var(--chart-divider), var(--chart-divider));
    background-position: 100% 0, 50% 0, 0 50%;
    background-repeat: no-repeat;
    background-size: 50% 50%, 1px 100%, 100% 1px;
    inset: 0;
    position: absolute;
  }

  .chart-note {
    color: var(--color--text-light, GrayText);
    margin: var(--spacing--x-small, 0.25rem) 0 0;
  }

  .chart-plot:has(.chart-event),
  .chart-bars:has(.chart-event) {
    margin-top: calc(1rem + var(--spacing--small, 0.5rem));
  }

  .chart-events {
    inset: 0;
    pointer-events: none;
    position: absolute;
  }

  .chart-event {
    align-items: center;
    bottom: 0;
    display: flex;
    flex-direction: column;
    left: var(--chart-at);
    pointer-events: auto;
    position: absolute;
    top: calc(-1rem - var(--spacing--small, 0.5rem));
    transform: translateX(-50%);

    .chart-event-count {
      background-color: var(--color--bg-secondary, Canvas);
      border: 1px solid var(--color--border-base, color-mix(in srgb, CanvasText 12%, transparent));
      border-radius: var(--border-radius--base, 3px);
      font-weight: var(--font-weight--bold, 600);
      line-height: 1rem;
      padding: 0 var(--spacing--x-small, 0.25rem);
    }

    .chart-event-line {
      border-left: 1px dashed var(--color--border-dark, color-mix(in srgb, CanvasText 40%, transparent));
      flex: 1;
      width: 1px;
    }
  }

  .chart-heatmap {
    column-gap: var(--spacing--small, 0.5rem);
    display: grid;
    grid-template-columns: var(--chart-y-axis-width, 2.25rem) minmax(0, 1fr);
    grid-template-rows: var(--chart-height, 12rem) auto;
  }

  .chart-heatmap-axis {
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-around;
    text-align: right;
    white-space: nowrap;
  }

  .chart-heatmap-plot {
    display: flex;
    gap: 1px;
  }

  .chart-heatmap-col {
    display: flex;
    flex: 1;
    flex-direction: column-reverse;
    gap: 1px;
    min-width: 0;
  }

  .chart-heatmap-cell {
    border-radius: 1px;
    flex: 1;
    min-height: 2px;
  }

  .chart-sparkline {
    column-gap: var(--spacing--small, 0.5rem);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: var(--chart-sparkline-height, 4rem) auto;
  }

  .chart-sparkline-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    line-height: 1;
    text-align: right;
  }

  .chart-sparkline-svg {
    display: block;
    height: 100%;
    overflow: visible;
    width: 100%;
  }

  .chart-sparkline-dates {
    display: flex;
    grid-column: 2;
    justify-content: space-between;
    margin-top: var(--spacing--x-small, 0.25rem);
  }

  .chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing--x-small, 0.25rem) var(--spacing--small, 0.5rem);
    line-height: 1;
    margin-top: var(--spacing--small, 0.5rem);
  }

  .chart-legend-title {
    font-weight: var(--font-weight--bold, 600);
    white-space: nowrap;
  }

  .chart-legend-key {
    align-items: center;
    display: flex;
    gap: var(--spacing--x-small, 0.25rem);
    white-space: nowrap;
  }

  /* The swatch is square: it is a key, not a control. */
  .chart-legend-swatch {
    border-radius: var(--border-radius--base, 3px);
    flex-shrink: 0;
    height: 0.625rem;
    width: 0.625rem;
  }
}
