/* TandemLLM documentation. The product site's instrument readout (dark) and the printed manual's own
   palette (light, preamble.tex): one stylesheet, two themes, switched on <html data-theme>. */

:root {
  --ground: #161d25;
  --ground-2: #1c242d;
  --ground-3: #232c37;
  --rule: rgba(255, 255, 255, 0.09);
  --rule-faint: rgba(255, 255, 255, 0.05);
  --ink: #eef2f7;
  --ink-2: #a3b0c2;
  --ink-3: #8795a8;
  --cob: #3987e5;
  --cob-hi: #6aa9f0;
  --cob-tint: rgba(57, 135, 229, 0.14);
  --org: #eb6834;
  --org-hi: #f7a24f;
  --org-tint: rgba(247, 162, 79, 0.12);
  --moss: #7fd1a0;
  --code-bg: #11171e;
  --sel: rgba(106, 169, 240, 0.28);

  /* the figures: the book's colour names, in this theme's values */
  --fig-ink: #eef2f7;
  --fig-slate: #a3b0c2;
  --fig-rule: rgba(255, 255, 255, 0.22);
  --fig-paper: #1c242d;
  --fig-white: #1c242d;
  --fig-cobalt: #6aa9f0;
  --fig-cobaltlight: rgba(57, 135, 229, 0.2);
  --fig-sky: #8fb3ff;
  --fig-signal: #f7a24f;
  --fig-signallight: rgba(247, 162, 79, 0.18);
  --fig-moss: #7fd1a0;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --top: 56px;
  --side: 284px;
  --toc: 224px;
  --measure: 74ch;
  color-scheme: dark;
}

