/* rodi. docs theme. Builds on tokens.css from the frontend-design skill. */

:root {
  --docs-sidebar: 288px;
  --docs-toc: 220px;
  --docs-measure: 740px;
  --docs-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  --docs-radius-xs: 8px;
  /* A quiet thumb for the navigation's own scrollbar, stronger while the pointer is over it. */
  --docs-scrollbar: #e4d6dd;
  --docs-scrollbar-hover: #cdb4c0;

  /* Code colors for the css-variables theme that the core asks Shiki for. */
  --code-foreground: var(--fd-text);
  --code-background: var(--fd-bg-app);
  --code-token-constant: #8e3a50;
  --code-token-string: #267348;
  --code-token-string-expression: #267348;
  --code-token-comment: #8a7680;
  --code-token-keyword: #9a3f55;
  --code-token-parameter: #5a4a54;
  --code-token-function: #715385;
  --code-token-punctuation: #74616c;
  --code-token-link: #a94460;
}

/*
 * The hand font of the diagrams sketchdraw draws at build time. The SVGs name the family and do
 * not embed it; the browser fetches the file only on a page that shows such a diagram.
 */
@font-face {
  font-family: 'sketchdraw Hand';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/SketchdrawHand-Regular.woff2') format('woff2');
}

/*
 * A page shorter than the window has no scrollbar. Without the reserved gutter the centred layout
 * would then sit 7.5 px to the right of where a long page puts it, and move on every such change.
 */
html {
  scroll-padding-top: 24px;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--fd-bg);
}

.visually-hidden,
.prose .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 30;
  padding: 10px 16px;
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
  color: var(--fd-rose-strong);
  font-weight: 600;
  box-shadow: var(--fd-shadow);
}

.skip-link:focus {
  top: 16px;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--fd-radius-sm);
  background: transparent;
  color: var(--fd-text);
  cursor: pointer;
  transition: background var(--fd-ease);
}

@media (hover: hover) {
  .icon-button:hover {
    background: var(--fd-rose-soft);
  }
}

/* Layout */

.topbar {
  display: none;
}

/*
 * Like Obsidian Help: the sidebar, the page and the table of contents form one block centred in
 * the window. The sidebar's white reaches the left edge, the page background fills the right.
 */
.layout {
  --docs-content: calc(var(--docs-measure) + var(--docs-toc) + 56px + 2 * 56px);

  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--docs-sidebar) minmax(0, var(--docs-content)) minmax(
      0,
      1fr
    );
  min-height: 100svh;
}

.layout::before {
  content: '';
  grid-column: 1;
  grid-row: 1;
  background: var(--fd-surface);
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100svh;
  padding: 28px 16px 20px;
  border-right: 1px solid var(--fd-line-app);
  background: var(--fd-surface);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
}

.menu-button,
.scrim {
  display: none;
}

/* On wide screens the frame is not a box at all, the sidebar is a cell of the layout grid. */
.sidebar-frame {
  display: contents;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--fd-text);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-logo {
  width: 28px;
  height: 28px;
}

/* The way back to the product's own site, when the home page's frontmatter names it. */
.home-link {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  color: var(--fd-muted);
  font-size: 14px;
  text-decoration: none;
}

.home-link .icon {
  width: 16px;
  height: 16px;
}

@media (hover: hover) {
  .home-link:hover {
    color: var(--fd-accent);
  }
}

.credit {
  margin: 0 8px;
  color: var(--fd-muted);
  font-size: 13px;
}

.credit-mark {
  color: var(--fd-text);
  font-weight: 700;
}

.credit-mark span {
  color: var(--fd-brand);
}

.main {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, var(--docs-measure)) var(--docs-toc);
  gap: 56px;
  min-width: 0;
  padding: 48px clamp(20px, 4vw, 56px) 96px;
}

/* Search */

.search {
  position: relative;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--fd-control-line);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
  color: var(--fd-muted);
  cursor: text;
}

.search-field:focus-within {
  outline: 3px solid var(--fd-rose);
  outline-offset: 2px;
}

.search-field input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--fd-text);
  font-size: 15px;
}

