/* KOR'K Sensor — Le prototype. Site privé.
   Fond blanc, Helvetica, grille de 12 colonnes, un seul accent : l'orange KOR'K (terracotta 500). */

:root {
  color-scheme: light;
  --fond: #ffffff;
  --encre: #111111;            /* 18,9:1 */
  --encre-2: #555555;          /* 7,5:1 */
  --encre-3: #6b6b6b;          /* 5,3:1 : légendes, sources */
  --filet: #e6e6e6;
  --filet-2: #cfcfcf;
  --lavis: #f4f4f3;
  --donnee-grise: #9a9a9a;     /* séries de contexte */

  /* Orange KOR'K (design system KOR'K Scan, terracotta) */
  --accent: #D87757;           /* tracés : 3,1:1, validé dataviz */
  --accent-encre: #A85539;     /* liens et textes : 5,2:1 */
  --accent-pale: #FBEBE3;

  /* Couleurs du produit, à ne pas confondre avec l'accent */
  --voyant-blanc: #FFF4E0;
  --voyant-rouge: #D14545;

  --police: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --marge: clamp(16px, 4vw, 48px);
  --gouttiere: clamp(16px, 2vw, 24px);
  --largeur: 1280px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  interpolate-size: allow-keywords;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font-family: var(--police); font-size: 17px; line-height: 1.55;
  font-kerning: normal; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.prose a, .source a, .lien { color: var(--accent-encre); }
:focus-visible { outline: 2px solid var(--accent-encre); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: 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; }
h1, h2, h3, h4, p, figure, ol, ul, dl, dd, blockquote { margin: 0; }
h1, h2, h3, h4 { font-weight: 500; text-wrap: balance; }
p, li, dd, .desc, figcaption { text-wrap: pretty; }
code { font-family: inherit; color: var(--encre-2); }
button { font: inherit; color: inherit; }

/* ---------- Grille ---------- */
.grille {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gouttiere);
  max-width: calc(var(--largeur) + 2 * var(--marge)); margin-inline: auto; padding-inline: var(--marge);
}
.plein { grid-column: 1 / -1; }

