/*
 * TutorCat user guide. The revamp design system (apps/web/src/styles/
 * tokens.css), restated for a static site: same colours, type, radii and
 * motion. Every colour below is a token; light and dark both supported.
 * No inline styles anywhere: the production CSP has style-src 'self'.
 */

/* ------------------------------------------------------------ tokens --- */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013;
  --surface: #161a1f;
  --surface2: #1e242c;
  --line: #262d36;
  --line2: #343d48;
  --text: #f3f5f7;
  --muted: #98a2ae;
  --accent: #6ef2c8;
  --accent-ink: #062a20;
  --accent2: #9b8cff;
  --danger: #ff6b6b;
  --accent-text: #6ef2c8;
  --accent2-text: #9b8cff;
  --danger-text: #ff6b6b;
  --success-text: #4ed17a;
  --warning-text: #ffc14d;
  --math-text: #ff7a59;
  --phys-text: #8b7bff;
  --bio-text: #4ed17a;
  --eng-text: #4fb7ff;
  --chem-text: #ffc14d;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.25);
  --shadow-float: 0 12px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 20px 40px rgba(0, 0, 0, 0.35);
  --shadow-dialog: 0 30px 80px rgba(0, 0, 0, 0.5);
  --glow: 0.16;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #edf1f5;
  --line: #e2e7ed;
  --line2: #cfd6de;
  --text: #141920;
  --muted: #5b6673;
  --accent: #22d3a5;
  --accent-ink: #062a20;
  --accent2: #7c6cf6;
  --danger: #e5484d;
  --accent-text: #0b7f61;
  --accent2-text: #6352e0;
  --danger-text: #c93439;
  --success-text: #1e7a3f;
  --warning-text: #8a5a00;
  --math-text: #b93c12;
  --phys-text: #5b4be0;
  --bio-text: #1e7a3f;
  --eng-text: #0b6fb0;
  --chem-text: #8a5a00;
  --scrim: rgba(20, 25, 32, 0.55);
  --shadow-sm: 0 2px 8px rgba(20, 25, 32, 0.08);
  --shadow-card: 0 12px 30px rgba(20, 25, 32, 0.06);
  --shadow-float: 0 12px 30px rgba(20, 25, 32, 0.08);
  --shadow-lift: 0 20px 40px rgba(20, 25, 32, 0.12);
  --shadow-dialog: 0 30px 80px rgba(20, 25, 32, 0.25);
  --glow: 0.22;
}

/* Without JavaScript (theme.js never ran): follow the system. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface2: #edf1f5;
    --line: #e2e7ed;
    --line2: #cfd6de;
    --text: #141920;
    --muted: #5b6673;
    --accent: #22d3a5;
    --accent2: #7c6cf6;
    --accent-text: #0b7f61;
    --accent2-text: #6352e0;
    --warning-text: #8a5a00;
    --math-text: #b93c12;
    --phys-text: #5b4be0;
    --eng-text: #0b6fb0;
    --scrim: rgba(20, 25, 32, 0.55);
    --shadow-sm: 0 2px 8px rgba(20, 25, 32, 0.08);
    --shadow-card: 0 12px 30px rgba(20, 25, 32, 0.06);
    --shadow-float: 0 12px 30px rgba(20, 25, 32, 0.08);
    --shadow-lift: 0 20px 40px rgba(20, 25, 32, 0.12);
    --shadow-dialog: 0 30px 80px rgba(20, 25, 32, 0.25);
    --glow: 0.22;
  }
}

:root {
  --math: #ff7a59;
  --math-ink: #2b0f08;
  --phys: #8b7bff;
  --phys-ink: #17104a;
  --bio: #4ed17a;
  --bio-ink: #0a2e15;
  --eng: #4fb7ff;
  --eng-ink: #07263d;
  --chem: #ffc14d;
  --chem-ink: #3a2a00;

  --font-display: "Fredoka", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --fs-hero: 56px;
  --fs-display: 44px;
  --fs-title: 28px;
  --fs-heading: 18px;
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-caption: 13px;
  --fs-label: 12px;
  --ls-label: 0.14em;

  --gutter: 40px;
  --topbar-h: 68px;
  --sidenav-w: 280px;
  --toc-w: 220px;
  --article-max: 760px;

  --r-8: 8px;
  --r-10: 10px;
  --r-12: 12px;
  --r-14: 14px;
  --r-16: 16px;
  --r-20: 20px;
  --r-24: 24px;
  --r-28: 28px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.2, 1.4, 0.4, 1);
  --dur-fast: 150ms;
  --dur-ui: 200ms;
  --dur-rise: 350ms;
  --stagger: 60ms;
  --rise-distance: 14px;

  --z-sticky: 10;
  --z-nav: 20;
  --z-overlay: 50;
}

@media (max-width: 767px) {
  :root {
    --gutter: 16px;
    --fs-display: 34px;
    --fs-title: 22px;
    --fs-hero: 40px;
    --topbar-h: 60px;
  }
}

html[data-motion="reduce"] {
  --dur-fast: 0ms;
  --dur-ui: 0ms;
  --dur-rise: 0ms;
  --stagger: 0ms;
  --rise-distance: 0px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-ui: 0ms;
    --dur-rise: 0ms;
    --stagger: 0ms;
    --rise-distance: 0px;
  }
}

/* Role hues: a fill and the ink that reads on it (all inks clear 5:1). */
.hue-accent {
  --hue: var(--accent);
  --hue-ink: var(--accent-ink);
}
.hue-eng {
  --hue: var(--eng);
  --hue-ink: var(--eng-ink);
}
.hue-math {
  --hue: var(--math);
  --hue-ink: var(--math-ink);
}
.hue-phys {
  --hue: var(--phys);
  --hue-ink: var(--phys-ink);
}
.hue-bio {
  --hue: var(--bio);
  --hue-ink: var(--bio-ink);
}
.hue-chem {
  --hue: var(--chem);
  --hue-ink: var(--chem-ink);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="reduce"]) {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2.5px;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: var(--r-8);
}

