/* Onglet « Comprendre » : le procédé et les pages d'équipements. Reprend les couleurs, les rôles et les cibles de style.css.
   Les étapes sont des listes groupées claires ; la 3D reste sombre, et tout le bloc passe en sombre en plein écran. */
.comprendre { display: grid; gap: 18px; min-width: 0; }
.cp-procede { max-width: 900px; }
.comprendre h1 { margin: 0; }
.comprendre h2 { margin: 0 4px 10px; }
.comprendre h3 { font-size: 17px; margin: 0; color: var(--texte-fort); }
.comprendre p { margin: 0; line-height: 1.45; }
.cp-intro { font-size: 17px; color: var(--texte); max-width: 70ch; }
.cp-famille { font-size: 15px; font-weight: 600; color: var(--texte-doux); margin-bottom: -12px !important; }

/* ---------- matières : une couleur par ce qui circule (un point, jamais un fond) */
.comprendre { --m-poudre: #b8955a; --m-liquide: #2f7fd8; --m-pate: #8a8578; --m-sac: #6c7a2e; --m-seau: #3f6f8f; --m-palette: #a8742f; --m-air: #4ba3c7; --m-eau: #2a9ad6; --m-aucune: var(--trait-fort); }
.matiere-poudre { --m: var(--m-poudre); } .matiere-liquide { --m: var(--m-liquide); } .matiere-pate { --m: var(--m-pate); }
.matiere-sac { --m: var(--m-sac); } .matiere-seau { --m: var(--m-seau); } .matiere-palette { --m: var(--m-palette); }
.matiere-air { --m: var(--m-air); } .matiere-eau { --m: var(--m-eau); } .matiere-aucune { --m: var(--m-aucune); }

/* ---------- le procédé : une vraie séquence, d'où les numéros */
.cp-flux { display: grid; gap: 0; }
.cp-rangee { min-width: 0; scroll-margin-top: calc(var(--entete) + 10px); }
.cp-rangee > h2 { align-items: center; }
.cp-numero { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--texte-fort); color: var(--surface); font-size: 14px; font-weight: 700; font-stretch: 100%; flex: none; }
.cp-cartes { display: grid; background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
.cp-etape { padding: 14px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.cp-etape + .cp-etape { border-top: 1px solid var(--trait); }
.cp-etape header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cp-matiere { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--texte-doux); white-space: nowrap; }
.cp-matiere::before { content: ''; width: 10px; height: 10px; border-radius: 999px; background: var(--m); }
.cp-etape > p { font-size: 15px; color: var(--texte); }
.cp-vers { font-size: 14px !important; color: var(--texte-doux) !important; }
.cp-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-puce { display: inline-flex; align-items: center; min-height: var(--cible); padding: 0 14px; border-radius: 999px; color: var(--texte-fort); text-decoration: none; font-weight: 600; font-size: 15px; background: var(--fond); max-width: 100%; overflow-wrap: anywhere; }
.cp-puce:active { background: var(--surface-2); }
@media (hover: hover) { .cp-puce:hover { background: var(--surface-2); } }
.cp-section > .cp-puces .cp-puce { background: var(--surface); }

/* Le schéma d'un coup d'œil : les grandes étapes, numérotées, chacune avec les points de ce qui y passe. */
.cp-schema { display: grid; background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
.cp-maillon { min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; background: none; color: var(--texte-fort); border: 0; font: inherit; font-weight: 650; font-size: 16px; text-align: left; cursor: pointer; }
.cp-maillon + .cp-maillon { border-top: 1px solid var(--trait); }
.cp-maillon:active { background: var(--fond); }
.cp-maillon:focus-visible { outline-offset: -3px; }
.cp-maillon-titre { flex: 1; min-width: 0; line-height: 1.2; }
.cp-pastilles { display: flex; gap: 4px; }
.cp-pastilles i { width: 10px; height: 10px; border-radius: 999px; background: var(--m); }
@media (min-width: 1000px) {
  .cp-schema { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .cp-maillon { flex-wrap: wrap; align-content: center; min-height: 92px; padding: 12px 14px; }
  .cp-maillon + .cp-maillon { border-top: 0; border-left: 1px solid var(--trait); }
  .cp-maillon-titre { flex-basis: 100%; order: 3; }
}

/* Entre deux rangées : un repère immobile vers le bas. */
.cp-fleche { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 40px; justify-content: center; }
.cp-fleche span { width: 5px; height: 5px; border-radius: 999px; background: var(--trait-fort); }
.cp-fleche span:nth-child(3) { border-radius: 0; width: 0; height: 0; background: none; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 8px solid var(--trait-fort); }
.cp-utilites { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--trait); }

.cp-familles .choix span { display: grid; gap: 2px; }
.cp-familles small, .cp-se small { font-weight: 400; color: var(--texte-doux); font-size: 14px; line-height: 1.35; }

/* ---------- le bloc animé : la scène sombre, la légende et les commandes claires dessous */
.cp-anim { background: var(--surface); border-radius: var(--rayon); overflow: hidden; min-width: 0; color: var(--texte); }
.cp-scene { height: clamp(260px, 46svh, 520px); background: var(--scene); background-image: var(--scene-fond); position: relative; overflow: hidden; }
.cp-scene canvas { display: block; width: 100%; height: 100%; max-width: 100%; }
.cp-scene .v3d-etiquette { font-size: 12px; padding: 2px 6px; opacity: 0.9; }
.cp-scene.avec-cibles .v3d-etiquette:not(.cp-cible) { display: none !important; }
.cp-scene .v3d-etiquette.cp-cible { background: var(--orange); color: var(--graphite); border-color: var(--orange); opacity: 1; font-size: 13px; }
.cp-legende { padding: 14px 16px 16px; display: grid; gap: 10px; }
.cp-etape-courante { display: flex; gap: 10px; align-items: baseline; min-height: 3.2em; }
.cp-num-etape { font-weight: 700; font-size: 14px; color: var(--surface); background: var(--texte-fort); border-radius: 999px; padding: 2px 9px; flex: none; }
.cp-texte-etape { font-size: 17px; font-weight: 600; color: var(--texte-fort); }
.cp-cibles { font-size: 14px; font-weight: 600; color: var(--orange-texte); min-height: 1.2em; }
.cp-commandes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-commandes .bouton.rond { width: var(--cible); height: var(--cible); }
.cp-commandes .bouton.rond.principal { width: 56px; height: 56px; }
.cp-commandes svg { fill: currentColor; stroke: none; }
.cp-bascule { min-height: var(--cible); padding: 0 16px; font-size: 15px; }
.cp-bascule[aria-pressed="true"] { background: var(--texte-fort); border-color: var(--texte-fort); color: var(--surface); }
.cp-bascule[hidden] { display: none; }
.cp-temps { font-size: 14px; font-weight: 500; color: var(--texte-doux); white-space: nowrap; margin-left: auto; }
.cp-indicateurs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 15px; }
.cp-indicateurs:empty, .cp-preventif-ici:empty, .cp-touche:empty { display: none; }
.cp-indicateurs b { font-weight: 600; color: var(--texte); }
.cp-indicateurs em { font-style: normal; font-weight: 700; color: var(--texte-fort); }
.cp-preventif-ici { font-size: 15px; color: var(--texte-fort); background: var(--surface-2); border-radius: var(--rayon-bouton); padding: 8px 12px; }
.cp-touche { font-size: 15px; background: var(--fond); border-radius: var(--rayon-bouton); padding: 8px 12px; display: grid; gap: 4px; }
.cp-touche-prev { color: var(--texte-doux); }

/* Le chronogramme : une colonne de noms, des pistes, une tête de lecture qu'on déplace au doigt. */
.cp-chrono { --nom: 118px; position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize; border-radius: var(--rayon-bouton); background: var(--fond); max-height: 34svh; overflow-y: auto; overflow-x: hidden; outline-offset: 2px; }
.cp-chrono-zone { position: relative; padding: 2px 0; }
.cp-chrono-ligne { display: grid; grid-template-columns: var(--nom) minmax(0, 1fr); align-items: center; min-height: 20px; }
.cp-chrono-nom { font-size: 12px; line-height: 1.15; color: var(--texte-doux); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-chrono-piste { position: relative; height: 14px; margin-right: 8px; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--trait) calc(10% - 1px) 10%); }
.cp-chrono-piste i { position: absolute; top: 3px; bottom: 3px; background: var(--trait-fort); border-radius: 999px; min-width: 2px; }
.cp-chrono-ligne.flux .cp-chrono-piste i { background: var(--m-poudre); }
.cp-chrono-ligne.actif .cp-chrono-nom { color: var(--texte-fort); font-weight: 700; }
.cp-chrono-ligne.actif .cp-chrono-piste i { background: var(--orange); }
.cp-chrono-phases { min-height: 28px; position: sticky; top: 0; z-index: 1; background: var(--fond); border-bottom: 1px solid var(--trait); }
.cp-chrono-phases .cp-chrono-piste { height: 22px; background: none; }
.cp-chrono-phases b { position: absolute; top: 2px; bottom: 2px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--surface); background: var(--texte-fort); border-right: 2px solid var(--fond); border-radius: 4px; overflow: hidden; }
.cp-chrono-tete { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--rouge); pointer-events: none; z-index: 2; }
.cp-chrono-tete::before { content: ''; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--rouge); }
.cp-anim .v3d-curseur-plein { display: none !important; }

