/* The project's shared base: the header, sections, type, a product's main page, figures, tables,
   references and the footer. Every page of the project takes it unchanged, after tokens.css, and
   adds a sheet of its own. Colours, type and line patterns come from tokens.css: this file names
   roles, never values. */
:root { --gutter: clamp(16px, 4vw, 48px); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
/* The footer sits at the window's foot on a page shorter than the window. */
body { font: 400 17px/1.6 var(--font-text); min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
a { color: inherit; }
.nb { white-space: nowrap; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: var(--focus-width) solid var(--ink); outline-offset: 3px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
/* Scrollbars thin and in the page's own colours, in either face: the page's on the page, a scroll
   area's on its own background. The colour is inherited and the width is not, so each scroll area
   names its width. */
html { scrollbar-width: thin; scrollbar-color: var(--rule) var(--page); }
:where(pre, table, figure, .diagram, nav) { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }

/* The header looks the same at every scroll position. Above a phone's width it sticks to the top,
   and once the page has scrolled (header.js sets .scrolled) a hairline shows under it; on a phone it
   scrolls away with the page. Nothing in it moves. --header is its height with the rule, for links
   into the page and the focus; header.js keeps it at the header's measured height, and these values
   stand without the script. */
:root { --header: 61px; }
header { position: sticky; top: 0; z-index: 10; background: var(--page); border-bottom: 1px solid transparent; }
.scrolled header { border-bottom-color: var(--hair); }
html { scroll-padding-top: var(--header); }
@media print { header { position: static; } }
/* Where the header scrolls away (--header-returns, set below and by a page's own sheet), header.js
   brings it back while the reader scrolls up: away, it waits fixed above the window, and the page
   keeps its place. */
.header-away body { padding-top: var(--header-flow); }
.header-away header { position: fixed; top: 0; left: 0; right: 0; transform: translateY(-100%); }
.header-away.header-back header { transform: none; }
@media (prefers-reduced-motion: no-preference) { .header-moves header { transition: transform .2s ease-out; } }
header .wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand nav face"; align-items: center; gap: 12px 26px; min-height: 60px; }
.brand { grid-area: brand; display: flex; align-items: center; gap: 10px; text-decoration: none; font: 400 14px/1 var(--font-display); letter-spacing: .04em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
header nav { grid-area: nav; justify-self: end; display: flex; align-items: center; gap: 26px; font-size: 15px; font-weight: 500; }
header nav a { text-decoration: none; color: var(--ink-2); }
header nav a:hover { color: var(--ink); }
/* Where the reader is: the page among the project's pages, or the section of this page. In ink,
   underlined. */
header nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; }
/* On a product's pages its name gives way to its group (design/README.md): the product's name in
   ink, then its pages, all on one rule, the page shown on a heavier stretch of it. Borders, so
   forced colours keep them. */
header nav .product { display: flex; column-gap: 18px; position: relative; }
header nav .product::after { content: ""; position: absolute; left: 0; right: 0; top: calc(100% + 6px); border-top: 1px solid var(--rule); }
header nav .product > a { position: relative; }
header nav .product > a:first-child { color: var(--ink); }
header nav .product > a[aria-current] { text-decoration: none; }
/* Over the rule, which the group draws after its links. */
header nav .product > a[aria-current="page"]::after, header nav .product > a + a[aria-current]::after { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: calc(100% + 5px); border-top: 3px solid var(--ink); }
/* A link past the header to the page's content, shown only while it has the focus. */
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 11; background: var(--raised); padding: 6px 10px; border-radius: 6px; }
.switch { grid-area: face; display: flex; align-items: center; background: none; border: 0; padding: 4px 0; cursor: pointer; }
/* face.js turns the face; without scripts the switch would do nothing. */
html:not(.js) .switch { visibility: hidden; }
.switch .track { position: relative; display: block; width: 46px; height: 26px; border-radius: 999px; border: 1.5px solid var(--rule); }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--ink); color: var(--page); overflow: hidden; }
/* The thumb is a window onto a disc with the sun on one half and the moon on the other, as on a
   watch's day/night indicator; half a turn as the thumb travels, clockwise going right. Both move
   only once the page has drawn them where they belong, so a night page loads still. */