button {
  font: inherit;
  color: inherit;
}

kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--r-8);
  border: 1px solid var(--line2);
  background: var(--surface2);
  color: var(--muted);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  flex: none;
  display: block;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  text-decoration: none;
  transition: top var(--dur-ui) var(--ease-out);
}

.skip:focus {
  top: 12px;
}

/* ----------------------------------------------------------- motion --- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(var(--rise-distance));
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  40% {
    transform: rotate(6deg) scale(1.06);
  }
  70% {
    transform: rotate(-3deg);
  }
}

.rise {
  animation: rise var(--dur-rise) var(--ease-out) both;
}

.stagger > * {
  animation: rise var(--dur-rise) var(--ease-out) both;
}

.stagger > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.stagger > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.stagger > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.stagger > :nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
.stagger > :nth-child(6) { animation-delay: calc(var(--stagger) * 5); }
.stagger > :nth-child(7) { animation-delay: calc(var(--stagger) * 6); }
.stagger > :nth-child(8) { animation-delay: calc(var(--stagger) * 7); }
.stagger > :nth-child(9) { animation-delay: calc(var(--stagger) * 8); }
.stagger > :nth-child(n + 10) { animation-delay: calc(var(--stagger) * 9); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  animation: none !important;
  transition: none !important;
}

/* ---------------------------------------------------------- top bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex: none;
  border-radius: var(--r-12);
}

.brandmark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 33%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  transform: rotate(-6deg);
  transition: transform var(--dur-ui) var(--ease-spring);
}

.brand:hover .brandmark {
  transform: rotate(4deg) scale(1.06);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand__name span {
  color: var(--muted);
  font-weight: 500;
}

.topbar__spacer {
  flex: 1;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  width: min(380px, 100%);
  padding: 0 10px 0 14px;
  margin-left: auto;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line2);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-small);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.search-trigger:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-trigger span {
  flex: 1;
  text-align: left;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.icon-btn:hover {
  background: var(--surface2);
}

.icon-btn:active {
  transform: scale(0.94);
}

.theme-toggle .icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon--sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon--moon {
  display: none;
}

.topbar__app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: var(--fs-small);
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.topbar__app:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-float);
}

.nav-toggle {
  display: none;
}

@media (max-width: 1023px) {
  .nav-toggle {
    display: inline-grid;
  }
}

@media (max-width: 767px) {
  .topbar {
    gap: 8px;
  }
  .brand__name span,
  .topbar__app {
    display: none;
  }
  .search-trigger {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }
}

/* ----------------------------------------------------------- layout --- */
.layout {
  display: grid;
  grid-template-columns: var(--sidenav-w) minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
}

.layout--toc {
  grid-template-columns: var(--sidenav-w) minmax(0, 1fr) var(--toc-w);
}