/* ---------- Rideau : le nom, un champ, rien d'autre ---------- */
html.ouvert .rideau { display: none; }
html:not(.ouvert) .site { display: none; }
.rideau {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--fond); padding: 24px; transition: opacity 240ms var(--ease-out);
}
.rideau.sort { opacity: 0; }
.rideau-form { width: min(280px, 100%); text-align: center; }
.rideau-nom { font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; }
.champ { position: relative; margin-top: 44px; border-bottom: 1px solid var(--encre); }
.champ input {
  display: block; width: 100%; border: 0; outline: none; background: transparent; border-radius: 0;
  -webkit-appearance: none; appearance: none; box-shadow: none;
  font: inherit; font-size: 17px; color: var(--encre); text-align: center; letter-spacing: 0.04em;
  padding: 12px 40px;
}
.champ input:placeholder-shown { caret-color: transparent; }
.champ input:focus:placeholder-shown { caret-color: transparent; }
.champ input::placeholder { color: var(--encre-3); opacity: 1; }
.champ button {
  position: absolute; right: -2px; top: 50%; translate: 0 -50%;
  width: 44px; height: 44px; border: 0; background: none; padding: 0;
  font-size: 19px; line-height: 1; cursor: pointer; color: var(--encre);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.champ input:placeholder-shown + button { opacity: 0; pointer-events: none; }
.champ button:active { transform: scale(0.94); }
.champ button:focus-visible { outline: none; color: var(--accent-encre); }
.rideau-erreur { min-height: 22px; margin-top: 14px; font-size: 14px; color: var(--encre-2); }
.champ.secoue { animation: secousse 300ms var(--ease-out); }
@keyframes secousse { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }

/* ---------- En-tête ---------- */
.entete { position: sticky; top: 0; z-index: 10; background: rgb(255 255 255 / 0.95); border-bottom: 1px solid var(--filet); }
.entete .grille { align-items: center; min-height: 56px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "chap nom nav"; }
/* Nom seul, centré dans la barre (choix d'Amdy du 9 nov. : pas de logo dans le menu) */
.entete-nom { grid-area: nom; justify-self: center; font-size: 16px; font-weight: 500; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap; padding: 12px 0; }
.entete-nav { display: flex; align-items: center; gap: 22px; }
.langue { display: inline-flex; align-items: center; gap: 0; font-size: 13px; letter-spacing: 0.04em; }
.langue-sep { padding: 0 5px; color: var(--encre-3); font-size: 14px; }
.langue a { padding: 12px 4px; color: var(--encre-3); text-decoration: none; }
.langue a[aria-current="true"] { color: var(--encre); box-shadow: inset 0 -2px 0 var(--accent); }
@media (hover: hover) and (pointer: fine) { .langue a:hover { color: var(--accent-encre); } }
.entete-chapitre { grid-area: chap; justify-self: start; max-width: 100%; padding-right: 16px; font-size: 15px; color: var(--encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete-nav { grid-area: nav; justify-self: end; font-size: 15px; }
.entete-nav a { text-decoration: none; display: inline-block; padding: 12px 0; }
@media (hover: hover) and (pointer: fine) { .entete-nav a:hover, .entete-nom:hover { color: var(--accent-encre); } }

/* ---------- Couverture ---------- */
.couverture { padding-top: 0; }
.couverture figure { grid-column: 1 / -1; }
.hero-cadre { position: relative; display: grid; }
/* Plusieurs images qui alternent en fondu, empilées dans la même case */
.hero-vue { grid-area: 1 / 1; opacity: 0; transition: opacity 1400ms var(--ease-in-out); }
.hero-vue.est-active { opacity: 1; }
.couverture .hero-haut img { object-position: 50% 8%; }  /* garde le boîtier, en haut de l'angle */
.hero-points { position: absolute; z-index: 2; right: max(var(--marge), calc((100% - var(--largeur)) / 2)); bottom: clamp(24px, 6vh, 72px); display: flex; gap: 4px; }
.hero-points button { width: 28px; height: 28px; border: 0; padding: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.hero-points button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgb(255 255 255 / 0.5); transition: background-color 200ms ease, transform 200ms var(--ease-out); }
.hero-points button[aria-pressed="true"]::before { background: #fff; transform: scale(1.25); }
@media (prefers-reduced-motion: reduce) { .hero-vue { transition: none; } }
.hero-cadre::after {  /* dégradé discret : le texte blanc reste lisible sur le mur vert sauge */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgb(22 30 24 / 0.62), rgb(22 30 24 / 0) 52%), linear-gradient(to right, rgb(22 30 24 / 0.3), rgb(22 30 24 / 0) 46%);
}
.hero-texte {
  position: absolute; z-index: 1; left: max(var(--marge), calc((100% - var(--largeur)) / 2)); bottom: clamp(24px, 6vh, 72px);
  color: #fff; max-width: min(1000px, calc(100% - 2 * var(--marge)));
}
.hero-texte h1 { font-size: clamp(46px, 8vw, 116px); line-height: 0.98; letter-spacing: -0.035em; font-weight: 500; text-wrap: balance; }
.hero-texte p { margin-top: clamp(10px, 1.6vh, 18px); font-size: clamp(15px, 1.5vw, 19px); color: rgb(255 255 255 / 0.9); }
/* Couverture en plein écran : l'image occupe toute la largeur et tout l'écran sous l'en-tête */
.couverture picture img { width: 100%; height: calc(100svh - 57px); min-height: 420px; object-fit: cover; object-position: 50% 50%; background: #8f9a86; }
.couverture .legende { max-width: calc(var(--largeur) + 2 * var(--marge)); margin: 12px auto 0; padding-inline: var(--marge); }

/* Accueil : dix cases, une par chapitre */
.cases { grid-column: 1 / -1; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--filet); border: 1px solid var(--filet); }
.cases li { display: flex; background: var(--fond); }
.case {
  position: relative; flex: 1; display: grid; grid-template-rows: auto auto 1fr auto; gap: 10px;
  min-height: 220px; padding: 20px 20px 18px; text-decoration: none;
  transition: background-color 160ms ease;
}
.case-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
/* Dix petits schémas au trait, un par chapitre : gris, un seul détail d'accent */
.case-picto { flex: none; width: 72px; height: 54px; color: var(--encre-2); transition: color 160ms ease, transform 200ms var(--ease-out); }
.case-picto .a { fill: var(--accent); stroke: none; }
.case-picto .a-trait { stroke: var(--accent); }
.case-picto .a-zone { fill: var(--accent); fill-opacity: 0.14; stroke: var(--accent); stroke-opacity: 0.5; }
.case-picto .fin { stroke-width: 1; }
@media (hover: hover) and (pointer: fine) { .case:hover .case-picto { color: var(--encre); transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .case-picto { transition: none; } }
.case-num { font-size: 15px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.case-titre { font-size: 21px; line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; }
.case-desc { font-size: 14px; line-height: 1.5; color: var(--encre-2); }
.case-fleche { justify-self: end; font-size: 18px; color: var(--encre-3); transition: transform 160ms var(--ease-out), color 160ms ease; }
.case::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 200ms var(--ease-out); }
.case:active { background: var(--lavis); }
@media (hover: hover) and (pointer: fine) {
  .case:hover { background: #fcfbfa; }
  .case:hover::before { transform: scaleX(1); }
  .case:hover .case-titre, .case:hover .case-fleche { color: var(--accent-encre); }
  .case:hover .case-fleche { transform: translateX(3px); }
}
.case:focus-visible { outline-offset: -3px; }
.legende { margin-top: 10px; font-size: 13px; line-height: 1.45; color: var(--encre-3); max-width: 72ch; }
.accroche { margin-top: clamp(32px, 4vw, 64px); align-items: end; }
.accroche .accroche-texte { grid-column: 1 / 10; font-size: clamp(30px, 4.3vw, 58px); line-height: 1.06; letter-spacing: -0.028em; font-weight: 500; }
.accroche .mention { grid-column: 10 / -1; justify-self: end; text-align: right; font-size: 15px; line-height: 1.4; color: var(--encre-2); }

/* ---------- Listes de chapitres (sommaire, sous-parties) ---------- */
.sommaire { margin-top: clamp(72px, 10vw, 144px); }
.sur-titre { grid-column: 1 / -1; font-size: 13px; font-weight: 400; letter-spacing: 0.02em; color: var(--encre-3); margin-bottom: 16px; }
.liste-lignes { grid-column: 1 / -1; list-style: none; padding: 0; border-bottom: 1px solid var(--filet); }
.liste-lignes > li { border-top: 1px solid var(--filet); }
.ligne { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gouttiere); align-items: baseline; padding: 20px 0; text-decoration: none; }
.ligne .num { grid-column: 1 / 2; font-size: 15px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.ligne .titre { grid-column: 2 / 7; font-size: 22px; line-height: 1.25; font-weight: 500; letter-spacing: -0.01em; }
.ligne .desc { grid-column: 7 / 12; font-size: 15px; line-height: 1.5; color: var(--encre-2); }
.ligne .fleche { grid-column: 12 / -1; justify-self: end; font-size: 18px; color: var(--encre-3); }
a.ligne:active { opacity: 0.7; }
@media (hover: hover) and (pointer: fine) { a.ligne:hover .titre, a.ligne:hover .fleche { color: var(--accent-encre); } }

.pied { margin-block: clamp(72px, 9vw, 128px) 40px; }
.pied p { grid-column: 1 / -1; font-size: 13px; color: var(--encre-3); }

/* ---------- Ouverture de chapitre ---------- */
.ouverture { padding-top: clamp(48px, 8vw, 120px); }
.ouverture .num-chapitre { grid-column: 1 / -1; font-size: 15px; color: var(--encre-3); }
.ouverture h1 { grid-column: 1 / 11; margin-top: 12px; font-size: clamp(40px, 6.4vw, 84px); line-height: 1.02; letter-spacing: -0.032em; }
.ouverture .chapeau { grid-column: 1 / 9; margin-top: 28px; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; color: var(--encre-2); }

.parties-nav { margin-top: clamp(40px, 6vw, 72px); }
.parties-nav ol { grid-column: 1 / -1; list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0 32px; border-block: 1px solid var(--filet); }
.parties-nav a { display: inline-block; padding: 14px 0; font-size: 15px; text-decoration: none; color: var(--encre-2); }
.parties-nav .n { color: var(--encre-3); margin-right: 6px; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .parties-nav a:hover { color: var(--accent-encre); } }

/* ---------- Sections et rangs (étiquette | contenu) ---------- */
.partie { margin-top: clamp(72px, 10vw, 136px); }
.rang { display: contents; }
.etiquette { grid-column: 1 / 4; padding-top: 6px; font-size: 13px; letter-spacing: 0.02em; color: var(--encre-3); }
.contenu { grid-column: 4 / 12; min-width: 0; }
.contenu.large { grid-column: 4 / -1; }
.rang + .rang > * { margin-top: clamp(32px, 4vw, 52px); }
.partie h2 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.08; letter-spacing: -0.025em; }
.partie h3 { font-size: 21px; line-height: 1.3; letter-spacing: -0.01em; }
.question { font-size: 21px; line-height: 1.45; }

.prose { max-width: 66ch; }
.prose p, .prose li { font-size: 18px; line-height: 1.6; }
.prose p + p, .prose p + ul, .prose ul + p, .prose p + ol, .prose ol + p { margin-top: 1em; }
.prose ul, .prose ol { padding-left: 1.15em; }
.prose li + li { margin-top: 0.35em; }
.prose strong { font-weight: 500; }
.prose .gris { color: var(--encre-2); }
.citation { border-left: 2px solid var(--accent); padding: 2px 0 2px 20px; font-size: 21px; line-height: 1.45; max-width: 52ch; }

.chiffre-cle { font-size: clamp(72px, 10vw, 132px); line-height: 0.95; letter-spacing: -0.035em; font-weight: 400; }
.chiffre-cle + p { margin-top: 18px; max-width: 58ch; font-size: 19px; line-height: 1.5; }
.chiffre-cle + p .gris { color: var(--encre-2); }

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 var(--gouttiere); border-top: 1px solid var(--encre); }
.chiffre { padding-top: 16px; }
.chiffre-valeur { font-size: clamp(32px, 3.4vw, 44px); line-height: 1.05; letter-spacing: -0.02em; }
.chiffre-libelle { margin-top: 8px; font-size: 14px; line-height: 1.45; color: var(--encre-2); }

/* ---------- Images ---------- */
.fig img { width: 100%; background: var(--lavis); }
.fig.contour img { outline: 1px solid var(--filet); outline-offset: -1px; }
.galerie { display: grid; gap: clamp(24px, 3vw, 40px) var(--gouttiere); }
.galerie-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.galerie-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ia { color: var(--encre-2); }

/* Croquis à repères */
.croquis { position: relative; }
.croquis img { width: 100%; }
.point {
  position: absolute; translate: -50% -50%; width: 44px; height: 44px; border: 0; padding: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.point span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--encre); color: #fff; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px #fff; transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.point[aria-pressed="true"] span { background: var(--accent); transform: scale(1.08); }
.point:active span { transform: scale(0.94); }
.notes-croquis { list-style: none; padding: 0; counter-reset: n; border-top: 1px solid var(--filet); }
.notes-croquis li { display: grid; grid-template-columns: 36px 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--filet); font-size: 15px; line-height: 1.5; color: var(--encre-2); transition: color 160ms ease; }
.notes-croquis li .n { font-variant-numeric: tabular-nums; color: var(--encre-3); }
.notes-croquis li.actif { color: var(--encre); }
.notes-croquis li.actif .n { color: var(--accent-encre); }
.notes-croquis strong { font-weight: 500; color: var(--encre); }

/* Plan du stand : deux vues à repères, une légende commune */
.stand-plan { grid-column: 1 / -1; display: grid; gap: clamp(20px, 3vw, 36px); margin-top: 8px; }
.stand-vue .croquis { border: 1px solid var(--filet); overflow: hidden; }
.stand-vue .cadre { position: relative; display: grid; }
.stand-vue .vue { grid-area: 1 / 1; }
.stand-vue .vue-rendu img { width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
/* Deux boutons : le schéma (avec repères) ou le rendu IA (sans repères) */
.bascule { display: inline-flex; gap: 2px; margin-bottom: 12px; padding: 2px; border: 1px solid var(--filet-2); border-radius: 999px; }
.bascule button { border: 0; background: transparent; padding: 7px 16px; min-height: 36px; border-radius: 999px; font-size: 14px; color: var(--encre-2); cursor: pointer; transition: background-color 160ms ease, color 160ms ease; }
.bascule button[aria-pressed="true"] { background: var(--encre); color: #fff; }
.bascule button:active { transform: scale(0.97); }
.stand-vue .vue-rendu { opacity: 0; visibility: hidden; transition: opacity 240ms var(--ease-out), visibility 0s linear 240ms; }
.stand-vue[data-mode="rendu"] .vue-rendu { opacity: 1; visibility: visible; transition: opacity 240ms var(--ease-out), visibility 0s; }
.stand-vue[data-mode="rendu"] .point { opacity: 0; pointer-events: none; }
.stand-vue .point { transition: opacity 160ms ease; }
.stand-vue .legende-rendu { visibility: hidden; }
.stand-vue[data-mode="rendu"] .legende-rendu { visibility: visible; }
@media (prefers-reduced-motion: reduce) { .stand-vue .vue-rendu, .stand-vue .point { transition: none; } }
.stand-plan .point span { background: var(--accent-encre); }
.stand-plan .point[aria-pressed="true"] span { background: var(--encre); }
.notes-stand { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gouttiere); border-top: 0; }
.notes-stand li:nth-child(-n+2) { border-top: 1px solid var(--filet); }
.stand-plan .source { margin-top: -8px; }
@media (max-width: 760px) {
  .notes-stand { grid-template-columns: 1fr; }
  .notes-stand li:nth-child(2) { border-top: 0; }
  /* le dessin occupe le milieu du 16:9 : on recadre sur la partie utile, les repères en % restent justes */
  .stand-vue .cadre { width: 190%; margin-left: -45%; }
  .stand-plan .point { width: 36px; height: 36px; }
  .stand-plan .point span { width: 24px; height: 24px; font-size: 12px; }
}

.croquis-bloc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.a-venir { border: 1px solid var(--filet-2); background: var(--lavis); padding: 20px; display: grid; gap: 6px; }
.a-venir strong { font-weight: 500; }
.a-venir p { font-size: 15px; color: var(--encre-2); }
.liste-simple { list-style: none; padding: 0; border-top: 1px solid var(--filet); }
.liste-simple li { padding: 12px 0; border-bottom: 1px solid var(--filet); font-size: 16px; line-height: 1.55; }
.liste-simple strong { font-weight: 500; }

/* Évolution des formes */
.formes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gouttiere); }
.formes li { border-top: 1px solid var(--encre); padding-top: 14px; }
.formes .etape { font-size: 13px; color: var(--encre-3); }
.formes h3 { margin-top: 4px; font-size: 20px; }
.formes img { margin-top: 14px; aspect-ratio: 4 / 3; object-fit: contain; background: var(--lavis); }
.formes p { margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--encre-2); }
.formes .verdict { margin-top: 10px; font-size: 14px; color: var(--encre); }