.search-field input:focus {
  outline: none;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-field kbd {
  padding: 1px 7px;
  border: 1px solid var(--fd-line);
  border-radius: 6px;
  color: var(--fd-muted);
  font: 12px var(--docs-mono);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  max-height: min(480px, 70vh);
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-md);
  background: var(--fd-surface);
  box-shadow: 0 16px 48px rgb(118 52 77 / 12%);
}

.search-results a {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--fd-radius-sm);
  color: var(--fd-text);
  text-decoration: none;
}

.search-results [aria-selected='true'] a,
.search-results a:hover {
  background: var(--fd-rose-soft);
}

.search-result-title {
  font-weight: 600;
}

.search-result-where,
.search-result-text,
.search-empty {
  color: var(--fd-muted);
  font-size: 13px;
}

.search-result-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-results mark {
  border-radius: 3px;
  background: #f5c6d2;
  color: inherit;
}

.search-empty {
  padding: 12px;
}

/* Navigation */

/*
 * Only the navigation scrolls, so the search results can open over the page. Its gutter is
 * reserved: a classic scrollbar that came and went with the open sections would narrow every item
 * and rewrap the long labels. Overlay scrollbars, the default on macOS and phones, take no gutter.
 */
.nav {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -8px;
  padding: 0 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--docs-scrollbar) transparent;
  font-size: 15px;
}

@media (hover: hover) {
  .nav:hover {
    scrollbar-color: var(--docs-scrollbar-hover) transparent;
  }
}

.nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-part {
  margin: 20px 12px 6px;
  color: var(--fd-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-part:first-child {
  margin-top: 4px;
}

.nav a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--docs-radius-xs);
  color: var(--fd-text);
  line-height: 1.35;
  text-decoration: none;
  transition: background var(--fd-ease);
}

@media (hover: hover) {
  .nav a:hover {
    background: var(--fd-bg-app);
  }
}

/*
 * The current page keeps the weight of its neighbours: a bolder label is wider and may take one
 * more line, which would push every item below it down when the reader opens the page.
 */
.nav a[aria-current='page'] {
  background: var(--fd-rose-soft);
  color: var(--fd-rose-strong);
}

.nav summary {
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
}

.nav summary::-webkit-details-marker {
  display: none;
}

.nav summary a {
  flex: 1;
  padding-left: 4px;
  font-weight: 600;
}

.nav-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 32px;
  color: var(--fd-muted);
}

.nav-toggle .icon {
  width: 16px;
  height: 16px;
  transition: transform var(--fd-ease);
}

.nav details[open] > summary .nav-toggle .icon {
  transform: rotate(90deg);
}

.nav details > ul {
  margin: 2px 0 6px 21px;
  padding-left: 8px;
  border-left: 1px solid var(--fd-line);
}

.nav details details > summary a {
  font-weight: 500;
}

/* Page */

.page {
  min-width: 0;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 22px;
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breadcrumbs a {
  color: var(--fd-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--fd-rose);
  text-decoration: underline;
}

.breadcrumb-home {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: -3px;
  border-radius: 6px;
}

.breadcrumb-home .icon {
  width: 16px;
  height: 16px;
}

.breadcrumb-home:focus-visible,
.breadcrumbs a:focus-visible {
  outline: 2px solid var(--fd-rose);
  outline-offset: 2px;
}

.breadcrumb-separator {
  width: 14px;
  height: 14px;
  color: var(--fd-control-line);
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.page-home .page-header h1 {
  font-size: clamp(36px, 5.5vw, 56px);
  letter-spacing: -0.04em;
}

.lead {
  max-width: 62ch;
  margin: 14px 0 0;
  color: var(--fd-muted);
  font-size: 19px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Prose: the Markdown content */

.prose {
  font-size: 16.5px;
  line-height: 1.7;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.prose h3,
.prose h4 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.prose h2 {
  margin: 56px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--fd-line);
  font-size: 25px;
}

.prose h3 {
  margin: 36px 0 12px;
  font-size: 19px;
}

.prose h4 {
  margin: 28px 0 8px;
  font-size: 16.5px;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 18px;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li + li {
  margin-top: 6px;
}

.prose li::marker {
  color: var(--fd-control-line);
}

.prose ol > li::marker {
  color: var(--fd-rose-strong);
  font-weight: 600;
}

.prose a {
  color: var(--fd-rose);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--fd-rose-strong);
  text-decoration-thickness: 2px;
}

.prose a.external::after {
  content: '\2197';
  margin-left: 2px;
  font-size: 0.8em;
}

.prose strong {
  font-weight: 650;
}

.prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--fd-line);
}

.prose :not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--fd-plum-soft);
  font: 0.88em var(--docs-mono);
  /* Breaks a long name only when it cannot fit a line; "anywhere" split table cells mid-word. */
  overflow-wrap: break-word;
}