html[data-theme="light"] {
  --ground: #f5f7fa;
  --ground-2: #ffffff;
  --ground-3: #e8eefb;
  --rule: rgba(28, 34, 48, 0.14);
  --rule-faint: rgba(28, 34, 48, 0.07);
  --ink: #1c2230;
  --ink-2: #5a6475;
  --ink-3: #6b7584;
  --cob: #1f4fcc;
  --cob-hi: #1f4fcc;
  --cob-tint: rgba(31, 79, 204, 0.09);
  --org: #e8641b;
  --org-hi: #c4540f;
  --org-tint: rgba(232, 100, 27, 0.1);
  --moss: #2e8b57;
  --code-bg: #eef1f6;
  --sel: rgba(31, 79, 204, 0.18);
  --fig-ink: #1c2230;
  --fig-slate: #5a6475;
  --fig-rule: #c9d0dc;
  --fig-paper: #f5f7fa;
  --fig-white: #ffffff;
  --fig-cobalt: #1f4fcc;
  --fig-cobaltlight: #e8eefb;
  --fig-sky: #8fb3ff;
  --fig-signal: #e8641b;
  --fig-signallight: #fcebdd;
  --fig-moss: #2e8b57;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--ground); color: var(--ink); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body { margin: 0; font: 400 16.5px/1.6 var(--sans); background: var(--ground); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--cob-hi); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--org-hi); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--sel); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 60; background: var(--org-hi); color: var(--ground); padding: 10px 14px; border-radius: 6px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

code, pre, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code { font-size: 0.88em; background: var(--rule-faint); padding: 0.1em 0.34em; border-radius: 4px; overflow-wrap: anywhere; }
html[data-theme="light"] code { background: rgba(28, 34, 48, 0.06); }

/* ---------- top bar ---------- */

.dtop {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  background: color-mix(in srgb, var(--ground) 84%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
@supports not (background: color-mix(in srgb, red, blue)) { .dtop { background: var(--ground); } }
.dtop-row { display: flex; align-items: center; gap: 14px; height: 100%; padding: 0 clamp(14px, 2.5vw, 28px); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font: 800 17px/1 var(--display); letter-spacing: -0.03em; }
.brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(127, 127, 127, 0.25); }
.dtop-docs { color: var(--ink-2); text-decoration: none; font-size: 15px; padding-left: 14px; border-left: 1px solid var(--rule); }
.dtop-docs:hover, .dtop-gh:hover { color: var(--ink); }
.dtop-gh { margin-left: auto; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.side-open { display: none; }

.vmenu { position: relative; font-size: 14px; }
.vmenu summary {
  list-style: none; cursor: pointer; padding: 6px 30px 6px 12px; border: 1px solid var(--rule); border-radius: 7px;
  color: var(--ink); font-family: var(--mono); font-size: 13px; white-space: nowrap; position: relative;
}
.vmenu summary::-webkit-details-marker { display: none; }
.vmenu summary::after { content: ""; position: absolute; right: 11px; top: 11px; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(45deg); }
.vmenu[open] summary { border-color: var(--cob-hi); }
.vmenu ul {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px; max-height: 60vh; max-height: 60dvh; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin: 0; padding: 6px; list-style: none; background: var(--ground-2); border: 1px solid var(--rule); border-radius: 9px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
.vmenu li a { display: block; padding: 6px 10px; border-radius: 5px; color: var(--ink); text-decoration: none; font-family: var(--mono); font-size: 13px; }
.vmenu li a:hover { background: var(--cob-tint); }
.vmenu li a[aria-current] { color: var(--org-hi); }
.vmenu li a[aria-current]::before { content: "\2713\00a0"; }
.vmenu-all { border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 6px; }
.vmenu-all a { font-family: var(--sans); color: var(--ink-2); }

.search { position: relative; flex: 0 1 300px; min-width: 0; }
.search input {
  width: 100%; min-height: 34px; padding: 5px 12px; border: 1px solid var(--rule); border-radius: 7px;
  background: var(--ground-2); color: var(--ink); font: 14px var(--sans);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--cob-hi); outline: none; box-shadow: 0 0 0 3px var(--cob-tint); }
.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; max-height: min(70vh, 560px); overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--ground-2); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 6px;
}
.results[hidden] { display: none; }
.results p { margin: 0; padding: 10px 12px; color: var(--ink-3); font-size: 14px; }
.results a { display: block; padding: 8px 12px; border-radius: 7px; color: var(--ink); text-decoration: none; }
.results a:hover, .results a:focus-visible { background: var(--cob-tint); outline: none; }
.results a.sel { background: var(--cob-tint); }
.results .rt { display: block; font-weight: 600; font-size: 14px; }
.results .rt small { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.results .rs { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.results mark { background: var(--org-tint); color: var(--org-hi); padding: 0 1px; border-radius: 2px; }

.theme {
  min-height: 34px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 7px; background: transparent;
  color: var(--ink-2); font: 600 13px var(--sans); cursor: pointer;
}
.theme:hover { color: var(--ink); border-color: var(--cob-hi); }

/* ---------- the three columns ---------- */

.dwrap { display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--toc); gap: 0 clamp(24px, 3vw, 48px); max-width: 1500px; margin: 0 auto; padding: 0 clamp(14px, 2.5vw, 28px); }

.side {
  position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); max-height: calc(100dvh - var(--top)); overflow-y: auto;
  overscroll-behavior: contain; padding: 22px 14px 40px 0; border-right: 1px solid var(--rule); font-size: 14.5px; scrollbar-width: thin;
}
.side ul, .side ol { list-style: none; margin: 0; padding: 0; }
.side li { margin: 0; }
.side a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.side a:hover { color: var(--ink); background: var(--rule-faint); }
.side li.cur > a { color: var(--ink); background: var(--cob-tint); font-weight: 600; }
.side .nnum { display: inline-block; min-width: 2em; font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.side li.cur > a .nnum { color: var(--cob-hi); }
.npart { margin-top: 18px; }
.npart h3 { margin: 0 0 4px; padding: 0 10px; font: 600 12.5px/1.4 var(--sans); color: var(--ink-3); letter-spacing: 0.01em; }
.nroman { display: inline-block; min-width: 2.2em; font-family: var(--mono); color: var(--org-hi); }
.nsub { margin: 2px 0 6px 2em !important; border-left: 1px solid var(--rule); }
.nsub a { padding: 3px 10px; font-size: 13.5px; }
.side .side-head { display: none; }

.content { min-width: 0; padding: 28px 0 60px; max-width: calc(var(--measure) + 2px); }

.toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); max-height: calc(100dvh - var(--top)); overflow-y: auto; overscroll-behavior: contain; padding: 26px 0 40px 16px; font-size: 13.5px; border-left: 1px solid var(--rule); scrollbar-width: thin; }
.toc h2 { margin: 0 0 8px; font: 600 12.5px var(--sans); color: var(--ink-3); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 3px 0; color: var(--ink-2); text-decoration: none; line-height: 1.35; border-left: 2px solid transparent; margin-left: -17px; padding-left: 15px; }
.toc .l3 a { padding-left: 27px; font-size: 13px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--org-hi); border-left-color: var(--org-hi); }