.layout--home {
  display: block;
  max-width: none;
}

main {
  min-width: 0;
  padding: 40px var(--gutter) 64px;
}

main:focus {
  outline: none;
}

@media (max-width: 1279px) {
  .layout--toc {
    grid-template-columns: var(--sidenav-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 1023px) {
  .layout,
  .layout--toc {
    display: block;
  }
  main {
    padding-top: 28px;
  }
}

/* ---------------------------------------------------------- sidenav --- */
.sidenav {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 16px 32px 24px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.sidenav__home {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: var(--r-14);
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-small);
  text-decoration: none;
}

.sidenav__home:hover {
  background: var(--surface2);
  color: var(--text);
}

.navgroup {
  margin-bottom: 6px;
}

.navgroup > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--r-14);
  cursor: pointer;
  font-weight: 800;
  font-size: var(--fs-small);
  color: var(--text);
  transition: background var(--dur-fast) var(--ease-out);
}

.navgroup > summary::-webkit-details-marker {
  display: none;
}

.navgroup > summary:hover {
  background: var(--surface2);
}

.navgroup > summary .chev {
  margin-left: auto;
  color: var(--muted);
  transition: transform var(--dur-ui) var(--ease-out);
}

.navgroup[open] > summary .chev {
  transform: rotate(180deg);
}

.navgroup__tile {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-10);
  background: var(--hue);
  color: var(--hue-ink);
}

.navgroup ul {
  list-style: none;
  margin: 2px 0 10px;
  padding: 0 0 0 26px;
  border-left: 0;
}

.navgroup li a {
  position: relative;
  display: block;
  padding: 8px 12px 8px 14px;
  border-radius: var(--r-12);
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.navgroup li a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--line2);
}

.navgroup li a:hover {
  background: var(--surface2);
  color: var(--text);
}

.navgroup li a[aria-current="page"] {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-weight: 800;
}

.navgroup li a[aria-current="page"]::before {
  background: var(--accent);
  width: 3px;
}

.navgroup__overview a {
  font-weight: 700;
}

.sidenav__pdf {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.scrim {
  display: none;
}

@media (max-width: 1023px) {
  .sidenav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--z-overlay);
    width: min(320px, 86vw);
    height: 100%;
    padding-top: 20px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-dialog);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform var(--dur-rise) var(--ease-out), visibility 0s linear var(--dur-rise);
  }
  .nav-open .sidenav {
    transform: none;
    visibility: visible;
    transition: transform var(--dur-rise) var(--ease-out);
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-overlay) - 1);
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-ui) var(--ease-out);
  }
  .nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .nav-open {
    overflow: hidden;
  }
}

.sidenav__close {
  display: none;
}

@media (max-width: 1023px) {
  .sidenav__close {
    display: inline-grid;
    margin: 0 0 12px auto;
  }
  .sidenav__top {
    display: flex;
  }
}

/* ------------------------------------------------------- breadcrumbs --- */
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--muted);
}

.crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.crumbs li + li::before {
  content: "/";
  color: var(--line2);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-8);
}

.crumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* --------------------------------------------------------------- page --- */
.article {
  max-width: var(--article-max);
  margin: 0 auto;
}

.layout--toc .article {
  margin: 0;
}

@media (min-width: 1280px) {
  .layout--toc main {
    padding-right: 24px;
  }
  .layout--toc .article {
    margin: 0 auto;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hue, var(--accent));
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-display);
  line-height: 1.05;
  margin: 0 0 14px;
}

.lead {
  margin: 0 0 24px;
  font-size: 19px;
  line-height: 1.55;
  color: var(--muted);
  font-weight: 500;
  max-width: 62ch;
  text-wrap: pretty;
}

.page-head {
  padding-bottom: 24px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.page-head__row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.page-head__tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--r-16);
  background: var(--hue);
  color: var(--hue-ink);
  transform: rotate(-4deg);
  margin-top: 4px;
}

.page-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

@media (max-width: 767px) {
  .page-head__tile {
    width: 44px;
    height: 44px;
    border-radius: var(--r-14);
  }
  .lead {
    font-size: 17px;
  }
}

/* ------------------------------------------------------------- prose --- */
.prose {
  font-size: 17px;
  line-height: 1.7;
  text-wrap: pretty;
}

.prose > * {
  margin: 0;
}

.prose > * + * {
  margin-top: 1em;
}

.prose li p,
.callout__body p {
  margin: 0;
}

