/* ============================================================================
   Formation M&A — feuille de style unique.
   Mobile-first. Tous les couples couleur/fond sont vérifiés AA (4.5:1 texte,
   3:1 éléments d'interface). Aucune dépendance externe.
   ========================================================================== */

/* ---------- 1. Jetons ---------- */
:root {
  color-scheme: light;

  --bg:            #f5f3ef;
  --bg-alt:        #ebe7e0;
  --surface:       #fffefb;
  --surface-sunk:  #f0ede7;

  --text:          #1b1a17;   /* 15.7:1 */
  --text-muted:    #565049;   /*  7.2:1 */
  --text-faint:    #6b655c;   /*  5.2:1 */

  --accent:        #8a5a11;   /*  5.3:1 */
  --accent-strong: #6d4508;   /*  7.6:1 */
  --accent-deep:   #5b3a06;   /*  8.3:1 sur --accent-soft */
  --accent-solid:  #7a4f0d;   /*  7.1:1 avec du blanc */
  --on-accent:     #ffffff;
  --accent-soft:   #f3e6cf;
  --accent-softer: #faf3e6;

  --border:        #ded7cb;
  --border-strong: #857e72;   /*  3.6:1 — contrôles interactifs */

  --ok:            #2f6a3f;
  --ok-soft:       #e4f0e5;
  --warn:          #8a4a10;
  --warn-soft:     #fbe9d8;
  --stop:          #8c2f26;
  --stop-soft:     #fbe4e1;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 68ch;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgb(27 26 23 / .06), 0 1px 1px rgb(27 26 23 / .04);
  --shadow-md: 0 4px 16px rgb(27 26 23 / .08), 0 1px 3px rgb(27 26 23 / .06);
  --shadow-lg: 0 16px 48px rgb(27 26 23 / .13);

  --header-h: 58px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #14130f;
  --bg-alt:        #1a1814;
  --surface:       #1e1c17;
  --surface-sunk:  #262319;

  --text:          #ece7de;   /* 15.1:1 */
  --text-muted:    #a8a094;   /*  7.2:1 */
  --text-faint:    #8b8478;   /*  5.0:1 */

  --accent:        #d9a441;   /*  8.3:1 */
  --accent-strong: #e8bc66;
  --accent-deep:   #f0cd88;
  --accent-solid:  #d9a441;
  --on-accent:     #14130f;
  --accent-soft:   #3a2e14;
  --accent-softer: #2a2211;

  --border:        #332f28;
  --border-strong: #7a7367;   /*  4.0:1 */

  --ok:            #7fc08d;
  --ok-soft:       #1c2a1f;
  --warn:          #e0a562;
  --warn-soft:     #2e2114;
  --stop:          #e79289;
  --stop-soft:     #2e1a17;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .5);
  --shadow-md: 0 4px 16px rgb(0 0 0 / .45);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / .6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14130f;         --bg-alt: #1a1814;
    --surface: #1e1c17;    --surface-sunk: #262319;
    --text: #ece7de;       --text-muted: #a8a094;  --text-faint: #8b8478;
    --accent: #d9a441;     --accent-strong: #e8bc66;
    --accent-deep: #f0cd88; --accent-solid: #d9a441; --on-accent: #14130f;
    --accent-soft: #3a2e14; --accent-softer: #2a2211;
    --border: #332f28;     --border-strong: #7a7367;
    --ok: #7fc08d;   --ok-soft: #1c2a1f;
    --warn: #e0a562; --warn-soft: #2e2114;
    --stop: #e79289; --stop-soft: #2e1a17;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .5);
    --shadow-md: 0 4px 16px rgb(0 0 0 / .45);
    --shadow-lg: 0 16px 48px rgb(0 0 0 / .6);
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* `display:flex` sur .btn / .steps__dots gagnerait sur [hidden] sans ceci */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  /* la cible d'une ancre ne doit pas passer sous l'en-tête collant */
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;      /* aucune page ne défile latéralement */
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.3rem + 3.4vw, 3.5rem); font-weight: 500; letter-spacing: -.025em; }
h2 { font-size: clamp(1.5rem, 1.15rem + 1.7vw, 2.25rem); }
h3 { font-size: clamp(1.125rem, 1rem + .6vw, 1.375rem); }
h4 { font-size: 1.0625rem; }

