/* turborel.com: docs and blog.
   The home page's palette and type, laid out like the classic Sphinx theme:
   a dark related bar, a coloured sidebar, the page on a white sheet. */

:root {
  --maroon: #5C282B;
  --maroon-deep: #45191C;
  --maroon-ink: #2E1214;
  --rust: #BB3400;
  --rust-dark: #8A2600;
  --accent: #E58A5C;
  --ink: #24201F;
  --muted: #6B5E5A;
  --rule: #E6DCD5;
  --band: #F7F0EA;
  --code-bg: #FAF5EA;
  --code-rule: #E3D6B8;
  --out-bg: #FBFAF8;
  --inline-code: #F3EDE4;
  --side-text: #EEDDD3;
  --side-link: #F6D2B8;
  --serif: "EB Garamond", Georgia, serif;
  --sans: "Work Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --shadow: 0 2px 4px 0 rgb(36,42,51), 0 18px 0 -9px rgb(28,33,40), 0 19.8px 11px -9px rgb(39,45,54);
}

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

/* overflow-y: always room for a scrollbar, so the layout doesn't shift
   between short and long pages, while the header and bands still reach the
   edge (same in home.html). scroll-padding: links to a heading land below
   the sticky header. */
html { color-scheme: light; -webkit-text-size-adjust: 100%; overflow-y: scroll; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--maroon);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: clip;
}

a { color: var(--rust); text-decoration: none; }
a:hover { color: var(--rust-dark); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: #fff; color: var(--maroon-ink); padding: 8px 12px; z-index: 10;
}
.skip:focus { left: 8px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; } /* same as the home page's .container */
.muted { color: var(--muted); font-weight: 400; }

/* ---- header ---------------------------------------------------------- */