.prose li p + p,
.callout__body p + p:not(.callout__title + p) {
  margin-top: 0.6em;
}

.prose h2 {
  font-size: var(--fs-title);
  margin: 2em 0 0.55em;
}

.prose h3 {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0;
  margin: 1.8em 0 0.4em;
}

.prose h4 {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: var(--fs-body);
  margin: 1.5em 0 0.3em;
}

.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0.8em;
}

.prose h2,
.prose h3,
.prose h4 {
  position: relative;
}

.anchor {
  position: absolute;
  left: -1.1em;
  width: 1em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

@media (max-width: 767px) {
  .anchor {
    display: none;
  }
}

.prose strong {
  font-weight: 800;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 1em 0 0;
}

.prose li + li {
  margin-top: 0.45em;
}

.prose li > p + * {
  margin-top: 0.6em;
}

/* Numbered steps: the over-the-shoulder numbers, styled like the badges. */
.prose ol {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}

.prose ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 46px;
  min-height: 32px;
}

.prose ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05em;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  background: var(--surface2);
  border: 1.5px solid var(--line2);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
}

.prose ul {
  list-style: none;
  padding-left: 0;
}

.prose ul > li {
  position: relative;
  padding-left: 24px;
}

.prose ul > li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.68em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.12em 0.4em;
  border-radius: var(--r-8);
  background: var(--surface2);
  border: 1px solid var(--line);
}

.prose pre {
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: var(--r-16);
  background: var(--surface2);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4em 0;
}

.prose blockquote {
  margin: 1.2em 0 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--line2);
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-16);
  background: var(--surface);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.prose th {
  background: var(--surface2);
  font-weight: 800;
  font-size: var(--fs-small);
}

.prose tr:last-child td {
  border-bottom: 0;
}

/* --------------------------------------------------------- callouts --- */
.callout {
  --c: var(--accent);
  --c-text: var(--accent-text);
  display: flex;
  gap: 14px;
  margin: 1.4em 0 0;
  padding: 16px 18px;
  border-radius: var(--r-20);
  background: color-mix(in srgb, var(--c) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 38%, var(--line));
  font-size: 16px;
  line-height: 1.6;
}

.callout--good,
.callout--note {
  --c: var(--eng);
  --c-text: var(--eng-text);
}

.callout--safety {
  --c: var(--accent2);
  --c-text: var(--accent2-text);
}

.callout--warning {
  --c: var(--chem);
  --c-text: var(--warning-text);
}

.callout__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-12);
  background: var(--c);
  color: var(--accent-ink);
}

.callout--safety .callout__icon {
  color: var(--phys-ink);
}

.callout--good .callout__icon,
.callout--note .callout__icon {
  color: var(--eng-ink);
}

.callout--warning .callout__icon {
  color: var(--chem-ink);
}

.callout__body {
  min-width: 0;
  padding-top: 5px;
}

.callout__body > * + * {
  margin-top: 0.6em;
}

.prose .callout__title {
  margin: 0 0 4px;
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  font-weight: 800;
  color: var(--c-text);
}

/* ------------------------------------------------------ screenshots --- */
.shot {
  margin: 1.5em 0 0;
}

.shot__zoom {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-16);
  background: var(--surface2);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-ui) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out), border-color var(--dur-ui) var(--ease-out);
}

.shot__zoom img {
  display: block;
  width: 100%;
  height: auto;
}

.shot__zoom:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line2);
}

.shot__hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.shot__zoom:hover .shot__hint,
.shot__zoom:focus-visible .shot__hint {
  opacity: 1;
  transform: none;
}

.figure--phone {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.figure--phone .shot__zoom {
  border-radius: var(--r-28);
}

.shot figcaption {
  margin-top: 10px;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 0 0 !important;
  padding: 0 !important;
  list-style: none;
  counter-reset: none;
}

.prose .legend > li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  min-height: 0;
  color: var(--text);
  font-weight: 700;
}

.prose .legend > li::before {
  content: none;
}

.badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
}

.shot__placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  aspect-ratio: 16 / 10;
  border: 1.5px dashed var(--line2);
  border-radius: var(--r-16);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-small);
  align-content: center;
}

.figure--phone .shot__placeholder {
  aspect-ratio: 393 / 852;
}