.switch .wheel { position: absolute; left: -10.5px; top: .5px; width: 40px; height: 40px; transform-origin: 20px 20px; }
.switch[aria-checked="true"] .thumb { transform: translateX(20px); }
.switch[aria-checked="true"] .wheel { transform: rotate(180deg); }
/* How long the face takes to turn: the thumb's travel, and the dip below (face.js reads it). */
:root { --face-turn: .26s; }
.switch.ready .thumb, .switch.ready .wheel { transition: transform var(--face-turn) cubic-bezier(.4, 0, .2, 1); }
@media (prefers-reduced-motion: reduce) { .switch.ready .thumb, .switch.ready .wheel { transition: none; } }
/* The switch turns the face under a cover (face.js): the page dips to the new face's background,
   changes while covered, and comes back up in the new face. The cover carries the new face
   (tokens.css gives a face to any element with data-face) and sits in the top layer, over the
   header and any popover, taking the pointer for the turn. A copy of the switch rides above it in
   the old face, and takes the new one as the cover passes half-way: the thumb is ink on the page,
   and would vanish against a page turning under it. */
.face-cover { position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: none; overflow: visible; }
.face-cover > i { position: absolute; inset: 0; background: var(--page); opacity: 0; }
.face-cover > .switch { position: fixed; margin: 0; }
.face-cover > .switch.focus { outline: var(--focus-width) solid var(--ink); outline-offset: 3px; }

h1 { font: 400 clamp(28px, 3.6vw, 42px)/1.25 var(--font-display); margin: 0 0 22px; letter-spacing: .01em; }
.lede { font-size: 20px; max-width: 26em; margin: 0 0 18px; }

/* A section: its heading above, its content in two columns; on an ultrawide screen the heading
   takes a column of its own beside them. */
section { border-top: 1px solid var(--hair); padding: 40px 0; }
.head { margin-bottom: 28px; }
h2 { font: 400 20px/1.3 var(--font-display); margin: 0; letter-spacing: .02em; }
.brand, h1, h2 { font-stretch: var(--display-stretch); font-weight: var(--display-weight); }
.kicker { color: var(--ink-2); font-size: 15px; margin: 6px 0 0; }
/* A section heading that leads to the section's whole page: underlined at rest, as links are,
   with no arrow. */
