/* guided-workspace site: components read only theme tokens from theme.css; no raw colours below. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: var(--text-base); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); line-height: var(--leading);
  font-variant-numeric: proportional-nums; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.12em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: var(--space-2); top: -4rem; padding: var(--space-1) var(--space-2); background: var(--surface); color: var(--text); z-index: 10; }
.skip:focus { top: var(--space-2); }

/* header */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4);
  padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5; transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
/* site.js sets this while reading downwards; without the script the header simply stays. */
[data-header="hidden"] .site-header { transform: translateY(-100%); }
.brand { font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: var(--step-1); color: var(--text); text-decoration: none; margin-right: auto; }
.top-nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-1); }
.top-nav a, .theme-toggle {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-2);
  color: var(--text); text-decoration: none; border-radius: var(--radius); font-size: var(--step-n1);
}
.top-nav a:hover { background: var(--surface-2); }
.top-nav a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
.theme-toggle { font: inherit; font-size: var(--step-1); line-height: 1; justify-content: center; min-width: 44px; padding: 0; background: transparent; border: 1px solid var(--border); cursor: pointer; }

/* shell and layouts */
.shell { display: grid; gap: var(--space-5); max-width: 84rem; margin: 0 auto; padding: var(--space-4); align-items: start; }
.layout-wiki .shell, .layout-docs .shell, .layout-course .shell { grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr) minmax(10rem, 13rem); }
.layout-wiki .shell:not(:has(.toc)), .layout-docs .shell:not(:has(.toc)), .layout-course .shell:not(:has(.toc)) { grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); }
.layout-landing .shell { grid-template-columns: minmax(0, 1fr); max-width: calc(var(--measure) + 8rem); }
/* Tufte: a reading column with a margin aside. Below this width the aside follows the text. */
.layout-tufte .shell { grid-template-columns: minmax(0, 1fr); max-width: calc(var(--measure) + 8rem); }
@media (min-width: 1101px) {
  .layout-tufte .shell { grid-template-columns: minmax(0, var(--measure)) minmax(12rem, 16rem); max-width: calc(var(--measure) + 16rem + var(--space-5) + 2 * var(--space-4)); }
  .layout-tufte .shell:has(.graph-page) { grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); max-width: 84rem; }
}
main { min-width: 0; container-type: inline-size; }
main:focus { outline: none; }
/* Side columns clear the header, then use the room it leaves while it is hidden. */
.sidebar, .toc, .aside { position: sticky; top: 6rem; max-height: calc(100vh - 7rem); overflow: auto; font-size: var(--step-n1); transition: top 200ms cubic-bezier(0.23, 1, 0.32, 1); }
[data-header="hidden"] .sidebar, [data-header="hidden"] .toc, [data-header="hidden"] .aside { top: var(--space-3); max-height: calc(100vh - var(--space-5)); }
.sidebar ul, .sidebar ol, .toc ul, .aside ul { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.layout-course .sidebar ol { list-style: decimal-leading-zero; padding-left: 2.2em; }
.layout-course .sidebar ol li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar a, .toc a, .aside a { display: block; padding: 0.45rem var(--space-1); color: var(--text); text-decoration: none; border-radius: var(--radius); }
.sidebar a:hover, .toc a:hover, .aside a:hover { background: var(--surface-2); }
.sidebar a[aria-current="page"], .aside a[aria-current="page"] { background: var(--tint-info); color: var(--text); font-weight: 600; }
.aside .toc-3 { padding-left: 1em; }
.side-title { font-family: var(--font-heading); font-size: var(--step-n1); font-weight: 650; color: var(--muted); margin: 0 0 var(--space-1); padding: 0 var(--space-1); }
/* A flex summary loses the browser's marker, so every disclosure draws its own: without one a closed folder reads as an empty heading. */
.sidebar summary, .toc summary, .aside summary, .outline-inline summary { cursor: pointer; display: flex; align-items: center; gap: 0.5em; min-height: 32px; list-style: none; }
.sidebar summary, .toc summary { margin: 0; border-radius: var(--radius); }
.toc summary { min-height: 24px; }
.sidebar summary:hover, .toc summary:hover, .aside summary:hover { background: var(--surface-2); color: var(--text); }
.sidebar summary::-webkit-details-marker, .toc summary::-webkit-details-marker, .aside summary::-webkit-details-marker, .outline-inline summary::-webkit-details-marker { display: none; }
.sidebar summary::before, .toc summary::before, .aside summary::before, .outline-inline summary::before { content: "\25B8"; flex: none; font-family: var(--font-body); font-variant: normal; color: var(--muted); }
.sidebar details[open] > summary::before, .toc details[open] > summary::before, .aside details[open] > summary::before, .outline-inline[open] > summary::before { content: "\25BE"; }
.sidebar details ul { margin: 0 0 var(--space-1); padding-left: 1em; }
.toc details ul { margin: var(--space-1) 0 0; }
@media (pointer: coarse) { .sidebar summary, .toc summary, .aside summary { min-height: 44px; } }
.toc .toc-3 a { padding-left: var(--space-3); }
/* The left menu does the same at the other edge. site.js adds the button; the head script restores the choice before the first paint, so the column never flashes. */
.menu-toggle { display: none; float: right; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; }
.menu-toggle:hover { color: var(--text); background: var(--surface-2); }
.menu-toggle svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .menu-toggle { width: 44px; height: 44px; } }
@media (min-width: 60.01rem) {
  .menu-toggle { display: inline-flex; }
  [data-menu="closed"] :is(.layout-wiki, .layout-docs, .layout-course) .shell { grid-template-columns: minmax(0, 1fr) minmax(10rem, 13rem); padding-left: calc(44px + var(--space-5)); }
  [data-menu="closed"] :is(.layout-wiki, .layout-docs, .layout-course) .shell:not(:has(.toc details[open])) { grid-template-columns: minmax(0, 1fr); }
  /* With a side column gone, the text widens a little and sits in the middle of the space. Wide blocks start with it and may run on to the column's right edge. */
  [data-menu="closed"] :is(.layout-wiki, .layout-docs, .layout-course) .note, :is(.layout-wiki, .layout-docs, .layout-course) .shell:has(.toc details:not([open])) .note { max-width: 48rem; margin-inline: auto; }
  [data-menu="closed"] :is(.layout-wiki, .layout-docs, .layout-course) .content > :is(.table-wrap, .code-block, figure.dv > .table-wrap), :is(.layout-wiki, .layout-docs, .layout-course) .shell:has(.toc details:not([open])) .content > :is(.table-wrap, .code-block, figure.dv > .table-wrap) { max-width: calc(50cqi + 50%); }
  [data-menu="closed"] .sidebar { position: fixed; left: max(var(--space-2), calc((100vw - 84rem) / 2 + var(--space-2))); z-index: 4; max-height: none; overflow: visible; }
  [data-menu="closed"] .sidebar > :not(.menu-toggle) { display: none; }
  [data-menu="closed"] .menu-toggle { float: none; width: 44px; height: 44px; color: var(--text); background: var(--surface); border-color: var(--border); }
}
/* Closed, the outline hands its column to the text and waits as one button at the edge of the page. */
.toc-icon { display: none; flex: none; width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
@media (min-width: 60.01rem) {
  .layout-wiki .shell:has(.toc details:not([open])), .layout-docs .shell:has(.toc details:not([open])), .layout-course .shell:has(.toc details:not([open])) { grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); padding-right: calc(44px + var(--space-5)); }
  .toc:has(details:not([open])) { position: fixed; right: max(var(--space-2), calc((100vw - 84rem) / 2 + var(--space-2))); z-index: 4; max-height: none; overflow: visible; }
  .toc details:not([open]) > summary { justify-content: center; width: 44px; min-height: 44px; margin: 0; padding: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
  .toc details:not([open]) > summary::before { content: none; }
  .toc details:not([open]) .toc-icon { display: block; }
  .toc details:not([open]) .toc-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 60rem) {
  .shell, .layout-wiki .shell, .layout-docs .shell, .layout-course .shell { grid-template-columns: minmax(0, 1fr) !important; padding: var(--space-3) var(--space-2); }
  .sidebar { order: 2; position: static; max-height: none; border-top: 1px solid var(--border); padding-top: var(--space-3); }
  .toc { display: none; }
  .site-header { padding: var(--space-1) var(--space-2); }
}
/* Phones: maps stay reachable from Home and All pages, so the header keeps only the fixed destinations. */
@media (max-width: 40rem) {
  .site-header .top-nav a.nav-map:not([aria-current]) { display: none; }
  /* brand and theme symbol share the first row, destinations get the second */
  .brand { flex: 1 1 auto; }
  .theme-toggle { order: 2; }
  .top-nav { order: 3; flex-basis: 100%; }
}

/* Collapsed outline above the text, shown only where the side outline is hidden or pushed below the text. */
.outline-inline { display: none; margin: var(--space-2) 0 0; font-size: var(--step-n1); }
.outline-inline summary { min-height: 44px; font-weight: 600; }
.outline-inline ul { list-style: none; padding: 0; margin: 0 0 var(--space-1); }
.outline-inline a { display: block; padding: 0.55rem 0; }
.outline-inline .toc-3 a { padding-left: var(--space-3); }
@media (max-width: 60rem) { .outline-inline { display: block; } }
@media (max-width: 1100px) {
  .layout-tufte .outline-inline { display: block; }
  .layout-tufte .aside .outline-block { display: none; }
  .aside { position: static; max-height: none; overflow: visible; border-top: 1px solid var(--border); padding-top: var(--space-3); }
}

/* note */
.note { max-width: var(--measure); }
.layout-landing .note { margin: 0 auto; }
.note-head { margin-bottom: var(--space-4); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: var(--heading-weight); line-height: 1.2; margin: 1.6em 0 0.5em; scroll-margin-top: 6rem; }
/* The header runs to two rows on phones. */
@media (max-width: 40rem) { h1, h2, h3, h4, h5, h6 { scroll-margin-top: 8rem; } }
/* A long unbroken word — a German compound, a URL, a code identifier — must wrap inside its column,
   not push the whole page sideways on a phone. Hyphenation only where the language is known. */
h1, h2, h3, h4, h5, h6, p, li, dd, td, th, figcaption, .callout-title { overflow-wrap: break-word; }
html[lang]:not([lang=""]) h1, html[lang]:not([lang=""]) h2, html[lang]:not([lang=""]) h3 { hyphens: auto; }
.note-head h1 { font-size: var(--step-4); margin: 0 0 var(--space-2); letter-spacing: -0.01em; }
.content h1 { font-size: var(--step-3); }
.content h2 { font-size: var(--step-2); }
.content h3 { font-size: var(--step-1); }
.content h4, .content h5, .content h6 { font-size: 1rem; }
.content > :first-child { margin-top: 0; }
p, ul, ol, dl, pre, figure, .table-wrap, blockquote, .callout { margin: 0 0 var(--space-3); }
ul, ol { padding-left: 1.4em; }
li { margin: 0.2em 0; }
li > ul, li > ol { margin: 0.2em 0; }
li.task { list-style: none; margin-left: -1.4em; }
li.task input { margin-right: 0.4em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }
img, video { max-width: 100%; height: auto; border-radius: var(--radius); }

/* figures: the box is reserved from the intrinsic size, so a lazy image never shifts the text */
figure.img { margin: 0 0 var(--space-4); }
/* Never enlarge: a 48px sketch stays 48px instead of blurring across the column. */
figure.img img { display: block; width: auto; max-width: 100%; height: auto; }
figure.img .credit { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--step-n1); line-height: 1.4; }
figure.img .credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a.remote-image::after { content: " ↗"; font-size: 0.8em; color: var(--muted); }
mark { background: var(--mark); color: var(--text); padding: 0 0.15em; border-radius: 2px; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.88em; }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--code-bg); padding: var(--space-2) var(--space-3); border-radius: var(--radius); overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; }
/* site.js wraps each block, so the copy button stays put while long lines scroll sideways. */
.code-block { position: relative; margin: 0 0 var(--space-3); }
.code-block > pre { margin: 0; }
/* Like tables, a long line may run on into the rest of the column before it has to scroll. */
.content > .code-block { width: max-content; min-width: 100%; max-width: 100cqi; }
.dv-source .code-block { margin-top: var(--space-1); }
.code-copy { position: absolute; top: var(--space-1); right: var(--space-1); display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.code-copy:hover, .code-copy[data-copied] { color: var(--text); }
.code-copy svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .code-copy { width: 44px; height: 44px; } }
blockquote { position: relative; background: var(--surface-2); padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 1.2rem); border-radius: var(--radius); color: var(--text); }
blockquote::before { content: "\201C"; position: absolute; left: var(--space-2); top: 0.1em; font-family: var(--font-heading); font-size: 2.4rem; line-height: 1; color: var(--muted); }
blockquote > :last-child, .callout > :last-child { margin-bottom: 0; }
.math { font-family: var(--font-mono); background: var(--code-bg); padding: 0 0.3em; border-radius: 4px; }
div.math { display: block; padding: var(--space-2); overflow-x: auto; white-space: pre-wrap; }
.tag { display: inline-block; font-size: 0.85em; background: var(--surface-2); color: var(--text); padding: 0 0.45em; border-radius: 999px; }
.link-unpublished { color: var(--muted); text-decoration: underline dotted; text-underline-offset: 0.18em; cursor: help; }
.link-unpublished[role="button"] { cursor: pointer; }
.link-why { display: inline-block; margin: 0 0 0 0.3em;padding: 0 0.45em; font-size: 0.82em; font-style: normal; color: var(--text); background: var(--surface-2); border-radius: var(--radius); }
.link-why::before { content: "\2014\2009"; color: var(--muted); }
a.external::after { content: "\2009\2197"; font-size: 0.8em; }
.footnotes { border-top: 1px solid var(--border); margin-top: var(--space-5); padding-top: var(--space-2); font-size: var(--step-n1); }