/* En plein écran, la 3D et ses commandes restent ensemble et tout passe en sombre : la scène prend la place libre, la légende défile si besoin. */
.cp-anim.v3d-plein {
  --fond: #1F2428; --surface: #262C31; --surface-2: #343B42;
  --texte-fort: #FFFFFF; --texte: #D5D9DA; --texte-doux: #A9B1B7; --trait: #3A4249;
  --principal-fond: #FFFFFF; --principal-texte: #1F2428; --focus: #FFFFFF; --orange-texte: #FFB36B;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; background: var(--fond); color: var(--texte);
  padding: var(--haut-sur) var(--droite-sur) 0 var(--gauche-sur);
}
.cp-anim.v3d-plein .bouton.principal:hover, .cp-anim.v3d-plein .bouton.principal:active { background: #E1E4E3; border-color: #E1E4E3; }
.cp-anim.v3d-plein .cp-scene { height: auto; min-height: 0; }
.cp-anim.v3d-plein .cp-legende { max-height: 46svh; overflow-y: auto; padding-bottom: calc(10px + var(--bas-sur)); gap: 8px; background: var(--surface); grid-auto-rows: max-content; align-content: start; }
.cp-anim.v3d-plein .cp-chrono { max-height: 22svh; }
.cp-anim.v3d-plein .cp-etape-courante { min-height: 0; }
.cp-anim.v3d-plein .cp-texte-etape { font-size: 16px; }

/* ---------- textes des pages */
.cp-colonnes { display: grid; gap: 18px; min-width: 0; }
.cp-colonnes > div { display: grid; gap: 18px; align-content: start; min-width: 0; }
.cp-section { min-width: 0; margin-top: 10px; }
.cp-principe { display: grid; gap: 8px; font-size: 16px; padding: 0 4px; }
.cp-preventif { margin: 0; padding: 0; list-style: none; display: grid; background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
.cp-preventif li { padding: 12px 16px; display: grid; gap: 4px; }
.cp-preventif li + li { border-top: 1px solid var(--trait); }
.cp-preventif strong { color: var(--texte-fort); font-weight: 650; }
.cp-preventif span { color: var(--texte-doux); font-size: 15px; line-height: 1.4; }
.cp-pieces { margin: 0; display: grid; background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
.cp-pieces dt { font-weight: 650; color: var(--texte-fort); padding: 12px 16px 0; }
.cp-pieces dt:not(:first-child) { border-top: 1px solid var(--trait); }
.cp-pieces dd { margin: 0; padding: 2px 16px 12px; color: var(--texte-doux); font-size: 15px; }
.cp-se .choix { min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
.cp-se .choix span { display: grid; gap: 2px; min-width: 0; }
.cp-se .choix b { font-weight: 650; }
.cp-variante { margin: 0 4px 10px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.cp-variante dt { color: var(--texte-doux); }
.cp-variante dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cp-repli { background: var(--surface); border-radius: var(--rayon); }
.cp-repli summary { min-height: var(--cible); display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 650; cursor: pointer; }
.cp-repli.doutes summary { color: var(--ambre); }
.cp-compte { font-size: 14px; font-weight: 600; color: var(--texte-doux); }
.cp-repli ul { margin: 0; padding: 0 16px 14px 34px; display: grid; gap: 6px; font-size: 15px; color: var(--texte); overflow-wrap: anywhere; }

@media (min-width: 900px) {
  .cp-colonnes { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
  .cp-scene { height: clamp(320px, 58svh, 620px); }
  .cp-anim { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
  .cp-legende { align-content: start; }
  .cp-etape-courante { flex-direction: column; gap: 6px; }
  .cp-anim.v3d-plein { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); grid-template-rows: minmax(0, 1fr); }
  .cp-anim.v3d-plein .cp-legende { max-height: none; }
  .cp-anim.v3d-plein .cp-chrono { max-height: 40svh; }
}