/* ------------------------------------------------------------ buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line2);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  font-size: var(--fs-small);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  box-shadow: var(--shadow-float);
}

.btn--sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: var(--fs-caption);
}

.btn--block {
  width: 100%;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface2);
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 700;
}

/* -------------------------------------------------------- inline toc --- */
.toc-inline {
  margin: 20px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r-16);
  background: var(--surface);
}

.toc-inline > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  font-size: var(--fs-small);
}

.toc-inline > summary::-webkit-details-marker {
  display: none;
}

.toc-inline > summary .chev {
  margin-left: auto;
  color: var(--muted);
  transition: transform var(--dur-ui) var(--ease-out);
}

.toc-inline[open] > summary .chev {
  transform: rotate(180deg);
}

.toc-inline .toc__list {
  padding: 0 16px 14px;
}

@media (min-width: 1280px) {
  .layout--toc .toc-inline {
    display: none;
  }
}

/* ---------------------------------------------------------- side toc --- */
.toc {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 40px 24px 32px 0;
}

.toc__title {
  margin: 0 0 12px;
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc__list a {
  display: block;
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  border-radius: 0;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.toc__list .lvl-3 a {
  padding-left: 26px;
}

.toc__list a:hover {
  color: var(--text);
}

.toc__list a.is-active {
  color: var(--accent-text);
  border-left-color: var(--accent);
  font-weight: 800;
}

.toc__pdf {
  margin-top: 24px;
}

/* -------------------------------------------------------- prev / next --- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  border-radius: var(--r-20);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur-ui) var(--ease-out), border-color var(--dur-ui) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out);
}

.pager a:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
}

.pager__dir {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
}

.pager__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.25;
}

.pager__next {
  grid-column: 2;
  text-align: right;
  align-items: flex-end;
}

@media (max-width: 599px) {
  .pager {
    grid-template-columns: 1fr;
  }
  .pager__next {
    grid-column: 1;
  }
}

/* ------------------------------------------------------- role landing --- */
.topics {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.topic {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--r-20);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur-ui) var(--ease-out), border-color var(--dur-ui) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out);
}

.topic:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--hue) 60%, var(--line));
  box-shadow: var(--shadow-card);
}

.topic__n {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-12);
  background: color-mix(in srgb, var(--hue) 18%, var(--surface2));
  color: var(--text);
}

.topic__text {
  flex: 1;
  min-width: 0;
}

.topic__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
}

.topic__summary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.topic__go {
  align-self: center;
  color: var(--muted);
  transition: transform var(--dur-ui) var(--ease-out), color var(--dur-ui) var(--ease-out);
}

.topic:hover .topic__go {
  transform: translateX(4px);
  color: var(--text);
}

.empty {
  margin-top: 28px;
  padding: 28px;
  border: 1.5px dashed var(--line2);
  border-radius: var(--r-20);
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

/* --------------------------------------------------------------- home --- */
.hero {
  position: relative;
  padding: 72px var(--gutter) 28px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}

/* Two soft glows behind the home hero, painted on the page itself so they
   fade out with no box edge. */
.page-home {
  background:
    radial-gradient(520px 420px at calc(50% - 340px) -60px, color-mix(in srgb, var(--accent) calc(var(--glow) * 100%), transparent), transparent 70%),
    radial-gradient(560px 440px at calc(50% + 360px) -40px, color-mix(in srgb, var(--accent2) calc(var(--glow) * 100%), transparent), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
}

.hero__mark {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 33%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  transform: rotate(-6deg);
  box-shadow: var(--shadow-float);
}

.hero h1 {
  font-size: var(--fs-hero);
  margin: 0 auto 14px;
  max-width: 14ch;
}

.accent {
  background: linear-gradient(90deg, var(--accent-text), var(--accent2-text));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lead {
  margin: 0 auto;
  max-width: 54ch;
}

.hero__search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(620px, 100%);
  height: 60px;
  margin: 32px auto 0;
  padding: 0 14px 0 22px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line2);
  background: var(--surface);
  color: var(--muted);
  font-size: 17px;
  cursor: text;
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.hero__search:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-card);
}

.hero__search span {
  flex: 1;
  text-align: left;
}

.roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px var(--gutter) 24px;
  list-style: none;
}

@media (min-width: 1200px) {
  .roles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .roles {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.role-card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 24px 22px;
  border-radius: var(--r-24);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 70% at 100% 0%, color-mix(in srgb, var(--hue) 20%, transparent), transparent 60%),
    var(--surface);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--dur-ui) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out), border-color var(--dur-ui) var(--ease-out);
}

