/* Base layout – mobile first. Visual design is refined in week 9. */

/* Onest (variable, SIL OFL 1.1 – see fonts/OFL-Onest.txt), self-hosted because of the CSP. */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: block;  /* wait for Onest (preloaded, so this is a few ms) instead of flashing a fallback font */
  src: url("../fonts/onest-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: block;  /* wait for Onest (preloaded, so this is a few ms) instead of flashing a fallback font */
  src: url("../fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Fallback shown until Onest has loaded: Arial scaled to Onest's metrics (computed from the font
   files with fontTools), so the text does not jump or grow when the real font swaps in. */
@font-face {
  font-family: "Onest Fallback";
  src: local("Arial"), local("ArialMT"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 104.14%;
  ascent-override: 93.15%;
  descent-override: 29.29%;
  line-gap-override: 0%;
}
:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #5d6166;
  --border: #dfe1e3;
  /* Highlight colour: a light/dark pair, picked in the customize menu (data-accent). */
  --accent-l: #b3261e;
  --accent-d: #ff6b5e;
  --accent: var(--accent-l);
  --accent-text: #ffffff;
  --danger: #b3261e;
  --code-bg: #f1f2f3;
  --warn-bg: #fff4e5;
  --warn-border: #e8a33d;
  --ok: #2f7d4f;
  --note: #2f6db5;
  --admonition-icon: var(--text);
  --radius: 6px;
  --font: "Onest", "Onest Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  /* Code highlighting (Pygments token classes, see .codehilite below); ≥ 4.5:1 on --code-bg */
  --hl-comment: #636b74;
  --hl-keyword: #9a1fa0;
  --hl-string: #2b6e36;
  --hl-number: #8a5100;
  --hl-function: #2b5bb8;
  --hl-variable: #b02a37;
  --hl-attr: #0b6a80;
}

/* Dark theme: follows the system unless the visitor picked a theme in the customize menu. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e6e7e8;
    --muted: #a0a5ab;
    --border: #33373c;
    --accent: var(--accent-d);
    --accent-text: #15171a;
    --danger: #ff6b5e;
    --code-bg: #262a2f;
    --warn-bg: #2e2416;
    --warn-border: #c98a2e;
    --ok: #5cc48a;
    --note: #6aa8f0;
    --admonition-icon: #ffffff;
    --hl-comment: #9198a1;
    --hl-keyword: #d19ef5;
    --hl-string: #9fd28a;
    --hl-number: #e3a96b;
    --hl-function: #74b4f5;
    --hl-variable: #f08a93;
    --hl-attr: #63c7d4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a;
  --surface: #1d2024;
  --text: #e6e7e8;
  --muted: #a0a5ab;
  --border: #33373c;
  --accent: var(--accent-d);
  --accent-text: #15171a;
  --danger: #ff6b5e;
  --code-bg: #262a2f;
  --warn-bg: #2e2416;
  --warn-border: #c98a2e;
  --ok: #5cc48a;
  --note: #6aa8f0;
  --admonition-icon: #ffffff;
  --hl-comment: #9198a1;
  --hl-keyword: #d19ef5;
  --hl-string: #9fd28a;
  --hl-number: #e3a96b;
  --hl-function: #74b4f5;
  --hl-variable: #f08a93;
  --hl-attr: #63c7d4;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* Highlight colours (customize menu). Light values keep ≥ 4.5:1 on the light background, dark values on the dark one. */
:root[data-accent="orange"] { --accent-l: #b45309; --accent-d: #fb923c; }
:root[data-accent="green"]  { --accent-l: #15803d; --accent-d: #4ade80; }
:root[data-accent="teal"]   { --accent-l: #0f766e; --accent-d: #2dd4bf; }
:root[data-accent="blue"]   { --accent-l: #1d4ed8; --accent-d: #60a5fa; }
:root[data-accent="violet"] { --accent-l: #6d28d9; --accent-d: #a78bfa; }
:root[data-accent="pink"]   { --accent-l: #be185d; --accent-d: #f472b6; }

/* Text size from the customize menu (everything is in rem, so this scales the whole page). */
:root[data-size="sm"] { font-size: 93.75%; }
:root[data-size="lg"] { font-size: 112.5%; }
:root[data-size="xl"] { font-size: 125%; }

/* Reduced motion, either from the system or from the customize menu. */
:root[data-motion="reduce"] { scroll-behavior: auto !important; }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation: none !important;
  transition: none !important;
}

* { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--font);
}

a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }

/* The header stays at the top while scrolling. --header-h is its real height (measured in main.js),
   so sticky columns sit below it and #anchor jumps don't end up hidden under it. */
html { scroll-padding-top: calc(var(--header-h, 4rem) + 0.75rem); }
.site-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 0.55rem; margin-right: auto; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-logo {
  display: block;
  width: 2rem;
  height: 2rem;
  flex: none;
  background: var(--text);
  -webkit-mask: url("../brand/icon.svg") center / contain no-repeat;
  mask: url("../brand/icon.svg") center / contain no-repeat;
}
.header-link { color: var(--text); font-weight: 600; text-decoration: none; text-underline-offset: 6px; }
.header-link:hover, .header-link[aria-current] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
.header-login {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.header-login:hover { opacity: 0.9; }
.header-login:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.header-login svg { width: 1rem; height: 1rem; }
.header-end { display: flex; align-items: center; gap: 0.75rem 1rem; margin-left: auto; }

/* Signed-in user: avatar + name, dropdown reuses the language list styling */
.user-menu { position: relative; }
.user-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.6rem 0.25rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
}
.user-button::-webkit-details-marker { display: none; }
.user-button:hover { border-color: var(--muted); }
.user-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-menu[open] .user-button { border-color: var(--accent); }
.user-menu[open] .caret { transform: rotate(180deg); }
.user-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: block; flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--code-bg); }
.avatar-letter { display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.user-list form { margin: 0; }
.user-list button {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
}
.user-list button:hover { background: var(--code-bg); }
.user-chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.user-chip .avatar { width: 1.25rem; height: 1.25rem; }
@media (max-width: 30rem) { .user-name { display: none; } }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Search */
.search-form { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 0.8rem; width: 1rem; height: 1rem; color: var(--muted); pointer-events: none; }
.search-form input {
  width: 100%;
  padding: 0.45rem 0.9rem 0.45rem 2.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.search-form input::placeholder { color: var(--muted); }
.search-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.header-search { order: 10; flex-basis: 100%; }
.search-form-large { gap: 0.5rem; max-width: 40rem; margin: 1rem 0 1.5rem; }
.search-form-large .search-icon { left: 1rem; width: 1.15rem; height: 1.15rem; }
.search-form-large input { padding: 0.7rem 1rem 0.7rem 2.75rem; font-size: 1rem; }
.search-form-large button { border-radius: 999px; padding: 0.7rem 1.25rem; font-weight: 600; }
.results-meta { color: var(--muted); }

/* Search results – shared by the search page and the popup */
.sr-list { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.sr-group { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.sr-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.sr-doc { width: 1.15rem; height: 1.15rem; color: var(--muted); }
.sr-title { font-size: 1.05rem; font-weight: 700; }
.sr-section { grid-column: 2; color: var(--muted); font-size: 0.8rem; }
.sr-hits { margin: 0; padding: 0.25rem 0 0.4rem 1.55rem; list-style: none; }
.sr-hits li { position: relative; padding-left: 1rem; border-left: 1.5px solid var(--border); }
.sr-hits li:last-child { border-left-color: transparent; }
/* tree connector: vertical line + tick to each hit, the last one ends in a corner */
.sr-hits li::before {
  content: "";
  position: absolute;
  top: 0;
  left: -1.5px;
  width: 0.7rem;
  height: 1.35rem;
  border-bottom: 1.5px solid var(--border);
}
.sr-hits li:last-child::before { border-left: 1.5px solid var(--border); border-bottom-left-radius: 4px; }
.sr-hit {
  display: grid;
  gap: 0.1rem;
  margin-right: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.sr-hit-title { font-weight: 600; }
.sr-excerpt { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.sr-head:hover, .sr-hit:hover { background: var(--code-bg); }
.sr-head:focus-visible, .sr-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--code-bg); }
.sr-list mark { padding: 0; background: none; color: var(--text); font-weight: 700; }
.sr-hit-title mark { color: var(--accent); }

/* Search popup */
.search-kbd { position: absolute; right: 0.6rem; }
.search-form input:focus + .search-kbd { display: none; }
kbd {
  display: inline-block;
  min-width: 1.35rem;
  padding: 0 0.3rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font: 600 0.72rem/1.25rem var(--font);
  text-align: center;
}
html:not(.js) .search-kbd { display: none; }

.search-dialog {
  width: min(44rem, calc(100vw - 1.5rem));
  max-height: min(42rem, calc(100dvh - 3rem));
  margin: 5vh auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.18), 0 30px 80px rgb(0 0 0 / 0.3);
  overflow: hidden;
}
.search-dialog[open] { display: flex; flex-direction: column; animation: lang-in 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.search-dialog::backdrop { background: rgb(10 12 14 / 0.55); backdrop-filter: blur(6px); }
.sd-bar { position: relative; display: flex; align-items: center; margin: 0.9rem; }
.sd-icon { position: absolute; left: 1rem; width: 1.2rem; height: 1.2rem; color: var(--muted); pointer-events: none; }
.sd-input {
  width: 100%;
  padding: 0.85rem 3rem 0.85rem 2.9rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}
.sd-input:focus { outline: none; border-color: var(--text); }
.sd-input::-webkit-search-cancel-button { display: none; }
.sd-close {
  position: absolute;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
}
.sd-close svg { width: 1.2rem; height: 1.2rem; }
.sd-close:hover { background: var(--code-bg); color: var(--text); }
.sd-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.sd-body { flex: 1; min-height: 0; padding: 0 0.9rem 0.9rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--border) transparent; }
.sd-status { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.sd-status:empty { display: none; }
.sd-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
}
.sd-foot kbd { margin-right: 0.15rem; }
@media (pointer: coarse) { .sd-foot, .search-kbd { display: none; } }

mark { padding: 0 0.1em; border-radius: 2px; background: color-mix(in srgb, var(--warn-border) 35%, transparent); color: inherit; }

/* Browse – filter dropdown */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1.25rem 0 0.5rem; }
.filter-menu { position: relative; }
.filter-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: border-color 0.15s ease-out;
}
.filter-button::-webkit-details-marker, .filter-cat > summary::-webkit-details-marker { display: none; }
.filter-button:hover, .filter-menu[open] .filter-button { border-color: var(--muted); }
.filter-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 1.1rem; height: 1.1rem; flex: none; }
.filter-badge, .cat-count {
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.filter-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 20;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 4px 6px rgb(0 0 0 / 0.04), 0 14px 32px rgb(0 0 0 / 0.12);
  animation: lang-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top left;
}
.filter-cat > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.filter-cat > summary span:first-of-type { flex: 1; }
.filter-cat > summary:hover, .filter-cat[open] > summary { background: var(--code-bg); }
.filter-cat > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chevron { width: 0.75rem; height: 0.75rem; color: var(--muted); transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.filter-cat[open] .chevron { transform: rotate(90deg); }

.filter-options { margin: 0.15rem 0 0.35rem; padding: 0.25rem 0 0.25rem 1.6rem; border: 0; }
.check-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.check-row:hover { background: var(--code-bg); }
.check-row input { width: 1rem; height: 1rem; margin: 0; flex: none; accent-color: var(--text); cursor: pointer; }
.check-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-num { color: var(--muted); font-variant-numeric: tabular-nums; }

.filter-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0.5rem 0.15rem; border-top: 1px solid var(--border); }
.js .filter-actions:not(:has(a)) { display: none; }
.filter-actions a { font-size: 0.85rem; }
.filter-actions button { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.js .no-js-only { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.chips a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
}
.chips a:hover { border-color: var(--accent); color: var(--accent); }
.chips a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips svg { width: 0.75rem; height: 0.75rem; }
.filter-count { margin-left: auto; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.browse-section { margin-top: 2.25rem; }
.browse-section h2 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.browse-section h2 a { color: var(--text); text-decoration: none; }
.browse-section h2 a:hover { color: var(--accent); }
.empty { color: var(--muted); font-size: 0.9rem; }

/* Language switcher */
.lang-menu { position: relative; }
.lang-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 2px 8px rgb(0 0 0 / 0.06);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.lang-button::-webkit-details-marker { display: none; }
.lang-button:hover { border-color: var(--muted); }
.lang-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-menu[open] .lang-button { border-color: var(--accent); color: var(--accent); }
.flag { display: block; width: 1.5rem; height: 1rem; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.08); }
.caret { width: 0.75rem; height: 0.75rem; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.lang-menu[open] .caret { transform: rotate(180deg); }
.lang-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 10;
  min-width: 12rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 6px rgb(0 0 0 / 0.04), 0 12px 28px rgb(0 0 0 / 0.12);
  animation: lang-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}
.lang-list a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 5px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.lang-list a:hover { background: var(--code-bg); }
.lang-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lang-name { flex: 1; }
.check { width: 1rem; height: 1rem; color: var(--ok); }
@keyframes lang-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
}
@media (prefers-reduced-motion: reduce) {
  .lang-list, .filter-panel, .filter-options, .search-dialog[open] { animation: none; }
  .chevron { transition: none; }
  .caret { transition: none; }
}

.layout { flex: 1 0 auto; width: 100%; padding: 0 1rem; }

.sidebar { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sidebar summary { padding: 0.5rem 0.75rem; cursor: pointer; font-weight: 600; }
.sidebar nav { padding: 0 0.4rem 0.6rem; }
/* Left navigation: clean list, groups "Guides" / "Advanced", articles only under the open section */
.side-group { margin: 1rem 0 0.3rem 0.6rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.side-group:first-child { margin-top: 0.25rem; }
.side-nav, .side-nav ul { display: grid; gap: 0.1rem; margin: 0; padding: 0; list-style: none; }
.side-nav ul { margin: 0.1rem 0 0.25rem; }
.side-item, .side-sub {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.6rem;
  border-radius: 7px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.12s ease-out, color 0.12s ease-out;
}
.side-item:hover, .side-sub:hover { background: var(--code-bg); }
.side-item:focus-visible, .side-sub:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-num { flex: none; width: 1.1rem; color: var(--muted); font-size: 0.8rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.side-item.is-active { font-weight: 600; }
.side-item.is-active .side-num { color: var(--accent); }
.side-item[aria-current] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.side-sub { padding-left: 2.3rem; color: var(--muted); font-size: 0.875rem; }
.side-sub[aria-current] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }

.content { min-width: 0; padding-bottom: 3rem; }
/* Every page uses the same centred block: 44rem text + 3rem gap + 14rem contents column,
   so the text starts at the same place on articles, sections, browse and search. */
.page-center { width: 100%; max-width: 61rem; margin-inline: auto; }

.lead { font-size: 1.1rem; color: var(--muted); }
.breadcrumbs { margin-top: 1rem; font-size: 0.9rem; color: var(--muted); }
.badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.4rem;
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  vertical-align: middle;
}

.section-cards { display: grid; gap: 0.75rem; padding: 0; list-style: none; }
.card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card .badge { justify-self: start; margin: 0.15rem 0 0.1rem; }
.card-number { grid-row: span 3; font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.card-text { color: var(--muted); font-size: 0.95rem; }

.article-list { padding: 0; list-style: none; }
.article-list li { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.article-list p { margin: 0.25rem 0 0; color: var(--muted); }

.meta { color: var(--muted); font-size: 0.9rem; }
.section-sources { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.section-sources h2 { margin: 0 0 0.5rem; color: var(--text); font-size: 1rem; }
.section-sources ol { margin: 0; padding-left: 1.25rem; }
.section-sources li + li { margin-top: 0.25rem; }
.section-sources a { text-underline-offset: 3px; overflow-wrap: anywhere; }
/* Article + table of contents. Mobile: collapsible block above the text; wide: sticky right column. */
.article-grid { display: flex; flex-direction: column; }
/* Narrow screens: flatten the main column so breadcrumbs sit above the collapsible contents. */
.article-main { display: contents; }
.article-main > .breadcrumbs { order: -1; }
.article-toc details { margin: 1rem 0 0; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.article-toc summary { cursor: pointer; font-weight: 600; }
.article-toc ul { margin: 0; padding: 0; list-style: none; }
.article-toc ul ul { padding-left: 0.85rem; }
.article-toc li { margin: 0; }
.article-toc a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.15s ease-out, border-color 0.15s ease-out;
}
.article-toc a:hover { color: var(--text); }
.article-toc a[aria-current] { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.article-toc a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.article-toc nav { margin-top: 0.5rem; }
.prose h2, .prose h3 { scroll-margin-top: calc(var(--header-h, 4rem) + 1.25rem); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

.prose { max-width: 44rem; overflow-wrap: anywhere; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prose code { padding: 0.1rem 0.3rem; background: var(--code-bg); border-radius: 4px; font: 0.9em var(--mono); }
.prose pre { padding: 0.75rem; overflow-x: auto; background: var(--code-bg); border-radius: var(--radius); }
.prose pre code { padding: 0; background: none; }

/* Copy button on code blocks (added by main.js) */
.code-block { position: relative; }
.code-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  transition: opacity 0.15s;
}
.code-copy:hover { border-color: var(--muted); color: var(--text); }
.code-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.code-copy.is-done { border-color: var(--ok); color: var(--ok); }
.code-copy svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
/* With a mouse the button shows on hover; on touch screens it is always visible. */
@media (hover: hover) {
  .code-copy { opacity: 0; }
  .code-block:hover .code-copy, .code-copy:focus-visible, .code-copy.is-done { opacity: 1; }
}
:root[data-motion="reduce"] .code-copy { transition: none; }

/* Syntax highlighting:```powershell etc. is coloured server-side by Pygments (codehilite). */
.codehilite .c, .codehilite .c1, .codehilite .cm, .codehilite .ch, .codehilite .cs, .codehilite .cp, .codehilite .cpf { color: var(--hl-comment); font-style: italic; }
.codehilite .k, .codehilite .kc, .codehilite .kd, .codehilite .kn, .codehilite .kp, .codehilite .kr, .codehilite .kt, .codehilite .ow { color: var(--hl-keyword); }
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sa, .codehilite .sb, .codehilite .sc, .codehilite .sd, .codehilite .se, .codehilite .sh, .codehilite .si, .codehilite .sr, .codehilite .ss, .codehilite .sx, .codehilite .dl { color: var(--hl-string); }
.codehilite .m, .codehilite .mb, .codehilite .mf, .codehilite .mh, .codehilite .mi, .codehilite .mo, .codehilite .il { color: var(--hl-number); }
.codehilite .nb, .codehilite .nf, .codehilite .fm, .codehilite .bp, .codehilite .nc { color: var(--hl-function); }
.codehilite .nv, .codehilite .vc, .codehilite .vg, .codehilite .vi { color: var(--hl-variable); }
.codehilite .na, .codehilite .nt, .codehilite .nn, .codehilite .no, .codehilite .nd, .codehilite .ne { color: var(--hl-attr); }
.codehilite .gh, .codehilite .gu { font-weight: 700; }
.codehilite .gi { color: var(--hl-string); }
.codehilite .gd { color: var(--hl-variable); }
.prose table, .table-wrap table { width: 100%; border-collapse: collapse; }
.prose th, .prose td, .table-wrap th, .table-wrap td { padding: 0.4rem 0.6rem; border: 1px solid var(--border); text-align: left; }
.prose { overflow-x: auto; }
/* File card in an article (md_files.py): name, size, uploader, SHA-256, download, content folded. */
.file-embed { margin: 1.25rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.file-embed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; padding: 0.8rem 1rem; }
/* File type: icon (static/icons/files, drawn in the accent colour via a mask) over the extension. */
.file-embed-type {
  display: grid; flex-shrink: 0; justify-items: center; gap: 0.15rem; width: 3rem; padding: 0.45rem 0 0.35rem;
  border-radius: var(--radius); background: var(--code-bg);
  color: var(--muted); font-family: var(--mono); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
}
.file-embed-icon {
  width: 1.6rem; height: 1.6rem; background: var(--accent);
  -webkit-mask: var(--file-icon) center / contain no-repeat; mask: var(--file-icon) center / contain no-repeat;
}
.file-icon-terminal { --file-icon: url("../icons/files/terminal.svg"); }
.file-icon-registry { --file-icon: url("../icons/files/registry.svg"); }
.file-icon-text { --file-icon: url("../icons/files/text.svg"); }
.file-icon-pdf { --file-icon: url("../icons/files/pdf.svg"); }
.file-icon-image { --file-icon: url("../icons/files/image.svg"); }
.file-embed-main { display: grid; flex: 1 1 12rem; min-width: 0; }
.file-embed-name { font-weight: 700; overflow-wrap: anywhere; }
.file-embed-meta { color: var(--muted); font-size: 0.85rem; }
.prose .file-embed-download { color: var(--accent-text); text-decoration: none; }
.prose .file-embed-desc { margin: -0.2rem 0 0; padding: 0 1rem 0.8rem; }
.file-embed-hash {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; padding: 0.6rem 1rem;
  border-top: 1px solid var(--border); font-size: 0.85rem;
}
.file-embed-label { color: var(--muted); font-weight: 600; }
.file-embed-hash code { flex: 1 1 20rem; min-width: 0; word-break: break-all; }
.file-embed-content { border-top: 1px solid var(--border); }
.file-embed-content > summary { padding: 0.6rem 1rem; color: var(--accent); font-weight: 600; cursor: pointer; }
.file-embed-content > .codehilite { margin: 0 1rem 1rem; }
.file-embed-more { margin: 0 1rem 1rem; font-size: 0.85rem; }

/* File page (uploads.view): download / VirusTotal buttons and the hash table. */
.file-title { overflow-wrap: anywhere; }
.file-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 0.5rem; }
.hash-table th { padding-right: 1rem; color: var(--muted); font-weight: 600; text-align: left; white-space: nowrap; }
.hash-table code { word-break: break-all; }
.file-image { max-width: 100%; height: auto; }

/* Tabs (=== "Chrome", app/md_tabs.py). Without JS the variants stack under their titles;
   main.js adds the tab bar (.is-tabbed). Print always shows every variant. */
.tabbed { margin: 1.25rem 0; border: 1px solid var(--border); border-radius: var(--radius); }
.tab { padding: 0.1rem 1rem 0.4rem; }
.tab + .tab { border-top: 1px solid var(--border); }
.tab-title { margin: 0.7rem 0 0.3rem; font-weight: 700; }
.tabbed.is-tabbed .tab-title { display: none; }
.tabbed.is-tabbed .tab + .tab { border-top: 0; }
/* Wraps onto a second row instead of scrolling (a scroll box also grew a vertical scrollbar). */
.tab-list {
  display: flex; flex-wrap: wrap; gap: 0.15rem; padding: 0.3rem 0.5rem 0;
  border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; background: var(--surface);
}
.tab-button {
  margin-bottom: -1px; padding: 0.45rem 0.85rem; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tab-button:hover { color: var(--text); }
.tab-button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--text); }
.tab-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Browser / OS logos (static/icons/tabs, see LICENSE.txt there), drawn in the text colour via a mask. */
.tab-icon {
  display: inline-block; width: 1.05em; height: 1.05em; margin-right: 0.45em; vertical-align: -0.17em;
  background: currentColor; -webkit-mask: var(--tab-icon) center / contain no-repeat; mask: var(--tab-icon) center / contain no-repeat;
}
.tab-icon-chrome { --tab-icon: url("../icons/tabs/chrome.svg"); }
.tab-icon-firefox { --tab-icon: url("../icons/tabs/firefox.svg"); }
.tab-icon-edge { --tab-icon: url("../icons/tabs/edge.svg"); }
.tab-icon-opera { --tab-icon: url("../icons/tabs/opera.svg"); }
.tab-icon-brave { --tab-icon: url("../icons/tabs/brave.svg"); }
.tab-icon-safari { --tab-icon: url("../icons/tabs/safari.svg"); }
.tab-icon-windows { --tab-icon: url("../icons/tabs/windows.svg"); }
.tab-icon-macos { --tab-icon: url("../icons/tabs/macos.svg"); }
.tab-icon-linux { --tab-icon: url("../icons/tabs/linux.svg"); }
.tab-icon-android { --tab-icon: url("../icons/tabs/android.svg"); }
.tab-icon-ios { --tab-icon: url("../icons/tabs/ios.svg"); }
/* Right end of a tab bar: switches names + logos / logos only (same setting as the Customize menu). */
.tab-view-toggle {
  display: inline-flex; align-self: center; margin-left: auto; padding: 0.3rem; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--muted);
}
.tab-view-toggle:hover { background: var(--code-bg); color: var(--text); }
.tab-view-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tab-view-toggle svg { width: 1.1rem; height: 1.1rem; }
/* Customize menu -> "Icons only": tabs with a logo hide their name (still the tooltip and the accessible name). */
:root[data-tabs="icons"] .tab-button:has(.tab-icon) { padding-inline: 0.7rem; }
:root[data-tabs="icons"] .tab-button .tab-icon { width: 1.25em; height: 1.25em; margin-right: 0; }
:root[data-tabs="icons"] .tab-button:has(.tab-icon) .tab-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
@media print {
  .tab-list { display: none; }
  .tabbed.is-tabbed .tab[hidden] { display: block; }
  .tabbed.is-tabbed .tab-title { display: block; }
}

/* Admonitions: !!! note | tip | warning | danger – flat box, white line icon before the title */
.admonition {
  --tone: var(--warn-border);
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/><path d='M12 9.5v4'/><path d='M12 17h.01'/></svg>");
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone) 9%, var(--surface));
}
.admonition.note, .admonition.info { --tone: var(--note); --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><path d='M12 11v5.5'/><path d='M12 7.6h.01'/></svg>"); }
.admonition.tip, .admonition.hint, .admonition.success { --tone: var(--ok); --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 18h6'/><path d='M10 21.5h4'/><path d='M12 2.5a6.5 6.5 0 0 0-3.9 11.7c.6.5.9 1.1.9 1.8V16h6v-.1c0-.7.4-1.3.9-1.8A6.5 6.5 0 0 0 12 2.5z'/></svg>"); }
.admonition.danger, .admonition.error, .admonition.caution { --tone: var(--danger); --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7.9 2.5h8.2l5.4 5.4v8.2l-5.4 5.4H7.9l-5.4-5.4V7.9z'/><path d='m9.2 9.2 5.6 5.6'/><path d='m14.8 9.2-5.6 5.6'/></svg>"); }
.admonition-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.3rem;
  color: color-mix(in srgb, var(--tone) 75%, var(--text));
  font-weight: 700;
  line-height: 1.4;
}
/* icon drawn through a mask so its colour comes from CSS */
.admonition-title::before {
  content: "";
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  background: var(--admonition-icon);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.admonition > :last-child { margin-bottom: 0; }

/* Glossary: abbreviations (pill + expansion) and terms (name + definition) */
.glossary-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin: 1.5rem 0 0.5rem; }
.kind-tabs { display: inline-flex; padding: 0.2rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.kind-tabs a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease-out, background-color 0.15s ease-out;
}
.kind-tabs a span { color: var(--muted); font-size: 0.78rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.kind-tabs a:hover { color: var(--text); }
.kind-tabs a[aria-current] { background: var(--code-bg); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.15); }
.kind-tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.glossary-filter { flex: 1 1 14rem; max-width: 22rem; }
.glossary-none { color: var(--muted); }
.glossary-group[hidden], .glossary-entry[hidden] { display: none; }
.glossary-letter {
  position: sticky;
  top: var(--header-h, 4rem);
  z-index: 1;
  margin: 1.75rem 0 0;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
  font-size: 1.1rem;
}
.glossary-list { margin: 0; }
.glossary-entry { padding: 0.85rem 0; border-bottom: 1px solid var(--border); scroll-margin-top: calc(var(--header-h, 4rem) + 3rem); }
.glossary-entry:target { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.glossary-entry dd { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }
.glossary-entry dd p { margin: 0; }
.glossary-entry dd p + p { margin-top: 0.5rem; }

.glossary-abbreviations dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.75rem; }
.glossary-abbreviations .glossary-name {
  min-width: 4.25rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
}
.glossary-abbreviations .glossary-short { font-weight: 600; }
.glossary-abbreviations dd { padding-left: 5rem; }

.glossary-terms dt { display: grid; gap: 0.15rem; }
.glossary-terms .glossary-name { font-size: 1.05rem; font-weight: 700; }
.glossary-terms .glossary-short { color: var(--text); }
@media (max-width: 40rem) { .glossary-abbreviations dd { padding-left: 0; } }

.letter-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.1rem, 1fr)); gap: 0.3rem; }
.article-toc .letter-index a {
  display: grid;
  place-items: center;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-weight: 700;
}
.article-toc .letter-index a:hover { border-color: var(--muted); }
.article-toc .letter-index a[aria-current] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }

/* Other Markdown elements */
.prose h2 { margin-top: 2.25rem; }
.prose h3 { margin-top: 1.75rem; }
.prose h4 { margin: 1.5rem 0 0.25rem; }
.prose li + li { margin-top: 0.25rem; }
.prose li > ul, .prose li > ol { margin-top: 0.25rem; }
.prose blockquote { margin: 1.25rem 0; padding: 0.1rem 1rem; border-left: 1px solid var(--muted); color: var(--muted); font-style: italic; }
.prose hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--border); }
.prose a { text-underline-offset: 3px; }
.prose kbd { font-size: 0.8rem; color: var(--text); }
.prose mark { padding: 0 0.15em; border-radius: 2px; background: color-mix(in srgb, var(--warn-border) 35%, transparent); color: inherit; }
.prose abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.prose figure { margin: 1.5rem 0; }
.prose figcaption { margin-top: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.prose dl { margin: 1rem 0; }
.prose dt { font-weight: 700; }
.prose dd { margin: 0.1rem 0 0.75rem 1.25rem; color: var(--muted); }
.prose th[align="center"], .prose td[align="center"] { text-align: center; }
.prose th[align="right"], .prose td[align="right"] { text-align: right; font-variant-numeric: tabular-nums; }
.prose sup { line-height: 0; }
.prose .footnote-ref { text-decoration: none; font-weight: 600; }
.prose .footnote { margin-top: 2.5rem; color: var(--muted); font-size: 0.875rem; }
.prose .footnote hr { margin: 0 0 1rem; }
.prose .footnote-backref { text-decoration: none; }
.prose pre { line-height: 1.5; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.pager .next { margin-left: auto; text-align: right; }

.page .prose h2 { margin-top: 2rem; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  text-align: center;
}
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.5rem; }
.footer-nav a { white-space: nowrap; }
.footer-nav a, .made-by a { color: var(--text); font-weight: 600; text-underline-offset: 3px; }
.footer-nav a:hover, .footer-nav a[aria-current], .made-by a:hover { color: var(--accent); }
.footer-nav a:focus-visible, .made-by a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.made-by { margin: 0; white-space: nowrap; }
/* keep the floating customize button (bottom right) from covering footer text */
.site-footer { padding-bottom: 4.5rem; }

/* Forms / admin */
.login-box { max-width: 22rem; margin: 2rem auto 0; }
.button.github-button { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 1.25rem; border-color: var(--text); background: var(--text); color: var(--bg); font-weight: 600; }
.button.github-button:hover { opacity: 0.9; }
.github-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.github-button svg { width: 1.15rem; height: 1.15rem; }
.login-or { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 0; color: var(--muted); font-size: 0.85rem; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.flash { padding: 0.5rem 0.75rem; border-radius: var(--radius); background: var(--warn-bg); }
.form { display: grid; gap: 0.75rem; margin: 1rem 0; }
.form.narrow { max-width: 22rem; }
.form label { display: grid; gap: 0.25rem; font-weight: 600; }
.form label.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.form input, .form select, .form textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.form input[type="checkbox"] { width: auto; }
.form .editor { font-family: var(--mono); font-size: 0.9rem; }
.form .grid { display: grid; gap: 0.75rem; }
.error { color: var(--accent); font-weight: 400; font-size: 0.85rem; }
.actions { display: flex; gap: 0.5rem; }
button, .button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.admin-bar h1 { margin-right: auto; }
.table-wrap { overflow-x: auto; }
.preview { margin-top: 2rem; padding-top: 1rem; border-top: 2px dashed var(--border); }

@media (min-width: 48rem) {
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; gap: 1rem 2rem; padding-right: 5.5rem; }
  .site-footer { padding-bottom: 0; }
  .footer-nav { justify-self: start; justify-content: flex-start; }
  .made-by { justify-self: end; }
  .filter-panel { width: 13.5rem; }
  .filter-cat[open] .chevron { transform: none; }
  .filter-cat { position: relative; }
  .filter-options {
    position: absolute;
    top: -0.4rem;
    left: calc(100% + 0.75rem);
    width: 17rem;
    margin: 0;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 4px 6px rgb(0 0 0 / 0.04), 0 14px 32px rgb(0 0 0 / 0.12);
    animation: lang-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }
  /* brand | search (centered) | browse, language, account */
  .site-header { display: grid; grid-template-columns: 1fr minmax(0, 30rem) 1fr; }
  .header-search { order: 0; grid-column: 2; width: 100%; }
  .header-end { grid-column: 3; justify-self: end; }
  .layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 2.5rem; }
  .layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: var(--header-h, 4rem); align-self: start; max-height: calc(100dvh - var(--header-h, 4rem)); margin: 0; padding: 1.25rem 0; overflow-y: auto; border: 0; background: none; }
  .sidebar summary { display: none; }
  .sidebar nav { padding: 0; }
  .section-cards { grid-template-columns: repeat(2, 1fr); }
  .form .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 72rem) {
  .article-grid { display: grid; grid-template-columns: minmax(0, 44rem) 14rem; justify-content: center; gap: 3rem; align-items: start; }
  .article-toc { grid-column: 2; grid-row: 1; position: sticky; top: var(--header-h, 4rem); max-height: calc(100dvh - var(--header-h, 4rem)); padding: 1.25rem 0; overflow-y: auto; }
  .article-toc details { margin: 0; padding: 0; border: 0; background: none; }
  .article-toc summary { margin-bottom: 0.25rem; color: var(--text); font-size: 0.875rem; cursor: default; list-style: none; pointer-events: none; }
  .article-toc summary::-webkit-details-marker { display: none; }
  .article-main { display: block; min-width: 0; grid-column: 1; grid-row: 1; }
}

