/* Tokens */
:root {
  color-scheme: light;
  --page: #f8fafc;
  --surface: #f0f3f7;
  --surface-strong: #e3e9f1;
  --text: #202733;
  --muted: #526174;
  --line: #d8e0ea;
  --accent: var(--configured-accent, #2856c5);
  --accent-strong: color-mix(in srgb, var(--accent) 88%, #15213a);
  --code: #edf1f6;
  --focus: #2856c5;
  --shadow-panel: 0 12px 32px rgb(31 48 76 / 12%);
  --header-height: 3.5rem;
  --explorer-width: 14rem;
  --context-width: 14rem;
  --reading-width: 46rem;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --page: #161a22;
  --surface: #1e2430;
  --surface-strong: #293345;
  --text: #e8edf5;
  --muted: #a8b3c5;
  --line: #354052;
  --accent: color-mix(in srgb, var(--configured-accent, #2856c5) 45%, #8bacff);
  --accent-strong: color-mix(in srgb, var(--configured-accent, #2856c5) 34%, #b8cbff);
  --code: #1c2330;
  --focus: #a9c0ff;
  --shadow-panel: 0 12px 32px rgb(0 0 0 / 34%);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --page: #161a22;
    --surface: #1e2430;
    --surface-strong: #293345;
    --text: #e8edf5;
    --muted: #a8b3c5;
    --line: #354052;
    --accent: color-mix(in srgb, var(--configured-accent, #2856c5) 45%, #8bacff);
    --accent-strong: color-mix(in srgb, var(--configured-accent, #2856c5) 34%, #b8cbff);
    --code: #1c2330;
    --focus: #a9c0ff;
    --shadow-panel: 0 12px 32px rgb(0 0 0 / 34%);
  }
}

/* Reset and base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 1.25rem); }
body { margin: 0; min-width: 20rem; background: var(--page); color: var(--text); font-size: .95rem; line-height: 1.6; --reading-scale: 1; }
a { color: var(--accent-strong); text-decoration-thickness: .07em; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, summary:focus-visible, pre:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button { color: inherit; font: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; top: .5rem; left: .5rem; padding: .5rem .75rem; transform: translateY(-150%); background: var(--text); color: var(--page); }
.skip-link:focus { transform: none; }

/* Top bar */
.topbar { position: sticky; z-index: 5; top: 0; display: flex; height: var(--header-height); align-items: center; gap: 1.1rem; padding: 0 clamp(1rem, 2.6vw, 2.25rem); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--page) 94%, transparent); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-size: .96rem; font-weight: 720; letter-spacing: -.03em; text-decoration: none; }
.brand::before { width: .72rem; height: .72rem; border-radius: 2px 6px 2px 6px; background: var(--accent); content: ""; }
.topbar-spacer { flex: 1; }
.icon-button { display: inline-grid; width: 2.15rem; height: 2.15rem; place-items: center; padding: 0; border: 1px solid transparent; border-radius: .25rem; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: var(--surface); color: var(--text); }
.menu-toggle { display: none; }
.theme-toggle { display: none; border-color: var(--line); border-radius: .4rem; color: var(--text); font-size: 1rem; }
.js .theme-toggle { display: inline-grid; }
.mobile-site-links, .mobile-standalone-links { display: none; }
.js-only { display: none; }
.site-links { display: flex; align-items: center; gap: .25rem; margin-left: .35rem; font-size: .82rem; }
.site-links a { padding: .38rem .65rem; border-radius: .35rem; color: var(--muted); text-decoration: none; transition: background-color .12s ease, color .12s ease; }
.site-links a:hover, .site-links a:focus-visible { background: var(--surface); color: var(--text); }
.site-links a[aria-current="page"], .mobile-standalone-links a[aria-current="page"] { background: var(--surface-strong); color: var(--accent-strong); font-weight: 650; }
.search-open { display: none; align-items: center; gap: .55rem; justify-content: flex-start; min-width: 8.5rem; min-height: 2.15rem; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); color: var(--muted); cursor: pointer; font-size: .82rem; }
.js .search-open { display: inline-flex; }
.search-open:hover { color: var(--text); border-color: var(--accent); }
.search-open kbd { margin-left: auto; padding: .05rem .25rem; border: 1px solid var(--line); border-radius: .2rem; background: var(--page); color: var(--muted); font-size: .68rem; }

/* Reading preferences popover */
.reading-menu { position: relative; display: none; }
.js .reading-menu { display: block; }
.reading-menu > summary { list-style: none; cursor: pointer; }
.reading-menu > summary::-webkit-details-marker { display: none; }
.reading-menu > summary::marker { content: ""; }
.reading-menu[open] > summary { border-color: var(--line); background: var(--surface); color: var(--text); }
.reading-menu .reading-tools { position: absolute; z-index: 7; top: calc(100% + .5rem); right: 0; width: 14rem; max-width: min(16rem, calc(100vw - 1rem)); margin: 0; padding: .45rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--page); box-shadow: var(--shadow-panel); }
.reading-size-row { display: flex; align-items: center; justify-content: space-between; padding: .2rem .35rem .45rem; color: var(--muted); font-size: .76rem; }
.reading-size-buttons { display: flex; gap: .3rem; }
.reading-size-buttons button, .graph-toolbar button { min-width: 2.15rem; min-height: 2rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--muted); cursor: pointer; font-size: .76rem; }
.reading-options { display: grid; gap: .05rem; padding-top: .3rem; border-top: 1px solid var(--line); }
.reading-menu .reading-options button { width: 100%; min-height: 2.2rem; padding: .4rem .5rem; border: 1px solid transparent; border-radius: .3rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .79rem; text-align: left; }
.reading-menu .reading-options button:hover { border-color: var(--line); background: var(--surface); color: var(--text); }
.reading-options button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent-strong); }
.graph-toolbar button:hover, .reading-size-buttons button:hover { color: var(--text); border-color: var(--accent); }
.reading-tools button:focus-visible, .graph-toolbar button:focus-visible, .copy-code:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Reading progress */
.reading-progress { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; overflow: hidden; pointer-events: none; }
.reading-progress-bar { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left center; background: var(--accent); transition: transform .1s linear; }

/* Page grid */
.page-grid { display: grid; grid-template-columns: var(--explorer-width) minmax(0, 1fr) var(--context-width); min-height: calc(100vh - var(--header-height)); }
.page-grid.no-context-layout { grid-template-columns: var(--explorer-width) minmax(0, 1fr); }
.explorer, .context-panel { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); overflow: auto; overscroll-behavior: contain; }

/* Explorer */
.explorer { padding: 1.35rem .85rem 2rem; border-right: 1px solid var(--line); background: var(--surface); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 .45rem .8rem; color: var(--text); font-size: .77rem; font-weight: 650; letter-spacing: .035em; text-transform: uppercase; }
.quiet { color: var(--muted); font-size: .73rem; font-weight: 450; letter-spacing: 0; text-transform: none; }
.file-tree { font-size: .82rem; }
.tree-list { margin: 0; padding: 0 0 0 .7rem; list-style: none; }
.file-tree > .tree-list { padding-left: 0; }
.tree-list li { margin-block: .06rem; }
.tree-list details > .tree-list { margin-left: .5rem; border-left: 1px solid var(--line); }
.tree-list summary { display: flex; align-items: center; gap: .35rem; overflow: hidden; min-height: 2.15rem; padding: .2rem .45rem; border-radius: .3rem; color: var(--muted); cursor: pointer; list-style: none; white-space: nowrap; }
.tree-list summary::-webkit-details-marker { display: none; }
.tree-list summary::before { content: ""; flex: 0 0 .9rem; width: .9rem; height: .9rem; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform .12s ease; }
.tree-list details[open] > summary::before { transform: rotate(90deg); }
.tree-list summary:hover { background: var(--surface-strong); color: var(--text); }
.folder-name { overflow: hidden; text-overflow: ellipsis; }
.tree-count { margin-left: auto; padding-left: .35rem; color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; }
.note-link { display: flex; align-items: center; overflow: hidden; min-height: 2.15rem; padding: .2rem .45rem .2rem 1.7rem; border-radius: .3rem; color: var(--muted); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.note-link:hover { background: var(--surface-strong); color: var(--text); }
.note-link.active { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent-strong); font-weight: 650; }
.note-link.active:hover { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); }
.empty { padding: .25rem .45rem; }
.browse-link { display: inline-flex; margin: 1rem .45rem 0; color: var(--muted); font-size: .79rem; text-decoration: none; }
.browse-link:hover { color: var(--accent-strong); }
.explorer-collapse { display: inline-grid; width: 2.15rem; height: 2.15rem; place-items: center; padding: 0; border: 1px solid transparent; border-radius: .3rem; background: transparent; color: var(--muted); cursor: pointer; }
.explorer-collapse:hover { border-color: var(--line); background: var(--surface-strong); color: var(--text); }
body.explorer-collapsed { --explorer-width: 3.3rem; }
body.explorer-collapsed .explorer { padding-inline: .65rem; }
body.explorer-collapsed .panel-heading { justify-content: center; padding-inline: 0; }
body.explorer-collapsed .panel-heading > span, body.explorer-collapsed .file-tree, body.explorer-collapsed .browse-link, body.explorer-collapsed .mobile-site-links { display: none; }
body.explorer-collapsed .explorer-collapse { rotate: 180deg; }