/* ---------- the chapter head: the book's heading, part line, number, title, signal rule ---------- */

.chead { margin: 6px 0 30px; padding-bottom: 18px; border-bottom: 2px solid var(--org); }
.kicker { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.kicker code { font-size: 13px; }
.chead h1 { margin: 0; font: 800 clamp(30px, 4vw, 42px)/1.08 var(--display); letter-spacing: -0.03em; color: var(--ink); }
.chnum { display: block; font: 500 clamp(40px, 6vw, 64px)/1 var(--mono); letter-spacing: -0.04em; color: var(--cob-hi); margin-bottom: 8px; }
.chead-sub { margin-top: 48px; border-bottom-width: 1px; border-bottom-color: var(--rule); }
.cover .kicker { color: var(--org-hi); }
.cover-sub { margin: 14px 0 0; max-width: 60ch; font-size: 17.5px; color: var(--ink-2); }
.cover-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px; border-radius: 8px; border: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.btn:hover { border-color: var(--cob-hi); }
.btn-primary { background: var(--org-hi); border-color: var(--org-hi); color: var(--ground); }
html[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

.banner { margin: 0 0 22px; padding: 10px 14px; border-left: 3px solid var(--org-hi); background: var(--org-tint); border-radius: 0 8px 8px 0; font-size: 14.5px; }
.banner-dev { border-left-color: var(--cob-hi); background: var(--cob-tint); }

/* the overview's parts */
.part { margin: 30px 0 0; padding-top: 22px; border-top: 1px solid var(--rule); }
.part h2 { margin: 0 0 10px; font: 700 22px/1.3 var(--display); letter-spacing: -0.015em; }
.part .nroman { min-width: 2.4em; }
.pintro { max-width: var(--measure); color: var(--ink-2); font-size: 15.5px; margin: 0 0 12px; }
.chapters { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.chapters li { break-inside: avoid; }
.chapters a { display: block; padding: 4px 0; text-decoration: none; color: var(--ink); }
.chapters a:hover { color: var(--cob-hi); }
.chapters .nnum { display: inline-block; min-width: 2.2em; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }

/* ---------- prose ---------- */

.prose { font-size: 16.5px; }
.prose > p, .prose li, .prose dd, .prose blockquote { max-width: var(--measure); }
.prose p { margin: 0 0 1.05em; }
.prose h2 { margin: 2.2em 0 0.7em; font: 700 clamp(22px, 2.6vw, 27px)/1.25 var(--display); letter-spacing: -0.02em; color: var(--ink); }
.prose h3 { margin: 1.8em 0 0.6em; font: 700 19px/1.3 var(--display); letter-spacing: -0.012em; }
.prose h4 { margin: 1.5em 0 0.5em; font: 700 16.5px/1.35 var(--sans); }
.prose h4.runin + p { margin-top: -0.35em; }
.hnum { color: var(--ink-3); font-family: var(--mono); font-weight: 500; margin-right: 0.45em; font-size: 0.85em; }
.hlink { margin-left: 0.4em; text-decoration: none; opacity: 0; font-weight: 400; }
.hlink::before { content: "#"; color: var(--ink-3); }
h2:hover .hlink, h3:hover .hlink, h4:hover .hlink, figcaption:hover .hlink, .hlink:focus-visible { opacity: 1; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.05em; }
.prose li { margin: 0.25em 0; }
.prose li > ul, .prose li > ol { margin-bottom: 0; }
.prose blockquote { margin: 0 0 1.05em; padding: 2px 0 2px 18px; border-left: 3px solid var(--rule); color: var(--ink-2); }
.prose dl.desc { margin: 0 0 1.2em; }
.prose dl.desc dt { font-weight: 700; margin-top: 0.9em; }
.prose dl.desc dd { margin: 0.15em 0 0 0; }
.prose dfn { font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose img { border-radius: 8px; }
.prose em { font-style: italic; }
.lbl { font-family: var(--sans); font-size: 0.78em; padding: 0 5px; border-radius: 4px; border: 1px solid var(--rule); color: var(--ink-2); vertical-align: 1px; white-space: nowrap; }
.lbl-measured { color: var(--cob-hi); border-color: color-mix(in srgb, var(--cob-hi) 45%, transparent); }
.lbl-arith { color: var(--org-hi); border-color: color-mix(in srgb, var(--org-hi) 45%, transparent); }
.c-slate { color: var(--ink-2); }
.c-cobalt { color: var(--cob-hi); }
.c-signal { color: var(--org-hi); }
.xref { font-variant-numeric: tabular-nums; }
.ref-missing { color: var(--org-hi); }
.center { text-align: center; }
.idx { position: relative; top: -1em; }

.math { margin: 0.6em 0 1.2em; overflow-x: auto; }
math { font-size: 1.08em; }
math[display="block"] { margin: 0; }

/* figures and tables: numbered, a label in cobalt like the book's */
.fig, .tbl { margin: 1.6em 0 1.8em; }
.fig svg { display: block; margin: 0 auto; width: 100%; height: auto; }
.fig.shot img { display: block; width: 100%; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.fig.shot a { display: block; }
figcaption { margin-top: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.5; max-width: var(--measure); }
.flabel { font-weight: 700; color: var(--cob-hi); margin-right: 0.3em; }
.tbl figcaption { margin: 0 0 8px; }

.tbl-wrap { margin: 0 0 1.2em; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.45; }
th, td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-faint); }
thead th { font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--rule); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-ref table { font-size: 13.5px; min-width: 560px; }
.tbl-ref td:first-child, .tbl-ref td:nth-child(2) { font-size: 13px; }
.tbl-ref td:first-child { min-width: 12em; }
.tbl-ref td:nth-child(2) { min-width: 9em; }
.tbl-ref code { font-size: 0.95em; }
.tbl-plain table { width: auto; }

/* code */
.code { margin: 0.4em 0 1.3em; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--code-bg); }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px 5px 14px; border-bottom: 1px solid var(--rule); font: 12.5px var(--mono); color: var(--ink-3); }
.copy { font: 600 12.5px var(--sans); color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.copy:hover { border-color: var(--cob-hi); }
.code pre { margin: 0; padding: 13px 14px 15px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.code pre code { background: none; padding: 0; font-size: inherit; white-space: pre; overflow-wrap: normal; color: var(--ink); }
.code .c, .code .c1, .code .cm, .code .ch { color: var(--ink-3); font-style: italic; }
.code .k, .code .kd, .code .kn, .code .nb, .code .kc { color: var(--cob-hi); }
.code .s, .code .s1, .code .s2, .code .sb, .code .sd { color: var(--org-hi); }
.code .nv, .code .vm, .code .na { color: var(--moss); }
.code .mi, .code .mf, .code .m { color: var(--ink); }
.code .err { color: inherit; border: 0; }
.code .gp { color: var(--ink-3); }

/* footnotes, foot */
.footnotes { margin-top: 2.5em; padding-top: 1em; border-top: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); }
.footnotes ol { padding-left: 1.4em; }
.fnref a { text-decoration: none; font-size: 0.8em; }
.pfoot { margin-top: 48px; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.pn a { display: block; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.pn a span { display: block; font: 400 12.5px var(--sans); color: var(--ink-3); margin-bottom: 3px; }
.pn a:hover { border-color: var(--cob-hi); }
.pn-next { text-align: right; }
.pmeta { font-size: 13.5px; color: var(--ink-3); }
.pmeta-top { padding: 10px 14px; border: 1px solid var(--rule); border-radius: 8px; font-size: 14.5px; color: var(--ink-2); }

/* the index of terms, the all-releases page */
.idx-jump { font-family: var(--mono); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.idx-letter h2 { font-family: var(--mono); color: var(--org-hi); }
.idx-letter ul { columns: 2; column-gap: 28px; padding: 0; list-style: none; }
.idx-letter li { break-inside: avoid; font-size: 14.5px; padding: 2px 0; }
.release { margin-top: 2.5em; padding-top: 1.5em; border-top: 1px solid var(--rule); }
.release h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 0; }
.release .rdate { font: 500 14px var(--mono); color: var(--ink-3); }
.release .chl-docs { font: 500 14px var(--sans); }

/* the figure colours */
.f-ink { fill: var(--fig-ink); } .s-ink { stroke: var(--fig-ink); }
.f-slate { fill: var(--fig-slate); } .s-slate { stroke: var(--fig-slate); }
.f-rule { fill: var(--fig-rule); } .s-rule { stroke: var(--fig-rule); }
.f-paper { fill: var(--fig-paper); } .s-paper { stroke: var(--fig-paper); }
.f-white { fill: var(--fig-white); } .s-white { stroke: var(--fig-white); }
.f-cobalt { fill: var(--fig-cobalt); } .s-cobalt { stroke: var(--fig-cobalt); }
.f-cobaltlight { fill: var(--fig-cobaltlight); } .s-cobaltlight { stroke: var(--fig-cobaltlight); }
.f-sky { fill: var(--fig-sky); } .s-sky { stroke: var(--fig-sky); }
.f-signal { fill: var(--fig-signal); } .s-signal { stroke: var(--fig-signal); }
.f-signallight { fill: var(--fig-signallight); } .s-signallight { stroke: var(--fig-signallight); }
.f-moss { fill: var(--fig-moss); } .s-moss { stroke: var(--fig-moss); }
/* tints (name!pct, mixed with white): the colour at reduced opacity */
[class*="-t"][class^="f-"], [class*="-t"][class^="s-"] { }
.f-cobalt-t75, .f-cobalt-t70, .f-cobalt-t55 { fill: var(--fig-cobalt); fill-opacity: 0.75; }
.f-cobalt-t45, .f-cobalt-t35, .f-cobalt-t25 { fill: var(--fig-cobalt); fill-opacity: 0.45; }
.s-cobalt-t75, .s-cobalt-t70, .s-cobalt-t55 { stroke: var(--fig-cobalt); stroke-opacity: 0.75; }
.s-cobalt-t45, .s-cobalt-t35, .s-cobalt-t25 { stroke: var(--fig-cobalt); stroke-opacity: 0.45; }
.f-slate-t60, .f-slate-t40, .f-slate-t35, .f-slate-t25 { fill: var(--fig-slate); fill-opacity: 0.4; }
.s-slate-t60, .s-slate-t40, .s-slate-t35, .s-slate-t25 { stroke: var(--fig-slate); stroke-opacity: 0.4; }
.f-signal-t70, .f-signal-t60 { fill: var(--fig-signal); fill-opacity: 0.7; }
.s-signal-t70, .s-signal-t60 { stroke: var(--fig-signal); stroke-opacity: 0.7; }
.f-signal-yellow-60 { fill: var(--fig-signal); fill-opacity: 0.85; }
.f-moss-t60, .f-moss-t35 { fill: var(--fig-moss); fill-opacity: 0.55; }
.f-cobaltlight-t40 { fill: var(--fig-cobaltlight); }
.s-rule-t60 { stroke: var(--fig-rule); stroke-opacity: 0.6; }
.f-ink-t94 { fill: var(--fig-ink); fill-opacity: 0.94; }
.f-white-t85, .f-white-t75 { fill: var(--fig-white); }

/* ---------- narrower screens ---------- */

@media (max-width: 1180px) {
  .dwrap { grid-template-columns: var(--side) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .dwrap { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .side-open { display: inline-flex; align-items: center; min-height: 34px; padding: 0 11px; border: 1px solid var(--rule); border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
  .dtop-docs { display: none; }
  /* the contents drawer: a full-height panel over the top bar that scrolls on its own; the page behind
     it stays put. Opened by the link (#nav, :target) without JS, by body.nav-open with docs.js. */
  .side {
    position: fixed; top: 0; bottom: auto; left: 0; z-index: 45; width: min(86vw, 340px);
    height: 100vh; height: 100dvh; max-height: none;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    /* the bottom: the home indicator and Safari's floating bottom bar */
    padding: 0 14px calc(96px + env(safe-area-inset-bottom, 0px));
    background: var(--ground-2); border-right: 1px solid var(--rule);
    transform: translateX(-104%); visibility: hidden; transition: transform 0.2s ease-out, visibility 0s linear 0.2s;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.45);
  }
  .side:target, body.nav-open .side { transform: none; visibility: visible; transition: transform 0.2s ease-out; }
  .side .side-head {
    display: block; position: sticky; top: 0; z-index: 1; margin: 0 -14px 10px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px; background: var(--ground-2); border-bottom: 1px solid var(--rule);
  }
  .side .side-close { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
  .side .side-close:hover { background: transparent; border-color: var(--cob-hi); }
  /* the page behind the open drawer: dimmed and locked */
  html.nav-lock, html:has(.side:target), html:has(body.nav-open), body.nav-open, body:has(.side:target) { overflow: hidden; }
  body.nav-open::after, body:has(.side:target)::after {
    content: ""; position: fixed; inset: 0; z-index: 44; background: rgba(6, 9, 13, 0.55);
  }
  html[data-theme="light"] body.nav-open::after, html[data-theme="light"] body:has(.side:target)::after { background: rgba(28, 34, 48, 0.32); }
  .content { padding-top: 18px; }
  .chapters { columns: 1; }
  .idx-letter ul { columns: 1; }
  .pn { grid-template-columns: 1fr; }
  .pn-next { text-align: left; }
  .search { flex: 1 1 120px; }
  .results { position: fixed; left: 12px; right: 12px; top: calc(var(--top) + 4px); max-height: min(560px, calc(var(--vvh, 100vh) - var(--top) - 16px)); }
  @supports (height: 100dvh) { .results { max-height: min(560px, calc(var(--vvh, 100dvh) - var(--top) - 16px)); } }
}
@media (max-width: 560px) {
  :root { --top: 100px; }
  .dtop-row { flex-wrap: wrap; align-content: center; gap: 10px 12px; padding-top: 8px; padding-bottom: 8px; }
  .search { flex: 1 1 100%; order: 10; }
  .search input { min-height: 36px; }
  .vmenu { margin-left: auto; }
  .brand span { display: none; }
  .dtop-gh { display: none; }
  .theme { padding: 0 9px; }
  body { font-size: 16px; }
  .prose { font-size: 16px; }
  .chead h1 { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  .side, .side:target, body.nav-open .side { transition: none; }
}

/* ---------- print: the book's page ---------- */

@media print {
  :root, html[data-theme="dark"] {
    --ground: #fff; --ground-2: #fff; --ground-3: #f0f3f8; --rule: #c9d0dc; --rule-faint: #e3e7ee; --ink: #1c2230; --ink-2: #5a6475;
    --ink-3: #6b7584; --cob: #1f4fcc; --cob-hi: #1f4fcc; --cob-tint: #e8eefb; --org: #e8641b; --org-hi: #c4540f; --org-tint: #fcebdd;
    --moss: #2e8b57; --code-bg: #f5f7fa;
    --fig-ink: #1c2230; --fig-slate: #5a6475; --fig-rule: #c9d0dc; --fig-paper: #f5f7fa; --fig-white: #fff; --fig-cobalt: #1f4fcc;
    --fig-cobaltlight: #e8eefb; --fig-sky: #8fb3ff; --fig-signal: #e8641b; --fig-signallight: #fcebdd; --fig-moss: #2e8b57;
  }
  html, body { background: #fff; color: #1c2230; font-size: 11pt; }
  .dtop, .side, .toc, .banner, .pn, .copy, .hlink, .skip, .side-open, .cover-links, .idx-jump { display: none !important; }
  .dwrap { display: block; padding: 0; max-width: none; }
  .content { max-width: none; padding: 0; }
  .prose > p, .prose li, .prose dd, figcaption { max-width: none; }
  .chead { break-after: avoid; }
  h2, h3, h4 { break-after: avoid; }
  .fig, .tbl, .code, tr { break-inside: avoid; }
  a { color: #1f4fcc; text-decoration: none; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #5a6475; }
  .code { border: 1px solid #c9d0dc; }
  .code pre { white-space: pre-wrap; }
  .pmeta { margin-top: 2em; }
}

/* ---------- the star button (the same as the home page's) and the website's overview pages ---------- */

.star {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px 0 11px;
  border: 1px solid var(--rule); border-radius: 7px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.star:hover { border-color: var(--cob-hi); color: var(--ink); }
.star .gh { width: 16px; height: 16px; fill: currentColor; display: block; }
.star-n { padding: 1px 7px; border-radius: 999px; background: var(--rule-faint); font: 600 12.5px var(--mono); color: var(--ink); min-width: 2em; text-align: center; }
html[data-theme="light"] .star-n { background: rgba(28, 34, 48, 0.08); }
@media (max-width: 900px) { .star span:first-of-type { display: none; } .star { padding-left: 9px; } }
@media (max-width: 560px) { .star { margin-left: 0; } .vmenu { margin-left: 0; } }

/* the overview pages load the site's stylesheet first (charts, the request path, the model rack); these keep the docs' measure */
.prose.site { font-size: 16.5px; }
.prose.site > p, .prose.site .sec-lede, .prose.site .prose { max-width: var(--measure); }
.prose.site .sec-lede { margin-top: 0; font-size: 17.5px; color: var(--ink-2); }
.prose.site .prose { margin-top: 20px; }
.prose.site h2 { margin-top: 2.4em; }
.prose.site .table-head { margin-top: 2.4em; }
.prose.site .table-head h3, .prose.site .chart-title { font-size: 19px; }
.prose.site .chart, .prose.site .kinds-wrap, .prose.site .gallery { margin-top: 22px; }
.prose.site .path { margin-top: 24px; }
.prose.site .path-grid { display: block; }
.prose.site .feature, .prose.site .pair, .prose.site .trio { margin-top: 28px; }
.prose.site .install-grid, .prose.site .chat-grid { margin-top: 22px; }
.prose.site .code { margin-top: 8px; }
.prose.site .code pre code { color: var(--ink); }
.prose.site .rack { margin-top: 24px; }
.prose.site .cc-grid { margin-top: 20px; }
.prose.site .loop figcaption, .prose.site figcaption { color: var(--ink-2); }
.prose.site .kinds thead th, .prose.site .kinds td { color: var(--ink); }
.prose.site .kinds td[data-k="plain"], .prose.site .kinds thead th, .prose.site .m-sub { color: var(--ink-2); }
.prose.site .btn-primary { color: var(--ground); }
html[data-theme="light"] .prose.site .svg-lbl { fill: var(--ink-2); }
html[data-theme="light"] .prose.site .loop svg circle[fill="#eef2f7"] { fill: var(--ink); }
html[data-theme="light"] .prose.site .loop svg circle[fill="#161d25"] { fill: var(--ground-2); }
html[data-theme="light"] .prose.site .bar-row.dim .bar { background: #9aa6b5; }
html[data-theme="light"] .prose.site .ttft-bars span, html[data-theme="light"] .prose.site .bar-name { color: var(--ink-2); }
html[data-theme="light"] .prose.site .chart::before { background: repeating-linear-gradient(180deg, transparent 0 47px, var(--rule-faint) 47px 48px); }
html[data-theme="light"] .prose.site .shot img { background: #fff; }
html[data-theme="light"] .prose.site .path > li::before { background: var(--ground-2); }
.prose.site .nw { white-space: normal; overflow-wrap: anywhere; }
.prose.site .install-grid > *, .prose.site .chat-grid > *, .prose.site .steps li, .prose.site .feature > *, .prose.site .pair > *, .prose.site .trio > * { min-width: 0; }
.prose.site .code pre { max-width: 100%; }
@media (max-width: 560px) {
  .dtop-row { gap: 8px 8px; }
  .vmenu summary { padding: 5px 22px 5px 9px; font-size: 12px; }
  .vmenu summary::after { right: 8px; top: 10px; }
  .theme { padding: 0 8px; font-size: 12.5px; min-height: 32px; }
  /* two rows: the controls, then the search with the star beside it (the star on the first row wrapped
     to a third one on 390 px and pushed the bar's rows out of its height) */
  .star { min-height: 36px; padding: 0 8px; gap: 5px; order: 11; margin-left: 0; }
  .search { flex: 1 1 calc(100% - 92px); }
  .side-open { padding: 0 9px; font-size: 13px; }
}