/* ---------- Graphes ---------- */
.figure-titre { font-size: 17px; font-weight: 500; line-height: 1.35; }
.figure-sous-titre { margin-top: 4px; font-size: 15px; color: var(--encre-2); }
.graphe { position: relative; margin-top: 20px; touch-action: pan-y; }
.graphe svg { width: 100%; overflow: visible; }
.graphe svg:focus-visible { outline: 2px solid var(--accent-encre); outline-offset: 6px; }
.graphe text { font-family: var(--police); }
.graphe .g-zone { fill: var(--lavis); }
.graphe .g-grille { stroke: var(--filet); stroke-width: 1; }
.graphe .g-axe { stroke: var(--filet-2); stroke-width: 1; }
.graphe .g-seuil { stroke: var(--encre-3); stroke-width: 1; }
.graphe .g-ligne { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphe .g-ligne.gris { stroke: var(--donnee-grise); }
.graphe .g-point { fill: var(--accent); stroke: var(--fond); stroke-width: 2; }
.graphe .g-point.gris { fill: var(--donnee-grise); }
.graphe .g-point.creux { fill: var(--fond); stroke: var(--donnee-grise); stroke-width: 2; }
.graphe .g-tige { stroke: var(--filet-2); stroke-width: 2; }
.graphe .g-viseur { stroke: var(--encre-3); stroke-width: 1; }
.graphe .g-repere { fill: none; stroke: var(--encre); stroke-width: 2; }
.graphe .g-t1 { fill: var(--encre); }
.graphe .g-t2 { fill: var(--encre-2); }
.graphe .g-t3 { fill: var(--encre-3); }
.graphe .g-num { font-variant-numeric: tabular-nums; }
.graphe .g-cellule { stroke: var(--fond); stroke-width: 1; }
.graphe .g-barre { fill: var(--accent); }
.graphe .g-barre.gris { fill: var(--donnee-grise); }
.graphe .g-auj { stroke: var(--encre); stroke-width: 1; }
.legende-series { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 14px; font-size: 13px; color: var(--encre-2); list-style: none; padding: 0; }
.legende-series li { display: inline-flex; align-items: center; gap: 8px; }
.cle { display: inline-block; width: 16px; height: 2px; background: var(--accent); }
.cle.gris { background: var(--donnee-grise); }
.cle.rond { width: 10px; height: 10px; border-radius: 50%; }
.cle.creux { background: var(--fond); box-shadow: inset 0 0 0 2px var(--donnee-grise); }
.cle.carre { width: 12px; height: 12px; border-radius: 2px; }
.bulle {
  position: absolute; top: 0; left: 0; z-index: 3; pointer-events: none;
  background: var(--fond); border: 1px solid var(--filet-2); padding: 8px 10px;
  font-size: 13px; line-height: 1.4; white-space: nowrap;
  opacity: 0; transform: translateY(2px); transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out);
}
.bulle.visible { opacity: 1; transform: none; }
.bulle strong { font-weight: 500; }
.bulle .gris { color: var(--encre-2); }
.source { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--encre-3); max-width: 84ch; }
.source code { color: var(--encre-2); }
.echelle { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--encre-3); }
.echelle-barre { width: 180px; height: 10px; border-radius: 2px; }