/* Article shell */
.article-column { min-width: 0; padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 4.5rem) 5rem; }
article { width: min(100%, var(--reading-width)); margin: 0 auto; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: 1.2rem; color: var(--muted); font-size: .77rem; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-strong); text-decoration: underline; }
.article-header { margin-bottom: 1.8rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
h1, h2, h3, h4, h5, h6 { color: var(--text); font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif; font-weight: 570; letter-spacing: -.025em; line-height: 1.22; }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.65rem); }
.description { max-width: 62ch; margin: .8rem 0 0; color: var(--muted); font-size: 1.04rem; line-height: 1.55; }
.metadata { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; row-gap: .4rem; column-gap: .6rem; margin-top: 1rem; color: var(--muted); font-size: .78rem; }
.meta-times, .meta-created { white-space: nowrap; }
.metadata-tags { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; max-width: 100%; }
.tag { max-width: 100%; overflow: hidden; padding: .13rem .42rem; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: color-mix(in srgb, var(--accent-strong) 85%, var(--text)); font-size: .73rem; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.tag:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-strong); }
.home-notes { margin-top: 2.2rem; }
.home-notes h2 { font-size: 1.3rem; }
.home-notes ul { padding-left: 1.2rem; }
.home-notes li { margin: .3rem 0; }

