/* ═══════════════════════════════════════════════════════════════════════
   doc.cmk.biz — feuille de style unique
   ═══════════════════════════════════════════════════════════════════════

   Direction : le produit est en verre — translucide, flottant, animé. Le
   manuel est en papier : opaque, plat, calme. Le contraste est délibéré ;
   on n'imite pas l'application, on lui répond.

   Aucune police distante. Le site doit rester lisible quand le reste de la
   plateforme est en panne : il ne dépend d'aucune autre origine, donc la
   personnalité typographique vient de l'échelle, des graisses et de
   l'espacement, pas d'un fichier téléchargé.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --ink: #171a2b;
  --ink-soft: #565d78;
  --paper: #f6f7fb;
  --surface: #ffffff;
  --rule: #e0e4f0;
  --rule-strong: #c8cee1;
  --accent: #4338ca;
  --accent-soft: #eeeefe;
  --focus: #4338ca;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 76rem;
  --read: 40rem;      /* ~68 caractères : la largeur d'une colonne qui se lit */
  --radius: 10px;
}

/* ── Thème sombre ──────────────────────────────────────────────────────
   Deux sélecteurs pour une seule palette, et l'ordre compte :

   1. le réglage du système s'applique TANT QUE le visiteur n'a rien choisi —
      d'où le `:not([data-theme='light'])`, qui laisse un choix explicite
      « Clair » l'emporter sur un système en sombre ;
   2. `[data-theme='dark']` s'applique quoi qu'en dise le système.

   L'attribut est posé par `assets/theme.js`, avant le premier rendu. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #e7e9f4;
    --ink-soft: #9aa1bd;
    --paper: #0f111c;
    --surface: #161927;
    --rule: #262b3f;
    --rule-strong: #39405a;
    --accent: #9aa0ff;
    --accent-soft: #1d2038;
    --focus: #9aa0ff;
  }
}

:root[data-theme='dark'] {
  --ink: #e7e9f4;
  --ink-soft: #9aa1bd;
  --paper: #0f111c;
  --surface: #161927;
  --rule: #262b3f;
  --rule-strong: #39405a;
  --accent: #9aa0ff;
  --accent-soft: #1d2038;
  --focus: #9aa0ff;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.018em; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.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 {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 20;
  background: var(--surface); color: var(--ink);
  padding: 0.5rem 0.9rem; border: 1px solid var(--rule-strong); border-radius: 8px;
  transition: top 120ms ease;
}
.skip:focus { top: 0.5rem; }

/* ── Bandeau ─────────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; flex: none; }
.brand__mark {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2.5px solid var(--accent);
}
.brand__text { font-size: 0.94rem; letter-spacing: 0.005em; color: var(--ink-soft); }
.brand__text b { color: var(--ink); font-weight: 650; }
.brand__sep { margin: 0 0.4rem; opacity: 0.5; }

/* Le bandeau doit pouvoir rétrécir : sans `min-width: 0`, un enfant en flex
   refuse de passer sous sa largeur intrinsèque et pousse la page en largeur.
   C'est ce qui provoquait un défilement horizontal sur mobile. */
.topbar__right { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; }

.minisearch { position: relative; display: flex; align-items: center; min-width: 0; max-width: 17rem; flex: 1; }
.minisearch input {
  font: inherit; font-size: 0.9rem;
  padding: 0.4rem 2.1rem 0.4rem 0.8rem;
  width: 100%; min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: 999px;
}
.minisearch input::placeholder { color: var(--ink-soft); }
.minisearch kbd {
  position: absolute; right: 0.55rem;
  font-family: var(--mono); font-size: 0.7rem; line-height: 1;
  padding: 0.2rem 0.35rem; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 4px;
}
@media (max-width: 40rem) {
  .minisearch kbd { display: none; }
  .minisearch input { padding-right: 0.8rem; }
}
@media (max-width: 27rem) { .brand__suffix { display: none; } }

/* ── Héros ───────────────────────────────────────────────────────────── */

.hero {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(2.5rem, 9vw, 6rem) var(--gutter) 1.75rem;
}
.hero--search { padding-bottom: 1rem; }

.hero__title {
  margin: 0 0 1.5rem;
  font-size: clamp(1.9rem, 5.2vw, 3.1rem);
  font-weight: 300;               /* le poids léger fait respirer la question */
  letter-spacing: -0.03em;
}