/* ---------- Panneaux dépliables ---------- */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details::details-content { block-size: 0; overflow-y: clip; transition: block-size 260ms var(--ease-out), content-visibility 260ms allow-discrete; }
details[open]::details-content { block-size: auto; }

.donnees { margin-top: 10px; }
.donnees > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--accent-encre); }
.donnees > summary::after { content: "+"; font-size: 16px; transition: transform 160ms var(--ease-out); }
.donnees[open] > summary::after { transform: rotate(45deg); }

.methode { border-block: 1px solid var(--encre); }
.methode > summary { display: flex; justify-content: space-between; align-items: center; min-height: 64px; font-size: 19px; font-weight: 500; transition: color 160ms ease; }
.methode > summary::after { content: "+"; font-size: 26px; font-weight: 400; transition: transform 200ms var(--ease-out); }
.methode[open] > summary::after { transform: rotate(45deg); }
@media (hover: hover) and (pointer: fine) { .methode > summary:hover, .donnees > summary:hover { color: var(--accent-encre); } }
.methode-corps { padding: 8px 0 40px; display: grid; gap: 32px; }
.methode-corps h3 { font-size: 13px; font-weight: 400; letter-spacing: 0.02em; color: var(--encre-3); margin-bottom: 8px; }
.methode-corps p, .methode-corps li { font-size: 16px; line-height: 1.6; max-width: 68ch; }
.methode-corps ul, .methode-corps ol { padding-left: 1.1em; }
.methode-corps li + li { margin-top: 4px; }
.formule { font-size: 16px; padding: 12px 0; border-block: 1px solid var(--filet); font-variant-numeric: tabular-nums; }