.role-card__link {
  color: inherit;
  text-decoration: none;
  border-radius: var(--r-8);
}

/* The whole card is the hit area of its main link. */
.role-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.role-card:hover,
.role-card:focus-within {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--hue) 65%, var(--line));
  box-shadow: var(--shadow-lift);
}

.role-card__link:focus-visible {
  outline: none;
}

.role-card:has(.role-card__link:focus-visible) {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.role-card__tile {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-16);
  background: var(--hue);
  color: var(--hue-ink);
  transform: rotate(-6deg);
  box-shadow: var(--shadow-sm);
}

.role-card:hover .role-card__tile {
  animation: wiggle 600ms var(--ease-out);
}

.role-card__title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.1;
}

.role-card__who {
  margin: 0;
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
  text-wrap: balance;
}

.role-card__blurb {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  flex: 1;
}

.role-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-small);
  font-weight: 800;
}

.role-card__go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.role-card__go .icon {
  transition: transform var(--dur-ui) var(--ease-out);
}

.role-card:hover .role-card__go .icon {
  transform: translateX(4px);
}

.role-card__pdf {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-caption);
  text-decoration: none;
  border-radius: var(--r-8);
}

.role-card__pdf:hover {
  color: var(--text);
  text-decoration: underline;
}

.home-pdf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  max-width: 1120px;
  margin: 8px auto 0;
  padding: 0 var(--gutter) 72px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 600;
  text-align: center;
}

/* ------------------------------------------------------------- footer --- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px var(--gutter) 40px;
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 600;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* ------------------------------------------------------------ dialogs --- */
dialog {
  color: var(--text);
}

dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

dialog[open] {
  animation: rise var(--dur-rise) var(--ease-out) both;
}

dialog[open]::backdrop {
  animation: fade var(--dur-ui) var(--ease-out) both;
}

/* Search */
.search {
  width: min(680px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 96px));
  margin: 72px auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-24);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
  overflow: hidden;
}

.search[open] {
  display: flex;
  flex-direction: column;
}

.search__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.search__input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 600 18px/1.2 var(--font-body);
}

.search__input::placeholder {
  color: var(--muted);
}

.search__input:focus {
  outline: none;
}

.search__input::-webkit-search-cancel-button {
  display: none;
}

.search__bar,
.search__filters,
.search__foot {
  flex: none;
}

.search__filters {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.filter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line2);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-caption);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.filter:hover {
  border-color: var(--accent);
}

.filter[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.filter .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hue);
}

.search__results {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 8px;
  list-style: none;
}

.result a {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-16);
  color: var(--text);
  text-decoration: none;
}

.result a:hover,
.result[aria-selected="true"] a {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface2));
}

.result[aria-selected="true"] a {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent);
}

.result__tile {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-12);
  background: var(--hue);
  color: var(--hue-ink);
}

.result__body {
  min-width: 0;
  flex: 1;
}

.result__title {
  display: block;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.35;
}

.result__section {
  color: var(--muted);
  font-weight: 700;
}

.result__meta {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
}

.result__snippet {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-caption);
  line-height: 1.5;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search mark {
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--text);
  border-radius: 3px;
  padding: 0 1px;
}

.search__empty {
  padding: 28px 20px 32px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-small);
}

.search__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.search__foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 767px) {
  .search {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: 0;
  }
  .search__foot {
    display: none;
  }
}

/* Lightbox */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
}

.lightbox::backdrop {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--gutter);
  position: relative;
  z-index: 1;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
}

.lightbox__caption {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-weight: 700;
  font-size: var(--fs-small);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox__count {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 700;
  white-space: nowrap;
}

.lightbox__stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 0 var(--gutter) var(--gutter);
  overscroll-behavior: contain;
}

.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 110px);
  width: auto;
  height: auto;
  border-radius: var(--r-16);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-dialog);
  cursor: zoom-in;
  background: var(--surface);
}

.lightbox.is-zoomed .lightbox__stage {
  place-items: start;
}

.lightbox.is-zoomed .lightbox__img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

/* ---------------------------------------------------------------- 404 --- */
.notfound {
  max-width: 640px;
  margin: 0 auto;
  padding: 80px var(--gutter);
  text-align: center;
}

.notfound__code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 96px;
  line-height: 1;
  margin: 0 0 12px;
}

.notfound .btn {
  margin: 6px;
}