.hero__form {
  position: relative; display: flex; align-items: center;
  max-width: 46rem;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.hero__form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.hero__icon {
  width: 20px; height: 20px; flex: none;
  margin-left: 1rem; color: var(--ink-soft);
}
.hero__form input {
  flex: 1; min-width: 0;
  font: inherit; font-size: clamp(0.98rem, 2vw, 1.1rem);
  padding: 0.95rem 1rem;
  color: var(--ink); background: none; border: 0;
}
.hero__form input:focus { outline: none; }
.hero__form input::placeholder { color: var(--ink-soft); opacity: 0.85; }

.hero__meta {
  margin: 0.9rem 0 0;
  font-size: 0.85rem; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ── Résultats ───────────────────────────────────────────────────────── */

.results { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 2rem; }
.results[hidden] { display: none; }

.results__count {
  margin: 0 0 0.9rem;
  font-size: 0.78rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-soft);
}

.results__list { list-style: none; margin: 0; padding: 0; max-width: 52rem; }

.result { border-bottom: 1px solid var(--rule); }
.result > a {
  display: block; padding: 0.85rem 0.6rem;
  text-decoration: none; border-radius: 8px;
}
.result > a:hover { background: var(--accent-soft); }

.result__title { display: block; font-weight: 600; letter-spacing: -0.012em; }
.result__where {
  display: block; margin-top: 0.15rem;
  font-size: 0.8rem; color: var(--ink-soft);
}
.result__where b { color: var(--accent); font-weight: 550; }
.result__snippet {
  display: block; margin-top: 0.3rem;
  font-size: 0.88rem; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.result mark {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: inherit; border-radius: 3px; padding: 0 1px;
}

@media (prefers-reduced-motion: no-preference) {
  .result { animation: rise 220ms ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(4px); } }
}

.results__empty { max-width: 46rem; }
.results__empty h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.results__empty p { margin: 0; color: var(--ink-soft); }

/* ── Bandes de l'accueil ─────────────────────────────────────────────── */

.band {
  max-width: var(--max); margin: 0 auto;
  padding: 2.25rem var(--gutter);
  border-top: 1px solid var(--rule);
}
.band__title {
  margin: 0 0 1.4rem;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-soft);
}

.tiles, .paths, .cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }

.tile > a {
  position: relative; display: block; height: 100%;
  padding: 1rem 1rem 1.05rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  transition: border-color 120ms ease;
}
.tile > a:hover { border-color: var(--accent); }
.tile .glyph { width: 22px; height: 22px; color: var(--accent); }
.tile__label { display: block; margin-top: 0.55rem; font-weight: 600; }
.tile__blurb {
  display: block; margin-top: 0.15rem;
  font-size: 0.85rem; line-height: 1.45; color: var(--ink-soft);
  padding-right: 2rem;
}
.tile__count {
  position: absolute; top: 0.7rem; right: 0.9rem;
  font-size: 1.5rem; font-weight: 200; line-height: 1;
  color: var(--rule-strong);
  font-variant-numeric: tabular-nums;
}

