/* Tokens : palette et typographie dans le style de la documentation discord.js
   (neutres zinc, accent blurple Discord, Geist). Les composants ne consomment que des rôles. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Typographie */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.625rem;
  --text-2xl: 2rem;
  --leading: 1.65;
  --measure: 72ch;

  /* Espacement (base 4) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Rayons : intérieur = extérieur - marge intérieure */
  --radius-lg: 10px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --radius-xs: 3px;

  /* Dimensions */
  --topbar-h: 3.5rem;
  --sidebar-w: 17rem;
  --toc-w: 13rem;
  --content-max: 52rem;

  /* Profondeur */
  --z-sticky: 20;
  --z-drawer: 30;
  --z-backdrop: 29;
  --z-modal: 50;

  /* Mouvement */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;

  /* Thème clair (base) */
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f4f4f5;
  --surface-hover: #f4f4f5;
  --code-bg: #f6f8fa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-muted: #52525b;
  --text-faint: #6b6b74;
  --accent: #4752c4;
  --accent-strong: #5865f2;
  --on-accent: #ffffff;
  --accent-soft: rgb(88 101 242 / 0.1);
  --focus: #5865f2;

  --ok: #1a7f37;
  --warn: #9a6700;
  --danger: #cf222e;

  --tk-keyword: #cf222e;
  --tk-string: #0a3069;
  --tk-number: #0550ae;
  --tk-function: #8250df;
  --tk-type: #953800;
  --tk-decorator: #8250df;
  --tk-builtin: #0550ae;
  --tk-comment: #6e7781;
  --tk-punct: #24292f;

  --shadow-float: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 32px -8px rgb(0 0 0 / 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #161618;
    --surface-2: #1f1f23;
    --surface-hover: #232327;
    --code-bg: #18181b;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --text-faint: #8d8d96;
    --accent: #8f99ff;
    --accent-strong: #5865f2;
    --on-accent: #ffffff;
    --accent-soft: rgb(88 101 242 / 0.16);
    --focus: #8f99ff;

    --ok: #3fb950;
    --warn: #d29922;
    --danger: #f85149;

    --tk-keyword: #ff7b72;
    --tk-string: #a5d6ff;
    --tk-number: #79c0ff;
    --tk-function: #d2a8ff;
    --tk-type: #ffa657;
    --tk-decorator: #d2a8ff;
    --tk-builtin: #79c0ff;
    --tk-comment: #8b949e;
    --tk-punct: #c9d1d9;

    --shadow-float: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -8px rgb(0 0 0 / 0.7);
  }
}

:root[data-theme="dark"] {
  --bg: #121214;
  --surface: #161618;
  --surface-2: #1f1f23;
  --surface-hover: #232327;
  --code-bg: #18181b;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-faint: #8d8d96;
  --accent: #8f99ff;
  --accent-strong: #5865f2;
  --on-accent: #ffffff;
  --accent-soft: rgb(88 101 242 / 0.16);
  --focus: #8f99ff;

  --ok: #3fb950;
  --warn: #d29922;
  --danger: #f85149;

  --tk-keyword: #ff7b72;
  --tk-string: #a5d6ff;
  --tk-number: #79c0ff;
  --tk-function: #d2a8ff;
  --tk-type: #ffa657;
  --tk-decorator: #d2a8ff;
  --tk-builtin: #79c0ff;
  --tk-comment: #8b949e;
  --tk-punct: #c9d1d9;

  --shadow-float: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -8px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* Base : reset, typographie, liens, focus. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + var(--space-4));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-2xl);
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: var(--text-md);
}

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

:not(pre) > code {
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text);
}

a > code,
a:not(.nav-link) :not(pre) > code {
  color: inherit;
}

kbd {
  font-size: var(--text-xs);
  padding: 0.1em 0.45em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--accent-soft);
}

img,
svg {
  max-width: 100%;
}

