/* The project's docs, shared by every product's: a product's docs index, a doc's text, its frame
   and the search. Each product's build writes the markup design/README.md gives; this sheet and
   doc.js, copy.js and search.js do the rest. The doc and the index are named with their elements,
   article.doc and div.docs-index, so the same class elsewhere on a page (a body's kind) takes none
   of this. */
/* A product's docs index: its docs, in groups or one list, each linked with what it covers. */
/* Two columns the groups flow down, so a long group does not leave a hole beside a short one. */
.doc-groups { columns: 2; column-gap: var(--gutter); }
.doc-groups > div { break-inside: avoid; margin-bottom: 32px; }
.doc-groups .group { font: 600 15px/1.4 var(--font-text); font-stretch: normal; letter-spacing: 0; color: var(--ink-2); margin: 0 0 6px; }
.doc-groups ul { list-style: none; margin: 0; padding: 0; }
.doc-groups li { padding: 9px 0; border-top: 1px solid var(--hair); }
.doc-groups li > a { font-weight: 600; }
.doc-groups li p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.coming { font-weight: 600; color: var(--ink-2); }
.coming small { font-weight: 500; font-size: 12px; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--rule); border-radius: 4px; }
@media (max-width: 860px) { .doc-groups { columns: 1; } }

/* The index page: the title with the search beside it, a line on where the docs are written, the docs. */
div.docs-index { padding-top: 32px; padding-bottom: 64px; }
div.docs-index .intro { color: var(--ink-2); margin-bottom: 40px; }
div.docs-index .doc-groups > div { scroll-margin-top: calc(var(--header) + 16px); }

/* A doc: the text in a reading column beside the contents. A word wider than the column, such as
   names joined by slashes, breaks rather than push the page sideways. */
article.doc { min-width: 0; max-width: 46em; overflow-wrap: break-word; }
article.doc h2 { font: var(--display-weight) 22px/1.3 var(--font-display); font-stretch: var(--display-stretch); margin: 44px 0 12px; padding-top: 20px; border-top: 1px solid var(--hair); }
article.doc h3 { font-size: 18px; font-weight: 600; margin: 30px 0 8px; }
article.doc h4 { font-size: 16px; font-weight: 600; margin: 24px 0 6px; }
article.doc p, article.doc li { max-width: 40em; }
article.doc li { margin: 4px 0; }
article.doc .anchor { margin-left: .35em; color: var(--ink-2); text-decoration: none; font-weight: 400; opacity: 0; }
article.doc :is(h2, h3, h4):hover .anchor, article.doc .anchor:focus-visible { opacity: 1; }
article.doc code { font: 500 .88em var(--font-code); font-stretch: var(--code-stretch); }
article.doc pre { background: var(--surface); border-radius: 8px; padding: 12px 14px; overflow-x: auto; line-height: 1.5; font-size: 14px; }
article.doc pre code { font-size: 1em; }
/* Inline code breaks between its words: each build puts every word short enough for a phone's
   column in a .word (design/README.md says how short), kept on one line. A longer word, a path,
   breaks anywhere. */
article.doc :not(pre) > code { overflow-wrap: anywhere; }
article.doc :not(pre) > code .word { white-space: nowrap; }
/* A column narrower than the longest .word, about 13.6em of the article's text at 22 characters, as
   at a large text size: the words break too, rather than widen the page. The query's em is the
   article's own, so it follows the text size. */
article.doc { container-type: inline-size; }
@container (max-width: 14em) { article.doc :not(pre) > code .word { white-space: normal; } }
/* A table keeps its columns and scrolls inside the column rather than the page sideways. */
article.doc table { display: block; width: max-content; max-width: 100%; overflow-x: auto; margin: 0 0 18px; }
/* A doc's figure keeps its text legible: drawn for the reading column, it shrinks to four fifths at
   most and then scrolls inside the column, as a table does. */
article.doc .diagram { margin: 24px 0 28px; overflow-x: auto; }
article.doc .diagram svg { display: block; width: 100%; min-width: 576px; max-width: 720px; height: auto; }
article.doc th, article.doc td { text-align: left; vertical-align: top; white-space: normal; min-width: 6em; max-width: 28em; }
article.doc th { border-bottom-color: var(--rule); }
.doc-source { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--hair); font-size: 14px; color: var(--ink-2); }
/* The docs' search: a field, a count, and the sections found, grouped by doc, each on the same trace
   as the contents (below), the pulse on the one chosen or the one the page shows. A word found is
   marked in lume, the site's colour for what to look at, in the results and, after following one,
   in the text. Without the script there is no field. */