/* ---------- Tableaux ---------- */
.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { text-align: right; padding: 8px 0 8px 16px; border-bottom: 1px solid var(--filet); font-variant-numeric: tabular-nums; vertical-align: top; }
.tableau th:first-child, .tableau td:first-child { text-align: left; padding-left: 0; }
.tableau .texte { text-align: left; }
.tableau thead th { font-weight: 500; color: var(--encre-2); border-bottom-color: var(--filet-2); vertical-align: bottom; }
.tableau tr.marque td { font-weight: 500; }
.tableau caption { caption-side: bottom; text-align: left; padding-top: 12px; font-size: 13px; color: var(--encre-3); }
.tableau.compact { font-size: 13px; }
.tableau.etroit { max-width: 560px; }

/* ---------- Correction et erreurs ---------- */
.correction { border-top: 1px solid var(--encre); padding-top: 18px; display: grid; grid-template-columns: auto 1fr; column-gap: 32px; row-gap: 10px; align-items: baseline; }
.avant-apres { font-size: 28px; letter-spacing: -0.02em; white-space: nowrap; }
.avant-apres s { color: var(--encre-3); text-decoration-thickness: 1px; }
.correction p { font-size: 16px; color: var(--encre-2); }
.erreurs { list-style: none; padding: 0; display: grid; gap: 0; border-bottom: 1px solid var(--filet); }
.erreur { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); gap: 8px var(--gouttiere); padding: 20px 0; border-top: 1px solid var(--filet); }
.erreur .n { font-size: 15px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.erreur h3 { grid-column: 2 / -1; font-size: 19px; }
.erreur .avant, .erreur .apres { font-size: 15px; line-height: 1.55; }
.erreur .avant { grid-column: 2; color: var(--encre-2); }
.erreur .apres { grid-column: 3; }
.erreur .mot { display: block; font-size: 12px; letter-spacing: 0.02em; color: var(--encre-3); margin-bottom: 4px; }
.erreur .apres .mot { color: var(--accent-encre); }

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--filet-2); background: var(--fond); color: var(--encre); font-size: 14px; cursor: pointer;
  transition: border-color 160ms ease, transform 160ms var(--ease-out);
}
.bouton:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .bouton:hover { border-color: var(--encre); } }
.segment { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--filet-2); }
.segment button {
  min-height: 40px; padding: 0 14px; border: 0; background: var(--fond); font-size: 14px; color: var(--encre-2); cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.segment button + button { border-left: 1px solid var(--filet-2); }
.segment button[aria-pressed="true"] { background: var(--encre); color: #fff; }
.segment button:active { transform: scale(0.97); }
.curseur { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; font-size: 14px; color: var(--encre-2); }
.curseur output { font-variant-numeric: tabular-nums; color: var(--encre); font-weight: 500; }
.curseur input[type="range"] { grid-column: 1 / -1; width: 100%; margin: 6px 0 0; accent-color: var(--accent); height: 28px; }
.groupe { display: grid; gap: 8px; }
.groupe-titre { font-size: 13px; color: var(--encre-3); letter-spacing: 0.02em; }

/* ---------- Visionneuse 3D ---------- */
.visionneuse { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--gouttiere); align-items: start; }
.vis-scene { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(#fff, #f6f6f4); border: 1px solid var(--filet); overflow: hidden; }
.vis-scene canvas { width: 100% !important; height: 100% !important; touch-action: none; cursor: grab; }
.vis-scene canvas:active { cursor: grabbing; }
.vis-commandes { display: grid; gap: 24px; }
.vis-repere { position: absolute; top: 0; left: 0; pointer-events: none; font-size: 12px; line-height: 1.3; color: var(--encre); background: rgb(255 255 255 / 0.92); padding: 2px 6px; border: 1px solid var(--filet-2); white-space: nowrap; }
.vis-repere::before { content: ""; position: absolute; left: var(--vis-ancre-x, 0); top: var(--vis-ancre-y, 50%); width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff; }
.vis-etape-materiel { margin-top: 8px; font-size: 13px; color: var(--encre-3); }
.vis-secours figure { margin-top: 12px; }
.vis-etape { border-top: 1px solid var(--encre); padding-top: 14px; }
.visionneuse[data-vis-mode="montage"] { grid-template-rows: auto 1fr; }
.visionneuse[data-vis-mode="montage"] .vis-scene { grid-column: 1; grid-row: 1 / span 2; }
.visionneuse[data-vis-mode="montage"] .vis-etape { grid-column: 2; grid-row: 1; }
.visionneuse[data-vis-mode="montage"] .vis-commandes { grid-column: 2; grid-row: 2; align-self: start; display: flex; flex-wrap: wrap; gap: 8px; }
.vis-etape-compteur { font-size: 13px; color: var(--encre-3); }
.vis-etape h3 { margin-top: 6px; font-size: 19px; }
.vis-etape p { margin-top: 8px; font-size: 15px; line-height: 1.55; color: var(--encre-2); }
.vis-secours { padding: 24px; font-size: 14px; color: var(--encre-2); }
.attente { display: grid; place-items: center; min-height: 320px; font-size: 14px; color: var(--encre-3); background: var(--lavis); }

/* ---------- Chambre interactive ---------- */
.chambre { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 20px clamp(24px, 3vw, 48px); align-items: start; }
.chambre-carte { position: relative; grid-column: 1; grid-row: 1 / span 2; }
.chambre .legende-echelle { grid-column: 1; grid-row: 3; display: grid; gap: 6px; max-width: 520px; }
.chambre .legende-titre, .chambre .legende-hors-champ { margin: 0; }
.chambre-commandes { display: grid; gap: 24px; grid-column: 2; grid-row: 1; }
.chambre .lectures { grid-column: 2; grid-row: 2; }
.bulle-note, .bulle-detail { display: block; }
.lectures { display: grid; gap: 0; border-top: 1px solid var(--encre); }
.lecture { display: grid; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--filet); }
.lecture-libelle { font-size: 13px; color: var(--encre-3); }
.lecture-valeur { font-size: 26px; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.legende-echelle { font-size: 12px; color: var(--encre-3); }
.note-portee { font-size: 14px; color: var(--accent-encre); }

/* ---------- Façade : voyant et volet (chapitre 06) ---------- */
.facade-demo { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.facade-demo svg { width: 100%; height: auto; }
.facade-demo .volet { transition: transform 250ms var(--ease-out); }
.facade-demo .lueur { transition: opacity 200ms ease; }
.facade-commandes { display: grid; gap: 20px; }
.etat-texte { font-size: 16px; line-height: 1.55; min-height: 3.2em; }

/* ---------- Trajet des données ---------- */
.flux { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; counter-reset: f; }
.flux li { position: relative; padding: 16px 16px 0 0; border-top: 2px solid var(--encre); }
.flux li::before { counter-increment: f; content: counter(f, decimal-leading-zero); display: block; font-size: 12px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.flux li.hors-ue { border-top-color: var(--accent); }
.flux h3 { margin-top: 6px; font-size: 17px; }
.flux .lieu { margin-top: 2px; font-size: 13px; color: var(--encre-3); }
.flux p { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--encre-2); }

/* ---------- Frise des décisions ---------- */
.frise-pistes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.frise { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 17), minmax(0, 1fr)); border-top: 1px solid var(--encre); }
.frise button {
  width: 100%; min-height: 64px; padding: 10px 2px 8px; border: 0; background: none; cursor: pointer; text-align: left;
  display: grid; gap: 4px; align-content: start; border-right: 1px solid var(--filet); color: var(--encre-2);
  transition: color 160ms ease, background-color 160ms ease;
}
.frise li:last-child button { border-right: 0; }
.frise .n { font-size: 15px; font-variant-numeric: tabular-nums; padding-left: 6px; }
.frise .trait { height: 3px; background: transparent; }
.frise button[aria-pressed="true"] { color: var(--encre); background: var(--lavis); }
.frise button[aria-pressed="true"] .trait { background: var(--accent); }
.frise button.attenue { color: #bdbdbd; }
@media (hover: hover) and (pointer: fine) { .frise button:hover { color: var(--encre); } }
.frise-detail { margin-top: clamp(28px, 3vw, 40px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(24px, 3vw, 48px); align-items: start; }
.frise-detail .n-etape { font-size: 13px; color: var(--encre-3); }
.frise-detail h3 { margin-top: 6px; font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -0.02em; }
.frise-detail .resume { margin-top: 14px; font-size: 17px; line-height: 1.6; color: var(--encre-2); max-width: 62ch; }
.decisions { list-style: none; padding: 0; margin-top: 24px; border-top: 1px solid var(--filet); }
.decisions li { padding: 14px 0; border-bottom: 1px solid var(--filet); display: grid; gap: 6px; }
.decisions .quoi { font-size: 16px; font-weight: 500; }
.decisions dl { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; font-size: 14px; line-height: 1.5; }
.decisions dt { color: var(--encre-3); }
.decisions dd { color: var(--encre-2); }

/* ---------- Planning ---------- */
.planning svg text { font-family: var(--police); }

/* ---------- Roadmap ---------- */
.phases { list-style: none; padding: 0; border-bottom: 1px solid var(--filet); }
.phases li { display: grid; grid-template-columns: 56px minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px var(--gouttiere); padding: 18px 0; border-top: 1px solid var(--filet); align-items: baseline; }
.phases .n { font-size: 15px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.phases h3 { font-size: 19px; }
.phases .periode { display: block; margin-top: 2px; font-size: 13px; color: var(--encre-3); font-weight: 400; }
.phases p { font-size: 15px; line-height: 1.5; color: var(--encre-2); }
.phases .mot { display: block; font-size: 12px; color: var(--encre-3); letter-spacing: 0.02em; margin-bottom: 2px; }
.phases li.ici { background: linear-gradient(90deg, var(--accent-pale), transparent 70%); }
.verrous { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gouttiere); }
.verrous li { border-top: 1px solid var(--encre); padding-top: 14px; }
.verrous .n { font-size: 13px; color: var(--encre-3); }
.verrous h3 { margin-top: 4px; font-size: 19px; }
.verrous p { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--encre-2); }

/* ---------- Nuremberg ---------- */
.faits { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); border-top: 1px solid var(--encre); }
.faits dt, .faits dd { padding: 14px 0; border-bottom: 1px solid var(--filet); }
.faits dt { font-size: 14px; color: var(--encre-3); padding-right: 16px; }
.faits dd { font-size: 16px; line-height: 1.55; }
.faits dd .source { margin-top: 4px; }
.jours { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--encre); }
.jours li { padding: 14px 14px 14px 0; border-right: 1px solid var(--filet); }
.jours li:last-child { border-right: 0; }
.jours .date { font-size: 13px; color: var(--encre-3); }
.jours h3 { margin-top: 4px; font-size: 17px; }
.jours p { margin-top: 8px; font-size: 14px; line-height: 1.5; color: var(--encre-2); }
.jours li.fort h3::after { content: ""; display: block; width: 24px; height: 3px; background: var(--accent); margin-top: 8px; }

/* ---------- Annexes ---------- */
.journal { max-width: 70ch; }
.journal h2 { margin-top: 56px; font-size: 26px; letter-spacing: -0.015em; }
.journal h2:first-child { margin-top: 0; }
.journal h3 { margin-top: 28px; font-size: 19px; }
.journal p, .journal li { font-size: 16px; line-height: 1.65; }
.journal p, .journal ul, .journal ol, .journal table, .journal figure { margin-top: 14px; }
.journal ul, .journal ol { padding-left: 1.15em; }
.journal strong { font-weight: 500; }
.journal img { margin-top: 18px; width: 100%; outline: 1px solid var(--filet); outline-offset: -1px; }
.journal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.journal th, .journal td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--filet); vertical-align: top; }
.journal th { font-weight: 500; color: var(--encre-2); }
.journal hr { border: 0; border-top: 1px solid var(--filet); margin: 40px 0; }
.filtre { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.filtre input[type="search"] {
  -webkit-appearance: none; appearance: none; border: 0; border-bottom: 1px solid var(--encre); border-radius: 0;
  font: inherit; font-size: 16px; padding: 10px 0; min-width: min(360px, 100%); background: transparent; outline: none;
}
.filtre .compte { font-size: 13px; color: var(--encre-3); }
.sources-liste { list-style: none; padding: 0; border-top: 1px solid var(--filet); }
.sources-liste li { padding: 12px 0; border-bottom: 1px solid var(--filet); font-size: 15px; line-height: 1.5; }
.sources-liste .quand { color: var(--encre-3); font-size: 13px; }
.glossaire { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); border-top: 1px solid var(--filet); }
.glossaire dt, .glossaire dd { padding: 12px 0; border-bottom: 1px solid var(--filet); font-size: 15px; line-height: 1.5; }
.glossaire dt { font-weight: 500; padding-right: 16px; }
.glossaire dd { color: var(--encre-2); }