.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: -4rem;
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--accent-strong);
  color: var(--on-accent);
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-2);
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--dur-base);
  animation-timing-function: var(--ease-out);
}

.topbar {
  view-transition-name: topbar;
}

.sidebar {
  view-transition-name: sidebar;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Mise en page : barre du haut, barre latérale, contenu, sommaire. Mobile d'abord. */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--topbar-h);
  min-width: 0;
  padding-inline: max(var(--space-3), env(safe-area-inset-left)) max(var(--space-3), env(safe-area-inset-right));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}

.brand__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__suffix {
  color: var(--accent);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-inline-start: auto;
}

.shell {
  display: block;
}

.main {
  min-width: 0;
  outline: none;
}

.page {
  display: block;
  padding: var(--space-5) max(var(--space-4), env(safe-area-inset-left)) var(--space-7);
}

.article {
  max-width: var(--content-max);
  margin-inline: auto;
  min-width: 0;
}

.footer {
  max-width: var(--content-max);
  margin: 0;
  padding: var(--space-5) var(--space-4) var(--space-7);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.footer p {
  margin: 0 0 var(--space-1);
}

/* Barre latérale : tiroir sur mobile, colonne fixe dès 64rem */

.sidebar {
  position: fixed;
  inset: var(--topbar-h) auto 0 0;
  z-index: var(--z-drawer);
  width: min(var(--sidebar-w), 86vw);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}

.sidebar[data-open] {
  transform: none;
  visibility: visible;
  transition: transform var(--dur-base) var(--ease-out), visibility 0s;
}

.sidebar__scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-4) var(--space-3) var(--space-7);
  scrollbar-width: thin;
}

.sidebar-backdrop {
  position: fixed;
  inset: var(--topbar-h) 0 0;
  z-index: var(--z-backdrop);
  background: rgb(0 0 0 / 0.5);
}

.toc {
  display: none;
}

@media (min-width: 64rem) {
  .topbar .topbar__menu {
    display: none;
  }

  .shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100dvh - var(--topbar-h));
    width: auto;
    transform: none;
    visibility: visible;
    transition: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .page {
    padding-inline: var(--space-7);
  }
}

@media (min-width: 84rem) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--toc-w);
    gap: var(--space-7);
    max-width: calc(var(--content-max) + var(--toc-w) + var(--space-7) * 3);
    margin-inline: 0;
  }

  .article {
    margin-inline: 0;
  }

  .toc {
    display: block;
    position: sticky;
    top: calc(var(--topbar-h) + var(--space-6));
    align-self: start;
    max-height: calc(100dvh - var(--topbar-h) - var(--space-7));
    overflow-y: auto;
    font-size: var(--text-sm);
  }
}

/* Composants : contrôles, navigation, recherche, contenu, référence. */

/* Contrôles */

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.icon--sun {
  display: none;
}

:root[data-theme="dark"] .icon--sun {
  display: block;
}

:root[data-theme="dark"] .icon--moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon--sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon--moon {
    display: none;
  }
}

.version-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}