/* callouts: tinted backgrounds and a leading dot, never a side rail */
.callout { background: var(--tint-info); padding: var(--space-2) var(--space-3); border-radius: var(--radius); }
.callout[data-kind="ok"] { background: var(--tint-ok); }
.callout[data-kind="warn"] { background: var(--tint-warn); }
.callout[data-kind="bad"] { background: var(--tint-bad); }
.callout[data-kind="plain"] { background: var(--surface-2); }
.callout-title { font-weight: 650; margin: 0 0 var(--space-1); display: flex; align-items: center; gap: 0.5em; }
.callout-title::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--accent); flex: none; }
.callout[data-kind="ok"] .callout-title::before { background: var(--ok); }
.callout[data-kind="warn"] .callout-title::before { background: var(--warn); }
.callout[data-kind="bad"] .callout-title::before { background: var(--bad); }
.callout[data-kind="plain"] .callout-title::before { background: var(--muted); }
details.callout > summary { cursor: pointer; }

/* properties */
.props { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--step-n1); margin: 0; }
.props div { display: flex; gap: 0.4em; align-items: baseline; }
.props dt { color: var(--muted); }
.props dt::after { content: ":"; }
.props dd { margin: 0; }
.props ul.dv-cell { display: inline; padding: 0; }
.props ul.dv-cell li { display: inline; }
.props ul.dv-cell li + li::before { content: ", "; }
.where { color: var(--muted); font-size: var(--step-n1); margin: 0 0 var(--space-1); }

