/* Fonts: Familjen Grotesk (UI, headings), Literata (body), JetBrains Mono (code), loaded from Google Fonts here so pages need no extra <link>. */
@import url("https://fonts.googleapis.com/css2?family=Familjen+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500&family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,600;1,7..72,400&display=swap");

:root {
  --paper: #F1F3EE;
  --panel: #FFFFFF;
  --ink: #1D2733;
  --ink-2: #55606E;
  --rule: #D5D9D2;
  --img: #2F5BD3;
  --txt: #B86F0E;
  --mm: #801680;
  --pos: #B3261E;
  --ok: #2E7D4F;
  --img-soft: color-mix(in srgb, var(--img) 12%, var(--panel));
  --txt-soft: color-mix(in srgb, var(--txt) 12%, var(--panel));
  --mm-soft: color-mix(in srgb, var(--mm) 12%, var(--panel));
  --pos-soft: color-mix(in srgb, var(--pos) 12%, var(--panel));
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);

  --ui: "Familjen Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --fs-sm: 13.6px;
  --fs-0: 17px;
  --fs-1: 21.25px;
  --fs-2: 26.5px;
  --fs-3: 33px;
  --fs-4: 41.5px;

  --side: 260px;
  --rail: 64px;
  --toc: 232px;
  --wide: 1040px;
  --flow: 1.1rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161B22;
    --panel: #1D232C;
    --ink: #E6E9EE;
    --ink-2: #A3ADBA;
    --rule: #2E3642;
    --img: #7A9BFF;
    --txt: #E3A24A;
    --mm: #DD56B8;
    --pos: #F84C41;
    --ok: #6FCF97;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161B22;
  --panel: #1D232C;
  --ink: #E6E9EE;
  --ink-2: #A3ADBA;
  --rule: #2E3642;
  --img: #7A9BFF;
  --txt: #E3A24A;
  --mm: #DD56B8;
  --pos: #F84C41;
  --ok: #6FCF97;
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-0)/1.65 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
:where(a) { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
:where(a:hover) { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--img); outline-offset: 2px; border-radius: 2px; }
:where(button) { font: inherit; color: inherit; }
:where(img, svg) { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; }