.version-select select {
  appearance: none;
  height: 2rem;
  padding: 0 1.75rem 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: 500 var(--text-xs) / 1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.version-select select:hover {
  border-color: var(--border-strong);
}

.version-select__chevron {
  position: absolute;
  inset-inline-end: 0.4rem;
  width: 0.9rem;
  height: 0.9rem;
  pointer-events: none;
  color: var(--text-muted);
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 2.25rem;
  padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}

.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.search-trigger__label,
.search-trigger__kbd {
  display: none;
}

@media (min-width: 48rem) {
  .search-trigger {
    width: clamp(12rem, 28vw, 22rem);
    margin-inline-start: var(--space-4);
  }

  .search-trigger__label {
    display: inline;
  }

  .search-trigger__kbd {
    display: inline;
    margin-inline-start: auto;
  }
}

.lang-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.lang-switch__item {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: 600 var(--text-xs) / 1.4 var(--font-mono);
  text-decoration: none;
}

.lang-switch__item:hover {
  color: var(--text);
}

.lang-switch__item[aria-current] {
  background: var(--surface-2);
  color: var(--text);
}

@media (max-width: 30rem) {
  .topbar {
    gap: var(--space-2);
  }

  .topbar__actions a.icon-button {
    display: none;
  }

  .brand__name {
    display: none;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--accent-strong);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

/* Navigation latérale */

.nav-group + .nav-group {
  margin-top: var(--space-5);
}

.nav-group__title {
  margin: 0 0 var(--space-2);
  padding-inline: var(--space-2);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0;
}

.nav-group__link {
  color: inherit;
  text-decoration: none;
}

.nav-group__link[aria-current] {
  color: var(--accent);
}

.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2rem;
  padding: 0.25rem var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-link[aria-current] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-link--code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-wrap: normal;
}

.nav-filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0 var(--space-2);
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-faint);
}

.nav-filter:focus-within {
  border-color: var(--focus);
}

.nav-filter input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  outline: none;
}

.nav-filter input::placeholder {
  color: var(--text-faint);
}

.nav-empty {
  margin: 0;
  padding: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.nav-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
  padding: 0.25rem var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 550;
  cursor: pointer;
  list-style: none;
}

.nav-section__title::-webkit-details-marker {
  display: none;
}

.nav-section__title:hover {
  background: var(--surface-hover);
}

.nav-section__chevron {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--text-faint);
  transform: rotate(-90deg);
  transition: transform var(--dur-fast) var(--ease-out);
}

.nav-section[open] > .nav-section__title .nav-section__chevron {
  transform: none;
}

.nav-section > .nav-list {
  margin: 0 0 var(--space-2) var(--space-2);
  padding-inline-start: var(--space-2);
  border-inline-start: 1px solid var(--border);
}

/* Glyphes de nature : la lettre porte l'information, la couleur l'accompagne */

.kind-glyph {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--text-muted);
  font: 700 0.625rem / 1 var(--font-mono);
}

.kind-glyph--class {
  background: var(--accent-soft);
  color: var(--accent);
}

.kind-glyph--exception {
  background: color-mix(in oklch, var(--danger) 14%, transparent);
  color: var(--danger);
}

.kind-glyph--constants,
.kind-glyph--enum {
  background: color-mix(in oklch, var(--warn) 16%, transparent);
  color: var(--warn);
}

/* Sommaire */

.toc__title {
  margin: 0 0 var(--space-2);
  color: var(--text);
  font-weight: 600;
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-inline-start: 1px solid var(--border);
}

.toc__item a {
  display: block;
  margin-inline-start: -1px;
  padding: 0.2rem var(--space-3);
  border-inline-start: 1px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.4;
}

.toc__item--l3 a {
  padding-inline-start: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.toc__item a:hover {
  color: var(--text);
}

.toc__item a[aria-current] {
  border-inline-start-color: var(--accent);
  color: var(--accent);
}

/* Bandeau de version */

.banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid color-mix(in oklch, var(--warn) 35%, var(--border));
  background: color-mix(in oklch, var(--warn) 9%, var(--bg));
  color: var(--text);
  font-size: var(--text-sm);
}

.banner p {
  margin: 0;
}

.banner .icon {
  color: var(--warn);
}

/* Recherche */

.search {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100dvh - 6rem));
  margin: 4rem auto auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.search[open] {
  display: flex;
  flex-direction: column;
}

.search::backdrop {
  background: rgb(0 0 0 / 0.55);
}

:root:not(.low-perf) .search::backdrop {
  backdrop-filter: blur(3px);
}

@media (prefers-reduced-motion: no-preference) {
  :root:not(.low-perf) .search[open] {
    animation: search-in var(--dur-base) var(--ease-out);
  }
}

@keyframes search-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.99);
  }
}