/* tables */
.table-wrap { max-width: 100%; overflow-x: auto; }
/* Prose keeps its measure, but a table may run on into the rest of the column before anything gets cut. */
.content > .table-wrap, .content > figure.dv > .table-wrap { width: max-content; min-width: 100%; max-width: 100cqi; }
table { border-collapse: collapse; width: 100%; table-layout: auto; font-size: 0.94em; }
th, td { min-width: 8rem; text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: normal; word-break: normal; hyphens: none; }
th:first-child, td:first-child { min-width: 3rem; }
th { font-family: var(--font-heading); font-size: var(--step-n1); font-weight: 650; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
/* site.js tries these in turn when a table can't fit even so: tighter columns first, then each row as a stack labelled by its headers, with the sort buttons on top. */
.is-tight th, .is-tight td, .is-tight th:first-child, .is-tight td:first-child { min-width: 0; white-space: normal; }
table.is-stacked, .is-stacked thead, .is-stacked tbody, .is-stacked tbody tr, .is-stacked tbody td { display: block; }
.is-stacked thead tr { display: flex; flex-wrap: wrap; gap: 0 var(--space-2); }
.is-stacked th { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; }
.is-stacked thead { border-bottom: 2px solid var(--border); }
.is-stacked tbody tr { padding: var(--space-1) 0; border-bottom: 1px solid var(--border); }
.is-stacked tbody td, .is-stacked tbody td:first-child { min-width: 0; padding: 0.15rem 0; border: 0; text-align: left; overflow-wrap: anywhere; }
.is-stacked tbody td:empty { display: none; }
.is-stacked tbody td::before { content: attr(data-label); display: block; color: var(--muted); font-size: var(--step-n1); }
th button { all: unset; cursor: pointer; display: inline-flex; gap: 0.35em; align-items: center; min-height: 32px; }
th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
th button .dir { font-size: 0.8em; color: var(--muted); }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin-bottom: var(--space-1); font-size: var(--step-n1); color: var(--muted); }
.table-tools input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem 0.6rem; min-height: 40px; min-width: 14rem; }
tr.flash td { animation: flash 300ms ease-out; }
@media (pointer: coarse) { .graph-key, .graph-reset, .graph-open, .graph-find input, .graph-neighbours button { min-height: 44px; } .graph-zoom button { min-height: 44px; min-width: 44px; } .brand { display: inline-flex; align-items: center; min-height: 44px; } }
@keyframes flash { from { background: var(--tint-info); } to { background: transparent; } }
ul.dv-cell { margin: 0; padding-left: 1em; }