h2 a { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .2em; }
h2 a:hover { text-decoration-thickness: 2.5px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gutter); align-items: start; }
p { margin: 0 0 14px; max-width: 36em; }
/* Ruled rows: a label beside its value, a hair between rows. */
.specs { margin: 0; }
.specs > div { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.specs > div:last-child { border-bottom: 1px solid var(--hair); }
.specs dt { color: var(--ink-2); }
/* A value too long for its column, a serial or a hash at a large text size, breaks inside it. */
.specs dd { margin: 0; overflow-wrap: anywhere; }

/* A product's main page opens with its head: the mark on a plate beside the product's name, the
   lede with the ways in under it, and a figure in the column beside them. A plate shows a mark in
   lume at whatever size the page gives it. */
.plate { background: var(--plate); color: var(--lume); box-shadow: inset 0 0 0 1px var(--hair); display: grid; place-items: center; flex: none; }
/* tickwave's mark draws the ticks between its edges' in plate-line, as its icon does (tokens.toml,
   [icon.tickwave]). */
.plate .line { fill: var(--plate-line); fill-opacity: .75; }
.product-head { padding: 32px var(--gutter) 40px; }
.product-id { display: flex; gap: 22px; align-items: center; margin-bottom: 32px; }
.product-id .plate { width: 96px; height: 96px; border-radius: 21px; }
.product-id .plate svg { width: 66px; height: 66px; }
.product-id h1 { margin: 0; }
.product-id .sub { color: var(--ink-2); margin: 2px 0 0; }
/* The ways on from a page or a section: links in a row, weighted as a heading's. */
.ways { display: flex; flex-wrap: wrap; gap: 12px 28px; font-weight: 600; }
.product-head .ways { margin: 22px 0 0; }
/* Until the first release, a line under the ways in says so. */
.status { color: var(--ink-2); font-size: 15px; margin: 0; }
.product-head .status { margin-top: 14px; }
/* The figure's caption, then the way on to the whole of it. */
.product-figure { border-left: 1px solid var(--hair); padding-left: var(--gutter); }
.product-figure p { font-size: 15px; color: var(--ink-2); text-wrap: pretty; }
.product-figure p:last-child { color: var(--ink); font-weight: 600; margin: 0; }
/* A command. It breaks only between its arguments, and an argument wider than the line, as at a
   large text size, scrolls inside the command rather than the page sideways. A wrapped line hangs
   past the prompt: an ink $ centred in a square of lume, its width and gap the hanging indent. The
   command is a copy target (copy.js), its Copy button in the corner. */
.console { position: relative; background: var(--surface); border-radius: 10px; padding: 12px 16px; }
.console code { display: block; overflow: auto hidden; font: 500 14px/1.5 var(--font-code); font-stretch: var(--code-stretch); padding-left: 1.9em; text-indent: -1.9em; }
.console code > span { display: inline-block; width: 1.4em; height: 1.4em; line-height: 1.4em; margin-right: .5em; text-indent: 0; text-align: center; vertical-align: middle; border-radius: 3px; background: var(--lume); color: var(--on-lume); }
.console code i { font-style: normal; white-space: nowrap; }
.console p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); max-width: none; }
.js .console code { padding-right: 4.6em; cursor: copy; }
/* Points in ruled columns, numbered where they are a sequence (an ol). */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.steps li { border-top: 1px solid var(--ink); padding-top: 12px; }
.steps h3 { font-size: 17px; font-weight: 600; margin: 0 0 8px; }
ol.steps { counter-reset: step; }
ol.steps li { counter-increment: step; }
ol.steps h3::before { content: counter(step); font: var(--figures-weight) 15px/1 var(--font-figures); margin-right: 10px; color: var(--ink-2); }
/* After .console p, which it ties with: a console in a step takes the step's size. */
.steps p { font-size: 15px; }
.after { margin: 28px 0 0; font-size: 15px; color: var(--ink-2); }
.after code { font: 500 .88em var(--font-code); font-stretch: var(--code-stretch); white-space: nowrap; }
.after a { color: var(--ink); }
/* A product's docs on its main page: a row a group, what it is for beside it, leading to the group
   on the docs' index. */
.doc-rows { margin: 0; }
.doc-rows > div { display: grid; grid-template-columns: 30% minmax(0, 1fr); padding: 14px 0; border-top: 1px solid var(--hair); }
.doc-rows > div:last-child { border-bottom: 1px solid var(--hair); }
.doc-rows dt a { font-weight: 600; }
.doc-rows dd { margin: 0; color: var(--ink-2); font-size: 15px; text-wrap: pretty; }

/* Figures: a chart on an unbordered surface, its numbered caption below. */
figure { margin: 0; }
figcaption { font-size: 14px; color: var(--ink-2); margin-top: 10px; max-width: 40em; }
figcaption b { color: var(--ink); font-weight: 600; }
.chart { position: relative; background: var(--surface); border-radius: 14px; padding: 12px 8px 6px; }
.legend { list-style: none; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 2px 10px 6px; font-size: 14px; color: var(--ink); }
.legend li { white-space: nowrap; }
.legend i { display: inline-block; width: 16px; height: 2px; vertical-align: middle; margin-right: 6px; }
.legend i.limit { height: 0; border-top: 2px dashed var(--ink-2); }
.chart:focus-visible { outline: var(--focus-width) solid var(--ink); outline-offset: 3px; }
.chart svg { display: block; }
.chart .dim { opacity: .2; }
/* Before its sweep the chart is drawn whole and only this hides its lines, so a reader view or any
   page without our CSS shows the figure complete. */
