/* Two themes, chosen with the button in the header and kept for the next visit: dark unless light was chosen.
   Every colour is a pair, light then dark, and which of the pair is used follows color-scheme. */
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
:root {
  --bg: light-dark(#ffffff, #1e1f22);
  --bg-soft: light-dark(#f5f7f8, #26282b);
  --card: light-dark(#ffffff, #2b2d30);
  --text: light-dark(#1b1f23, #e6e8eb);
  --muted: light-dark(#5b6570, #a3abb5);
  --line: light-dark(#dfe3e8, #3a3d41);
  --brand: light-dark(#0f7f73, #45bfa8);
  --brand-text: light-dark(#ffffff, #06211d);
  --code-bg: light-dark(#f0f3f5, #17181a);
  --brand-bg: light-dark(#e2f3f0, #1f3a35);
  --mark: light-dark(#ffe69a, #6a5a1c);
  accent-color: var(--brand);
  scrollbar-color: light-dark(#b5bcc4, #55595e) transparent;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: 20px; }

.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); text-decoration: none; }
.logo img { width: 28px; height: 28px; }
/* the mark in the shades of the page's theme: dark unless the page is set light, as script.js sets it */
:root[data-theme="light"] .logo .logo-on-dark, :root:not([data-theme="light"]) .logo .logo-on-light { display: none; }
.site-header nav { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--text); }
#theme { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
#theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* the theme a press goes to: the sun in the dark, the moon in the light */
#theme .theme-moon { display: none; }
:root[data-theme="light"] #theme .theme-sun { display: none; }
:root[data-theme="light"] #theme .theme-moon { display: block; }
#theme:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#theme:hover { color: var(--text); border-color: var(--brand); }

.hero { padding: 72px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.12; margin: 0 0 16px; letter-spacing: -0.02em; text-wrap: balance; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 720px; margin: 0 auto 28px; text-wrap: pretty; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; padding: 11px 20px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font-weight: 600; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn:hover { filter: brightness(1.06); }
.badges { margin-top: 18px; color: var(--muted); font-size: 14px; }
.hero-media { margin: 44px auto 0; max-width: 1000px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); background: #1e1f22; }
.hero-media video { width: 100%; height: auto; aspect-ratio: 1708 / 1010; }

section { padding: 64px 0; }
section.alt { background: var(--bg-soft); border-block: 1px solid var(--line); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 8px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 32px; max-width: 720px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

.steps { counter-reset: step; display: grid; gap: 14px; padding: 0; margin: 0; list-style: none; max-width: 760px; }
.steps li { counter-increment: step; padding: 14px 16px 14px 56px; position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-text); font-weight: 700; font-size: 14px; display: grid; place-items: center; }

code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
pre code { background: none; border: 0; padding: 0; }
table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 14px; color: var(--muted); font-weight: 600; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 13.5px; }
.site-footer p { margin: 0 0 8px; max-width: 900px; }

/* documentation layout */
.docs { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 40px; padding-block: 36px 72px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 14.5px; }
/* search this page: a box over the contents, its results listed under it */
.find { position: relative; padding: 0 0 14px; }
.find label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.find input { width: 100%; font: inherit; font-size: 14px; line-height: 1.4; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 30px 7px 10px; }
.find input::placeholder { color: var(--muted); }
.find input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.find-key { position: absolute; right: 9px; top: 8px; font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; pointer-events: none; }
.find input:focus ~ .find-key, .find input:not(:placeholder-shown) ~ .find-key { display: none; }
#find-said { margin: 7px 2px 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
#find-said:empty { display: none; }
#find-results { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
#find-results[hidden] { display: none; }
#find-results li { padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1.45; color: var(--text); margin: 0; }
#find-results li:hover, #find-results li[aria-selected="true"] { background: var(--brand-bg); }
#find-results .where { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#find-results .snip { display: block; overflow-wrap: anywhere; }
#find-results li.more { cursor: default; color: var(--muted); font-size: 12px; }
#find-results li.more:hover { background: none; }
#find-results mark, mark.find-hit { background: var(--mark); color: var(--text); border-radius: 3px; padding: 0 1px; }
.find-flash { outline: 2px solid var(--brand); outline-offset: 6px; border-radius: 6px; }
/* a screenshot in both themes: the dark one on the dark page, the light one on the light page */
figure img.lt { display: none; }
:root[data-theme="light"] figure img.dk { display: none; }
/* the loops, likewise: the one in the page's theme */
figure video.lt { display: none; }
:root[data-theme="light"] figure video.dk { display: none; }
:root[data-theme="light"] figure video.lt { display: block; }
:root[data-theme="light"] figure img.lt { display: block; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 2px 0; }
.toc a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.toc a:hover { background: var(--bg-soft); color: var(--text); }
.doc h1 { font-size: 2.1rem; margin: 0 0 8px; letter-spacing: -0.02em; }
.doc h2 { margin-top: 48px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc h3 { margin: 28px 0 6px; font-size: 1.1rem; }
.doc p, .doc li { max-width: 78ch; }
.doc figure { margin: 20px 0; }
.doc figure img { border: 1px solid var(--line); border-radius: 10px; }
.doc figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.note { border-left: 4px solid var(--brand); background: var(--bg-soft); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 16px 0; max-width: 78ch; }
@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; gap: 16px; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
  .site-header nav { gap: 14px; }
  .hero { padding-top: 44px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* A loop's pause button (2026-11-06): a loop plays by itself as it comes into view; this stops it, and it stays stopped
   until played again. Over the loop's top right corner, in both pages' figures. */
.loop-host { position: relative; }
.loop-pause { position: absolute; top: 18px; right: 18px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  color: var(--text); font: 600 12px/1 inherit; font-family: inherit; cursor: pointer; opacity: .85; }
.loop-pause:hover, .loop-pause:focus-visible { opacity: 1; }
.loop-pause:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.loop-pause svg { width: 12px; height: 12px; fill: currentColor; }
@media (max-width: 680px) { .loop-pause { top: 12px; right: 12px; padding: 6px; } .loop-pause span { display: none; } }
/* A picture enlarged (2026-11-06): its button over the figure's top right, like a loop's Pause; the dialog it opens */
.zoom-host { position: relative; }
.zoom-host > img { cursor: zoom-in; }
.zoom-btn { position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  color: var(--text); font: 600 12px/1 inherit; font-family: inherit; cursor: pointer; opacity: 0; transition: opacity .15s; }
.zoom-host:hover .zoom-btn, .zoom-btn:focus-visible { opacity: .9; }
.zoom-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.zoom-btn svg { width: 12px; height: 12px; fill: currentColor; }
@media (hover: none) { .zoom-btn { opacity: .85; } .zoom-btn span { display: none; } .zoom-btn { padding: 6px; } }
dialog.zoom { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
  width: min(96vw, 1618px); max-width: 96vw; max-height: 94vh; overflow: hidden; }
dialog.zoom::backdrop { background: rgb(0 0 0 / .72); }
dialog.zoom img { display: block; width: 100%; height: auto; max-height: 94vh; object-fit: contain; cursor: zoom-in; }
.zoom-scroll { max-height: 94vh; overflow: hidden; }
/* actual size: the picture's own pixels, scrolled both ways */
dialog.zoom.actual .zoom-scroll { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
dialog.zoom.actual img { width: auto; max-width: none; max-height: none; cursor: zoom-out; }
dialog.zoom form { position: absolute; top: 10px; right: 10px; z-index: 1; margin: 0; display: flex; gap: 6px; }
.zoom-size { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  color: var(--text); font: 600 12px/1 inherit; font-family: inherit; cursor: pointer; }
.zoom-size:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.zoom-close { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  color: var(--text); font: 600 12px/1 inherit; font-family: inherit; cursor: pointer; }
.zoom-close:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .zoom-btn { transition: none; } }