.search__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.search__input {
  flex: 1;
  min-width: 0;
  height: 3.25rem;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-md);
  outline: none;
}

.search__input::-webkit-search-cancel-button {
  display: none;
}

.search__close {
  border: 0;
  background: none;
  cursor: pointer;
}

.search__status {
  margin: 0;
  padding: var(--space-3) var(--space-4) 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.search__results {
  margin: 0;
  padding: var(--space-2);
  overflow-y: auto;
  list-style: none;
}

.search__result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
}

.search__result-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.search__result-kind {
  color: var(--text-faint);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.search__result-summary {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search__result[aria-selected="true"] {
  background: var(--accent-soft);
}

.search__result[aria-selected="true"] .search__result-title {
  color: var(--accent);
}

.search__result mark {
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Contenu */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--text-faint);
  font-size: var(--text-sm);
}

.crumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--accent);
}

.page-head {
  margin-bottom: var(--space-6);
}

.page-head .lead {
  margin-bottom: 0;
}

.lead {
  max-width: var(--measure);
  margin: var(--space-3) 0 var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-md);
  line-height: 1.6;
}

.prose > :is(p, ul, ol, h2, h3, .callout) {
  max-width: var(--measure);
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2,
.article > h2 {
  margin: var(--space-7) 0 var(--space-3);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

.prose h3 {
  margin: var(--space-6) 0 var(--space-2);
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 var(--space-4);
}

.prose li + li {
  margin-top: var(--space-1);
}

.anchor {
  margin-inline-start: var(--space-2);
  color: var(--text-faint);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--dur-fast);
}

:is(h2, h3):hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .anchor {
    opacity: 0.6;
  }
}