/* Page frame */
body { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { grid-column: 1; grid-row: 1; }
#content { grid-column: 2; grid-row: 1; min-width: 0; padding: 40px clamp(24px, 4.5vw, 64px) 56px; }
.toc { display: none; }
.topbar, .scrim, .sheet-close { display: none; }

@media (min-width: 1280px) {
  body:not(.no-toc) { grid-template-columns: var(--side) minmax(0, 1168px) var(--toc); }
  body.rail:not(.no-toc) { grid-template-columns: var(--rail) minmax(0, 1168px) var(--toc); }
  body:not(.no-toc) .toc { display: block; grid-column: 3; grid-row: 1; }
}
@media (min-width: 900px) {
  body.rail { grid-template-columns: var(--rail) minmax(0, 1fr); }
}

/* Prose flow: zero-specificity defaults so component classes always win */
:where(#content) :where(h1, h2, h3, h4, h5, p, ul, ol, dl, dd, pre, blockquote, figure, table, hr, aside, section, details) { margin: 0; }
:where(#content) > :where(*) { max-width: 68ch; }
:where(#content section) > :where(*) { max-width: 68ch; }
:where(#content, #content section) > :where(section, .wide) { max-width: var(--wide); }
:where(#content) :where(*) + :where(p, ul, ol, dl, pre, blockquote, figure, aside, details, section, table, .table-scroll, .widget, .calc, .chart, .title-row) { margin-top: var(--flow); }
:where(#content) :where(ul, ol) { padding-left: 1.3em; }
:where(#content) :where(li + li) { margin-top: 0.35em; }
:where(#content) :where(li > ul, li > ol) { margin-top: 0.35em; }
:where(#content) :where(h1, h2, h3, h4) { font-family: var(--ui); color: var(--ink); text-wrap: balance; }
:where(#content) :where(h1) { font-size: var(--fs-4); line-height: 1.12; font-weight: 700; letter-spacing: -0.01em; max-width: 22em; }
:where(#content) :where(h2) { font-size: var(--fs-2); line-height: 1.25; font-weight: 600; margin-top: 3rem; padding-top: 1.1rem; border-top: 1px solid var(--rule); }
:where(#content) :where(h3) { font-size: var(--fs-1); line-height: 1.3; font-weight: 600; margin-top: 2.2rem; }
:where(#content) :where(h4) { font-size: var(--fs-0); line-height: 1.4; font-weight: 600; margin-top: 1.6rem; }
:where(#content) :where(h2, h3, h4) + :where(*) { margin-top: 0.6rem; }
:where(#content) :where(h1, h2, h3, h4, [id]) { scroll-margin-top: 24px; }
:where(#content) :where(strong, b) { font-weight: 600; }
:where(#content) :where(code) { font-family: var(--mono); font-size: 0.84em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 0.1em 0.3em; border-radius: 4px; overflow-wrap: anywhere; }
:where(#content) :where(pre) { font: 400 14px/1.55 var(--mono); background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
:where(#content) :where(pre code) { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
:where(#content) :where(blockquote) { border-left: 3px solid var(--rule); padding-left: 1em; color: var(--ink-2); }
:where(#content) :where(hr) { border: 0; border-top: 1px solid var(--rule); margin-block: 2rem; }
:where(#content) :where(img) { height: auto; }

.crumb { font: 500 14px/1.4 var(--ui); color: var(--ink-2); margin-bottom: 0.6rem; }
.crumb a { color: var(--ink-2); text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.lede { font-size: var(--fs-1); line-height: 1.5; max-width: 32em; margin-top: 1rem; }
.title-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 20px; }
.title-row h1 { flex: 1 1 18rem; }
.title-actions { display: flex; gap: 8px; padding-top: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 14px/1.2 var(--ui); color: var(--ink);
  background: var(--panel); border: 1px solid var(--rule); border-radius: 6px;
  padding: 7px 12px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); }
.btn .icon { width: 16px; height: 16px; }
.btn[aria-pressed="true"] { border-color: var(--ink); }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--rule);
  background: var(--paper);
  font-family: var(--ui);
}
.brand-row { display: flex; align-items: flex-start; gap: 6px; }
.brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; padding: 2px 4px; }
.logo { width: 30px; height: 30px; flex: none; }
.logo .l-img { fill: var(--img); }
.logo .l-txt { fill: var(--txt); }
.logo .l-mm { fill: var(--mm); }
.brand-name { display: block; font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-sub { display: block; font-weight: 500; font-size: 13px; line-height: 1.3; color: var(--ink-2); margin-top: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sheet-close { display: none; }

.site-nav { flex: 1; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-h { margin: 0 0 4px 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list > li + li { margin-top: 1px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; line-height: 1.3;
}
.nav-link .icon { color: var(--ink-2); }
.nav-link:hover { background: var(--hover); }
.nav-link[aria-current="page"] { background: var(--panel); font-weight: 600; }
.nav-link[aria-current="page"] .icon, .nav-link.is-parent .icon { color: var(--ink); }
.nav-link[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: var(--mm);
}
.nav-link.is-parent { font-weight: 600; }

.nav-docs { margin: 4px 0 6px 20px; padding-left: 8px; border-left: 1px solid var(--rule); font-size: var(--fs-sm); }
.nav-docs details + details { margin-top: 2px; }
.nav-docs summary { cursor: pointer; padding: 4px 6px; border-radius: 4px; font-weight: 600; color: var(--ink-2); list-style-position: outside; }
.nav-docs summary:hover { color: var(--ink); }
.nav-docs ul { list-style: none; margin: 2px 0 6px; padding: 0; }
.doc-link { position: relative; display: block; padding: 4px 6px 4px 10px; border-radius: 4px; color: var(--ink); text-decoration: none; line-height: 1.35; font-weight: 500; }
.doc-link:hover { background: var(--hover); }
.doc-link[aria-current="page"] { background: var(--panel); font-weight: 600; }
.doc-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; background: var(--mm); }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
.credits {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel);
  font-size: 13px; line-height: 1.4; color: var(--ink-2);
}
.credits p { margin: 0; }
.credits a { color: var(--ink-2); }
.credits-initials {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-weight: 700; font-size: 12.5px;
}
.credits-name { color: var(--ink); font-weight: 600; font-size: 14px; }
.theme-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  font: 500 14px/1.3 var(--ui); color: var(--ink-2); text-align: left;
}
.theme-btn:hover { background: var(--hover); color: var(--ink); }

.rail-tip {
  position: fixed; z-index: 60; transform: translateY(-50%); pointer-events: none;
  padding: 5px 9px; border-radius: 5px; background: var(--ink); color: var(--paper);
  font: 500 13px/1.2 var(--ui); white-space: nowrap;
}

@media (min-width: 900px) {
  body.rail .sidebar { padding: 18px 10px 14px; align-items: center; }
  body.rail .brand-row { flex-direction: column; align-items: center; gap: 10px; }
  body.rail .brand { padding: 0; flex: none; }
  body.rail :is(.brand-text, .nav-label, .credits-body, .theme-label) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  body.rail .nav-group-h, body.rail .nav-docs { display: none; }
  body.rail .site-nav { width: 100%; }
  body.rail .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
  body.rail .nav-link { justify-content: center; width: 44px; height: 38px; padding: 0; margin-inline: auto; }
  body.rail .sidebar-foot { align-items: center; }
  body.rail .credits { padding: 0; border: 0; background: none; }
  body.rail .theme-btn { justify-content: center; width: 44px; height: 38px; padding: 0; }
}

/* Mobile: top bar and slide-in sheet */
@media (max-width: 899.98px) {
  body { display: block; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30; height: 54px; padding: 0 16px;
    background: var(--paper); border-bottom: 1px solid var(--rule); font-family: var(--ui);
  }
  .topbar-brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; }
  .topbar-brand .logo { width: 24px; height: 24px; }
  .topbar-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(320px, 86vw); height: 100%;
    transform: translateX(-100%); visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
    background: var(--paper);
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform 0.2s ease; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(10 14 20 / 0.4); }
  .rail-btn { display: none; }
  .icon-btn.sheet-close { display: inline-grid; }
  #content { padding: 26px 16px 48px; }
  :where(#content) :where(h1, h2, h3, h4, [id]) { scroll-margin-top: 70px; }
}
@media (max-width: 600px) {
  :where(#content) :where(h1) { font-size: var(--fs-3); }
  figure.diagram, .widget { padding: 16px 14px 14px; }
  .lede { font-size: 19px; }
}

/* On this page */
.toc { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 44px 20px 24px 0; font: 500 var(--fs-sm)/1.35 var(--ui); }
.toc-h { margin: 0 0 8px; font-weight: 600; color: var(--ink); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc a { display: block; margin-left: -1px; padding: 3px 0 3px 12px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; }
.toc .lvl-3 a { padding-left: 24px; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-left-color: var(--ink); }

/* Components */
ul.tldr { list-style: none; padding: 2px 0 2px 20px; border-left: 3px solid var(--ink); font-size: 18px; line-height: 1.55; margin-top: 1.5rem; }
ul.tldr > li { position: relative; }
ul.tldr > li::before { content: ""; position: absolute; left: -12px; top: 0.72em; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-2); }

aside.note { padding: 2px 0 2px 18px; border-left: 3px solid var(--rule); font-size: 16px; line-height: 1.6; }
aside.note.source { border-left-color: var(--ok); }
aside.note.reading { border-left: 2px dashed var(--ink-2); padding-left: 19px; }
aside.note.caveat { border-left-color: var(--pos); }
.note-h { font: 600 var(--fs-sm)/1.3 var(--ui); margin-bottom: 0.35rem; }
aside.note > .note-h + * { margin-top: 0; }
aside.note.source .note-h { color: var(--ok); }
aside.note.reading .note-h { color: var(--ink-2); }
aside.note.caveat .note-h { color: var(--pos); }
.note-h a { color: var(--ink-2); font-weight: 500; }

figure.diagram { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 20px 20px 16px; }
figure.diagram > svg { display: block; width: 100%; height: auto; color: var(--ink); }
.diagram-scroll { overflow-x: auto; }
.diagram-scroll > svg { display: block; height: auto; color: var(--ink); }
.fig-title { font: 600 15px/1.35 var(--ui); color: var(--ink); margin: 0 0 12px; }
figure.diagram figcaption { margin-top: 14px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
figure.diagram figcaption a { color: var(--ink-2); }

:where(svg) text { font-family: var(--ui); font-size: 13px; font-weight: 500; fill: currentColor; }
.ch-img { fill: var(--img-soft); stroke: var(--img); }
.ch-txt { fill: var(--txt-soft); stroke: var(--txt); }
.ch-mm { fill: var(--mm-soft); stroke: var(--mm); }
.ch-pos { fill: var(--pos-soft); stroke: var(--pos); }
.ch-img-ink { fill: var(--img); }
.ch-txt-ink { fill: var(--txt); }
.ch-mm-ink { fill: var(--mm); }
.ch-pos-ink { fill: var(--pos); }
svg .box { fill: var(--panel); stroke: currentColor; stroke-width: 1.25; }
svg .edge { fill: none; stroke: currentColor; stroke-width: 1.5; }
svg .hair { fill: none; stroke: var(--rule); }
svg .frozen { stroke-dasharray: 4 3; }
svg .lbl-2 { fill: var(--ink-2); }
svg .lbl-b { font-weight: 600; }

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font: 400 15px/1.45 var(--serif); font-variant-numeric: tabular-nums lining-nums; }
table.data caption { caption-side: top; text-align: left; font: 600 15px/1.35 var(--ui); padding-bottom: 8px; }
table.data th { font: 600 14px/1.3 var(--ui); text-align: left; vertical-align: bottom; padding: 8px 10px; border-bottom: 1px solid var(--ink); }
table.data td { vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--rule); }
table.data :is(th, td):first-child { padding-left: 0; }
table.data :is(th, td):last-child { padding-right: 0; }
table.data :is(th, td).num { text-align: right; white-space: nowrap; }
table.data td.nw { white-space: nowrap; }
table.data tr.best td { font-weight: 600; }
table.data td code { white-space: nowrap; }

sup.cite { font: 500 0.72em/0 var(--ui); vertical-align: super; margin-left: 0.15em; white-space: nowrap; }
sup.cite a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted currentColor; }
sup.cite a:hover { color: var(--ink); border-bottom-style: solid; }

.tag {
  display: inline-flex; align-items: center; gap: 0.4em; vertical-align: 0.1em;
  padding: 3px 9px 3px 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--panel);
  font: 500 13px/1.2 var(--ui); color: var(--ink); white-space: nowrap;
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); }
.tag.img { background: var(--img-soft); border-color: color-mix(in srgb, var(--img) 40%, var(--panel)); }
.tag.txt { background: var(--txt-soft); border-color: color-mix(in srgb, var(--txt) 40%, var(--panel)); }
.tag.mm { background: var(--mm-soft); border-color: color-mix(in srgb, var(--mm) 40%, var(--panel)); }
.tag.img::before { background: var(--img); }
.tag.txt::before { background: var(--txt); }
.tag.mm::before { background: var(--mm); }

ol.steps { list-style: none; padding: 0; counter-reset: step; }
ol.steps > li { position: relative; counter-increment: step; padding-left: 46px; }
ol.steps > li + li { margin-top: 1.6rem; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--ink); font: 600 14px/25px var(--ui); text-align: center; background: var(--paper);
}
ol.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: -1.3rem; width: 1px; background: var(--rule); }
ol.steps h4 { margin-top: 0; padding-top: 2px; font: 600 var(--fs-0)/1.4 var(--ui); }
.calc {
  display: block; font: 400 14px/1.6 var(--mono); font-variant-numeric: tabular-nums;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 6px;
  padding: 10px 14px; white-space: pre; overflow-x: auto;
}

.widget { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 20px; font: 400 15px/1.5 var(--ui); }
.widget-h { font: 600 15px/1.35 var(--ui); margin-bottom: 10px; }
.widget label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-weight: 500; }
.widget input[type="range"] { flex: 1 1 160px; min-width: 120px; accent-color: var(--img); }
.widget output { min-width: 3.5em; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.widget :is(input, select, button):focus-visible { outline: 2px solid var(--img); outline-offset: 2px; }

dl.glossary dt { font: 600 var(--fs-0)/1.4 var(--ui); }
dl.glossary dd { margin: 0.2rem 0 0; }
dl.glossary dd + dt { margin-top: 1.1rem; }

.pagenav { display: flex; justify-content: space-between; gap: 16px; margin-top: 4rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); font-family: var(--ui); }
.pagenav a { display: flex; flex-direction: column; gap: 2px; max-width: 48%; color: var(--ink); text-decoration: none; }
.pagenav a.next { margin-left: auto; text-align: right; }
.pagenav small { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.pagenav span { font-size: var(--fs-0); font-weight: 600; }
.pagenav a:hover span { text-decoration: underline; text-underline-offset: 0.18em; }
.page-foot { margin-top: 2.2rem; font: 500 var(--fs-sm)/1.4 var(--ui); color: var(--ink-2); }
.pagenav + .page-foot { margin-top: 1.6rem; }

/* Lists used on home, library and references */
ul.worklist, ul.doclist, ol.refs { list-style: none; padding: 0; }
ul.worklist > li, ul.doclist > li, ol.refs > li { margin: 0; padding: 14px 0; border-top: 1px solid var(--rule); }
ul.worklist > li:last-child, ul.doclist > li:last-child, ol.refs > li:last-child { border-bottom: 1px solid var(--rule); }
.w-title { font: 600 18px/1.35 var(--ui); margin: 0; }
.w-title a { text-decoration: none; }
.w-title a:hover { text-decoration: underline; }
ul.worklist p { margin-top: 0.3rem; font-size: 16px; }
.w-links { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 4px 18px; font: 500 14px/1.4 var(--ui); }
ul.doclist > li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; padding: 11px 0; }
ul.doclist a { font: 600 16px/1.35 var(--ui); text-decoration: none; }
ul.doclist a:hover { text-decoration: underline; }
ul.doclist .path { font: 500 var(--fs-sm)/1.35 var(--ui); color: var(--ink-2); }
ul.doclist .desc { flex-basis: 100%; margin: 0; font-size: 15.5px; color: var(--ink-2); }

ol.timeline { list-style: none; padding: 0; }
ol.timeline > li { position: relative; display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0 16px; margin: 0; padding: 0 0 1.1rem 26px; }
ol.timeline > li::before {
  content: ""; position: absolute; left: 0; top: 0.42em; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--ink-2); background: var(--paper);
}
ol.timeline > li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 1.35em; bottom: 0.1em; width: 1px; background: var(--rule); }
ol.timeline > li.done::before { background: var(--ink-2); }
ol.timeline > li.now::before { border-color: var(--ink); background: var(--ink); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--ink); }
.tl-date { font: 500 14px/1.5 var(--ui); color: var(--ink-2); padding-top: 1px; }
.tl-title { margin: 0; font: 600 16px/1.45 var(--ui); }
.tl-state { font-weight: 500; color: var(--ink-2); }
.tl-body { margin: 0.15rem 0 0; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); }
@media (max-width: 600px) {
  ol.timeline > li { grid-template-columns: minmax(0, 1fr); }
}

ol.refs > li { scroll-margin-top: 24px; }
ol.refs > li:target { background: linear-gradient(to right, var(--mm) 0 3px, transparent 3px); padding-left: 14px; }
.ref-key { font: 600 15px/1.4 var(--ui); margin: 0; }
.ref-main { margin: 0.2rem 0 0; }
.ref-title { font-style: italic; }
.ref-used { margin: 0.3rem 0 0; font-size: 15.5px; color: var(--ink-2); }
.ref-links { margin: 0.35rem 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font: 500 14px/1.4 var(--ui); }
.refs-group + .refs-group, h2 + ol.refs { margin-top: 0.6rem; }

/* Charts */
.chart { font-family: var(--ui); color: var(--ink); }
.chart-svg svg { display: block; overflow: visible; }
.chart text { font-size: 12.5px; font-weight: 500; }
.chart .muted { fill: var(--ink-2); }
.chart .grp { font-size: 13px; font-weight: 600; fill: var(--ink); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis-line { stroke: var(--ink-2); stroke-width: 1; }
.chart .ref-line { stroke: var(--ink-2); stroke-width: 1.25; stroke-dasharray: 4 3; }
.chart .row-bg { fill: transparent; }
.chart .row:hover .row-bg { fill: var(--hover); }
.chart .dot { stroke-width: 2; }
.chart .dot.solid { stroke: var(--panel); }
.chart .dot.hollow { fill: var(--panel); stroke-width: 2; }
.chart .whisker { stroke-width: 1.5; fill: none; }
.chart .solid.ch-img { fill: var(--img); }
.chart .solid.ch-txt { fill: var(--txt); }
.chart .solid.ch-mm { fill: var(--mm); }
.chart .solid.ch-pos { fill: var(--pos); }
.chart .bar { stroke: none; }
.chart .cell-empty { fill: none; stroke: var(--rule); stroke-dasharray: 3 3; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; padding: 0; list-style: none; font: 500 13px/1.4 var(--ui); color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.chart-legend svg { width: 22px; height: 14px; flex: none; overflow: visible; }

/* Present mode */
aside.notes { display: none; padding: 10px 14px; border: 1px dashed var(--ink-2); border-radius: 6px; background: var(--panel); font: 400 15px/1.5 var(--ui); color: var(--ink-2); }
aside.notes::before { content: "Speaker notes"; display: block; margin-bottom: 4px; font-weight: 600; color: var(--ink); }
body.show-notes aside.notes { display: block; }
.present-counter, .present-exit { display: none; }
body.presenting { display: block; }
body.presenting :is(.sidebar, .topbar, .toc, .scrim, .rail-tip) { display: none !important; }
body.presenting #content { padding: 0; }
body.presenting #content > :not(section.slide) { display: none; }
body.presenting section.slide { display: none; max-width: none; min-height: 100vh; margin: 0; padding: 7vh 8vw 12vh; font-size: 24px; line-height: 1.5; }
body.presenting section.slide.current { display: block; animation: slide-in 150ms ease-out; }
body.presenting section.slide > * { max-width: 44em; }
body.presenting section.slide > :is(.wide, figure.diagram, .table-scroll) { max-width: min(1200px, 100%); }
body.presenting .slide :where(h1) { font-size: 52px; }
body.presenting .slide :where(h2) { font-size: var(--fs-4); margin-top: 0; padding-top: 0; border-top: 0; }
body.presenting .slide :where(h3) { font-size: var(--fs-3); }
body.presenting .slide table.data { font-size: 20px; }
body.presenting .slide table.data th { font-size: 18px; }
body.presenting .slide figure.diagram figcaption { font-size: 19px; }
body.presenting .present-counter { display: block; position: fixed; right: 20px; bottom: 16px; font: 500 15px/1 var(--ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
body.presenting .present-exit { display: inline-flex; position: fixed; top: 14px; right: 16px; z-index: 5; }
@keyframes slide-in { from { opacity: 0; } to { opacity: 1; } }

/* Motion and print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    --paper: #FFFFFF; --panel: #FFFFFF; --ink: #111111; --ink-2: #444444; --rule: #CCCCCC;
    --img: #2F5BD3; --txt: #B86F0E; --mm: #801680; --pos: #B3261E; --ok: #2E7D4F;
    color-scheme: light;
  }
  body { display: block; font-size: 11pt; }
  :is(.sidebar, .topbar, .toc, .scrim, .pagenav, .rail-tip, .title-actions, .present-counter, .present-exit, aside.notes) { display: none !important; }
  #content { padding: 0; }
  :where(#content) > :where(*) { max-width: none; }
  :is(figure, table, .widget, .calc, aside.note, ol.steps > li) { break-inside: avoid; }
  :where(#content) :where(h2, h3) { break-after: avoid; }
  section.slide + section.slide { break-before: page; }
}

/* Library */
.doc-meta { margin-top: 0.5rem; font: 500 14px/1.4 var(--ui); color: var(--ink-2); }
.repo-file { color: var(--ink-2); }
.katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 2px; }

/* Forms, sign-in page and users page */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label { font: 600 var(--fs-sm)/1.3 var(--ui); color: var(--ink); }
.input {
  width: 100%; min-height: 40px; padding: 8px 10px;
  font: 400 16px/1.4 var(--ui); color: var(--ink);
  background: var(--panel); border: 1px solid var(--rule); border-radius: 6px;
}
.input:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.danger { color: var(--pos); }
.btn.danger.is-armed { background: var(--pos); color: #fff; border-color: var(--pos); }
.form-msg { margin: 0; min-height: 1.4em; font: 500 14px/1.4 var(--ui); color: var(--ink-2); }
.form-msg.is-error { color: var(--pos); }
.form-msg.page-status { margin-top: 1.6rem; font-size: 15px; }

body.auth { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 32px 16px; font-family: var(--ui); }
.auth-card { width: 100%; max-width: 400px; padding: 28px 28px 22px; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
.auth-card .logo { width: 40px; height: 40px; display: block; }
.auth-card h1 { margin: 18px 0 4px; font: 700 var(--fs-2)/1.2 var(--ui); letter-spacing: -0.01em; }
.auth-sub { margin: 0 0 22px; font: 400 16px/1.5 var(--serif); color: var(--ink-2); }
.auth-card .btn.primary { width: 100%; justify-content: center; min-height: 42px; margin-top: 20px; font-size: 15px; }
.auth-card .form-msg { margin-top: 12px; }
.auth-foot { margin: 22px 0 0; display: flex; flex-direction: column; align-items: center; gap: 10px; font: 500 var(--fs-sm)/1.4 var(--ui); color: var(--ink-2); text-align: center; }
.auth-foot p { margin: 0; max-width: 34ch; }
.auth-brand { display: block; width: 70px; height: auto; border-radius: 4px; }
.auth-note { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); font: 400 var(--fs-sm)/1.45 var(--ui); color: var(--ink-2); }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; font-family: var(--ui); }
.form-row .field { flex: 1 1 16rem; margin: 0; }
.form-row .field.narrow { flex: 0 1 9rem; }
.form-row .btn { min-height: 40px; }
.secret { padding: 14px 16px; border: 1px solid var(--rule); border-left: 3px solid var(--ok); border-radius: 8px; background: var(--panel); font-family: var(--ui); }
.secret-h { margin: 0; font-weight: 600; font-size: 15px; }
.secret-row { display: flex; gap: 8px; margin-top: 8px; }
.secret-row .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 15px; }
.secret-note { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.admin-panel > :not(.wide) { max-width: 68ch; }
table.users td { vertical-align: middle; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions .btn { padding: 5px 10px; font-size: 13.6px; white-space: nowrap; }
@media (max-width: 600px) {
  table.users thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.users, table.users tbody, table.users tr { display: block; }
  table.users tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  table.users td { display: inline; padding: 0; border: 0; }
  table.users td:first-child { display: block; font-weight: 600; overflow-wrap: anywhere; }
  table.users td:nth-child(n+2):nth-child(-n+4) { font: 500 14px/1.5 var(--ui); color: var(--ink-2); }
  table.users td:nth-child(2)::after, table.users td:nth-child(3)::after { content: ", "; }
  table.users td:last-child { display: block; margin-top: 8px; }
  table.users .row-actions { justify-content: flex-start; }
}
.credits .credits-session { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
.credits-email { color: var(--ink); overflow-wrap: anywhere; }
.credits .credits-links { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 2px; }
.credits-links a { color: var(--ink); }