.prose pre {
  margin: 0 0 22px;
  padding: 16px 20px;
  overflow-x: auto;
  border: 1px solid var(--fd-line-app);
  border-radius: var(--fd-radius-sm);
  font: 14px/1.6 var(--docs-mono);
  tab-size: 2;
}

.prose pre:focus-visible {
  outline: 3px solid var(--fd-rose);
  outline-offset: 2px;
}

.prose blockquote {
  margin: 0 0 22px;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--fd-line);
  color: var(--fd-muted);
}

/* Tables: one surface with dividers */

.table-wrap {
  margin: 0 0 24px;
  overflow-x: auto;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.prose th,
.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--fd-line-app);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--fd-bg-app);
  color: var(--fd-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.prose tr:last-child td {
  border-bottom: 0;
}

/*
 * Browsers may break a line after a hyphen, which split flags such as --strict in a narrow column.
 * Code in a cell stays on one line; a table that grows too wide scrolls inside its frame.
 */
.prose td code {
  white-space: nowrap;
}

/* Footnotes: quieter than the text, under a rule. Their heading is for screen readers only. */

.prose .footnotes {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--fd-line);
  color: var(--fd-muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.prose .footnotes ol {
  margin-bottom: 0;
}

.prose .footnotes p {
  margin: 0;
}

/* A superscript keeps its line as tall as the others. */
.prose sup {
  line-height: 0;
}

.prose [data-footnote-ref],
.prose [data-footnote-backref] {
  text-decoration: none;
}

/* Callouts: the family's notice with a bar on the left edge */

.callout {
  margin: 0 0 22px;
  padding: 14px 18px;
  border: 1px solid var(--fd-line);
  border-left: 4px solid var(--fd-rose);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px !important;
  color: var(--fd-rose-strong);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.callout-title::before {
  content: '';
  width: 18px;
  height: 18px;
  flex: none;
  background: currentColor;
  mask: var(--callout-icon) center / contain no-repeat;
}

.callout-note {
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
}

.callout-tip {
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3Z'/%3E%3C/svg%3E");
  border-left-color: var(--fd-success);
}

.callout-tip .callout-title {
  color: var(--fd-success);
}

.callout-important {
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z'/%3E%3Cpath d='M12 7v4M12 14h.01'/%3E%3C/svg%3E");
  border-left-color: var(--fd-plum);
  background: var(--fd-plum-soft);
}

.callout-important .callout-title {
  color: var(--fd-plum-text);
}

.callout-warning {
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
  border-left-color: var(--fd-warning);
}

.callout-warning .callout-title {
  color: var(--fd-text);
}

.callout-warning .callout-title::before {
  background: var(--fd-warning);
}

.callout-caution {
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.9 2h8.2L22 7.9v8.2L16.1 22H7.9L2 16.1V7.9Z'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
  border-left-color: var(--fd-error);
  background: var(--fd-rose-soft);
}

.callout-caution .callout-title {
  color: var(--fd-error);
}

/* Figures and diagrams */

.prose img {
  /* A site of phone captures sets --docs-media-width, so each shows at one size. */
  max-width: min(100%, var(--docs-media-width, 100%));
  height: auto;
  border-radius: var(--fd-radius-sm);
}

.prose figure {
  margin: 8px 0 28px;
}

.prose figure img {
  display: block;
  margin: 0 auto;
  border: 1px solid var(--fd-line);
  box-shadow: var(--fd-shadow);
}

.prose figcaption {
  margin-top: 10px;
  color: var(--fd-muted);
  font-size: 14px;
  text-align: center;
}

/*
 * A drawn diagram keeps its natural size up to the column width and shrinks to fit a narrower
 * column, as the Mermaid blocks do. On a phone a wide diagram would shrink its 20 px node labels
 * and 16 px edge labels to a few pixels, so there it stops at 70 percent of its natural width
 * (14 px and 11 px labels) and scrolls inside its frame, as a wide table does.
 */
.prose figure.diagram {
  margin: 0 0 22px;
  overflow-x: auto;
  padding: clamp(12px, 3vw, 24px);
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
}

.prose figure.diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .prose figure.diagram svg {
    min-width: calc(var(--diagram-width, 0px) * 0.7);
  }
}

/*
 * site.js wraps a drawn diagram in this frame and shows the button in its corner while the diagram
 * is drawn at less than three quarters of its size. Laid over the figure, it moves nothing when it
 * appears, and it stays put while a wide diagram scrolls on a phone.
 */
.diagram-frame {
  position: relative;
}

.diagram-open {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--fd-line);
  border-radius: var(--docs-radius-xs);
  background: var(--fd-surface);
  color: var(--fd-rose);
  cursor: pointer;
  transition: background var(--fd-ease);
}

.diagram-open .icon {
  width: 18px;
  height: 18px;
}

.diagram-open[hidden] {
  display: none;
}

.diagram-open:focus-visible,
.diagram-dialog-close:focus-visible {
  outline: 2px solid var(--fd-rose);
  outline-offset: 2px;
}

@media (hover: hover) {
  .diagram-open:hover,
  .diagram-dialog-close:hover {
    background: var(--fd-rose-soft);
  }
}

/* The dialog shows the diagram at its natural size and scrolls when the window is smaller. */
.diagram-dialog {
  width: fit-content;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
  box-shadow: var(--fd-shadow);
  color: var(--fd-text);
}

.diagram-dialog[open] {
  display: flex;
  flex-direction: column;
}

.diagram-dialog::backdrop {
  background: rgb(41 36 42 / 35%);
}

.diagram-dialog-close {
  align-self: flex-end;
  margin: 12px 12px 0;
  padding: 6px 14px;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
  color: var(--fd-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--fd-ease);
}

.diagram-dialog-frame {
  overflow: auto;
  padding: 12px 24px 24px;
}

.diagram-dialog-frame svg {
  display: block;
  max-width: none;
  height: auto;
}

.prose pre.mermaid {
  display: flex;
  justify-content: center;
  padding: 24px;
  border-color: var(--fd-line);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
  color: var(--fd-muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
}

/*
 * The drawing's labels must not inherit the source's preserved spaces. Mermaid marks the block
 * processed before the drawing is in, so the switch waits for the SVG: done earlier, it rewrapped
 * the source text for a moment and made the block taller.
 */
.prose pre.mermaid:has(> svg) {
  white-space: normal;
}

/*
 * While Mermaid loads, the box keeps the height of the source and hides its text, so the page does
 * not flash code before the drawing. site.js drops the flag when Mermaid is done or failed to load,
 * and a block Mermaid could not draw shows its source again. The text is hidden by an animation
 * that ends on its own, so the source becomes readable even when site.js never runs.
 */
[data-mermaid='pending'] .prose pre.mermaid:not([data-processed]) {
  animation: mermaid-source-wait 4s;
}

@keyframes mermaid-source-wait {
  from,
  to {
    color: transparent;
  }
}

/*
 * Mermaid appends its tooltip to the end of <body>. Left in the flow it makes the page taller than
 * the layout grid, and the sticky sidebar then slides up at the bottom of every page.
 */
.mermaidTooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 60;
  max-width: 280px;
  padding: 6px 10px;
  border: 1px solid var(--fd-line);
  border-radius: var(--docs-radius-xs);
  background: var(--fd-surface);
  color: var(--fd-text);
  font-size: 13px;
  box-shadow: var(--fd-shadow);
  pointer-events: none;
}

.prose pre.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Home page: one card per section */

.sections {
  display: grid;
  gap: 32px;
  margin-top: 48px;
}

.sections-title,
.footer-title,
.toc-title {
  margin: 0 0 12px;
  color: var(--fd-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.section-card {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-md);
  background: var(--fd-surface);
  color: var(--fd-text);
  text-decoration: none;
  transition:
    border-color var(--fd-ease),
    transform var(--fd-ease),
    box-shadow var(--fd-ease);
}

.section-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 650;
}

.section-card-title .icon {
  width: 18px;
  height: 18px;
  color: var(--fd-rose);
}

.section-card-text {
  color: var(--fd-muted);
  font-size: 14.5px;
  line-height: 1.5;
}

@media (hover: hover) {
  .section-card:hover {
    border-color: var(--fd-accent);
    box-shadow: var(--fd-shadow);
    transform: translateY(-2px);
  }
}

/* Section page: the pages inside, as one list with dividers */

.children {
  margin-top: 40px;
}

.child-list {
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-md);
  background: var(--fd-surface);
}