/* dataview */
figure.dv { margin: 0 0 var(--space-4); }
.dv-source { font-size: var(--step-n1); color: var(--muted); margin-top: var(--space-1); }
.dv-source summary { cursor: pointer; }
.dv-source pre { margin-top: var(--space-1); }
.dv-note, .dv-empty { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); margin: 0 0 var(--space-3); font-size: var(--step-n1); }
.dv-note p, .dv-empty p { margin: 0 0 var(--space-1); }
.dv-note > :last-child, .dv-empty > :last-child { margin-bottom: 0; }
.dv-null { color: var(--muted); }
code.dv-inline { color: var(--muted); }

/* embeds, backlinks, pager, indexes */
.embed { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); margin: 0 0 var(--space-3); box-shadow: var(--shadow); }
.embed-source { font-size: var(--step-n1); color: var(--muted); margin: 0 0 var(--space-1); }
.backlinks { margin-top: var(--space-5); padding-top: var(--space-2); border-top: 1px solid var(--border); font-size: var(--step-n1); }
.backlinks h2 { font-size: var(--step-1); margin: 0 0 var(--space-1); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: var(--space-5); }
.pager-position { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: var(--step-n1); }
.pager a { display: block; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font-size: var(--step-n1); color: var(--muted); }
.pager .next { grid-column: 2; text-align: right; }
.section-index { margin: 0 0 var(--space-4); }
.section-index ul { list-style: none; padding: 0; }
.section-index li { padding: var(--space-1) 0; border-bottom: 1px solid var(--border); }
.section-index .excerpt { display: block; color: var(--muted); font-size: var(--step-n1); }
.landing-index { margin-top: var(--space-5); }
.landing-index h2 { font-size: var(--step-2); }