/* -------------------------------------------------------------- print --- */
@media print {
  :root,
  [data-theme] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface2: #f2f4f7;
    --text: #141920;
    --muted: #4a5561;
    --line: #dde3ea;
    --line2: #c5ced8;
    --accent: #22d3a5;
    --accent-text: #0b7f61;
    --shadow-card: none;
  }
  body {
    background: #fff;
  }
  .topbar,
  .sidenav,
  .scrim,
  .toc,
  .toc-inline,
  .pager,
  .site-footer,
  .skip,
  .anchor,
  .shot__hint,
  .page-head__meta,
  dialog {
    display: none !important;
  }
  .layout,
  .layout--toc {
    display: block;
  }
  main {
    padding: 0;
  }
  .article {
    max-width: none;
  }
  .shot,
  .callout,
  .table-wrap,
  pre {
    break-inside: avoid;
  }
  h2,
  h3 {
    break-after: avoid;
  }
  .shot__zoom {
    box-shadow: none;
  }
  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: var(--muted);
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Generated by build.mjs: numbered lists that start past 1. */
.prose ol[start="2"]{counter-reset:step 1}
.prose ol[start="3"]{counter-reset:step 2}
.prose ol[start="4"]{counter-reset:step 3}
.prose ol[start="5"]{counter-reset:step 4}
.prose ol[start="6"]{counter-reset:step 5}
.prose ol[start="7"]{counter-reset:step 6}
.prose ol[start="8"]{counter-reset:step 7}
.prose ol[start="9"]{counter-reset:step 8}
.prose ol[start="10"]{counter-reset:step 9}
.prose ol[start="11"]{counter-reset:step 10}
.prose ol[start="12"]{counter-reset:step 11}
.prose ol[start="13"]{counter-reset:step 12}
.prose ol[start="14"]{counter-reset:step 13}
.prose ol[start="15"]{counter-reset:step 14}
.prose ol[start="16"]{counter-reset:step 15}
.prose ol[start="17"]{counter-reset:step 16}
.prose ol[start="18"]{counter-reset:step 17}
.prose ol[start="19"]{counter-reset:step 18}
.prose ol[start="20"]{counter-reset:step 19}
.prose ol[start="21"]{counter-reset:step 20}
.prose ol[start="22"]{counter-reset:step 21}
.prose ol[start="23"]{counter-reset:step 22}
.prose ol[start="24"]{counter-reset:step 23}
.prose ol[start="25"]{counter-reset:step 24}
.prose ol[start="26"]{counter-reset:step 25}
.prose ol[start="27"]{counter-reset:step 26}
.prose ol[start="28"]{counter-reset:step 27}
.prose ol[start="29"]{counter-reset:step 28}
.prose ol[start="30"]{counter-reset:step 29}
.prose ol[start="31"]{counter-reset:step 30}
.prose ol[start="32"]{counter-reset:step 31}
.prose ol[start="33"]{counter-reset:step 32}
.prose ol[start="34"]{counter-reset:step 33}
.prose ol[start="35"]{counter-reset:step 34}
.prose ol[start="36"]{counter-reset:step 35}
.prose ol[start="37"]{counter-reset:step 36}
.prose ol[start="38"]{counter-reset:step 37}
.prose ol[start="39"]{counter-reset:step 38}
.prose ol[start="40"]{counter-reset:step 39}
.prose ol[start="41"]{counter-reset:step 40}
.prose ol[start="42"]{counter-reset:step 41}
.prose ol[start="43"]{counter-reset:step 42}
.prose ol[start="44"]{counter-reset:step 43}
.prose ol[start="45"]{counter-reset:step 44}
.prose ol[start="46"]{counter-reset:step 45}
.prose ol[start="47"]{counter-reset:step 46}
.prose ol[start="48"]{counter-reset:step 47}
.prose ol[start="49"]{counter-reset:step 48}
.prose ol[start="50"]{counter-reset:step 49}
.prose ol[start="51"]{counter-reset:step 50}
.prose ol[start="52"]{counter-reset:step 51}
.prose ol[start="53"]{counter-reset:step 52}
.prose ol[start="54"]{counter-reset:step 53}
.prose ol[start="55"]{counter-reset:step 54}
.prose ol[start="56"]{counter-reset:step 55}
.prose ol[start="57"]{counter-reset:step 56}
.prose ol[start="58"]{counter-reset:step 57}
.prose ol[start="59"]{counter-reset:step 58}
.prose ol[start="60"]{counter-reset:step 59}