.doc-rail.searching .doc-nav { display: none; }
.find { display: none; position: relative; margin: 0 0 14px; }
.js .find { display: block; }
.find input { width: 100%; appearance: none; margin: 0; padding: 7px 32px 7px 10px; font: 400 14px/1.3 var(--font-text); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.find input::placeholder { color: var(--ink-2); opacity: 1; }
.find input::-webkit-search-cancel-button { display: none; }
.find input:focus-visible { outline: var(--focus-width) solid var(--ink); outline-offset: 2px; }
/* The key that reaches the field, in it while it is empty and unfocused, for a keyboard and mouse. */
.find .key { display: none; position: absolute; top: 7px; right: 8px; min-width: 18px; padding: 0 4px; font: 500 12px/18px var(--font-text); text-align: center; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 4px; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .find:not(.typed):not(:focus-within) .key { display: block; } }
.find .clear { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; padding: 0; background: none; border: 0; border-radius: 4px; color: var(--ink-2); cursor: pointer; }
.find .clear::before, .find .clear::after { content: ""; position: absolute; left: 7px; top: 12px; width: 12px; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.find .clear::after { transform: rotate(-45deg); }
.find .clear:hover { color: var(--ink); }
.find .count { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.find .count:empty { display: none; }
.found { position: relative; }
.found .doc-name { margin: 14px 0 4px; padding: 2px 0; font-weight: 600; color: var(--ink-2); }
.found [role="group"]:first-child .doc-name { margin-top: 0; }
.found a[role="option"], .found .more { display: block; padding: 4px 0 6px 14px; border-left: 2px solid var(--hair); text-decoration: none; color: var(--ink); cursor: pointer; }
.found .h { display: block; font-size: 13px; font-weight: 600; line-height: 1.4; }
.found .snip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 1px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.found a[role="option"]:hover .h, .found a[role="option"]:hover .snip:first-child, .found .more:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.found .more { padding-top: 2px; font-size: 13px; color: var(--ink-2); }
.found mark, article.doc mark.hit { padding: 0 1px; margin: 0 -1px; border-radius: 2px; background: var(--lume); color: var(--on-lume); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
/* On the docs' index: the field beside the title, its count under it, and the results in the
   groups' place, wider. Where the two do not fit on a line, the field goes under the title. */
.docs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 32px; margin: 0 0 34px; }
.docs-head h1 { margin: 0; }
div.docs-index .find { flex: 0 1 22rem; margin: 0; }
div.docs-index .find .count { position: absolute; top: 100%; left: 0; margin-top: 6px; white-space: nowrap; }
div.docs-index .found { max-width: 46em; }
div.docs-index .found .h { font-size: 15px; }
div.docs-index .found .snip { font-size: 14px; }
@media (min-width: 861px) { div.docs-index .found .snip { -webkit-line-clamp: 2; } }
@media (max-width: 760px) {
  .docs-head { margin-bottom: 22px; }
  div.docs-index .find .count { position: static; }
}
div.docs-index .found .doc-name { margin-top: 22px; font-size: 15px; }
div.docs-index.searching .doc-groups { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .found .pulse { transition: top .15s ease-out, height .15s ease-out; }
}

/* A doc page's frame, shared by the project's docs: the contents in a rail on the left, the text
   beside it; narrow, a bar at the top that names the section the reader is in and opens the
   contents as a sheet. doc.js drives it. The markup it expects is in design/README.md. */
.doc-wrap { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 48px; padding-top: 32px; padding-bottom: 32px; align-items: start; }
.doc-wrap > article.doc { min-width: 0; }
.doc-bar { display: none; }
/* The rail: the contents, under a field where the page has one (the site's search). Every doc,
   in groups or not, a group the reader's doc is in open; under the doc shown, its sections, and a
   section's subsections while the reader is in it (doc.js marks where). */
.doc-rail { position: sticky; top: calc(var(--header) + 24px); max-height: calc(100vh - var(--header) - 48px); display: flex; flex-direction: column; font-size: 14px; }
.doc-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 4px 8px 0; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
/* A rail taller than the window scrolls on its own, its scrollbar thin and on the left, in the gutter
   beside the page, so the field and the list keep their place. An edge with more past it fades out
   (doc.js says which). */
@media (min-width: 1000px) {
  .doc-list { direction: rtl; margin-left: -18px; padding-left: 18px; }
  .doc-list > * { direction: ltr; }
  .doc-list.more-below { mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
  .doc-list.more-above { mask-image: linear-gradient(to bottom, transparent, #000 32px); }
  .doc-list.more-above.more-below { mask-image: linear-gradient(to bottom, transparent, #000 32px, #000 calc(100% - 40px), transparent); }
}
.doc-nav details + details { margin-top: 12px; }
.doc-nav summary { list-style: none; cursor: pointer; padding: 2px 0; font-weight: 600; color: var(--ink-2); }
.doc-nav summary::-webkit-details-marker { display: none; }
.doc-nav summary::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 10px 2px 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.doc-nav details[open] > summary::before { transform: rotate(45deg); }
.doc-nav summary:hover { color: var(--ink); }
.doc-nav ul { list-style: none; margin: 4px 0 0; padding: 0; }
.doc-nav li { margin: 0; }
.doc-nav a, .doc-nav .coming { display: block; padding: 3px 0 3px 12px; border-left: 2px solid var(--hair); text-decoration: none; font-weight: 400; color: var(--ink); }
.doc-nav a:hover { border-left-color: var(--ink-2); }
.doc-nav a[aria-current="page"] { border-left-color: var(--ink); font-weight: 600; }
.doc-nav .coming { color: var(--ink-2); opacity: .7; }
.doc-nav .toc { position: relative; margin: 2px 0 8px; }
.doc-nav .toc a { padding: 2px 0 2px 24px; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.doc-nav .toc a:hover { color: var(--ink); }
.doc-nav .toc ul { display: none; margin: 0; }
.doc-nav .toc .here > ul { display: block; }
.doc-nav .toc ul a { padding-left: 36px; }
.doc-nav .toc a[aria-current="location"] { color: var(--ink); }
/* The line beside the sections is a trace, and where the reader is, a pulse on it: the line steps
   out beside the section and back, or beside the doc itself above its first section. doc.js moves
   the one pulse along the trace as the reader goes. */
.pulse { position: absolute; left: 0; width: 8px; border: 2px solid var(--ink); border-left: 0; pointer-events: none; visibility: hidden; }
.pulse::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--page); }
.pulse.on { visibility: visible; }

@media (prefers-reduced-motion: no-preference) {
  .doc-nav summary::before { transition: transform .15s; }
  .doc-nav.moving .pulse { transition: top .22s ease-out, height .22s ease-out; }
  .header-moves .doc-bar { transition: top .2s ease-out; }
}
@media (max-width: 999px) {
  /* The header scrolls away here; the doc keeps the bar instead. */
  html:has(.doc-wrap) { scroll-padding-top: 56px; }
  html:has(.doc-wrap) { --header-returns: 1; }
  html:has(.doc-wrap):not(.header-away) header { position: static; }
  /* The header, back on the way up, takes the bar's place: the bar steps down under it. */
  html.header-back .doc-bar { top: var(--header-back); }
  .doc-wrap { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .doc-wrap > article.doc { padding-top: 24px; }
  /* Without the script, the contents above the text. */
  .doc-rail { position: static; display: block; max-height: none; padding: 20px 0 22px; border-bottom: 1px solid var(--hair); }
  .doc-list { overflow: visible; }
  /* With it, a bar that stays at the top and names the section the reader is in. It opens the
     contents as a sheet over the text. */
  .js .doc-bar { display: flex; align-items: baseline; gap: 14px; position: sticky; top: 0; z-index: 9; margin: 0 calc(-1 * var(--gutter)); padding: 13px var(--gutter) 12px; background: var(--page); border: 0; border-bottom: 1px solid var(--hair); font: 500 14px/1.3 var(--font-text); color: var(--ink); text-align: left; cursor: pointer; }
  .js .doc-bar .label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
  .js .doc-bar .label::after { content: ""; width: 6px; height: 6px; margin-bottom: 3px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(45deg); }
  .js .doc-bar[aria-expanded="true"] .label::after { transform: rotate(-135deg); margin: 3px 0 0; }
  .js .doc-bar .where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
  .js .doc-rail { display: none; }
  .js .doc-wrap.open .doc-rail { display: flex; position: fixed; z-index: 9; top: var(--bar-bottom, 48px); left: 0; right: 0; max-height: calc(100dvh - var(--bar-bottom, 48px) - 24px); margin: 0; padding: 14px var(--gutter) 20px; background: var(--page); border-bottom: 1px solid var(--hair); box-shadow: 0 10px 18px rgba(0, 0, 0, .12); }
  .js .doc-wrap.open .doc-list { overflow-y: auto; }
  .js .doc-wrap.open::before { content: ""; position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, .2); }
}