/* Customize menu: floating button bottom right */
.prefs { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 30; }
html:not(.js) .prefs { display: none; }
.prefs-button {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.12), 0 8px 24px rgb(0 0 0 / 0.16);
  cursor: pointer;
  list-style: none;
  transition: border-color 0.15s ease-out, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.prefs-button::-webkit-details-marker { display: none; }
.prefs-button:hover { border-color: var(--muted); }
.prefs-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.prefs-button svg { width: 1.35rem; height: 1.35rem; transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.prefs[open] .prefs-button { border-color: var(--accent); color: var(--accent); }
.prefs[open] .prefs-button svg { transform: rotate(60deg); }
.prefs-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(19rem, calc(100vw - 2.5rem));
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 8px rgb(0 0 0 / 0.06), 0 16px 40px rgb(0 0 0 / 0.2);
  animation: prefs-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}
@keyframes prefs-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.prefs-title { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 700; }
.prefs-group { margin: 0 0 1rem; padding: 0; border: 0; }
.prefs-group legend { margin-bottom: 0.4rem; padding: 0; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.segmented { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; padding: 0.2rem; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.1rem;
  padding: 0 0.4rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease-out, background-color 0.15s ease-out;
}
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented svg { width: 1rem; height: 1rem; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches span {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15);
  cursor: pointer;
  transition: transform 0.15s ease-out;
}
.swatches span:hover { transform: scale(1.08); }
.swatches svg { width: 1rem; height: 1rem; color: #fff; opacity: 0; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatches input:checked + span svg { opacity: 1; }
.swatches input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 4px; }
.sw-red { --sw: #e5484d; }
.sw-orange { --sw: #ea7a1a; }
.sw-green { --sw: #2f9e5a; }
.sw-teal { --sw: #14a394; }
.sw-blue { --sw: #3b74e6; }
.sw-violet { --sw: #8257e5; }
.sw-pink { --sw: #db3f8c; }
.size-sample { line-height: 1; }
.size-sample.s1 { font-size: 0.75rem; }
.size-sample.s2 { font-size: 0.9rem; }
.size-sample.s3 { font-size: 1.05rem; }
.size-sample.s4 { font-size: 1.2rem; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.switch { position: relative; flex: none; width: 2.5rem; height: 1.4rem; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background-color 0.15s ease-out; pointer-events: none; }
.switch span::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(1.1rem); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.prefs-reset {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.prefs-reset:hover { border-color: var(--muted); color: var(--text); }
@media (prefers-reduced-motion: reduce) { .prefs-panel { animation: none; } }
@media print { .prefs { display: none; } }

/* Edit suggestions */
.suggest-link { color: inherit; }
.suggestion { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.suggestion header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; font-weight: 600; }
.suggestion p { margin: 0.35rem 0; }
.status { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--code-bg); color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.status-accepted { color: var(--ok); }
.status-rejected { color: var(--danger); }
.review-note, .suggest-note { padding: 0.5rem 0.75rem; border-left: 3px solid var(--border); background: var(--code-bg); white-space: pre-line; }
.suggest-note { margin: 1rem 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 1rem 0; }
.tabs a { color: var(--text); text-decoration: none; font-weight: 600; }
.tabs a[aria-current] { color: var(--accent); text-decoration: underline; text-underline-offset: 6px; }
.diff { overflow-x: auto; padding: 0.75rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); font-family: var(--mono); font-size: 0.85rem; line-height: 1.45; }
.diff span { display: block; min-height: 1.45em; padding: 0 0.75rem; white-space: pre-wrap; }
.diff-add { background: color-mix(in srgb, var(--ok) 18%, transparent); }
.diff-del { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.diff-hunk { color: var(--muted); }

/* Admin: FAQ and glossary editor */
.tabs-sep { color: var(--border); }
.row-actions { display: flex; gap: 0.35rem; justify-content: flex-end; white-space: nowrap; }
.row-actions form { margin: 0; }
button.small, .button.small { padding: 0.15rem 0.55rem; }
/* Page title with an "Edit" button beside it; the button drops below a long title on narrow screens. */
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.title-row h1 { margin-bottom: 0; }
.edit-button { display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; font-size: 0.9rem; font-weight: 600; }
.edit-icon { width: 1em; height: 1em; }
button:disabled { opacity: 0.35; cursor: default; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1.5rem 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.danger-zone label { display: flex; align-items: center; gap: 0.5rem; }

/* Admin: missing translation warnings */
.translation-alerts { margin: 1rem 0 1.5rem; padding: 0.75rem 1rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--warn-bg); }
.translation-alerts summary { font-weight: 600; cursor: pointer; }
.translation-alerts ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.translation-alerts li { margin: 0.35rem 0; }
.translation-alerts li a { margin-left: 0.6rem; white-space: nowrap; }
.translation-ok { color: var(--ok); }

/* Admin: created / modified by */
.stamp { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.5rem; }
td .stamp { font-size: 0.9rem; }
.stamps .stamp { margin-right: 0.15rem; }

/* Contributors leaderboard */
.leaderboard { margin: 1rem 0; padding: 0; list-style: none; }
.lb-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border); }
.lb-rank { flex: none; width: 2rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.lb-avatar { width: 2.5rem; height: 2.5rem; }
.lb-who { display: grid; flex: 1; min-width: 0; gap: 0.1rem; }
.lb-name { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
a.lb-name { text-decoration: none; }
a.lb-name:hover { color: var(--accent); text-decoration: underline; }
.lb-detail { color: var(--muted); font-size: 0.85rem; }
.lb-total { flex: none; text-align: right; }
.lb-total strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.lb-total span { color: var(--muted); font-size: 0.85rem; }
.lb-top { border-radius: var(--radius); background: var(--surface); }
.lb-top .lb-rank { display: grid; place-items: center; height: 2rem; border-radius: 50%; color: #1b1b1b; }
.lb-top-1 .lb-rank { background: #f5c542; }
.lb-top-2 .lb-rank { background: #c9ced6; }
.lb-top-3 .lb-rank { background: #d9925b; }
.lb-cta { margin-top: 1.5rem; color: var(--muted); }

/* Article change history and public edit suggestions */
.history { margin: 1rem 0; padding: 0; list-style: none; }
.history-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.85rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.history-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.history-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.history-tags a.status { text-decoration: none; }
.history-tags a.status:hover { color: var(--accent); }
.history-stats { margin-left: auto; font-family: var(--mono); font-size: 0.85rem; }
.diff-plus { color: var(--ok); }
.diff-minus { color: var(--danger); }
details.preview > summary { cursor: pointer; font-weight: 600; }
.suggestion-note { color: var(--muted); }

/* User profile and settings */
a.user-chip { color: var(--text); text-decoration: none; }
a.user-chip:hover { color: var(--accent); text-decoration: underline; }
.profile-head { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.profile-head h1 { margin: 0; overflow-wrap: anywhere; }
.profile-head .meta { margin: 0.25rem 0 0; }
.profile-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.profile-github { display: inline-flex; align-items: center; gap: 0.35rem; }
.profile-github svg { width: 1rem; height: 1rem; }
.profile-avatar { width: 5rem; height: 5rem; font-size: 2rem; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.5rem; margin: 1.25rem 0 2rem; }
.profile-stats div { padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.profile-stats dt { color: var(--muted); font-size: 0.85rem; }
.profile-stats dd { margin: 0.15rem 0 0; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.settings-form fieldset { display: grid; gap: 0.35rem; margin: 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.settings-form legend { padding: 0 0.35rem; font-weight: 700; }
.setting-hint { margin: 0 0 0.75rem 1.6rem; font-weight: 400; }

/* Uploaded files: admin page and the editor's file picker */
.upload-form, .files-search { max-width: 32rem; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.75rem; margin: 1rem 0; padding: 0; list-style: none; }
.file-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.file-thumb { display: grid; place-items: center; height: 9rem; background: var(--code-bg); text-decoration: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: contain; }
.file-type { color: var(--muted); font-family: var(--mono); font-size: 1.25rem; font-weight: 700; }
.file-info { display: grid; align-content: start; gap: 0.35rem; padding: 0.65rem 0.75rem; min-width: 0; }
.file-name { overflow-wrap: anywhere; }
.file-md { overflow-wrap: anywhere; padding: 0.25rem 0.4rem; border-radius: 4px; background: var(--code-bg); font: 0.75rem var(--mono); user-select: all; }
.file-delete { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.file-delete label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; }

.file-picker {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(36rem, calc(100dvh - 2rem));
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.file-picker[open] { display: flex; flex-direction: column; gap: 0.6rem; }
.file-picker::backdrop { background: rgb(0 0 0 / 0.45); }
.fp-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.fp-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fp-search { flex: 1 1 12rem; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; }
.fp-upload { padding: 0.45rem 0.8rem; }
.fp-status { min-height: 1.2em; margin: 0; }
.fp-list { display: grid; gap: 0.3rem; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.fp-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.fp-item:hover, .fp-item:focus-visible { border-color: var(--border); background: var(--code-bg); }
.fp-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fp-thumb { display: grid; place-items: center; width: 3rem; height: 2.25rem; overflow: hidden; border-radius: 4px; background: var(--code-bg); color: var(--muted); font: 700 0.7rem var(--mono); }
.fp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-manage { align-self: flex-end; font-size: 0.85rem; }

/* Home page: contributor chips */
.home-contributors { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.home-contributors h2 { margin: 0 0 0.25rem; }
.contributor-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; padding: 0; list-style: none; }
.contributor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.3rem 0.4rem 0.3rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
a.contributor-chip:hover { border-color: var(--accent); color: var(--accent); }
a.contributor-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.contributor-chip > span:not([class]) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contributor-count { min-width: 1.5rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--code-bg); color: var(--muted); font-size: 0.8rem; text-align: center; font-variant-numeric: tabular-nums; }

/* Markdown editor toolbar (main.js wraps every textarea.editor) */
.md-editor { display: grid; }
.md-toolbar {
  position: sticky;
  top: var(--header-h, 0);
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--code-bg);
  font-weight: 400;
}
.md-group { display: flex; gap: 0.1rem; }
.md-group + .md-group { padding-left: 0.25rem; border-left: 1px solid var(--border); }
.md-toolbar button {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.35rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}
.md-toolbar button:hover { border-color: var(--border); background: var(--surface); color: var(--accent); }
.md-toolbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.md-toolbar svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.form .md-toolbar .md-lang { width: auto; height: 2rem; padding: 0 0.4rem; background: var(--surface); font-size: 0.85rem; }
.md-editor textarea { border-top-left-radius: 0; border-top-right-radius: 0; }

/* Diagnostic guide: with JS (html.js) one node shows at a time; without it they are listed. */
.guide-cta { margin: 1.25rem 0; }
.guide { max-width: 44rem; margin-inline: auto; }
.guide-node {
  margin: 1rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.guide-node h2 { margin-top: 0; font-size: 1.25rem; }
.guide-node h2:focus { outline: none; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0; }
.guide-help { border-color: var(--accent); }
.js .guide-node { display: none; }
.js .guide-node.is-active { display: block; }
.guide-nav { display: flex; gap: 0.75rem; }
.guide-nav button { background: transparent; color: var(--accent); }
.guide-nav[hidden] { display: none; }

/* Image gallery in articles: equal-sized thumbnails (tall screenshots are cropped from the top),
   a click opens the lightbox from main.js; without JS the thumbnail links to the full image. */
.prose .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.prose .gallery figure { display: flex; flex-direction: column; margin: 0; }
.prose .gallery a { display: block; line-height: 0; }
.prose .gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; cursor: zoom-in; }
.prose .gallery a:hover img, .prose .gallery a:focus-visible img { border-color: var(--accent); }
.prose .gallery a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.prose .gallery figcaption { font-size: 0.8rem; }

.lightbox {
  width: min(92vw, 70rem);
  max-width: none;
  max-height: 92vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: rgb(10 12 14 / 0.75); }
.lightbox-stage { display: grid; place-items: center; min-height: 0; flex: 1; padding: 0.75rem; background: var(--code-bg); overflow: auto; }
.lightbox-stage img { max-width: 100%; max-height: calc(92vh - 9rem); object-fit: contain; }
.lightbox-caption { margin: 0; padding: 0.75rem 1rem; font-size: 0.95rem; }
.lightbox-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0 1rem 0.75rem; }
.lightbox-count { margin-right: auto; color: var(--muted); font-size: 0.85rem; }
.lightbox-bar button { padding: 0.3rem 0.9rem; background: transparent; color: var(--accent); }
.lightbox-bar button:disabled { opacity: 0.35; cursor: default; }