.child-list li + li {
  border-top: 1px solid var(--fd-line-app);
}

.child-list a {
  display: grid;
  gap: 2px;
  padding: 14px 18px;
  color: var(--fd-text);
  text-decoration: none;
  transition: background var(--fd-ease);
}

.child-title {
  color: var(--fd-rose);
  font-weight: 600;
}

.child-text {
  color: var(--fd-muted);
  font-size: 14.5px;
}

@media (hover: hover) {
  .child-list a:hover {
    background: var(--fd-rose-soft);
  }
}

/* Page footer */

.page-footer {
  display: grid;
  gap: 32px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--fd-line);
}

.backlinks ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.backlinks a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--fd-line);
  border-radius: 999px;
  color: var(--fd-rose);
  font-size: 14px;
  text-decoration: none;
}

.backlinks a:hover {
  border-color: var(--fd-accent);
  background: var(--fd-rose-soft);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pager-link {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid var(--fd-line);
  border-radius: var(--fd-radius-md);
  background: var(--fd-surface);
  color: var(--fd-text);
  text-decoration: none;
  transition: border-color var(--fd-ease);
}

.pager-next {
  grid-column: 2;
  text-align: right;
}

.pager-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fd-muted);
  font-size: 13px;
}

.pager-next .pager-label {
  justify-content: flex-end;
}