.chart[data-pending] .sweep, .chart[data-pending] #limit { visibility: hidden; }
.chart g.dim .end { visibility: hidden; }
.chart circle.pt { stroke: var(--surface); }
.chart circle.hollow { fill: var(--surface); }
/* A number in the text that points at its evidence in the figure and the table. Only a script links
   them, so only then is it underlined. */
.js .ref { text-decoration: underline dotted var(--ink-2); text-decoration-thickness: 1.5px; text-underline-offset: .22em; }
.js .ref:hover, .js .ref:focus-visible { text-decoration-style: solid; text-decoration-color: var(--ink); }
.tip { position: absolute; z-index: 1; pointer-events: none; background: var(--page); border: 1px solid var(--hair); border-radius: 8px; padding: 6px 10px; font-size: 13px; line-height: 1.45; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.tip b { font-weight: 600; }
.tip i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
/* Around a table that can outgrow its column at a large text size: it scrolls there, not the page. */
.scroll-x { max-width: 100%; overflow-x: auto; }
/* Figures and every heading over them share a right edge; only the clock column reads from the
   left. Headings sit on the header's bottom line. The misread marker hangs in the padding, so no
   figure moves for it. */
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--hair); }
th { font-weight: 600; font-size: 14px; border-bottom-color: var(--ink); vertical-align: bottom; }
th.clock, td.clock { text-align: left; }
td.wrong { color: var(--ink-2); }
td { white-space: nowrap; position: relative; }
td .mark { position: absolute; right: -3px; }
th.group { border-bottom-color: var(--hair); }
/* The interaction layer is hue-free: an ink wash for the clock under the pointer, an ink fill for a
   value the text points at. Nothing fades: a highlight is there or it is not. */
tr.on td { background: var(--wash); }
td.sel { background: var(--ink); color: var(--page); }
td.dim, th.dim { color: var(--ink-2); }

footer { border-top: 1px solid var(--hair); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding-top: 14px; padding-bottom: 18px; color: var(--ink-2); font-size: 14px; }