p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
ul, ol { max-width: var(--measure); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-strong); }

strong { font-weight: 650; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
::selection { background: var(--accent-soft); color: var(--accent-deep); }

.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; top: 0; left: 0; z-index: 200;
  transform: translateY(-120%);
  background: var(--accent-solid); color: var(--on-accent);
  padding: .75rem 1.25rem; font-weight: 600; text-decoration: none;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { transform: translateY(0); color: var(--on-accent); }

/* ---------- 3. Mise en page ---------- */
.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }
@media (min-width: 700px) { .wrap { width: min(100% - 4rem, 1180px); } }

.page {
  display: block;
  padding-block: 2rem 5rem;
}
@media (min-width: 1080px) {
  /* colonne de navigation collante + colonne de lecture */
  .page.has-toc {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    gap: 3.5rem;
    align-items: start;
  }
}

/* ---------- 4. En-tête ---------- */
.masthead {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.masthead__bar {
  height: var(--header-h);
  display: flex; align-items: center; gap: 1rem;
}
.brand {
  display: flex; align-items: baseline; gap: .55rem;
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--accent-strong); }
.brand__mark {
  font-size: .6875rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-family: var(--font-body); font-weight: 600;
}
.brand__sub { display: none; }
@media (min-width: 640px) { .brand__sub { display: inline; color: var(--text-faint); font-weight: 400; font-size: .9375rem; } }

.masthead__spacer { margin-left: auto; }

.chapnav { display: none; }
@media (min-width: 940px) {
  .chapnav { display: flex; gap: .15rem; align-items: center; }
  .chapnav a {
    display: grid; place-items: center;
    width: 2.1rem; height: 2.1rem; border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums; font-size: .875rem; font-weight: 600;
    color: var(--text-muted); text-decoration: none;
    transition: background .16s var(--ease), color .16s var(--ease);
  }
  .chapnav a:hover { background: var(--bg-alt); color: var(--text); }
  .chapnav a[aria-current="page"] { background: var(--accent-solid); color: var(--on-accent); }
}

/* barre de progression de lecture */
.readbar {
  position: absolute; left: 0; bottom: -1px; height: 2px;
  background: var(--accent-solid); width: 0;
  transition: width .12s linear;
}