/* index blocks: a head with a count, then a grid of cards rather than an undifferentiated list */
.index-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-3); padding-bottom: var(--space-1); border-bottom: 1px solid var(--border); }
.index-head h2 { margin: 0; }
.index-count { margin: 0; color: var(--muted); font-size: var(--step-n1); font-variant-numeric: tabular-nums; }
.section-index.is-cards ul.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--space-2); }
.section-index.is-cards li.card {
  display: flex; flex-direction: column; gap: 0.35em; padding: var(--space-2) var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.section-index.is-cards li.card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.section-index.is-cards li.card > a { font-family: var(--font-heading); font-size: var(--step-1); font-weight: var(--heading-weight); text-decoration: none; line-height: 1.25; }
.section-index.is-cards li.card > a:hover { text-decoration: underline; }
.card-meta { color: var(--muted); font-size: var(--step-n1); font-variant-numeric: tabular-nums; }
.section-index.is-cards .excerpt { margin-top: 0.15em; }
@media (prefers-reduced-motion: reduce) { .section-index.is-cards li.card:hover { transform: none; } }

/* search */
.search label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.search input { width: 100%; font: inherit; font-size: var(--step-1); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.8rem; min-height: 48px; }
#search-status { color: var(--muted); font-size: var(--step-n1); }
#search-results { padding-left: 1.2em; }
#search-results li { margin-bottom: var(--space-2); }
#search-results .hit-folder { color: var(--muted); font-size: var(--step-n1); }
#search-results p { margin: 0.2em 0 0; font-size: var(--step-n1); }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: var(--step-n1); padding: var(--space-3) var(--space-4); margin-top: var(--space-5); }
.site-footer p { max-width: 84rem; margin: 0 auto; }

/* network graph: canvas + controls, drawn from theme tokens only */
.note.graph-page { max-width: none; } /* a drawing and a table, not a reading column */
.layout-landing .shell:has(.graph-page) { max-width: 84rem; }
.graph-intro { color: var(--muted); font-size: var(--step-n1); margin: 0 0 var(--space-2); }
.graph-filters { display: grid; gap: var(--space-1); margin: 0 0 var(--space-1); }
.graph-find { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.graph-find input { font: inherit; font-size: var(--step-n1); flex: 1 1 14rem; min-width: 0; max-width: 24rem; min-height: 36px; padding: 0 var(--space-2); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.graph-legend { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.graph-key, .graph-reset, .graph-zoom button, .graph-open, .graph-neighbours button {
  font: inherit; font-size: var(--step-n1); display: inline-flex; align-items: center; gap: 0.45em;
  min-height: 36px; padding: 0 var(--space-2); cursor: pointer; text-decoration: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
}
.graph-reset:disabled { color: var(--muted); cursor: not-allowed; border-style: dashed; }
.graph-reset[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.graph-key[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.graph-key[aria-pressed="false"] .dot { opacity: 0.35; }
.graph-key:hover, .graph-reset:hover:not(:disabled), .graph-zoom button:hover, .graph-open:hover, .graph-neighbours button:hover { border-color: var(--accent); }
.graph-key-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.graph-c0 { --type: var(--graph-node); } .graph-c1 { --type: var(--graph-c1); } .graph-c2 { --type: var(--graph-c2); } .graph-c3 { --type: var(--graph-c3); } .graph-c4 { --type: var(--graph-c4); }
.graph-c5 { --type: var(--graph-c5); } .graph-c6 { --type: var(--graph-c6); } .graph-c7 { --type: var(--graph-c7); } .graph-c8 { --type: var(--graph-c8); }
.graph-page .dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; background: var(--type, var(--graph-node)); flex: none; }
.graph-page .dot.shape-square { border-radius: 1px; }
.graph-page .dot.shape-diamond { border-radius: 1px; transform: rotate(45deg) scale(0.86); }
.graph-status { font-size: var(--step-n1); color: var(--muted); margin: 0 0 var(--space-1); font-variant-numeric: tabular-nums; }
.graph-panes { display: grid; gap: var(--space-3); align-items: start; }
.graph-main, .graph-side, .graph-list { min-width: 0; }
.graph-wrap { position: relative; border: 1px solid var(--border); border-radius: var(--radius); background: var(--graph-bg); margin: 0 0 var(--space-2); overflow: hidden; }
.graph-wrap canvas { display: block; width: 100%; height: var(--graph-h); touch-action: none; cursor: grab; }
.graph-wrap canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.graph-zoom { position: absolute; right: var(--space-1); bottom: var(--space-1); display: flex; gap: 4px; }
.graph-zoom button { padding: 0; min-width: 36px; justify-content: center; }
.graph-detail { font-size: var(--step-n1); margin: 0 0 var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); }
.graph-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.graph-detail-head strong { font-size: 1rem; }
.graph-detail-meta, .graph-detail-hint { color: var(--muted); margin: 0; }
.graph-neighbours { list-style: none; margin: var(--space-1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; max-height: 7.5rem; overflow-y: auto; }
.graph-neighbours li { margin: 0; max-width: 100%; }
.graph-neighbours button { max-width: 100%; min-height: 32px; padding: 0 var(--space-1); }
.graph-neighbours button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graph-note { font-size: var(--step-n1); color: var(--muted); }
.content .graph-list h2 { margin: 0 0 var(--space-1); font-size: 1rem; }
.graph-list .table-wrap { margin-bottom: var(--space-1); }
.graph-list th, .graph-list td { min-width: 0; padding: 0.4rem 0.5rem; }
.graph-list td:nth-child(2) { white-space: nowrap; }
.graph-list td .dot { margin-right: 0.4em; }
.graph-list tbody tr { cursor: pointer; }
.graph-list tbody tr.is-hot { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.graph-list tbody tr.is-selected { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.graph-empty { color: var(--muted); font-size: var(--step-n1); }
@container (min-width: 720px) { /* pixels: themes change the root font size */
  .graph-panes { grid-template-columns: minmax(0, 1fr) minmax(16rem, 33%); }
  .graph-side { display: flex; flex-direction: column; height: var(--graph-h); }
  .graph-list { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .graph-list .table-wrap { flex: 1; min-height: 0; overflow-y: auto; }
  .graph-neighbours { max-height: 4.6rem; }
  .graph-list th { font-size: 0.8em; }
  /* The title needs this width. The legend names each dot, so the word goes, for sight only; without JS there is no legend and it stays. */
  [data-graph-filters]:not([hidden]) ~ .graph-panes .graph-list td:nth-child(2) { font-size: 0; }
  [data-graph-filters]:not([hidden]) ~ .graph-panes .graph-list td .dot { display: block; font-size: 1rem; margin: 0.4em auto 0; }
  .graph-detail { margin-bottom: var(--space-1); padding-bottom: var(--space-1); }
  .content .graph-list table { margin: 0; border-collapse: separate; border-spacing: 0; } /* collapsed borders let rows show through a sticky header */
  .graph-list thead th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
  .graph-list:has([data-graph-empty]:not([hidden])) .table-wrap { flex: none; }
  .graph-list th:nth-child(3), .graph-list td:nth-child(3) { display: none; }
}
@media (max-width: 40rem) {
  .graph-page { --graph-h: clamp(260px, 52vh, 480px); }
  .graph-legend { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .graph-legend button { flex: none; white-space: nowrap; }
}

/* motion: only where it says something. Easing is ease-out throughout: fast at the start, so a click feels answered at once. */
/* Disclosures. data-motion arrives after the first frame, so an outline restored as closed doesn't animate on every page load.
   Browsers without ::details-content or size interpolation keep the plain snap. */
:root { interpolate-size: allow-keywords; }
[data-motion] .sidebar details::details-content, [data-motion] .aside details::details-content, [data-motion] .outline-inline::details-content {
  block-size: 0; opacity: 0; overflow: clip;
  transition: block-size 180ms cubic-bezier(0.23, 1, 0.32, 1), opacity 180ms cubic-bezier(0.23, 1, 0.32, 1), content-visibility 180ms allow-discrete;
}
[data-motion] .sidebar details[open]::details-content, [data-motion] .aside details[open]::details-content, [data-motion] .outline-inline[open]::details-content { block-size: auto; opacity: 1; }
/* Landing on a heading or footnote: a brief tint shows where the jump ended. */
.content :target { animation: flash 300ms ease-out; }
/* The reason behind an unpublished link fades in rather than pushing into the line. */
.link-why { transition: opacity 150ms cubic-bezier(0.23, 1, 0.32, 1); }
@starting-style { .link-why { opacity: 0; } }
/* Press feedback on the controls that change something in place or leave the page. */
@media (prefers-reduced-motion: no-preference) {
  .theme-toggle, .pager a, .graph-key, .graph-reset, .code-copy, .menu-toggle { transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
  .theme-toggle:active, .pager a:active, .graph-key:active, .graph-reset:active, .code-copy:active, .menu-toggle:active { transform: scale(0.97); }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* Kept apart: `*` doesn't reach this pseudo-element, and a browser that doesn't know it would drop a whole shared rule. */
@media (prefers-reduced-motion: reduce) { ::details-content { transition: none !important; } }
@media print { .site-header, .sidebar, .toc, .aside, .pager, .theme-toggle, .table-tools, .skip, .code-copy { display: none !important; } .shell { display: block; } }