/* ---------- Suite ---------- */
.suite { margin-top: clamp(72px, 9vw, 128px); }
.suite nav { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--encre); }
.suite a { padding: 20px 0; text-decoration: none; font-size: 15px; color: var(--encre-2); }
.suite a strong { display: block; font-size: 22px; font-weight: 500; color: var(--encre); letter-spacing: -0.01em; }
.suite a + a, .suite a.droite { text-align: right; grid-column: 2; }
.suite a:active { opacity: 0.7; }
@media (hover: hover) and (pointer: fine) { .suite a:hover strong { color: var(--accent-encre); } }

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 960px) {
  .cases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case { min-height: 180px; }
  .visionneuse, .chambre { grid-template-columns: 1fr; }
  .vis-scene { aspect-ratio: 1 / 1; max-height: 68vh; }
  .visionneuse[data-vis-mode="montage"] { grid-template-rows: none; }
  .visionneuse[data-vis-mode="montage"] .vis-scene,
  .visionneuse[data-vis-mode="montage"] .vis-etape,
  .visionneuse[data-vis-mode="montage"] .vis-commandes { grid-column: 1; grid-row: auto; }
  .chambre { grid-template-rows: none; }
  .chambre-carte, .chambre .legende-echelle, .chambre-commandes, .chambre .lectures { grid-column: 1; grid-row: auto; }
  .formes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flux { grid-template-columns: 1fr; gap: 0; }
  .flux li { padding: 14px 0 18px 0; }
  .jours { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jours li:nth-child(2n) { border-right: 0; }
  .croquis-bloc { grid-template-columns: 1fr; }
  .frise { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .frise li:nth-child(9) button { border-right: 0; }
  .frise-detail { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .entete-nav > a { display: none; }  /* le nom centré mène déjà au sommaire */
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .entete-chapitre { display: none; }
  .entete-nav { gap: 14px; }
  .couverture picture img { object-position: 50% 50%; }
  .case { padding: 14px 14px 12px; min-height: 170px; gap: 6px; }
  .case-titre { font-size: 17px; }
  .case-picto { width: 56px; height: 42px; }
  .case-desc { font-size: 13px; }
  .accroche .accroche-texte { grid-column: 1 / -1; }
  .accroche .mention { justify-self: start; text-align: left; margin-top: 20px; }
  .ligne { grid-template-columns: 40px 1fr 20px; row-gap: 4px; padding: 18px 0; }
  .ligne .num { grid-column: 1; grid-row: 1; }
  .ligne .titre { grid-column: 2; grid-row: 1; font-size: 20px; }
  .ligne .desc { grid-column: 2; grid-row: 2; }
  .ligne .fleche { grid-column: 3; grid-row: 1; }
  .ouverture h1, .ouverture .chapeau { grid-column: 1 / -1; }
  .parties-nav ol { gap: 0 20px; }
  .etiquette, .contenu, .contenu.large { grid-column: 1 / -1; }
  .etiquette { padding-top: 0; }
  .rang > .etiquette + .contenu { margin-top: 8px !important; }
  .question { font-size: 19px; }
  .prose p, .prose li { font-size: 17px; }
  .correction { grid-template-columns: 1fr; }
  .galerie-2, .galerie-3 { grid-template-columns: 1fr; }
  .formes { grid-template-columns: 1fr; }
  .erreur { grid-template-columns: 32px 1fr; }
  .erreur .avant, .erreur .apres { grid-column: 2; }
  .phases li { grid-template-columns: 40px 1fr; }
  .phases li > p { grid-column: 2; }
  .verrous { grid-template-columns: 1fr; gap: 24px; }
  .faits, .glossaire { grid-template-columns: 1fr; }
  .faits dt, .glossaire dt { border-bottom: 0; padding-bottom: 0; }
  .jours { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jours li { border-right: 0; border-bottom: 1px solid var(--filet); }
  .facade-demo { grid-template-columns: 1fr; }
  .facade-demo svg { max-width: 260px; }
  .frise { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .frise button { border-right: 1px solid var(--filet) !important; border-bottom: 1px solid var(--filet); min-height: 52px; }
  .decisions dl { grid-template-columns: 1fr; }
  .suite nav { grid-template-columns: 1fr; }
  .suite a, .suite a + a, .suite a.droite { grid-column: 1; text-align: left; }
  .suite a + a { border-top: 1px solid var(--filet); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  details::details-content { transition: none; }
}
@media print {
  .rideau, .entete, .suite { display: none !important; }
  html:not(.ouvert) .site { display: block; }
}