@media (min-width: 2000px) {
  .wrap { max-width: 1720px; }
  section .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 4fr); gap: var(--gutter); }
  .head { margin-bottom: 0; }
  section .wrap > .two:first-child { grid-column: 2; }
}
@media (max-width: 860px) {
  /* One row: the mark without its name, the places, the switch. */
  :root { --header: 51px; }
  header .wrap { grid-template-rows: 34px; min-height: 0; padding-top: 8px; padding-bottom: 8px; }
  header nav { justify-self: center; gap: 18px; }
  header nav .product { column-gap: 14px; }
  .brand .name { display: none; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .product-figure { border-left: 0; padding-left: 0; border-top: 1px solid var(--hair); padding-top: 20px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .doc-rows > div { grid-template-columns: minmax(0, 1fr); }
  .doc-rows dd { margin-top: 4px; }
}
@media (max-width: 520px) {
  /* Two rows that scroll away with the page: the mark and the switch, the places under them. */
  :root { --header-returns: 1; }
  header { position: static; }
  html { scroll-padding-top: 8px; }
  header .wrap { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(34px, auto) auto; grid-template-areas: "brand face" "nav nav"; row-gap: 10px; padding-top: 12px; padding-bottom: 10px; }
  /* At a large text size the name wraps, its row growing, rather than run under the switch. */
  .brand { white-space: normal; }
  /* The places wrap rather than widen the page on the narrowest phones, a wrapped line clear of
     the rule under a product's group. */
  header nav { justify-self: start; flex-wrap: wrap; gap: 12px 14px; font-size: 14px; }
  header nav .product { column-gap: 12px; }
  .brand svg { width: 24px; height: 24px; }
  .brand .name { display: inline; }
  /* Back on the way up, one row: the mark and the places. */
  .header-away header .wrap { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "brand nav"; column-gap: 12px; padding-top: 10px; padding-bottom: 10px; }
  .header-away header nav { column-gap: 12px; }
  .header-away header nav .product { column-gap: 10px; }
  .header-away header :is(.brand .name, .switch) { display: none; }
  .specs > div { grid-template-columns: 1fr; gap: 0; }
  .specs dt { font-size: 14px; }
  th, td { padding: 6px 4px; font-size: 14px; }
  section { padding: 32px 0; }
  /* A product's head closes up to the first section's line, as the sections do. */
  .product-head { padding-bottom: 32px; }
  .product-id .plate { width: 72px; height: 72px; border-radius: 16px; }
  .product-id .plate svg { width: 50px; height: 50px; }
}

/* Click-to-copy (copy.js): a Copy button in the corner of a command or a doc's code block, the
   command itself a copy target. Copied, the button fills with ink for a moment, as a selected thing
   does. */
.copy { position: absolute; top: 9px; right: 10px; font: 500 13px/1 var(--font-text); color: var(--ink-2); background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.copy:hover { color: var(--ink); background: var(--wash); }
/* One word shows at a time (copy.js); the others sit over it, centred. The button changes width to
   fit the new word from its right edge, which stays put, so the point the reader pressed stays on
   it. The old word fades out first and the new one fades in as the width settles, so the two never
   blur together. */
.copy { display: inline-flex; justify-content: center; overflow: hidden; transition: color .18s, background-color .18s, border-color .18s, width .2s cubic-bezier(.3, 0, .2, 1); }
.copy > .say { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: opacity .14s .08s; }
.copy > .say:not(.on) { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0; transition: opacity .1s; }
.copied > .copy { color: var(--page); background: var(--ink); border-color: var(--ink); animation: copy-press .32s cubic-bezier(.3, 0, .2, 1); }
/* The button's word is never part of a selection, and the button hides while the reader selects text
   in its box. */
.copy { user-select: none; -webkit-user-select: none; }
.selecting > .copy, article.doc .codeblock.selecting .copy { visibility: hidden; opacity: 0; }
.copy .tick { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 12; }
.copied > .copy .on .tick { animation: copy-tick .26s .06s ease-out backwards; }
@keyframes copy-press { 0% { transform: scale(.9); } 55% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes copy-tick { from { stroke-dashoffset: 12; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .copy, .copy > .say, .copied > .copy, .copied > .copy .on .tick { transition: none; animation: none; } }
.codeblock { position: relative; }
.codeblock code { cursor: copy; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
/* A doc's code block (copy.js wraps it): its button shows over the code's corner while the block is
   pointed at, while the button has the keyboard's focus, or once it has copied, so the code needs no
   room kept for it. Without hover, as on a touch screen, it stays. */
article.doc .codeblock { margin: 0 0 16px; }
article.doc .codeblock pre { margin: 0; }
article.doc .codeblock .copy { top: 8px; right: 10px; opacity: 0; transition: opacity .15s, color .18s, background-color .18s, border-color .18s, width .2s cubic-bezier(.3, 0, .2, 1); }
article.doc .codeblock:hover .copy, article.doc .codeblock .copy:focus-visible, article.doc .codeblock.copied .copy { opacity: 1; }
/* Without hover the button stays, so the code starts below it rather than under it. */
@media (hover: none) {
  article.doc .codeblock .copy { opacity: 1; }
  article.doc .codeblock pre { padding-top: 40px; }
}