/* Sticky: stays at the top while the page scrolls (same in home.html). */
.site-header {
  position: sticky; top: 0; z-index: 30; background: inherit;
  border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
.scrolled .site-header { border-bottom-color: rgba(20, 6, 8, 0.28); } /* a fine dark edge once the page scrolls under it */
:where(:root[data-theme="dark"]).scrolled .site-header { border-bottom-color: rgba(0, 0, 0, 0.6); }
/* Frosted: the page shows through, blurred, as it scrolls under the header. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header {
    background: rgba(92, 40, 43, 0.88);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    backdrop-filter: blur(24px) saturate(140%);
  }
  :where(:root[data-theme="dark"]) .site-header {
    background: rgba(18, 13, 14, 0.76);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
  }
}

.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px 16px; padding-top: 20px; padding-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { color: #fff; text-decoration: none; }
.brand img { display: block; height: 28px; width: auto; }
.brand span { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1; }

.site-nav { order: 1; margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 15px; line-height: 1.2; }
.site-nav a { color: #F1DDD2; padding: 5px 0 3px; border-bottom: 2px solid transparent; } /* text lines up with the home page's nav */
.site-nav a:hover { color: #fff; }
.site-nav a[aria-current="page"] { color: #fff; border-bottom: 2px solid var(--accent); }

/* the light / dark switch (see _includes/theme-toggle.njk); same in home.html */
.theme-toggle {
  order: 2; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin: -6px -8px -6px 0; padding: 0;
  border: 0; background: none; color: #F1DDD2; cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: #fff; }
.theme-toggle .sun, :where(:root[data-theme="dark"]) .theme-toggle .moon { display: none; }
:where(:root[data-theme="dark"]) .theme-toggle .sun { display: block; }

/* menu: the phone menu button (see _includes/menu.njk); same in home.html */
.menu-toggle {
  order: 3; display: none; width: 40px; height: 36px; padding: 0;
  align-items: center; justify-content: center;
  border: 0; background: none; color: #F1DDD2; cursor: pointer;
}
.menu-toggle:hover { color: #fff; }
.menu-toggle .bars, .menu-toggle .bars::before, .menu-toggle .bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; transition: transform 0.2s, background-color 0.2s;
}
.menu-toggle .bars { position: relative; }
.menu-toggle .bars::before, .menu-toggle .bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle .bars::before { top: -6px; }
.menu-toggle .bars::after { top: 6px; }
.menu-toggle[aria-expanded="true"] .bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---- related bar ------------------------------------------------------ */

.relbar { background: var(--maroon-deep); color: #E9D6CC; font-size: 13.5px; line-height: 1.5; }
.relbar .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 9px; padding-bottom: 9px; }
/* One line at any width: a long path shortens with "…" (the page's own name
   first) so the links on the right never drop to a line of their own. */
.relbar nav[aria-label="Breadcrumb"] { flex: 1 1 auto; min-width: 0; }
.relbar .related { flex: none; white-space: nowrap; }
.relbar a { color: #F1DDD2; }
.relbar a:hover { color: #fff; }
.relbar ol { list-style: none; margin: 0; padding: 0; display: flex; white-space: nowrap; }
.relbar li { flex: 0 1 auto; min-width: 2.6em; overflow: hidden; text-overflow: ellipsis; }
.relbar li:last-child { flex-shrink: 40; }
.relbar li + li::before { content: "»"; margin: 0 0.45em; color: #C9A99B; }
.relbar .off { color: #A98C80; }

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

.layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px; padding-top: 28px; padding-bottom: 16px; }
.layout.single .sheet { flex-basis: 100%; }

.sheet {
  flex: 999 1 560px; min-width: 0;
  background: #fff; box-shadow: var(--shadow);
  padding: 40px 56px 36px;
}

/* ---- sidebar ---------------------------------------------------------- */

.sidebar {
  flex: 1 1 230px; max-width: 280px;
  color: var(--side-text); font-size: 14px; line-height: 1.55;
  display: flex; flex-direction: column; gap: 26px;
}
.sidebar a { color: var(--side-link); }
.sidebar a:hover { color: #fff; }
.sidebar p { margin: 0 0 6px; }
.sidebar ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.sb-title { display: block; margin: 0 0 8px; font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 1.3; color: #fff; }
.sb-extra .sb-title + p + .sb-title { margin-top: 16px; }
.toc .toc-3 { margin-left: 14px; list-style: circle; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* version menu: <details>, works without JavaScript */
.version { position: relative; }
.version summary {
  list-style: none; cursor: pointer;
  min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; background: #fff; color: var(--ink);
  border: 1px solid var(--maroon-ink); border-radius: 2px; font-size: 14px;
}
.version summary::-webkit-details-marker { display: none; }
.version summary strong { font-weight: 600; }
.version[open] summary svg { transform: rotate(180deg); }
.version-menu {
  position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: #fff; border: 1px solid var(--maroon-ink); box-shadow: 0 8px 20px rgba(20,8,8,0.35); padding: 4px 0;
}
.sidebar .version-menu ul { list-style: none; padding: 0; gap: 0; }
.sidebar .version-menu a {
  min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; color: var(--ink); font-size: 14px;
}
.sidebar .version-menu a:hover { background: #FBF6F2; color: var(--ink); text-decoration: none; }
.sidebar .version-menu a[aria-current] { background: #F7EFE8; color: var(--ink); }
.version-menu a[aria-current] svg { color: var(--rust); flex: none; }
.version-note { border-top: 1px solid #EADFD8; margin: 4px 0 0 !important; padding: 8px 12px 6px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* quick search */
.search-row { display: flex; gap: 6px; }
.search-row input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 6px 10px;
  border: 1px solid var(--maroon-ink); border-radius: 2px; font: 14px var(--sans);
}
.search-row button {
  min-height: 44px; padding: 0 14px; background: #E9D6CC; color: var(--maroon-ink);
  border: 1px solid var(--maroon-ink); border-radius: 2px; font: 600 14px var(--sans); cursor: pointer;
}
.search-row button:hover { background: #fff; }

/* ---- document --------------------------------------------------------- */

.doc h1, .page-title {
  margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
  font-family: var(--serif); font-weight: 500; font-size: 42px; line-height: 1.15; color: var(--maroon-ink);
}
.doc h2 {
  margin: 34px 0 12px; padding: 5px 12px; background: var(--band); border-bottom: 1px solid var(--rule);
  font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.25; color: var(--maroon-ink);
}
.doc h3 { margin: 26px 0 8px; font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.3; color: var(--maroon-ink); }
.doc h4 { margin: 20px 0 6px; font-size: 16px; font-weight: 600; color: var(--maroon-ink); }
.doc h1, .doc h2, .doc h3, .doc h4 { scroll-margin-top: 16px; }

.headerlink { margin-left: 8px; font-size: 0.7em; color: #C9B8AE; opacity: 0; transition: opacity .1s; }
.headerlink:hover { color: var(--rust); text-decoration: none; }
:is(h1, h2, h3, h4):hover > .headerlink, .headerlink:focus { opacity: 1; }
@media (hover: none) { .headerlink { opacity: 0.6; } }

.doc p, .doc ul, .doc ol { margin: 0 0 14px; }
.doc li + li { margin-top: 4px; }
.doc hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0; }
.doc blockquote { margin: 0 0 16px; padding: 4px 18px; border-left: 3px solid var(--rule); color: #4A3F3C; }

.doc code { font-family: var(--mono); font-size: 0.86em; background: var(--inline-code); padding: 1px 5px; border-radius: 2px; }
.doc a code { color: inherit; }

pre.code {
  margin: 0 0 16px; padding: 12px 16px; overflow-x: auto;
  background: var(--code-bg); border-top: 1px solid var(--code-rule); border-bottom: 1px solid var(--code-rule);
  font-family: var(--mono); font-size: 13.5px; line-height: 1.55; tab-size: 4;
}
pre.code code { background: none; padding: 0; font-size: inherit; border-radius: 0; }
pre.code.output { background: var(--out-bg); border-color: var(--rule); }

/* syntax colours (Prism tokens, highlighted at build time) */
.token.keyword, .token.important, .token.selector { color: #8A2600; font-weight: 600; }
.token.string, .token.char, .token.attr-value, .token.regex { color: #2F5A86; }
.token.number, .token.boolean, .token.constant { color: #3B6A2E; }
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7A6D66; font-style: italic; }
.token.function, .token.macro, .token.property { color: #6A3D8F; }
.token.builtin, .token.class-name, .token.type-definition { color: #7A4A00; }
.token.operator, .token.punctuation { color: #4E4442; }
.token.variable, .token.lifetime-annotation, .token.attribute { color: #8A2600; }
.token.table, .token.key { color: #2E1214; font-weight: 600; }
.token.deleted { color: #A3201A; }
.token.inserted { color: #2E6B2E; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 18px; }
.doc table { border-collapse: collapse; font-size: 14.5px; line-height: 1.5; min-width: 50%; }
.doc th, .doc td { border: 1px solid var(--rule); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--band); font-weight: 600; color: var(--maroon-ink); }
.doc tbody tr:nth-child(even) td { background: #FDFBF9; }

/* admonitions */
.admonition { margin: 0 0 28px; border: 1px solid #E3C9A8; background: #FCF4E8; font-size: 14.5px; line-height: 1.55; }
.admonition p { margin: 0; padding: 10px 14px; }
.admonition .admonition-title { padding: 7px 14px; background: #F3E2CA; font-weight: 600; color: var(--maroon); }
.admonition.note { border-color: #D6CFC8; background: #FAF8F6; }
.admonition.note .admonition-title { background: #EEE8E3; }

/* previous / next */
.pager {
  margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 15px;
}
.pager a { display: flex; flex-direction: column; }
.pager a span { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.pager-next { text-align: right; margin-left: auto; }

/* ---- blog ------------------------------------------------------------- */

.lede { margin: -8px 0 8px; color: var(--muted); font-size: 15px; }
.kicker { margin: 0 0 4px; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kicker a { color: var(--muted); }
.post-summary { padding: 26px 0; border-bottom: 1px solid var(--rule); }
.post-summary:last-of-type { border-bottom: 0; }
.post-summary h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.2; }
.post-summary h2 a { color: var(--maroon-ink); }
.post-summary h2 a:hover { color: var(--rust); text-decoration: none; }
.post-summary p { margin: 0 0 10px; }
.post-summary .more { font-size: 15px; margin: 0; }
.post-summary .summary-by { margin: -4px 0 10px; color: var(--muted); font-size: 14px; }
.summary-cover { display: block; margin-bottom: 16px; }
.summary-cover img, .cover img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--band); }
.cover { margin: 0 0 28px; }
.cover figcaption { margin-top: 8px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.cover figcaption span { display: block; }
.cover .cover-credit { font-size: 12.5px; }
.cover .cover-credit a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--rule); }
.cover .cover-credit a:hover { color: var(--rust); }

/* attachments, at the end of a post */
.attachments { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--rule); }
.doc .attachments h2 { margin: 0 0 10px; padding: 0; background: none; border: 0; font-size: 22px; }
.attachments ul { list-style: none; margin: 0; padding: 0; }
.attachments li { padding: 10px 0 10px 28px; border-bottom: 1px solid var(--rule); position: relative; }
.attachments li:last-child { border-bottom: 0; }
.attachments li::before {
  content: ""; position: absolute; left: 2px; top: 15px; width: 13px; height: 16px;
  border: 1.5px solid var(--muted); border-radius: 2px;
  background: linear-gradient(225deg, var(--muted) 4px, transparent 4px);
}
.attachments a { font-weight: 500; overflow-wrap: anywhere; }
.attachments .file-meta { margin-left: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.attachments p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.tag-list { padding-left: 18px; }

.post { max-width: 700px; font-size: 17px; line-height: 1.75; }
.doc .post-title { margin: 0 0 12px; padding: 0; border: 0; font-size: 46px; line-height: 1.1; }
.byline { margin: 0 0 26px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 15px; }
.post-body > p:first-child { font-family: var(--serif); font-size: 22px; line-height: 1.5; color: #3A2E2B; }
.post-body h2 { background: none; border: 0; padding: 0; font-size: 28px; }

/* search page (Pagefind UI) */
#search {
  --pagefind-ui-primary: var(--rust);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-border: var(--rule);
  --pagefind-ui-tag: var(--band);
  --pagefind-ui-border-radius: 2px;
  --pagefind-ui-font: var(--sans);
}

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

.site-footer { max-width: 1100px; margin: 0 auto; padding: 18px 20px 30px; text-align: center; color: #D9C2B6; font-size: 13px; line-height: 1.6; }
.site-footer p { margin: 0; }
.site-footer a { color: #F1DDD2; }
.site-footer a:hover { color: #fff; }

/* the project's accounts, above the copyright line (same in home.html) */
.social { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 0 0 10px; padding: 0; }
.social a { display: inline-flex; padding: 4px; }
.social svg { display: block; }

/* share buttons, at the end of a post */
.share { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--rule); }
.doc .share h2 { margin: 0 0 12px; padding: 0; background: none; border: 0; font-size: 22px; }
.share ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.share li { margin: 0; }
.share a, .share button {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px;
  border: 1px solid var(--rule); border-radius: 999px; background: #fff; color: var(--ink);
  font: inherit; font-size: 14px; line-height: 1.3; cursor: pointer;
}
.share a:hover, .share button:hover { border-color: var(--rust); color: var(--rust); text-decoration: none; }
.share .icon { flex: none; }

/* ---- dark mode -------------------------------------------------------- */
/* On when <html data-theme="dark">: set before drawing by theme-head.njk,
   from the reader's choice (the sun/moon button) or else the system's.
   The oxblood page becomes a warm near-black, white sheets a warm charcoal,
   and rust links a soft coral that reads on dark. Print always stays light.
   Keep in step with home.html. */

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --maroon-ink: #F3E7E0;            /* headings */
    --rust: #F0956A;
    --rust-dark: #F8B795;
    --ink: #E9E0DB;
    --muted: #A89A93;
    --rule: #3A2E2F;
    --band: #261E1F;
    --code-bg: #211A1A;
    --code-rule: #3D3030;
    --out-bg: #1A1415;
    --inline-code: #2B2223;
    --shadow: 0 2px 4px 0 rgba(0,0,0,0.7), 0 18px 0 -9px #0B0809, 0 19.8px 11px -9px rgba(0,0,0,0.8);
  }
  :where(:root[data-theme="dark"]) body { background: #120D0E; }
  :where(:root[data-theme="dark"]) .relbar { background: #1B1415; }
  :where(:root[data-theme="dark"]) .skip, :where(:root[data-theme="dark"]) .sheet, :where(:root[data-theme="dark"]) .share a, :where(:root[data-theme="dark"]) .share button { background: #1C1617; }

  :where(:root[data-theme="dark"]) .version summary, :where(:root[data-theme="dark"]) .version-menu { background: #1C1617; border-color: #3A2E2F; }
  :where(:root[data-theme="dark"]) .version-menu { box-shadow: 0 8px 20px rgba(0,0,0,0.6); }
  :where(:root[data-theme="dark"]) .sidebar .version-menu a:hover { background: #261E1F; color: var(--ink); }
  :where(:root[data-theme="dark"]) .sidebar .version-menu a[aria-current] { background: #2C2324; }
  :where(:root[data-theme="dark"]) .version-note { border-top-color: #3A2E2F; }
  :where(:root[data-theme="dark"]) .search-row input { background: #1C1617; color: var(--ink); border-color: #3A2E2F; }
  :where(:root[data-theme="dark"]) .search-row button { background: #2C2324; color: var(--ink); border-color: #3A2E2F; }
  :where(:root[data-theme="dark"]) .search-row button:hover { background: #3A2E2F; }

  :where(:root[data-theme="dark"]) .headerlink { color: #6E5F5A; }
  :where(:root[data-theme="dark"]) .doc blockquote { color: #CBBFB9; }
  :where(:root[data-theme="dark"]) .post-body > p:first-child { color: #E5DAD4; }
  :where(:root[data-theme="dark"]) .doc tbody tr:nth-child(even) td { background: #201919; }

  :where(:root[data-theme="dark"]) .admonition { border-color: #5A4328; background: #241B13; }
  :where(:root[data-theme="dark"]) .admonition .admonition-title { background: #33261A; color: #F4C9A0; }
  :where(:root[data-theme="dark"]) .admonition.note { border-color: #3A3232; background: #1F1A1A; }
  :where(:root[data-theme="dark"]) .admonition.note .admonition-title { background: #2A2323; color: var(--ink); }

  :where(:root[data-theme="dark"]) .token.keyword, :where(:root[data-theme="dark"]) .token.important, :where(:root[data-theme="dark"]) .token.selector { color: #F0956A; }
  :where(:root[data-theme="dark"]) .token.string, :where(:root[data-theme="dark"]) .token.char, :where(:root[data-theme="dark"]) .token.attr-value, :where(:root[data-theme="dark"]) .token.regex { color: #8DB8E8; }
  :where(:root[data-theme="dark"]) .token.number, :where(:root[data-theme="dark"]) .token.boolean, :where(:root[data-theme="dark"]) .token.constant { color: #9CCB8A; }
  :where(:root[data-theme="dark"]) .token.comment, :where(:root[data-theme="dark"]) .token.prolog, :where(:root[data-theme="dark"]) .token.doctype, :where(:root[data-theme="dark"]) .token.cdata { color: #8E807A; }
  :where(:root[data-theme="dark"]) .token.function, :where(:root[data-theme="dark"]) .token.macro, :where(:root[data-theme="dark"]) .token.property { color: #C9A3E6; }
  :where(:root[data-theme="dark"]) .token.builtin, :where(:root[data-theme="dark"]) .token.class-name, :where(:root[data-theme="dark"]) .token.type-definition { color: #E3B868; }
  :where(:root[data-theme="dark"]) .token.operator, :where(:root[data-theme="dark"]) .token.punctuation { color: #C4B6B0; }
  :where(:root[data-theme="dark"]) .token.variable, :where(:root[data-theme="dark"]) .token.lifetime-annotation, :where(:root[data-theme="dark"]) .token.attribute { color: #F0956A; }
  :where(:root[data-theme="dark"]) .token.table, :where(:root[data-theme="dark"]) .token.key { color: #F3E7E0; }
  :where(:root[data-theme="dark"]) .token.deleted { color: #F08080; }
  :where(:root[data-theme="dark"]) .token.inserted { color: #8FCB8F; }

  :where(:root[data-theme="dark"]) #search { --pagefind-ui-background: #1C1617; --pagefind-ui-tag: #2C2324; }
}

/* Wide screens: the sidebar stays in view while the page scrolls, and
   scrolls on its own when it's taller than the window. */
@media (min-width: 861px) {
  .sidebar {
    position: sticky; top: 84px; max-height: calc(100vh - 100px);
    overflow-y: auto; overscroll-behavior: contain;
    /* The gap to the page lives inside the sidebar (padding, then a negative
       margin of the layout's 28px gap), so its scrollbar sits right against
       the page. Wider to match, so the links keep their width. */
    flex-basis: 250px; max-width: 300px;
    padding: 2px 20px 12px 2px; margin: -2px -28px 0 -2px;
    scrollbar-width: thin; scrollbar-color: rgba(241, 221, 210, 0.3) transparent;
  }
}

/* ---- small screens ---------------------------------------------------- */

@media (max-width: 860px) {
  /* One column. The sidebar's blocks join it one by one: the short ones
     marked .sb-top (version, quick search) above the page, the rest (table
     of contents, previous/next, this page) under it. */
  .layout { flex-direction: column; align-items: stretch; gap: 22px; }
  .sheet { flex: none; width: 100%; }
  .sidebar { display: contents; }
  .sidebar > .sb-block { order: 1; }
  .sidebar > .sb-top { order: -1; }
}
@media (max-width: 520px) {
  .site-nav { order: 4; width: 100%; margin-left: 0; } /* on its own line under the name, as on the home page */
  .theme-toggle { margin: 0 0 0 auto; }
  .js .menu-toggle { display: inline-flex; }
  .js .site-nav { display: none; }
  .js .site-nav.open { display: flex; flex-direction: column; gap: 0; margin-top: -6px; }
  .js .site-nav.open a { padding: 11px 0; border-top: 1px solid rgba(241, 221, 210, 0.15); border-bottom: 0; font-size: 16px; }
  .js .site-nav.open a[aria-current="page"] { font-weight: 600; }
  /* share buttons as icons only; the names stay for screen readers */
  .share a, .share button { padding: 9px; }
  .share a span, .share button span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}
@media (max-width: 640px) {
  .wrap { padding-left: 20px; padding-right: 20px; } /* sides only: .layout keeps its top padding */
  .sheet { padding: 26px 20px 24px; }
  .doc h1, .page-title { font-size: 34px; }
  .doc h2 { font-size: 23px; }
  .doc .post-title { font-size: 36px; }
  .post-body > p:first-child { font-size: 20px; }
}

@media print {
  body { background: #fff; }
  .site-header, .relbar, .sidebar, .pager, .site-footer, .headerlink { display: none; }
  .sheet { box-shadow: none; padding: 0; }
}
