/* Mode 8 - manual pages (generated by site/tools/build_manual.py). Tokens live in mode8.css. */

body.manual { font-size: 1.0625rem; }

.site-header.wide .wrap { padding-inline: 20px; gap: 14px; }
.brand-sub { text-decoration: none; margin-left: 0; }
.brand-sub:hover { color: var(--text); }
.chip.ver { padding: 2px 8px; color: var(--text-3); flex: none; }

/* ------------------------------------------------------------------ search */

.search { position: relative; flex: 1; max-width: 460px; min-width: 0; margin-left: auto; }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 12px;
  font: 400 .95rem/1 var(--font-sans); color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 4px;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search-key { position: absolute; right: 8px; top: 8px; pointer-events: none; font-size: .7rem; padding: 0 5px; border-bottom-width: 2px; color: var(--text-3); }
.search input:focus + .search-key { display: none; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 60;
  max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px;
}
.search-results a { display: block; padding: 9px 10px; border-radius: 4px; text-decoration: none; color: var(--text-2); }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--bg-3); color: var(--text); }
.search-results .hit-title { display: block; color: var(--text); font-weight: 700; }
.search-results .hit-title small { font: 400 11px/1.45 var(--font-pixel); letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-left: 8px; }
.search-results .hit-text { display: block; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results mark { background: color-mix(in srgb, var(--mint) 35%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-results .empty { padding: 12px 10px; margin: 0; color: var(--text-3); }
.nav { margin-left: 0; }
.menu-btn { display: none; text-decoration: none; }

/* ------------------------------------------------------------------ layout */

.doc-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 232px;
  max-width: 1480px; margin: 0 auto;
  align-items: start;
}
.doc-nav, .doc-toc {
  position: sticky; top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 28px 20px 48px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.doc-nav { border-right: 1px solid var(--line); }
.doc-nav h2, .doc-toc h2 { color: var(--text-3); margin: 22px 0 8px 10px; }
.doc-toc h2 { margin: 0 0 10px; }
.doc-nav ul { list-style: none; margin: 0; padding: 0; }
.doc-nav a {
  display: block; padding: 5px 10px; border-radius: 4px;
  color: var(--text-2); text-decoration: none; font-size: .95rem; line-height: 1.35;
  border-left: 3px solid transparent;
}
.doc-nav a:hover { color: var(--text); background: var(--bg-3); }
.doc-nav a[aria-current="page"] { color: var(--text); background: var(--bg-3); border-left-color: var(--mint); font-weight: 700; }
.doc-nav .nav-home { font-weight: 700; color: var(--text); }

.doc-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.doc-toc a, .toc-inline a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 1px solid transparent; color: var(--text-3); text-decoration: none; font-size: .875rem; line-height: 1.35; }
.doc-toc .l3 a, .toc-inline .l3 a { padding-left: 24px; }
.doc-toc a:hover, .toc-inline a:hover { color: var(--text); }
.doc-toc a.here { color: var(--accent-text); border-left-color: var(--accent-text); }
.toc-inline { display: none; margin: 0 0 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.toc-inline summary { cursor: pointer; padding: 10px 14px; color: var(--text-2); }
.toc-inline ol { list-style: none; margin: 0; padding: 0 14px 12px 4px; }

.doc-main { min-width: 0; padding: 28px 48px 72px; }
.crumbs { color: var(--text-3); margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs a { color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs i { font-style: normal; color: var(--line-2); }

/* ------------------------------------------------------------------ article */

.doc { max-width: 820px; overflow-wrap: break-word; }
.doc a { overflow-wrap: anywhere; }
.doc > :first-child { margin-top: 0; }
.doc h1 { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.6rem); letter-spacing: -.015em; margin: 0 0 12px; }
.doc .summary { font-size: 1.2rem; line-height: 1.5; color: var(--text-2); margin: 0 0 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.doc h2 { font-size: 1.6rem; margin: 52px 0 14px; padding-top: 4px; }
.doc h3 { font-size: 1.25rem; margin: 36px 0 10px; }
.doc h4 { font-size: 1.05rem; margin: 28px 0 8px; color: var(--text-2); }
.doc h2 code, .doc h3 code, .doc h4 code { font-size: .86em; }
.doc :is(h2, h3, h4) { scroll-margin-top: calc(var(--header-h) + 16px); }
.anchor { margin-left: 8px; color: var(--text-3); text-decoration: none; font-family: var(--font-pixel); font-weight: 400; font-size: .7em; opacity: 0; }
:is(h2, h3, h4):hover .anchor, .anchor:focus-visible { opacity: 1; }
@media (hover: none) { .anchor { opacity: .6; } }

.doc p, .doc ul, .doc ol { margin: 0 0 1.1em; }
.doc ul, .doc ol { padding-left: 1.5em; }
.doc li { margin: .3em 0; }
.doc li > p { margin: 0 0 .6em; }
.doc li > ul, .doc li > ol { margin: .3em 0; }
.doc ul > li::marker { color: var(--text-3); }
.doc ol > li::marker { color: var(--text-3); font-family: var(--font-mono); font-size: .9em; }
.doc li > .code, .doc li > .term { margin-top: .6em; }
.doc strong { color: var(--text); font-weight: 700; }
.doc hr { border: 0; height: 4px; margin: 44px 0; background: repeating-linear-gradient(90deg, var(--line-2) 0 4px, transparent 4px 8px); }
.doc a.broken, .doc .broken { color: var(--coral-text); text-decoration-style: wavy; }

.doc blockquote { margin: 0 0 1.25em; padding: 2px 0 2px 18px; border-left: 4px solid var(--line-2); color: var(--text-2); }
.doc blockquote > :last-child { margin-bottom: 0; }

.callout {
  --c: var(--blue); --ct: var(--blue-text);
  position: relative; margin: 0 0 1.25em; padding: 14px 16px 14px 18px;
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius);
  background: var(--bg-2);
}
.callout.tip { --c: var(--mint); --ct: var(--accent-text); }
.callout.warning { --c: var(--amber); --ct: var(--amber-text); }
.callout.important { --c: var(--coral); --ct: var(--coral-text); }
.callout-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px !important; color: var(--ct); }
.callout-title::before { content: ""; width: 8px; height: 8px; background: var(--c); box-shadow: 0 0 0 1px #000; }
.callout > :last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 1.25em; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap:focus-visible { outline-offset: 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.doc th, .doc td { padding: 9px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.doc thead th { border-top: 0; background: var(--bg-2); color: var(--text); font-weight: 700; white-space: nowrap; }
.doc tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
.doc td code { overflow-wrap: normal; white-space: nowrap; }
.doc td:last-child code { white-space: normal; overflow-wrap: anywhere; }

code.swatch, .doc code.nw { white-space: nowrap; }
code.swatch i { display: inline-block; width: .85em; height: .85em; margin-right: .4em; vertical-align: -.08em; border: 1px solid #000; box-shadow: 0 0 0 1px var(--line-2); }

.shot { margin: 0 0 1.25em; padding: 16px; overflow-x: auto; text-align: center; line-height: 0; }
.shot img, img.pixel-shot { max-width: none; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
.doc p > img.pixel-shot { vertical-align: middle; max-height: 4em; width: auto; background: var(--screen); border-radius: 3px; }

/* UI screenshots: the whole window always fits the column; click opens it at full size */
.shot.ui { padding: 0; overflow: visible; }
a.zoom { display: block; cursor: zoom-in; border-radius: var(--radius); }
.shot.ui img, img.ui-shot {
  display: block; max-width: 100%; height: auto; margin-inline: auto;
  image-rendering: auto;
  border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow);
}
:root[data-theme="light"] img.ui-shot { border-color: #0d0f18; }
.doc td a.zoom { display: inline-block; }

.zoom-box {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(5, 6, 12, .94); color: #d6daea;
}
.zoom-box::backdrop { background: rgba(5, 6, 12, .94); }
.zoom-box .zoom-bar {
  position: absolute; inset: 0 0 auto 0; z-index: 1; height: 44px; padding: 0 8px 0 14px;
  display: flex; align-items: center; gap: 8px; background: #0a0b14; border-bottom: 1px solid #232842;
}
.zoom-box .zoom-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8b93b4; }
.zoom-box .copy-btn { color: #d6daea; border-color: #323a5c; min-height: 28px; }
.zoom-box .zoom-scroll { position: absolute; inset: 44px 0 0 0; overflow: auto; display: grid; cursor: zoom-out; }
.zoom-box .zoom-scroll img { margin: auto; max-width: none; height: auto; display: block; image-rendering: auto; }
.zoom-box.fit .zoom-scroll { cursor: zoom-in; }
.zoom-box.fit .zoom-scroll { overflow: hidden; grid-template: minmax(0, 1fr) / minmax(0, 1fr); padding: 12px; }
.zoom-box.fit .zoom-scroll img { width: 100%; height: 100%; object-fit: scale-down; }

.doc .code pre, .doc .term pre { max-height: 640px; }

/* Terminal transcripts never scroll sideways: output wraps, and a long output folds after 12 lines. */
.doc .term.transcript pre { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: visible; max-height: none; }
/* a wrapped line hangs 4 columns in, so a long command or path still reads as one line */
.doc .term.transcript pre .out, .doc .term.transcript pre .cmd { display: inline-block; vertical-align: top; padding-left: 4ch; text-indent: -4ch; }
.doc .term.transcript pre .out { max-width: 100%; }
.doc .term.transcript pre .cmd { max-width: calc(100% - 2ch); }
.doc .term.transcript .nw, .doc .term.transcript .cmd .tok-num { white-space: nowrap; }
.doc .term.transcript pre + .fold > summary { margin-top: -10px; }
.doc .term .fold > summary {
  list-style: none; cursor: pointer; padding: 6px 16px 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.doc .term .fold > summary::-webkit-details-marker { display: none; }
.doc .term .fold > summary::before { content: "+"; display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1px solid var(--line-2); border-radius: 2px; }
.doc .term .fold[open] > summary::before { content: "-"; }
.doc .term .fold > summary:hover { color: var(--text); }
.doc .term .fold > pre { padding-top: 0; }
.doc .term .fold + pre { padding-top: 0; }
.term-head .needs, .term-head .exit { flex: none; padding: 2px 6px; border: 1px solid currentColor; border-radius: 3px; margin: 0; }
.term-head .needs { color: #8ab8ff; }
.code-head .lang.file { text-transform: none; letter-spacing: 0; font-family: var(--font-mono); font-size: .8rem; }

/* A figure's caption, and an image the media manifest lists but the build has not made yet. */
.shot figcaption { margin: 10px 0 0; line-height: 1.45; font-size: .9rem; color: var(--text-3); text-align: center; }
.shot.pending { overflow: visible; }
.shot.pending .pending-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  max-width: 100%; margin-inline: auto; padding: 16px; box-sizing: border-box;
  line-height: 1.4; text-align: center; color: var(--text-2);
  border: 2px dashed var(--line-2); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, var(--bg-2) 0 10px, var(--bg-3) 10px 20px);
}
.shot.pending .px { color: var(--amber-text); }
.shot.pending .pending-alt { max-width: 46ch; font-size: .95rem; }
.shot.pending code { font-size: .78rem; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ page footer */

.doc-foot { max-width: 820px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.doc-foot .edit { font-size: .95rem; color: var(--text-2); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 0; }
.pager a {
  display: grid; gap: 4px; padding: 14px 16px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2);
  text-decoration: none; color: var(--text); box-shadow: 0 3px 0 var(--line-2);
}
.pager a:hover { border-color: var(--text-3); }
.pager a:active { transform: translateY(3px); box-shadow: none; }
.pager .next { text-align: right; }
.pager span.px { color: var(--text-3); }
.pager .prev span.px::before { content: "< "; }
.pager .next span.px::after { content: " >"; }
.pager b { overflow: hidden; text-overflow: ellipsis; }
.fineprint { margin: 28px 0 0; color: var(--text-3); font-size: .85rem; }
.fineprint a { color: var(--text-3); }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  .doc-layout { grid-template-columns: 252px minmax(0, 1fr); }
  .doc-toc { display: none; }
  .toc-inline { display: block; max-width: 820px; }
  .doc-main { padding-inline: 36px; }
}

@media (max-width: 860px) {
  .doc-layout { display: block; }
  .menu-btn { display: inline-grid; }
  .nav-wide, .chip.ver, .search-key { display: none; }
  .doc-nav {
    display: none; position: fixed; z-index: 40; inset: var(--header-h) 0 0 0;
    max-height: none; background: var(--bg); border-right: 0; padding: 16px 16px 64px;
  }
  .doc-nav:target, .doc-nav.open { display: block; }
  .doc-nav a { padding: 9px 10px; font-size: 1rem; }
  .doc-main { padding: 20px 16px 56px; }
  .site-header.wide .wrap { padding-inline: 12px; gap: 8px; }
  .search-results { position: fixed; left: 8px; right: 8px; top: calc(var(--header-h) + 4px); }
  .doc h2 { font-size: 1.4rem; margin-top: 40px; }
  .doc .summary { font-size: 1.1rem; }
  .shot { padding: 10px; }
  .doc .term pre { font-size: .8125rem; padding-inline: 12px; }
  .pager { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .brand-sub { display: none; }
}

@media print {
  .site-header, .doc-nav, .doc-toc, .toc-inline, .doc-foot .edit, .pager, .copy-btn, .zoom-box { display: none !important; }
  .doc-layout { display: block; }
  .doc-main { padding: 0; }
}