.paths { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.path {
  padding: 1.1rem 1.15rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.path__head { display: flex; gap: 0.7rem; align-items: flex-start; }
.path__head .glyph { width: 22px; height: 22px; flex: none; margin-top: 0.15rem; color: var(--accent); }
.path__title { margin: 0; font-size: 1.02rem; }
.path__blurb { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.path__list { list-style: none; margin: 0.9rem 0 0; padding: 0; }
.path__list li + li { margin-top: 0.1rem; }
.path__list a {
  display: block; padding: 0.3rem 0.4rem; margin-left: -0.4rem;
  font-size: 0.92rem; text-decoration: none; border-radius: 6px;
  text-decoration: underline; text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}
.path__list a:hover { background: var(--accent-soft); text-decoration-color: var(--accent); }

.cards { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.card > a, .card > div {
  display: block; height: 100%; padding: 1rem 1.1rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.card > a:hover { border-color: var(--accent); }
.card h3 { margin: 0; font-size: 1rem; }
.card p { margin: 0.25rem 0 0; font-size: 0.86rem; color: var(--ink-soft); }
.card--muted > div { background: none; border-style: dashed; }

/* ── Trois colonnes ──────────────────────────────────────────────────── */

.three {
  max-width: var(--max); margin: 0 auto;
  padding: 1.75rem var(--gutter) 4rem;
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 14rem minmax(0, 1fr) 13rem;
  align-items: start;
}
.three--nomap { grid-template-columns: 14rem minmax(0, 1fr); }

@media (max-width: 62rem) {
  .three, .three--nomap { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .sidenav { order: 2; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
}

.sidenav { position: sticky; top: 4.5rem; font-size: 0.9rem; }
@media (max-width: 62rem) { .sidenav { position: static; } }
.sidenav__title, .toc__title {
  margin: 0 0 0.6rem;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-soft);
}
.sidenav__list, .sidenav__sub, .toc ul { list-style: none; margin: 0; padding: 0; }
.sidenav__list > li > a {
  display: flex; justify-content: space-between; gap: 0.5rem;
  padding: 0.24rem 0.5rem; margin-left: -0.5rem;
  text-decoration: none; border-radius: 6px; color: var(--ink-soft);
}
.sidenav__list > li > a:hover { color: var(--ink); background: var(--accent-soft); }
.sidenav__list > li > a[aria-current] { color: var(--ink); font-weight: 600; }
.sidenav__count { font-size: 0.75rem; color: var(--rule-strong); font-variant-numeric: tabular-nums; }
.sidenav__sub {
  margin: 0.3rem 0 0.8rem 0.15rem; padding-left: 0.7rem;
  border-left: 1px solid var(--rule);
}
.sidenav__sub a {
  display: block; padding: 0.22rem 0.5rem; margin-left: -0.5rem;
  font-size: 0.86rem; text-decoration: none; color: var(--ink-soft); border-radius: 6px;
}
.sidenav__sub a:hover { color: var(--ink); background: var(--accent-soft); }
.sidenav__sub a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.toc { position: sticky; top: 4.5rem; font-size: 0.85rem; }
.toc li + li { margin-top: 0.05rem; }
.toc a {
  display: block; padding: 0.18rem 0 0.18rem 0.7rem;
  color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid var(--rule);
}
.toc a:hover { color: var(--ink); border-left-color: var(--accent); }

/* Section en cours de lecture. Le trait porte l'information — la couleur seule
   ne suffirait pas à qui distingue mal les teintes. */
.toc a[aria-current="true"] {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  border-left-width: 2px;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--accent) 9%, transparent),
    transparent 70%
  );
}

/* ── Contenu rédactionnel ────────────────────────────────────────────── */

.crumbs { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 1rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 0.4rem; }

.eyebrow { display: flex; gap: 0.4rem; margin: 0 0 0.5rem; }
.eyebrow__type, .eyebrow__audience {
  font-size: 0.68rem; font-weight: 650;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
}
.eyebrow__type[data-type="depannage"] {
  background: color-mix(in srgb, #d97706 15%, transparent); color: #b45309;
}
.eyebrow__audience {
  background: none; color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
}
/* L'ambre de « Dépannage » est trop sombre sur fond nocturne : on l'éclaircit,
   dans les deux cas où le fond est sombre. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .eyebrow__type[data-type="depannage"] { color: #f0b45f; }
}
:root[data-theme="dark"] .eyebrow__type[data-type="depannage"] { color: #f0b45f; }

/* ── Sélecteur de thème ─────────────────────────────────────────────── */

.theme {
  display: none; flex: none;
  padding: 2px; gap: 1px;
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: 999px;
}
.theme button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 22px; padding: 0;
  color: var(--ink-soft);
  background: none; border: 0; border-radius: 999px;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}
.theme svg { width: 14px; height: 14px; }

/* Le contrôle n'apparaît que si le script a tourné : sans lui, aucun des trois
   boutons ne ferait quoi que ce soit — le thème du système s'applique déjà
   seul, et un contrôle mort vaut moins que pas de contrôle. `theme.js` s'exécute
   AVANT le premier rendu, donc il n'y a rien à voir clignoter. */
html.js .theme { display: inline-flex; }

.prose { max-width: var(--read); }
.prose h1 { margin: 0 0 0.9rem; font-size: clamp(1.6rem, 3.6vw, 2.15rem); font-weight: 640; }
.prose h2 {
  margin: 2.4rem 0 0.7rem; padding-top: 0.2rem;
  font-size: 1.22rem; font-weight: 640;
}
/* Dans le guide, les `###` portent la structure du chapitre : ils doivent se
   distinguer d'un simple paragraphe en gras, sans rivaliser avec un `##`. */
.prose h3 {
  margin: 1.9rem 0 0.5rem; font-size: 1.06rem; font-weight: 640;
  color: var(--ink); letter-spacing: -0.01em;
}
.prose h3::before {
  content: ""; display: block; width: 1.6rem;
  border-top: 2px solid var(--accent); margin-bottom: 0.5rem;
}
.prose p, .prose ul, .prose ol { margin: 0 0 0.9rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.32rem; }
.prose li::marker { color: var(--ink-soft); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose strong { font-weight: 640; }

.prose code {
  font-family: var(--mono); font-size: 0.86em;
  padding: 0.1em 0.35em; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
}

.prose blockquote {
  margin: 1.1rem 0; padding: 0.7rem 1rem;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose table {
  width: 100%; border-collapse: collapse; margin: 1.1rem 0;
  font-size: 0.92rem; display: block; overflow-x: auto;
}
.prose th, .prose td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 640; }

.lead { font-size: 1.03rem; color: var(--ink-soft); }
.lead p:last-child { margin-bottom: 0; }
.module-blurb { margin: 0 0 1.6rem; font-size: 1.03rem; color: var(--ink-soft); }

.section { scroll-margin-top: 5rem; }
.anchor {
  margin-left: 0.4rem; color: var(--rule-strong);
  text-decoration: none; opacity: 0; transition: opacity 120ms ease;
}
h2:hover .anchor, .anchor:focus-visible { opacity: 1; }

.related {
  margin-top: 2.75rem; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.related h2 {
  margin: 0 0 0.6rem;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-soft);
}
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { margin-bottom: 0.2rem; }
.related a { color: var(--accent); text-underline-offset: 3px; }

.updated { margin-top: 2rem; font-size: 0.8rem; color: var(--ink-soft); }

.index-list { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.index-list a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.5rem; margin-left: -0.5rem;
  text-decoration: none; border-radius: 8px;
  border-bottom: 1px solid var(--rule);
}
.index-list a:hover { background: var(--accent-soft); }
.index-list__title { font-weight: 550; }
.index-list__type {
  flex: none; font-size: 0.68rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* ── Manuel (le guide) ───────────────────────────────────────────────── */

.manual-layout {
  max-width: var(--max); margin: 0 auto;
  padding: 1.75rem var(--gutter) 4rem;
  display: grid; gap: clamp(1.5rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr) 13rem;
  align-items: start;
}
@media (max-width: 62rem) { .manual-layout { grid-template-columns: minmax(0, 1fr); } }

.manual { max-width: 42rem; margin: 0 auto; padding: 2.5rem var(--gutter) 4rem; }
.manual--reading { padding: 0; margin: 0; }
.manual__head { margin-bottom: 2rem; }
.manual__head h1 { margin: 0.3rem 0 0.4rem; font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 300; }
.manual__blurb { margin: 0; color: var(--ink-soft); }

.chapters { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.chapters__item { border-bottom: 1px solid var(--rule); }
.chapters__item a {
  display: flex; align-items: baseline; gap: 1.1rem;
  padding: 0.85rem 0.5rem; margin-left: -0.5rem;
  text-decoration: none; border-radius: 8px;
}
.chapters__item a:hover { background: var(--accent-soft); }
.chapters__num {
  font-size: 0.95rem; font-weight: 300; color: var(--rule-strong);
  font-variant-numeric: tabular-nums; min-width: 1.8rem;
}
.chapters__title { font-weight: 550; }

.chapter__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.chapter__num {
  font-size: clamp(2rem, 6vw, 3rem); font-weight: 200; line-height: 1;
  color: var(--rule-strong); font-variant-numeric: tabular-nums;
}
.chapter__head h1 { margin: 0; }

.chapter__nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule);
}
.chapter__nav a { text-decoration: none; max-width: 48%; }
.chapter__next { text-align: right; margin-left: auto; }
.chapter__nav span {
  display: block; font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft);
}
.chapter__nav b { color: var(--accent); font-weight: 550; }

/* ── Divers ──────────────────────────────────────────────────────────── */

.notice {
  max-width: var(--max); margin: 0 auto; padding: 1rem var(--gutter);
  color: var(--ink-soft);
}

.footer { border-top: 1px solid var(--rule); margin-top: 2rem; }
.footer__inner {
  max-width: var(--max); margin: 0 auto;
  padding: 1.75rem var(--gutter) 3rem;
  font-size: 0.85rem; color: var(--ink-soft);
}
.footer nav { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-bottom: 0.7rem; }
.footer nav a { text-decoration: none; }
.footer nav a:hover { text-decoration: underline; }
.footer__note { margin: 0; max-width: 46rem; }