.pager-label .icon {
  width: 16px;
  height: 16px;
}

.pager-title {
  color: var(--fd-rose);
  font-weight: 600;
}

@media (hover: hover) {
  .pager-link:hover {
    border-color: var(--fd-accent);
  }
}

.reviewed {
  margin: 0;
  color: var(--fd-muted);
  font-size: 13px;
}

/* Table of contents */

.toc {
  position: sticky;
  top: 48px;
  align-self: start;
  max-height: calc(100svh - 96px);
  overflow-y: auto;
  font-size: 14px;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--fd-line);
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: 5px 0 5px 14px;
  border-left: 2px solid transparent;
  color: var(--fd-muted);
  line-height: 1.4;
  text-decoration: none;
}

.toc .toc-depth-3 a {
  padding-left: 28px;
  font-size: 13.5px;
}

.toc a:hover {
  color: var(--fd-text);
}

/* No bolder weight here either: the marker moves while reading and must not rewrap the list. */
.toc a[aria-current='true'] {
  border-left-color: var(--fd-rose);
  color: var(--fd-rose-strong);
}

/* Narrower screens */

@media (max-width: 1240px) {
  .layout {
    --docs-content: calc(var(--docs-measure) + 2 * 56px);
  }

  .main {
    grid-template-columns: minmax(0, var(--docs-measure));
  }

  .toc {
    display: none;
  }
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout::before {
    display: none;
  }

  .main {
    grid-column: 1;
  }

  .topbar {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--fd-line-app);
    background: var(--fd-surface);
  }

  /* The navigation button sits at the bottom right, where a thumb reaches it. */
  .menu-button {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: var(--fd-radius-md);
    background: var(--fd-accent);
    color: var(--fd-on-accent);
    box-shadow: 0 10px 28px rgb(118 52 77 / 26%);
    cursor: pointer;
    transition:
      background var(--fd-ease),
      transform var(--fd-ease);
  }

  .menu-button:active {
    transform: scale(0.96);
  }

  .menu-button .icon {
    width: 24px;
    height: 24px;
  }

  .menu-button .icon-close,
  .menu-open .menu-button .icon-open {
    display: none;
  }

  .menu-open .menu-button .icon-close {
    display: block;
  }

  /*
   * The drawer reads from the thumb up: the search shares the bottom row with the menu button, the
   * navigation fills the middle, the name and the credit sit on top.
   */
  .sidebar {
    display: grid;
    grid-template:
      'head credit' auto
      'nav nav' minmax(0, 1fr)
      'search search' auto
      / minmax(0, 1fr) auto;
  }

  .sidebar-head {
    grid-area: head;
  }

  .credit {
    grid-area: credit;
    display: flex;
    align-items: center;
    gap: 0.28em;
  }

  .nav {
    grid-area: nav;
  }

  /* 56 px button plus a 12 px gap stay free on the right of the search. */
  .search {
    grid-area: search;
    display: flex;
    align-items: center;
    min-height: 56px;
    margin-right: 68px;
  }

  .search-field {
    flex: 1;
  }

  .search-field kbd {
    display: none;
  }

  .search-results {
    top: auto;
    bottom: calc(100% + 8px);
    width: calc(100% + 68px);
  }

  .topbar .home-link {
    margin-left: auto;
    padding-left: 12px;
  }

  /* On phones the top bar carries the way back; the drawer keeps its head for the name. */
  .sidebar-head .home-link {
    display: none;
  }

  .topbar-title {
    overflow: hidden;
    color: var(--fd-text);
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /*
   * The closed drawer waits beyond the right edge. The frame is exactly the viewport and clips it;
   * without the frame a phone widens the page to the drawer and lets it slide sideways.
   */
  .sidebar-frame {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    overflow: hidden;
    pointer-events: none;
  }

  .sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    height: auto;
    width: min(340px, 88vw);
    pointer-events: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    border-right: 0;
    border-left: 1px solid var(--fd-line-app);
    transform: translateX(100%);
    visibility: hidden;
    box-shadow: 0 0 48px rgb(41 36 42 / 16%);
    transition:
      transform 200ms ease,
      visibility 200ms;
  }

  .menu-open .sidebar {
    transform: none;
    visibility: visible;
  }

  .scrim:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    background: rgb(41 36 42 / 24%);
  }

  .menu-open {
    overflow: hidden;
  }

  .main {
    padding: 28px 16px 104px;
  }

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

  .pager-next {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .section-card {
    transition: none;
  }
}

@media print {
  .sidebar,
  .topbar,
  .menu-button,
  .toc,
  .pager,
  .skip-link {
    display: none;
  }

  .layout,
  .main {
    display: block;
    padding: 0;
  }
}

/*
 * Page changes: the browser crossfades the page while the top bar and the navigation stay in
 * place, so moving between pages does not flash the whole window. Browsers without cross-document
 * view transitions change pages as before.
 */
@view-transition {
  navigation: auto;
}

.topbar {
  view-transition-name: topbar;
}

.sidebar {
  view-transition-name: sidebar;
}

/*
 * The top bar and the sidebar are the same on both pages apart from the current item, so the new
 * snapshot replaces the old one at once, with no crossfade and no movement. The old image is not
 * drawn at all: under the opaque new one it could only show through as a doubled sidebar.
 */
::view-transition-group(topbar),
::view-transition-group(sidebar),
::view-transition-new(topbar),
::view-transition-new(sidebar) {
  animation: none;
}

::view-transition-old(topbar),
::view-transition-old(sidebar) {
  display: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 120ms;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