/* ---------- 5. Boutons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .5rem 1rem;
  font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.2;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
}
.btn:hover { background: var(--bg-alt); }
.btn:active { transform: translateY(1px); }
.btn--primary { --btn-bg: var(--accent-solid); --btn-fg: var(--on-accent); --btn-bd: var(--accent-solid); }
.btn--primary:hover { --btn-bg: var(--accent-strong); --btn-bd: var(--accent-strong); }
.btn--quiet { --btn-bd: transparent; color: var(--text-muted); }
.btn--quiet:hover { color: var(--text); }
.btn--sm { min-height: 38px; padding: .35rem .7rem; font-size: .8125rem; }
.btn--icon { min-width: 44px; padding: .5rem; }

.iconbtn {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.iconbtn:hover { background: var(--bg-alt); color: var(--text); }
.iconbtn svg { width: 19px; height: 19px; }

/* ---------- 6. Sommaire latéral (scrollspy) ---------- */
.toc { display: none; }
@media (min-width: 1080px) {
  .toc {
    display: block; position: sticky;
    top: calc(var(--header-h) + 1.75rem);
    max-height: calc(100vh - var(--header-h) - 3.5rem);
    overflow-y: auto; overscroll-behavior: contain;
    padding-right: .5rem;
  }
}
.toc__title {
  font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 .85rem; font-weight: 600;
}
.toc__list { list-style: none; margin: 0; padding: 0; }
.toc__list a {
  display: grid; grid-template-columns: 1.75rem 1fr; gap: .5rem;
  padding: .42rem .5rem .42rem .55rem;
  font-size: .8125rem; line-height: 1.35; color: var(--text-muted);
  text-decoration: none; border-left: 2px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.toc__list a:hover { background: var(--bg-alt); color: var(--text); }
.toc__list a .n { font-variant-numeric: tabular-nums; color: var(--text-faint); }
.toc__list a[aria-current="true"] {
  color: var(--text); font-weight: 600;
  border-left-color: var(--accent-solid); background: var(--accent-softer);
}
.toc__list a[aria-current="true"] .n { color: var(--accent); }
.toc__foot {
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: .75rem; color: var(--text-faint);
}

/* ---------- 7. Fiche « module » (un diagramme = une section) ---------- */
.module {
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
  padding-block: 2.5rem;
  border-top: 1px solid var(--border);
}
.module:first-of-type { border-top: 0; padding-top: .5rem; }

.module__head { margin-bottom: 1.75rem; }
.module__eyebrow {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin: 0 0 .5rem;
  font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 600; color: var(--accent);
}
.module__num {
  display: inline-grid; place-items: center;
  min-width: 1.85rem; height: 1.85rem; padding-inline: .35rem;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums; font-size: .8125rem; letter-spacing: 0;
}
.module__title { margin: 0 0 .6rem; }
.module__intro { color: var(--text-muted); font-size: 1.0625rem; }

/* la note « à retenir » de bas de diagramme */
.takeaway {
  margin-top: 1.75rem; padding: 1.15rem 1.25rem;
  background: var(--accent-softer);
  border-left: 3px solid var(--accent-solid);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.takeaway__label {
  display: block; margin-bottom: .35rem;
  font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--accent-strong);
}
.takeaway p { margin: 0; max-width: none; color: var(--text); }

/* ---------- 8. Grilles & cartes de contenu ---------- */
.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card > :last-child { margin-bottom: 0; }
.card__kicker {
  font-size: .6875rem; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 600; color: var(--accent); margin: 0 0 .4rem;
}
.card__title { font-size: 1.1875rem; margin: 0 0 .3rem; }
.card__sub { font-size: .875rem; color: var(--text-faint); margin: 0 0 .8rem; }
.card p { font-size: .9375rem; max-width: none; }
.card--accent { border-color: var(--accent-solid); background: var(--accent-softer); }

.note {
  margin-top: auto; padding-top: .85rem;
  border-top: 1px solid var(--border);
  font-size: .875rem; color: var(--text-muted);
}
.note strong { color: var(--accent-strong); }

/* liste à puces « — » */
.dashlist { list-style: none; margin: 0 0 1rem; padding: 0; }
.dashlist li {
  position: relative; padding-left: 1.1rem; margin-bottom: .45rem;
  font-size: .9375rem; line-height: 1.5;
}
.dashlist li::before {
  content: "—"; position: absolute; left: 0; color: var(--accent);
}
.dashlist--check li::before { content: "✓"; font-size: .8em; top: .1em; }
.dashlist--cross li::before { content: "✕"; font-size: .8em; top: .1em; color: var(--stop); }

/* ---------- 9. Tableaux (mobile : cartes empilées) ---------- */
.tablewrap {
  overflow-x: auto; overscroll-behavior-x: contain;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.tablewrap:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

table.t { width: 100%; border-collapse: collapse; font-size: .9375rem; }
table.t caption {
  text-align: left; padding: .9rem 1rem; font-size: .8125rem;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
table.t th, table.t td {
  padding: .7rem .85rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
table.t thead th {
  font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700;
  background: var(--surface-sunk);
  position: sticky; top: 0;
}
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--bg-alt); }
table.t th[scope="row"] { font-weight: 600; color: var(--text); }
.t__hint {
  display: block; margin-top: .5rem; font-size: .8125rem; color: var(--text-faint);
}
@media (min-width: 720px) { .t__hint { display: none; } }

/* variante « liste de définitions » — remplace les tableaux étroits sur mobile */
.deflist { display: grid; gap: .1rem; }
.deflist__row {
  display: grid; gap: .15rem .9rem;
  padding: .7rem 0; border-bottom: 1px solid var(--border);
}
.deflist__row:last-child { border-bottom: 0; }
.deflist__k {
  font-size: .6875rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600;
}
.deflist__v { font-size: .9375rem; }
@media (min-width: 760px) {
  .deflist__row { grid-template-columns: 13rem minmax(0, 1fr); align-items: baseline; }
  .deflist__k { padding-top: .12rem; }
}
/* comparatif à deux colonnes */
@media (min-width: 860px) {
  .deflist--2 .deflist__row { grid-template-columns: 13rem minmax(0,1fr) minmax(0,1fr); }
}
.deflist--2 .deflist__v + .deflist__v { padding-top: .5rem; }
@media (min-width: 860px) {
  .deflist--2 .deflist__v { padding-left: .9rem; border-left: 1px solid var(--border); }
  .deflist--2 .deflist__v + .deflist__v { padding-top: 0; }
}
.deflist__hd {
  display: none; font-family: var(--font-display); font-weight: 600; font-size: 1rem;
}
@media (min-width: 860px) {
  .deflist--2 .deflist__hd { display: block; }
}

/* ---------- 10. Étiquettes ---------- */
.tag {
  display: inline-block; padding: .15rem .55rem;
  font-size: .75rem; font-weight: 600; line-height: 1.5;
  border-radius: 100px; white-space: nowrap;
  background: var(--surface-sunk); color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag--accent { background: var(--accent-soft); color: var(--accent-deep); border-color: transparent; }
.tag--ok    { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.tag--warn  { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag--stop  { background: var(--stop-soft); color: var(--stop); border-color: transparent; }
.taglist { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }

/* ---------- 11. Schémas simples (boîtes / flux) ---------- */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.flow__box {
  padding: .5rem .8rem; font-size: .9375rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.flow__box--on { background: var(--accent-soft); border-color: var(--accent-solid); color: var(--accent-deep); font-weight: 600; }
.flow__box--off { border-style: dashed; color: var(--text-faint); text-decoration: line-through; }
.flow__arrow { color: var(--accent); font-size: 1.1rem; line-height: 1; }
.flow__label {
  font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin: .5rem 0 .3rem;
}
.flow__caption { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--accent-strong); }

/* chaîne de valeur — empilée sur petit écran, sinon en rail */
.chain {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; font-size: .8125rem;
}
.chain > * {
  flex: 1; padding: .6rem .7rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
.chain > *:last-child { border-bottom: 0; }
@media (min-width: 620px) {
  .chain { flex-direction: row; }
  .chain > * { padding: .6rem .4rem; text-align: center; border-bottom: 0; border-right: 1px solid var(--border); }
  .chain > *:last-child { border-right: 0; }
}
.chain .is-you { background: var(--surface-sunk); font-weight: 650; }
.chain .is-target { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }

/* ---------- 12. Barres, jauges, entonnoirs ---------- */
.bar {
  position: relative; height: 26px; border-radius: var(--radius-sm);
  background: var(--surface-sunk); border: 1px solid var(--border);
  overflow: hidden;
}
.bar__fill {
  position: absolute; inset-block: 0;
  background: var(--accent-solid); opacity: .85;
  border-radius: inherit;
  transform-origin: left center;
}
.bar__fill--soft { background: var(--accent); opacity: .38; }
.bar__range {
  position: absolute; inset-block: 0;
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  border-inline: 2px solid var(--accent-solid);
}
.bar__tick {
  position: absolute; inset-block: -3px; width: 2px;
  background: var(--text); opacity: .75;
}
.axis {
  display: flex; justify-content: space-between;
  font-size: .6875rem; font-variant-numeric: tabular-nums;
  color: var(--text-faint); padding-top: .35rem;
}

.gauge { margin-bottom: .6rem; }
.gauge__head { display: flex; justify-content: space-between; gap: 1rem; font-size: .8125rem; margin-bottom: .25rem; }
.gauge__head b { font-weight: 600; color: var(--accent-strong); }
.gauge__track { height: 7px; border-radius: 100px; background: var(--surface-sunk); overflow: hidden; }
.gauge__fill { height: 100%; background: var(--accent-solid); border-radius: inherit; }

/* pastilles d'intensité */
.pips { display: inline-flex; gap: .25rem; }
.pips span {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--accent); background: transparent;
}
.pips span.on { background: var(--accent-solid); }
.pipsrow { display: flex; align-items: center; gap: .75rem; justify-content: space-between; font-size: .8125rem; padding: .3rem 0; }

/* entonnoir */
.funnel { display: grid; gap: .3rem; }
.funnel__row {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .5rem 1rem;
  align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border);
}
.funnel__bar { height: 30px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid var(--accent); display: flex; align-items: center; padding-inline: .6rem; font-size: .8125rem; font-weight: 600; color: var(--accent-deep); }
.funnel__nums { display: flex; gap: 1rem; font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.funnel__nums b { color: var(--text); font-weight: 600; }

/* chronogramme (gantt) */
.gantt { display: grid; gap: .35rem; }
.gantt__row { display: grid; grid-template-columns: 1fr; gap: .2rem; }
@media (min-width: 700px) { .gantt__row { grid-template-columns: 15rem minmax(0,1fr); gap: .75rem; align-items: center; } }
.gantt__label { font-size: .8125rem; color: var(--text-muted); }
.gantt__track { position: relative; height: 20px; background: var(--surface-sunk); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.gantt__bar {
  position: absolute; inset-block: 2px;
  background: color-mix(in srgb, var(--accent) 42%, transparent);
  border: 1px solid var(--accent); border-radius: 3px;
}
.gantt__bar--key { background: var(--accent-solid); }
.gantt__axis { display: flex; justify-content: space-between; font-size: .6875rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
@media (min-width: 700px) { .gantt__axis { margin-left: calc(15rem + .75rem); } }

/* cascade (waterfall) — liste lisible plutôt qu'un graphique inaccessible */
.waterfall { display: grid; gap: .1rem; }
.wf__row {
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  gap: .35rem 1rem; align-items: baseline;
  padding: .6rem .8rem; border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
}
.wf__row:last-child { border-bottom: 0; }
.wf__row--total { background: var(--accent-soft); font-weight: 650; border-bottom: 0; margin-block: .3rem; }
.wf__row--total .wf__val { color: var(--accent-deep); }
.wf__label { font-size: .9375rem; }
.wf__val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.wf__val--neg { color: var(--stop); }
.wf__val--pos { color: var(--ok); }
.wf__meter { grid-column: 1 / -1; height: 5px; border-radius: 100px; background: var(--surface-sunk); overflow: hidden; }
.wf__meter i { display: block; height: 100%; background: var(--accent-solid); border-radius: inherit; }

/* ---------- 13. Étapes (mode pas-à-pas) ---------- */
.steps__bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: 1.25rem; padding: .5rem .65rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.steps__label { font-size: .8125rem; color: var(--text-muted); margin-right: auto; }
.steps__count { font-variant-numeric: tabular-nums; font-size: .8125rem; font-weight: 600; color: var(--accent-strong); }
.steps__dots { display: flex; gap: .3rem; }
.steps__dots button {
  width: 28px; height: 28px; padding: 0; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 50%; cursor: pointer;
}
.steps__dots button::after {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.steps__dots button[aria-current="step"]::after { background: var(--accent-solid); transform: scale(1.35); }
.steps__dots button.done::after { background: var(--accent); }

/* un bloc d'étape non atteint : masqué proprement, jamais illisible */
.step[hidden] { display: none; }
.step {
  animation: stepIn .38s var(--ease) both;
}
@keyframes stepIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 14. Ateliers interactifs ---------- */
.lab {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm);
}
.lab__grid { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .lab__grid--split { grid-template-columns: minmax(0,1fr) minmax(0, 22rem); } }
@media (min-width: 900px) { .lab__grid--half { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.lab__legend {
  font-size: .6875rem; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 700; color: var(--accent); margin: 0 0 .75rem; padding: 0;
}

.field { margin-bottom: 1.1rem; }
.field__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .35rem; }
.field__label { font-size: .9375rem; font-weight: 600; }
.field__value { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-strong); white-space: nowrap; }
.field__hint { font-size: .8125rem; color: var(--text-muted); margin: .35rem 0 0; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 100px; background: var(--surface-sunk);
  border: 1px solid var(--border-strong);
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 100px; background: var(--surface-sunk);
  border: 1px solid var(--border-strong);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; margin-top: -10px; border-radius: 50%;
  background: var(--accent-solid); border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-solid); border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
input[type="range"]:focus-visible::-moz-range-thumb { outline: 3px solid var(--accent); outline-offset: 2px; }

/* interrupteurs facteur (prime / décote) */
.chips { display: grid; gap: .4rem; margin: 0 0 1rem; padding: 0; border: 0; }
.chip {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 44px; padding: .5rem .75rem; width: 100%;
  background: transparent; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-size: .875rem; text-align: left; color: var(--text);
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.chip:hover { background: var(--bg-alt); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-solid); color: var(--accent-deep); }
.chip__v { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

/* lecture des résultats */
.readout {
  padding: 1rem 1.1rem; border-radius: var(--radius);
  background: var(--accent-softer); border: 1px solid var(--accent-soft);
  margin-bottom: .85rem;
}
.readout__k {
  font-size: .6875rem; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 700; color: var(--accent-strong); margin: 0 0 .2rem;
}
.readout__v {
  font-family: var(--font-display); font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
  margin: 0 0 .2rem; color: var(--text);
}
.readout__n { font-size: .8125rem; color: var(--text-muted); margin: 0; }

.verdict {
  padding: .95rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--border); border-left-width: 4px;
  background: var(--surface-sunk);
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.verdict__t { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; margin: 0 0 .3rem; }
.verdict p { font-size: .9375rem; margin: 0; max-width: none; color: var(--text-muted); }
.verdict[data-tone="ok"]   { border-left-color: var(--ok);   background: var(--ok-soft); }
.verdict[data-tone="warn"] { border-left-color: var(--warn); background: var(--warn-soft); }
.verdict[data-tone="stop"] { border-left-color: var(--stop); background: var(--stop-soft); }
.verdict[data-tone="neutral"] { border-left-color: var(--border-strong); }

/* mini-tableau clé/valeur */
.kv { display: grid; gap: 0; margin: 0; }
.kv > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .45rem 0; border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.kv > div:last-child { border-bottom: 0; }
.kv dt, .kv .k { color: var(--text-muted); }
.kv dd, .kv .v { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }

/* liste de constats cliquables */
.picklist { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.picklist button {
  display: grid; grid-template-columns: 1.6rem 1fr; gap: .6rem;
  width: 100%; min-height: 44px; padding: .6rem .7rem;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-size: .875rem; line-height: 1.4; text-align: left; color: var(--text);
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.picklist button:hover { background: var(--bg-alt); }
.picklist button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-solid); }
.picklist .n { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }

/* ---------- 15. Pagination bas de page ---------- */
.pager {
  display: grid; gap: .75rem; margin-top: 3.5rem;
  padding-top: 2rem; border-top: 1px solid var(--border);
}
@media (min-width: 700px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager__link {
  display: block; padding: 1.1rem 1.25rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.pager__link:hover { border-color: var(--accent-solid); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.pager__link--next { text-align: right; }
.pager__dir {
  display: block; font-size: .6875rem; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 600; color: var(--accent); margin-bottom: .3rem;
}
.pager__t { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; }
.pager__empty { border-style: dashed; opacity: .55; }

/* ---------- 16. Accueil ---------- */
.hero { padding-block: clamp(2.5rem, 1rem + 6vw, 5.5rem) 2.5rem; }
.hero__eyebrow {
  font-size: .75rem; letter-spacing: .18em; text-transform: uppercase;
  font-weight: 600; color: var(--accent); margin: 0 0 1rem;
}
.hero h1 { margin-bottom: .75rem; }
.hero__lede { font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem); color: var(--text-muted); max-width: 62ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 2.5rem; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg); padding: 1.1rem 1.25rem; }
.stat__v { font-family: var(--font-display); font-size: 1.875rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__k { font-size: .8125rem; color: var(--text-muted); margin-top: .3rem; }

.chapters { display: grid; gap: 1rem; margin-top: 3rem; }
.chapter {
  display: grid; gap: 1rem; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.chapter:hover { border-color: var(--accent-solid); transform: translateY(-2px); box-shadow: var(--shadow-md); }
@media (min-width: 800px) { .chapter { grid-template-columns: 5.5rem minmax(0,1fr); gap: 1.75rem; padding: 1.75rem; } }
.chapter__n {
  font-family: var(--font-display); font-size: 2.5rem; line-height: .9;
  color: var(--accent); font-weight: 500;
}
.chapter__meta { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); margin-top: .45rem; }
.chapter__t { font-size: 1.5rem; margin: 0 0 .4rem; }
.chapter__t a { color: var(--text); text-decoration: none; }
.chapter__t a::after { content: ""; position: absolute; inset: 0; }
.chapter { position: relative; }
.chapter:hover .chapter__t a { color: var(--accent-strong); }
.chapter__d { color: var(--text-muted); font-size: .9375rem; }
.chapter__items {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; gap: .1rem; font-size: .875rem;
}
@media (min-width: 640px) { .chapter__items { grid-template-columns: 1fr 1fr; gap: .1rem 2rem; } }
.chapter__items li { display: grid; grid-template-columns: 1.9rem 1fr; gap: .5rem; padding: .22rem 0; color: var(--text-muted); }
.chapter__items .n { font-variant-numeric: tabular-nums; color: var(--accent); }

.resume {
  display: none; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-top: 2rem; padding: 1rem 1.25rem;
  background: var(--accent-softer); border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
}
.resume.is-on { display: flex; }
.resume p { margin: 0; font-size: .9375rem; }

/* ---------- 17. Pied de page ---------- */
.sitefoot {
  margin-top: 4rem; padding-block: 2.5rem 3.5rem;
  border-top: 1px solid var(--border);
  font-size: .875rem; color: var(--text-muted);
}
.sitefoot p { max-width: 78ch; }
.disclaimer {
  padding: 1.1rem 1.25rem; margin-top: 2rem;
  background: var(--bg-alt); border-radius: var(--radius);
  font-size: .8125rem; color: var(--text-muted);
}
.disclaimer strong { color: var(--text); }

/* ---------- 18. Feuille mobile du sommaire ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  display: grid; align-items: end;
  background: rgb(0 0 0 / .45);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease);
}
.sheet[open], .sheet.is-open { opacity: 1; pointer-events: auto; }
.sheet__panel {
  background: var(--bg); border-radius: 18px 18px 0 0;
  max-height: 82vh; overflow-y: auto;
  padding: 1rem 1.25rem 2rem;
  transform: translateY(100%);
  transition: transform .28s var(--ease);
  box-shadow: var(--shadow-lg);
}
.sheet.is-open .sheet__panel { transform: none; }
.sheet__grab { width: 40px; height: 4px; border-radius: 100px; background: var(--border-strong); margin: .25rem auto 1rem; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.sheet__head h2 { margin: 0; font-size: 1.125rem; }
.sheet__list { list-style: none; margin: 0; padding: 0; }
.sheet__list a {
  display: grid; grid-template-columns: 2.2rem 1fr; gap: .6rem;
  padding: .7rem .25rem; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: .9375rem;
}
.sheet__list a .n { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.sheet__list a[aria-current="true"] { color: var(--accent-strong); font-weight: 600; }
@media (min-width: 1080px) { .sheet, .js-toc-open { display: none !important; } }

/* ---------- 19. Animations d'apparition ----------
   Les états de départ sont préfixés par `.js`, posé par un script en ligne
   dans le <head>. Sans JavaScript, rien n'est masqué : le contenu est lisible
   tel quel, l'animation n'est qu'un enrichissement. */
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.js .reveal[data-delay="1"].is-in { transition-delay: .06s; }
.js .reveal[data-delay="2"].is-in { transition-delay: .12s; }
.js .reveal[data-delay="3"].is-in { transition-delay: .18s; }
.js .reveal[data-delay="4"].is-in { transition-delay: .24s; }

/* barres qui se remplissent à l'entrée dans le champ */
.js .grow { transform: scaleX(0); transform-origin: left center; }
.js .grow.is-in { transform: scaleX(1); transition: transform .8s var(--ease); }

/* ---------- 20. Respect de prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .js .grow { transform: none; }
}

/* ---------- 21. Impression ---------- */
@media print {
  .masthead, .toc, .sheet, .pager, .steps__bar, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page.has-toc { display: block; }
  .module { break-inside: avoid; border-top: 1px solid #ccc; }
  .step[hidden] { display: block !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}