.table-wrap {
  max-width: 100%;
  margin: 0 0 var(--space-5);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.prose table,
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.prose table {
  margin: 0 0 var(--space-5);
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td,
.ref-table th,
.ref-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.prose th,
.ref-table th {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.ref-table tbody tr:last-child td {
  border-bottom: 0;
}

.ref-table td:first-child,
.ref-table td:nth-child(2) {
  white-space: nowrap;
}

.ref-table--compact {
  width: auto;
  min-width: 50%;
}

.ref-table td code {
  background: none;
  padding: 0;
}

.param-name {
  color: var(--text);
  font-weight: 600;
}

code.type {
  color: var(--tk-type);
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge--required {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Encadrés : bordure complète et fond teinté, jamais de barre latérale */

.callout {
  display: flex;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid color-mix(in oklch, var(--tone) 35%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in oklch, var(--tone) 7%, var(--bg));
  --tone: var(--accent);
}

.callout > svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  margin-top: 0.15rem;
  color: var(--tone);
}

.callout__body > :last-child {
  margin-bottom: 0;
}

.callout--tip {
  --tone: var(--ok);
}

.callout--warning {
  --tone: var(--warn);
}

.callout--danger {
  --tone: var(--danger);
}

/* Accueil */

.home-head {
  margin-bottom: var(--space-6);
}

.home-title {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  letter-spacing: -0.03em;
}

.home-label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  gap: var(--space-6) var(--space-7);
  margin-top: var(--space-7);
}

.home-col h2 {
  margin-bottom: var(--space-3);
}

.index-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: guide;
}

.index-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.index-link {
  font-weight: 600;
  text-decoration: none;
}

.index-link:hover {
  text-decoration: underline;
}

.index-desc {
  flex-basis: 100%;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.index-list--compact .index-desc {
  flex-basis: auto;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Référence */

.ref-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.ref-title code {
  padding: 0;
  background: none;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.ref-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.kind {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.kind--class {
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
  color: var(--accent);
}

.kind--exception,
.kind--deprecated {
  border-color: color-mix(in oklch, var(--danger) 40%, var(--border));
  color: var(--danger);
}

.kind--constants,
.kind--enum {
  border-color: color-mix(in oklch, var(--warn) 45%, var(--border));
  color: var(--warn);
}

.aliases {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.aliases > span {
  margin-inline-end: var(--space-2);
  font-weight: 600;
}

.returns {
  margin: 0 0 var(--space-4);
}

.member {
  padding-top: var(--space-2);
}

.member + .member {
  margin-top: var(--space-5);
  border-top: 1px solid var(--border);
  padding-top: var(--space-5);
}

.member__title {
  margin-bottom: var(--space-2);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

.member__title code {
  padding: 0;
  background: none;
  font-size: var(--text-md);
}

.ref-section h2 {
  margin: var(--space-6) 0 var(--space-2);
  scroll-margin-top: calc(var(--topbar-h) + var(--space-4));
}

.ref-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 40rem) {
  .ref-row {
    grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
    gap: var(--space-4);
  }
}

.ref-row__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  text-decoration: none;
}

.ref-row__name code {
  padding: 0;
  background: none;
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ref-row__name:hover code {
  text-decoration: underline;
}

.ref-row__summary {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Précédent / suivant */

.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: var(--space-3);
  max-width: var(--content-max);
  margin: 0 auto var(--space-5);
  padding-inline: var(--space-4);
}

.pager__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--dur-fast);
}

.pager__link:hover {
  border-color: var(--accent);
}

.pager__link--next {
  text-align: end;
  grid-column: -2;
}

.pager__label {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.pager__title {
  color: var(--text);
  font-weight: 600;
}

/* Blocs de code : coloration, lignes mises en avant, bouton Copier. */

.code {
  position: relative;
  margin: 0 0 var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--code-bg);
  min-width: 0;
}

.code__file {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font: 500 var(--text-xs) / 1.4 var(--font-mono);
}

.code pre {
  margin: 0;
  padding: var(--space-3) 0;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
  tab-size: 4;
  scrollbar-width: thin;
  border-radius: calc(var(--radius-md) - 1px);
}

.code pre:focus-visible {
  outline-offset: -2px;
}

.code code {
  display: block;
  min-width: max-content;
  padding: 0;
  background: none;
  color: var(--text);
}

.code .line {
  display: block;
  padding-inline: var(--space-4) var(--space-7);
  transition: filter var(--dur-base), opacity var(--dur-base);
}

/* Focus contextuel : les lignes utiles nettes, le contexte en retrait jusqu'au survol ou au focus */

.code[data-focus] .line:not(.is-focus) {
  filter: blur(1.2px);
  opacity: 0.5;
}

.code[data-focus]:is(:hover, :focus-within) .line {
  filter: none;
  opacity: 1;
}

.code .line.is-focus {
  background: var(--accent-soft);
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .code[data-focus] .line:not(.is-focus) {
    filter: none;
    opacity: 0.62;
  }
}

:root.low-perf .code .line {
  filter: none !important;
}

.code__copy {
  position: absolute;
  top: var(--space-2);
  inset-inline-end: var(--space-2);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}

.code__file + .code__copy {
  top: calc(var(--space-2) + 2.05rem);
}

.code__copy svg {
  width: 1rem;
  height: 1rem;
}

.code:hover .code__copy,
.code__copy:focus-visible,
.code__copy[data-copied] {
  opacity: 1;
}

.code__copy:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.code__copy[data-copied] {
  border-color: color-mix(in oklch, var(--ok) 50%, var(--border));
  color: var(--ok);
}

@media (hover: none) {
  .code__copy {
    opacity: 1;
  }
}

.tk-k {
  color: var(--tk-keyword);
}

.tk-s {
  color: var(--tk-string);
}

.tk-n {
  color: var(--tk-number);
}

.tk-f {
  color: var(--tk-function);
}

.tk-t {
  color: var(--tk-type);
}

.tk-d {
  color: var(--tk-decorator);
}

.tk-b {
  color: var(--tk-builtin);
}

.tk-c {
  color: var(--tk-comment);
}

.tk-o,
.tk-p {
  color: var(--tk-punct);
}