/* Prose */
.prose { overflow-wrap: anywhere; font-size: calc(1.0625rem * var(--reading-scale)); line-height: 1.7; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 2.8rem 0 .85rem; font-size: 1.65rem; }
.prose h3 { margin: 2.1rem 0 .65rem; font-size: 1.3rem; }
.prose h4 { margin: 1.7rem 0 .55rem; font-size: 1.14rem; font-weight: 600; }
.prose h5 { margin: 1.7rem 0 .55rem; font-size: 1.02rem; font-weight: 650; letter-spacing: -.01em; }
.prose h6 { margin: 1.7rem 0 .55rem; color: var(--muted); font-family: inherit; font-size: .9rem; font-weight: 700; letter-spacing: .015em; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { position: relative; scroll-margin-top: calc(var(--header-height) + 1rem); }
.heading-anchor { margin-left: .4rem; color: var(--muted); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity .12s ease; }
.prose :is(h1, h2, h3, h4, h5, h6):hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.prose p { margin: 1rem 0; }
.prose ul, .prose ol { padding-left: 1.45rem; }
.prose li { padding-left: .14rem; margin: .25rem 0; }
.prose li > ul, .prose li > ol { margin: .2rem 0; }
.prose blockquote { margin: 1.4rem 0; padding: .1rem 0 .1rem 1rem; border-left: 2px solid var(--accent); color: var(--muted); }
.prose blockquote p { margin: .45rem 0; }
.prose hr { height: 1px; margin: 2rem 0; border: 0; background: var(--line); }
.prose img, .prose video { max-width: 100%; height: auto; }
.prose a.external-link::after { display: inline-block; width: .62em; height: .62em; margin-left: .2em; background: currentColor; opacity: .5; vertical-align: -.02em; content: ""; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 11 11 5M6 5h5v5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 11 11 5M6 5h5v5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.prose :not(pre) > code { padding: .12rem .28rem; border: 1px solid var(--line); border-radius: .2rem; background: var(--code); font-size: .84em; }
.prose pre { max-width: 100%; overflow: auto; margin: 1.35rem 0; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .45rem; background: var(--code); font-size: .84rem; line-height: 1.62; tab-size: 2; }
.prose pre code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.prose details { margin: 1rem 0; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .25rem; }
.prose details summary { cursor: pointer; font-weight: 600; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; border-radius: .45rem; font-size: .88rem; }
.prose th, .prose td { min-width: 7rem; padding: .52rem .7rem; border: 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); font-weight: 650; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.prose pre.mermaid { border-radius: .45rem; }

/* Callouts */
.callout { --callout-color: var(--accent); margin: 1.2rem 0; padding: .8rem 1rem; border-left: 3px solid var(--callout-color); border-radius: 0 .35rem .35rem 0; background: color-mix(in srgb, var(--callout-color) 8%, var(--surface)); }
.prose details.callout { padding: .8rem 1rem; border: 0; border-left: 3px solid var(--callout-color); background: color-mix(in srgb, var(--callout-color) 8%, var(--surface)); }
.callout-title { margin-bottom: .3rem; color: color-mix(in srgb, var(--callout-color) 78%, var(--text)); font-weight: 650; }
.callout > summary { color: color-mix(in srgb, var(--callout-color) 78%, var(--text)); list-style: none; }
.callout > summary::-webkit-details-marker { display: none; }
.callout > summary::marker { content: ""; }
.callout-title::before, .callout > summary::before { display: inline-block; width: .5rem; height: .5rem; margin-right: .5rem; border-radius: 50%; background: var(--callout-color); vertical-align: baseline; content: ""; }
.callout[data-callout="note"] { --callout-color: #4c6ef5; }
.callout[data-callout="abstract"], .callout[data-callout="summary"] { --callout-color: #0c8599; }
.callout[data-callout="info"], .callout[data-callout="todo"] { --callout-color: #1971c2; }
.callout[data-callout="tip"], .callout[data-callout="success"], .callout[data-callout="check"] { --callout-color: #2f9e44; }
.callout[data-callout="warning"], .callout[data-callout="caution"] { --callout-color: #e8590c; }
.callout[data-callout="danger"], .callout[data-callout="error"], .callout[data-callout="failure"], .callout[data-callout="bug"] { --callout-color: #c92a2a; }
.callout[data-callout="question"], .callout[data-callout="help"] { --callout-color: #7048e8; }
.callout[data-callout="example"] { --callout-color: #6741d9; }
.callout[data-callout="quote"], .callout[data-callout="cite"] { --callout-color: #6c757d; }

/* Highlighted code */
.chroma { overflow-x: auto; tab-size: 2; }
.chroma .ln { padding-right: 1rem; color: var(--muted); user-select: none; }
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn { color: #86519a; }
.chroma .kt, .chroma .nb, .chroma .bp, .chroma .o { color: #985b25; }
.chroma .m, .chroma .mi, .chroma .mf, .chroma .mb { color: #9a542a; }
.chroma .nc, .chroma .nn, .chroma .nt { color: #32677a; }
.chroma .err { color: #b42318; text-decoration: underline wavy; }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb { color: #2856c5; }
.chroma .c, .chroma .c1, .chroma .cm { color: var(--muted); font-style: italic; }
.chroma .nf, .chroma .na { color: #32677a; }
html[data-theme="dark"] .chroma .k, html[data-theme="dark"] .chroma .kc, html[data-theme="dark"] .chroma .kd, html[data-theme="dark"] .chroma .kn { color: #d0a8e3; }
html[data-theme="dark"] .chroma .s, html[data-theme="dark"] .chroma .s1, html[data-theme="dark"] .chroma .s2, html[data-theme="dark"] .chroma .sb { color: #a9c0ff; }
html[data-theme="dark"] .chroma .nf, html[data-theme="dark"] .chroma .na { color: #9acbdb; }
html[data-theme="dark"] .chroma .kt, html[data-theme="dark"] .chroma .nb, html[data-theme="dark"] .chroma .bp, html[data-theme="dark"] .chroma .o, html[data-theme="dark"] .chroma .m, html[data-theme="dark"] .chroma .mi, html[data-theme="dark"] .chroma .mf, html[data-theme="dark"] .chroma .mb { color: #e6b578; }
html[data-theme="dark"] .chroma .nc, html[data-theme="dark"] .chroma .nn, html[data-theme="dark"] .chroma .nt { color: #9acbdb; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .chroma .k, html[data-theme="system"] .chroma .kc, html[data-theme="system"] .chroma .kd, html[data-theme="system"] .chroma .kn { color: #d0a8e3; }
  html[data-theme="system"] .chroma .s, html[data-theme="system"] .chroma .s1, html[data-theme="system"] .chroma .s2, html[data-theme="system"] .chroma .sb { color: #a9c0ff; }
  html[data-theme="system"] .chroma .nf, html[data-theme="system"] .chroma .na { color: #9acbdb; }
  html[data-theme="system"] .chroma .kt, html[data-theme="system"] .chroma .nb, html[data-theme="system"] .chroma .bp, html[data-theme="system"] .chroma .o, html[data-theme="system"] .chroma .m, html[data-theme="system"] .chroma .mi, html[data-theme="system"] .chroma .mf, html[data-theme="system"] .chroma .mb { color: #e6b578; }
  html[data-theme="system"] .chroma .nc, html[data-theme="system"] .chroma .nn, html[data-theme="system"] .chroma .nt { color: #9acbdb; }
}
.code-wrap { margin: 1.35rem 0; }
.code-wrap pre { margin: 0; }
.code-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; padding: .2rem .3rem .2rem .65rem; border: 1px solid var(--line); border-bottom: 0; border-radius: .45rem .45rem 0 0; background: color-mix(in srgb, var(--surface) 62%, var(--code)); }
.code-toolbar + pre { border-top-left-radius: 0; border-top-right-radius: 0; }
.code-wrap .chroma { padding: .65rem 1rem .9rem; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 .45rem .45rem; background: var(--code); color: var(--text); font-size: .82rem; line-height: 1.5; }
.code-wrap .chroma code { display: block; white-space: pre; }
.code-language { display: block; margin-right: auto; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .7rem; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.copy-code { min-width: 2.9rem; min-height: 1.75rem; padding: .1rem .4rem; border: 1px solid transparent; border-radius: .35rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .76rem; opacity: .75; transition: opacity .15s ease, background .15s ease, border-color .15s ease; }
.copy-code:hover, .code-wrap:focus-within .copy-code { color: var(--text); border-color: var(--line); background: var(--surface-strong); opacity: 1; }
.wrap-code .prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Context panel */
.context-panel { padding: 1.7rem clamp(.9rem, 1.5vw, 1.5rem) 2rem; background: color-mix(in srgb, var(--surface) 55%, var(--page)); }
.context-section { margin-bottom: 1.8rem; }
.context-section h2 { margin: 0 0 .7rem; color: var(--muted); font-family: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.toc { display: grid; gap: .18rem; border-left: 1px solid var(--line); }
.toc a { padding: .18rem .6rem; color: var(--muted); font-size: .78rem; line-height: 1.45; text-decoration: none; }
.toc a:hover { color: var(--accent-strong); }
.toc a[aria-current="location"] { margin-left: -1px; border-left: 2px solid var(--accent); color: var(--accent-strong); font-weight: 650; }
.toc .level-3 { padding-left: 1.05rem; }
.toc .level-4, .toc .level-5, .toc .level-6 { padding-left: 1.5rem; }
.toc-deeper { margin-top: .2rem; }
.toc-deeper > summary { padding: .2rem .6rem; color: var(--muted); cursor: pointer; font-size: .74rem; list-style-position: inside; }
.toc-deeper[open] > summary { color: var(--accent-strong); }
.toc-deeper > a { display: block; padding: .12rem .6rem .12rem 1.5rem; color: var(--muted); font-size: .76rem; line-height: 1.45; text-decoration: none; }
.toc-deeper > a:hover { color: var(--accent-strong); }
.backlinks ul { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.backlinks a { color: var(--muted); font-size: .8rem; text-decoration: none; }
.backlinks a:hover { color: var(--accent-strong); text-decoration: underline; }
.backlinks li, .related-notes li { display: grid; gap: .15rem; }
.backlinks small { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.related-notes ul, .local-graph-fallback { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.related-notes a, .local-graph-fallback a { color: var(--muted); font-size: .8rem; text-decoration: none; }
.related-notes a:hover, .local-graph-fallback a:hover { color: var(--accent-strong); text-decoration: underline; }
.mobile-toc { display: none; }
.mobile-context { display: none; margin-top: 2rem; padding: .7rem .8rem; border: 1px solid var(--line); }
.mobile-context summary { color: var(--accent-strong); cursor: pointer; font-size: .82rem; font-weight: 620; }
.mobile-context h2 { font-family: inherit; font-size: .78rem; }
.mobile-context ul { padding-left: 1.1rem; font-size: .82rem; }
.mobile-context small { display: block; color: var(--muted); font-size: .72rem; }

/* Previous / next */
.previous-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.previous-next a { display: grid; gap: .22rem; min-width: 0; color: var(--text); text-decoration: none; }
.previous-next a span { color: var(--muted); font-size: .72rem; }
.previous-next strong { overflow: hidden; text-overflow: ellipsis; }
.next-note { text-align: right; }

/* Browse and tag rows */
.directory-page { min-width: 0; grid-column: 2 / -1; }
.directory-page article { width: min(100%, 58rem); }
.directory-page .article-header { margin-bottom: 1rem; padding-bottom: .8rem; }
.directory-page .archive-list > p { max-width: 68ch; color: var(--muted); }
.archive-list > ul { display: grid; gap: 0; margin: 1rem 0 1.5rem; padding: 0; list-style: none; }
.archive-list > ul > li { display: grid; gap: .15rem; padding: .85rem .35rem; border-bottom: 1px solid var(--line); }
.archive-list > ul > li:hover { background: color-mix(in srgb, var(--surface) 58%, transparent); }
.archive-list > ul > li > a { font-weight: 570; text-decoration: none; }
.archive-list > ul > li > a:hover { text-decoration: underline; }
.archive-list > ul > li > span { color: var(--muted); font-size: .76rem; }
.archive-items { grid-template-columns: minmax(0, 1fr); }
.archive-title { overflow-wrap: anywhere; }
.archive-summary { display: -webkit-box; overflow: hidden; margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.archive-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; margin: .1rem 0 0; color: var(--muted); font-size: .74rem; }
.archive-folder { overflow-wrap: anywhere; }
.archive-tag { padding: .05rem .4rem; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--accent) 8%, transparent); color: color-mix(in srgb, var(--accent-strong) 85%, var(--text)); text-decoration: none; }
.archive-tag:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-strong); }
.archive-list > ul.tag-index { margin-top: 1rem; }
.archive-list > ul.tag-index > li { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.archive-list > ul.tag-index > li > a { font-weight: 600; }
.archive-list > ul.tag-index > li > span { flex: 0 0 auto; overflow-wrap: anywhere; }
.archive-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: .8rem; margin: 1.3rem 0 .5rem; }
.archive-controls.tag-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.archive-controls label { display: grid; min-width: 0; gap: .25rem; color: var(--muted); font-size: .76rem; }
.archive-controls input, .archive-controls select { width: 100%; min-height: 2.35rem; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--text); font: inherit; }
.archive-count { margin: 0; color: var(--muted); font-size: .77rem; }
.archive-count:empty { display: none; }
.empty-state { margin: 1.5rem 0; padding: 1rem 0; border-top: 1px solid var(--line); color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; margin-top: 1.6rem; padding-top: .85rem; border-top: 1px solid var(--line); font-size: .82rem; }
.pagination span { color: var(--muted); }

/* Graph */
.graph-workspace { grid-column: 1 / -1; min-width: 0; padding: 1.5rem clamp(1rem, 2.5vw, 2.5rem) 3rem; }
.graph-workspace article { width: 100%; max-width: none; }
.graph-workspace .article-header { margin-bottom: 1rem; padding-bottom: .75rem; }
.graph-workspace .graph-page { width: 100%; }
.graph-page { margin-top: 0; }
.graph-toolbar { display: none; flex-wrap: wrap; align-items: end; gap: .55rem; margin-bottom: .8rem; }
.js .graph-toolbar { display: flex; }
.graph-toolbar label { display: grid; gap: .2rem; color: var(--muted); font-size: .72rem; }
.graph-toolbar input, .graph-toolbar select { min-width: 8rem; max-width: 13rem; min-height: 2rem; padding: .25rem .4rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--page); color: var(--text); font: inherit; }
.graph-stage { position: relative; min-height: clamp(28rem, 65vh, 52rem); border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); }
.graph-canvas { display: none; width: 100%; height: clamp(28rem, 65vh, 52rem); touch-action: none; cursor: grab; }
.graph-canvas:active { cursor: grabbing; }
.js .graph-canvas { display: block; }
.graph-status { margin: .5rem 0; color: var(--muted); font-size: .76rem; }
.graph-stage .graph-status { position: absolute; right: .55rem; bottom: .35rem; padding: .15rem .35rem; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.graph-selection { min-height: 1.3em; margin: .5rem 0; color: var(--muted); font-size: .8rem; }
.graph-selection:empty { display: none; }
.graph-open-link { display: inline-block; margin: .15rem 0 .6rem; font-size: .78rem; }
.graph-fallback { margin-top: 1rem; color: var(--muted); font-size: .82rem; }
.graph-fallback ul { columns: 2; padding-left: 1.1rem; }
.graph-fallback li { break-inside: avoid; margin: .3rem 0; }
.local-graph-stage { min-height: 12rem; overflow: hidden; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); }
.local-graph-stage .graph-canvas { height: 12rem; }
.local-graph-fallback { margin-top: .7rem; }
.local-graph > .graph-status, .local-graph > .graph-selection { font-size: .75rem; }
.local-graph > .graph-status { margin: .45rem 0 0; }
.local-graph-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.local-graph-heading h2 { margin: 0; }
.graph-popup-open, .graph-dialog-close { min-height: 2.25rem; padding: .35rem .65rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--accent-strong); cursor: pointer; font-size: .78rem; }
.graph-popup-open { display: none; }
.js .graph-popup-open { display: inline-block; }
.graph-inspector { position: absolute; z-index: 2; top: .75rem; right: .75rem; width: min(20rem, calc(100% - 1.5rem)); max-height: calc(100% - 4rem); overflow: auto; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--page); box-shadow: var(--shadow-panel); font-size: .8rem; }
.graph-inspector-header { display: flex; align-items: start; justify-content: space-between; gap: .5rem; }
.graph-inspector h2 { margin: 0; font-family: inherit; font-size: .95rem; font-weight: 650; line-height: 1.35; }
.graph-inspector h3 { margin: .85rem 0 .3rem; color: var(--muted); font-family: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.graph-inspector-meta { margin: .35rem 0; color: var(--muted); overflow-wrap: anywhere; }
.graph-inspector-open { display: inline-block; margin-top: .45rem; font-weight: 650; text-decoration: none; }
.graph-inspector ul { margin: 0; padding: 0; list-style: none; }
.graph-inspector li { margin: 0; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.graph-inspector li a { display: block; overflow-wrap: anywhere; text-decoration: none; }
.graph-inspector-close { flex: 0 0 auto; padding: .1rem .3rem; border: 0; border-radius: .25rem; background: transparent; color: var(--muted); cursor: pointer; font-size: .72rem; }
.graph-inspector-close:hover { background: var(--surface); color: var(--text); }
.page-grid:has(.graph-workspace) { grid-template-columns: minmax(0, 1fr); }
.page-grid:has(.graph-workspace) .explorer, .page-grid:has(.graph-workspace) .context-panel { display: none; }
.page-grid:has(.directory-page) { grid-template-columns: minmax(min(13rem, var(--explorer-width)), var(--explorer-width)) minmax(0, 1fr); }
.page-grid:has(.directory-page.no-explorer) { grid-template-columns: minmax(0, 1fr); }
.directory-page.no-explorer { grid-column: 1 / -1; }

/* Search */
.search-dialog { position: fixed; inset: 5rem 0 auto; width: min(42rem, calc(100vw - 2rem)); max-height: calc(100dvh - 6rem); overflow: auto; margin-inline: auto; padding: 0; border: 1px solid var(--line); border-radius: .65rem; background: var(--page); color: var(--text); box-shadow: var(--shadow-panel); }
.search-dialog::backdrop { background: rgb(20 27 39 / 58%); }
.search-form { position: sticky; z-index: 1; top: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .65rem; padding: .8rem; border-bottom: 1px solid var(--line); background: var(--page); }
.search-form label { position: static; grid-column: 1 / -1; width: auto; height: auto; overflow: visible; clip: auto; color: var(--muted); font-size: .78rem; white-space: normal; }
.search-form input { flex: 1; min-width: 0; min-height: 2.75rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--text); font: inherit; }
.search-close { min-width: 2.75rem; min-height: 2.75rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--muted); cursor: pointer; font-size: .74rem; }
.search-dialog > p { margin: .6rem .9rem; color: var(--muted); font-size: .76rem; }
.search-dialog #search-results { max-height: none; overflow: visible; margin: 0; padding: 0 .7rem; list-style: none; }
.search-result { display: grid; gap: .3rem; margin: .2rem 0; padding: .75rem .8rem; border-radius: .35rem; color: var(--text); cursor: pointer; }
.search-result.selected, .search-result[aria-selected="true"], .search-result:hover { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.search-result strong { font-size: .95rem; }
.search-path, .search-excerpt, .search-tags { color: var(--muted); font-size: .82rem; }
.search-excerpt { line-height: 1.55; }
.search-tags { color: var(--accent-strong); }
.search-result mark { border-radius: .12rem; background: color-mix(in srgb, var(--accent) 18%, var(--page)); color: var(--text); }
.search-shortcuts { position: sticky; bottom: 0; padding: .5rem .9rem .75rem; text-align: right; }
.js .search-open kbd { display: inline-block; }

/* Graph dialog */
.graph-dialog { width: min(72rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--page); color: var(--text); box-shadow: var(--shadow-panel); }
.graph-dialog::backdrop { background: rgb(20 27 39 / 58%); }
.graph-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.graph-dialog-header h2 { margin: 0; font-family: inherit; font-size: 1.1rem; }
.graph-popup-canvas-wrapper { overflow: hidden; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); }
.graph-popup-stage .graph-canvas { height: clamp(16rem, 60dvh, 40rem); }

/* Media, diagrams, math, transclusion */
.diagram-output { max-width: 100%; overflow-x: auto; margin: 1.4rem 0; padding: .8rem; border: 1px solid var(--line); background: var(--surface); }
.diagram-output svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.diagram-error { max-height: 26rem; overflow: auto; }
.math-display { overflow-x: auto; max-width: 100%; }
.transclusion { margin: 1rem 0; padding: .7rem .9rem; border-left: 2px solid var(--line); background: var(--surface); }
.transclusion-source { margin-bottom: .45rem; color: var(--muted); font-size: .77rem; }
.transclusion > :last-child { margin-bottom: 0; }
.unavailable-reference, .transclusion-unavailable { color: var(--muted); }
.link-preview { position: fixed; z-index: 30; max-height: min(15rem, 45vh); overflow: auto; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--page); color: var(--text); box-shadow: var(--shadow-panel); font-size: .8rem; }
.link-preview p { margin: .35rem 0 0; color: var(--muted); line-height: 1.45; }

/* Footer */
.site-footer { margin-top: 1rem; padding: 1rem 1.4rem 1.6rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; text-align: center; }
.site-footer a { color: var(--muted); }

/* Typography presets */
html[data-typography="technical"] h1,
html[data-typography="technical"] h2,
html[data-typography="technical"] h3,
html[data-typography="technical"] h4,
html[data-typography="technical"] h5,
html[data-typography="technical"] h6,
html[data-typography="minimal"] h1,
html[data-typography="minimal"] h2,
html[data-typography="minimal"] h3,
html[data-typography="minimal"] h4,
html[data-typography="minimal"] h5,
html[data-typography="minimal"] h6 { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
html[data-typography="technical"] h1,
html[data-typography="technical"] h2,
html[data-typography="technical"] h3,
html[data-typography="technical"] h4,
html[data-typography="technical"] h5,
html[data-typography="technical"] h6 { letter-spacing: -.035em; font-weight: 640; }
html[data-typography="minimal"] h1,
html[data-typography="minimal"] h2,
html[data-typography="minimal"] h3,
html[data-typography="minimal"] h4,
html[data-typography="minimal"] h5,
html[data-typography="minimal"] h6 { letter-spacing: -.02em; font-weight: 560; }

/* Reader mode */
body.reader-mode .explorer, body.reader-mode .context-panel, body.reader-mode .menu-toggle { display: none !important; }
body.reader-mode .page-grid, body.reader-mode .page-grid.no-context-layout { grid-template-columns: minmax(0, 1fr); }
body.reader-mode .article-column { grid-column: 1 / -1; padding-inline: clamp(1rem, 5vw, 4rem); }
body.reader-mode article { width: min(100%, var(--reading-width)); }
body.reader-mode .mobile-toc { display: block; margin: 0 0 1.5rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .35rem; }
body.reader-mode .mobile-toc summary { cursor: pointer; color: var(--accent-strong); font-size: .84rem; font-weight: 620; }
body.reader-mode .mobile-toc .toc { margin-top: .65rem; }
body.reader-mode .mobile-context { display: block; }

/* Responsive */
@media (max-width: 1279px) and (min-width: 861px) {
  :root { --explorer-width: 15rem; }
  .page-grid, .page-grid.no-context-layout { grid-template-columns: minmax(12rem, var(--explorer-width)) minmax(0, 1fr); }
  body.explorer-collapsed .page-grid { grid-template-columns: var(--explorer-width) minmax(0, 1fr); }
  .context-panel { display: none; }
  .mobile-context { display: block; }
  .article-column { padding-inline: clamp(1.5rem, 4vw, 3.5rem); }
  .mobile-toc { display: block; margin: 0 0 1.5rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .35rem; }
  .mobile-toc summary { cursor: pointer; color: var(--accent-strong); font-size: .84rem; }
  .mobile-toc .toc { margin-top: .65rem; }
}
@media (max-width: 860px) {
  .page-grid { display: block; }
  .context-panel { display: none; }
  .mobile-context { display: block; }
  .js .site-links { display: none; }
  .site-links { gap: .45rem; font-size: .75rem; }
  .js .mobile-site-links { display: flex; gap: 1rem; margin: 1rem .45rem 0; font-size: .82rem; }
  .js .mobile-site-links a { color: var(--muted); text-decoration: none; }
  .js .mobile-site-links a:hover { color: var(--accent-strong); text-decoration: underline; }
  .js .explorer { position: fixed; z-index: 10; top: var(--header-height); bottom: 0; left: 0; width: min(19rem, 86vw); height: auto; max-height: none; padding: 1.35rem .85rem 2rem; border-right: 1px solid var(--line); transform: translateX(-105%); box-shadow: 12px 0 30px #0001; transition: transform .18s ease; }
  .js body.drawer-open .explorer { transform: translateX(0); }
  .js .menu-toggle { display: inline-grid; }
  .mobile-toc { display: block; margin: -1rem 0 1.6rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .25rem; }
  .mobile-toc summary { cursor: pointer; color: var(--accent-strong); font-size: .84rem; font-weight: 620; }
  .mobile-toc .toc { margin-top: .65rem; }
  .article-column { padding: 2rem clamp(1.2rem, 6vw, 3.2rem) 4rem; }
  .graph-workspace { padding: 1.5rem 1.2rem 3rem; }
  body.explorer-collapsed { --explorer-width: 17rem; }
  body.explorer-collapsed .explorer { padding: 1.35rem .85rem 2rem; }
  body.explorer-collapsed .panel-heading { justify-content: space-between; }
  body.explorer-collapsed .panel-heading > span, body.explorer-collapsed .file-tree, body.explorer-collapsed .browse-link, body.explorer-collapsed .mobile-site-links { display: revert; }
  body.explorer-collapsed .explorer-collapse { rotate: none; }
  body.reader-mode .article-column { padding-inline: clamp(1rem, 5vw, 2.5rem); }
  .reading-menu .reading-tools button { min-height: 2.6rem; }
  .search-dialog { inset: .5rem 0 auto; width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); margin-inline: auto; }
  .search-form { padding: .7rem; }
  .search-dialog #search-results { padding-inline: .45rem; }
  .search-dialog > p { font-size: .82rem; }
  .search-result { padding: .75rem .65rem; }
  .search-close { min-width: 2.75rem; min-height: 2.75rem; }
  .graph-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); padding: .75rem; }
  .graph-popup-open, .graph-dialog-close { min-height: 2.75rem; }
  .js .mobile-standalone-links { display: flex; align-items: center; gap: .35rem; overflow-x: auto; padding: .45rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
  .mobile-standalone-links a { flex: 0 0 auto; padding: .25rem .6rem; border-radius: .3rem; color: var(--muted); font-size: .82rem; text-decoration: none; }
  .mobile-standalone-links a:hover, .mobile-standalone-links a:focus-visible { background: var(--surface-strong); color: var(--text); }
}
@media (max-width: 520px) {
  .topbar { gap: .4rem; padding-inline: .65rem; }
  .brand { overflow: hidden; max-width: 32vw; text-overflow: ellipsis; white-space: nowrap; }
  .brand::before { flex: 0 0 .65rem; width: .65rem; height: .65rem; }
  .search-open, .theme-toggle, .menu-toggle { min-width: 2.75rem; min-height: 2.75rem; }
  .search-open { justify-content: center; padding-inline: .45rem; }
  .js .search-open .search-trigger-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .js .search-open kbd { display: none; }
  .article-column { padding-inline: 1rem; }
  .article-header { margin-bottom: 1.6rem; }
  .prose pre { margin-right: -.2rem; margin-left: -.2rem; padding: .8rem; font-size: .78rem; }
  .graph-workspace { padding-inline: 1rem; }
  .graph-toolbar { align-items: stretch; }
  .graph-toolbar label { flex: 1 1 8rem; }
  .graph-toolbar input, .graph-toolbar select { width: 100%; max-width: none; }
  .graph-stage, .graph-canvas { min-height: 65vh; height: 65vh; }
  .archive-controls { gap: .55rem; }
  .archive-controls label:first-child { grid-column: 1 / -1; }
  .archive-controls.tag-controls label { grid-column: 1 / -1; }
}
@media (max-width: 1300px) {
  .archive-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
