/* ============================================================================
   porto — CSS applicatif
   ----------------------------------------------------------------------------
   Ne référence QUE des variables sémantiques du design system (--accent,
   --surface, --text-2…). Conséquence : les 9 démos passent en mode sombre
   sans une seule retouche, y compris leurs états rouge/vert.
   ============================================================================ */

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

/* ---- Écran de mot de passe (gate.js) --------------------------------------- */
html.gate-verrouille body > *:not(.porte-acces) { display: none; }
.porte-acces {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--bg);
  padding: var(--ds-space-5);
}
.porte-acces__carte {
  width: min(24rem, 100%);
  text-align: center;
  display: flex; flex-direction: column; gap: var(--ds-space-3);
}
.porte-acces__carte form { display: flex; flex-direction: column; gap: var(--ds-space-3); }
.porte-acces__erreur { margin: 0; color: var(--red); font-size: var(--ds-text-xs); }

html { font-size: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0 0 var(--ds-space-3); }
p:last-child { margin-bottom: 0; }

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
}

.lien-evitement {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff;
  padding: var(--ds-space-2) var(--ds-space-4); border-radius: var(--ds-radius-sm);
  z-index: 100;
}
.lien-evitement:focus { left: var(--ds-space-4); top: var(--ds-space-4); }

/* ---- En-tête --------------------------------------------------------------- */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--ds-space-4);
  padding: var(--ds-space-3) var(--ds-space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.entete__marque { display: flex; align-items: center; gap: var(--ds-space-3); }
.entete__sceau {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--ds-radius);
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: var(--ds-text-lg);
}
.entete h1 { font-size: var(--ds-text-lg); letter-spacing: -0.01em; }
.entete__sous-titre { margin: 0; font-size: var(--ds-text-xs); color: var(--text-2); }
.entete__outils { display: flex; align-items: center; gap: var(--ds-space-2); }
#bouton-presentation[aria-pressed="true"] {
  background: var(--accent-bg); color: var(--accent); border-color: var(--accent);
  font-weight: 600;
}

/* ---- Coquille -------------------------------------------------------------- */
.coquille {
  flex: 1;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  align-items: start;
}

.barre-laterale {
  position: sticky; top: 59px;
  max-height: calc(100vh - 59px); overflow-y: auto;
  padding: var(--ds-space-4) var(--ds-space-3);
  border-right: 1px solid var(--border);
}
.nav-famille { margin-bottom: var(--ds-space-5); }
.nav-famille__titre {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); font-weight: 700;
  padding: 0 var(--ds-space-2) var(--ds-space-2);
}
.nav-lien {
  display: flex; align-items: baseline; gap: var(--ds-space-2);
  width: 100%; text-align: left;
  padding: var(--ds-space-2) var(--ds-space-2);
  border: none; background: transparent; border-radius: var(--ds-radius-sm);
  font: inherit; font-size: var(--ds-text-sm); color: var(--text-2);
  cursor: pointer;
}
.nav-lien:hover { background: var(--surface-2); color: var(--text); }
.nav-lien.est-active {
  background: var(--accent-bg); color: var(--accent); font-weight: 600;
}
.nav-lien__num {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-3); min-width: 14px;
}
.nav-lien.est-active .nav-lien__num { color: var(--accent); }

/* ---- Contenu --------------------------------------------------------------- */
.contenu { padding: var(--ds-space-5) var(--ds-space-6); max-width: 1180px; outline: none; }

.page__tete { margin-bottom: var(--ds-space-5); }
.page__surtitre {
  display: flex; align-items: center; gap: var(--ds-space-2);
  font-size: var(--ds-text-xs); color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  margin-bottom: var(--ds-space-2);
}
.page__titre { font-size: 30px; letter-spacing: -0.02em; margin-bottom: var(--ds-space-2); }
.page__accroche {
  font-size: var(--ds-text-lg); color: var(--text-2); max-width: 68ch; line-height: 1.5;
}

.bloc-texte { max-width: 74ch; }
.bloc-texte p + p { margin-top: var(--ds-space-3); }
.bloc-texte strong { color: var(--text); font-weight: 650; }
.bloc-texte ul { margin: 0; padding-left: var(--ds-space-5); }
.bloc-texte li { margin-bottom: var(--ds-space-2); }
.bloc-texte li:last-child { margin-bottom: 0; }

.section { margin-bottom: var(--ds-space-6); }
.section__titre {
  display: flex; align-items: center; gap: var(--ds-space-2);
  font-size: var(--ds-text-xs); text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-3); font-weight: 700;
  margin-bottom: var(--ds-space-3);
}
.section__titre::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Blocs pliables (concept, débrief, pièges) — repliés en mode présentation. */
.pliable { border-top: 1px solid var(--border); }
.pliable > summary {
  cursor: pointer; list-style: none;
  padding: var(--ds-space-3) 0;
  font-size: var(--ds-text-sm); font-weight: 650; color: var(--text);
  display: flex; align-items: center; gap: var(--ds-space-2);
}
.pliable > summary::-webkit-details-marker { display: none; }
.pliable > summary::before {
  content: '▸'; color: var(--text-3); transition: transform 0.15s ease;
}
.pliable[open] > summary::before { transform: rotate(90deg); }
.pliable__corps { padding: 0 0 var(--ds-space-4); }

/* ---- Carte de démo --------------------------------------------------------- */
.carte { margin-bottom: var(--ds-space-4); }
.carte__tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--ds-space-4); margin-bottom: var(--ds-space-4);
}
.carte__tete h3 { font-size: var(--ds-text-base); font-weight: 650; }
.carte__tete p { margin: 2px 0 0; }
.carte__actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); align-items: center; }
.carte__corps > * + * { margin-top: var(--ds-space-4); }

.demo { display: grid; gap: var(--ds-space-4); }
.demo--2col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.demo--3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.demo--2-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
@media (max-width: 1080px) {
  .demo--2col, .demo--3-2, .demo--2-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Métriques ------------------------------------------------------------- */
.grille-metriques {
  display: grid; gap: var(--ds-space-3);
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* ---- Interrupteur ---------------------------------------------------------- */
.interrupteur {
  display: flex; align-items: flex-start; gap: var(--ds-space-3);
  cursor: pointer; user-select: none;
}
.interrupteur input { position: absolute; opacity: 0; width: 0; height: 0; }
.interrupteur__piste {
  flex: none; position: relative; margin-top: 2px;
  width: 38px; height: 22px; border-radius: var(--ds-radius-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.interrupteur__pastille {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-3);
  transition: transform 0.15s ease, background 0.15s ease;
}
.interrupteur input:checked + .interrupteur__piste {
  background: var(--accent-bg); border-color: var(--accent);
}
.interrupteur input:checked + .interrupteur__piste .interrupteur__pastille {
  transform: translateX(16px); background: var(--accent);
}
.interrupteur input:focus-visible + .interrupteur__piste {
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.interrupteur__texte { display: flex; flex-direction: column; gap: 1px; font-size: var(--ds-text-sm); }

/* ---- Tons partagés --------------------------------------------------------- */
.est-accent  { --ton: var(--accent); --ton-bg: var(--accent-bg); }
.est-succes  { --ton: var(--green);  --ton-bg: var(--green-bg); }
.est-alerte  { --ton: var(--amber);  --ton-bg: var(--amber-bg); }
.est-erreur  { --ton: var(--red);    --ton-bg: var(--red-bg); }
.est-neutre  { --ton: var(--text-3); --ton-bg: var(--surface-2); }
/* Alias lisibles pour le blue/green, où « bleu » et « vert » sont le sujet. */
.est-bleu    { --ton: var(--accent); --ton-bg: var(--accent-bg); }
.est-vert    { --ton: var(--green);  --ton-bg: var(--green-bg); }

.pastille {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ton, var(--text-3)); margin-right: 5px;
}

/* ---- Barre segmentée ------------------------------------------------------- */
.barre-segments {
  display: flex; height: 12px; border-radius: var(--ds-radius-pill);
  overflow: hidden; background: var(--surface-2);
}
.barre-segments__part { transition: width 0.25s ease; background: var(--ton, var(--text-3)); }
.barre-segments__legende {
  display: flex; flex-wrap: wrap; gap: var(--ds-space-3);
  margin-top: var(--ds-space-2);
  font-size: var(--ds-text-xs); color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.barre-segments__cle { display: inline-flex; align-items: center; }

/* ---- Mini-courbe ----------------------------------------------------------- */
.courbe { width: 100%; height: 60px; display: block; overflow: visible; }
.courbe__trace {
  fill: none; stroke: var(--accent); stroke-width: 1.75;
  vector-effect: non-scaling-stroke; stroke-linejoin: round;
}
.courbe__seuil {
  stroke: var(--red); stroke-width: 1; stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke; opacity: 0.7;
}

/* ---- Journal --------------------------------------------------------------- */
.journal {
  overflow-y: auto;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--ds-radius-sm); padding: var(--ds-space-2);
}
.journal__ligne {
  display: flex; flex-wrap: wrap; gap: var(--ds-space-2);
  padding: 2px var(--ds-space-2); border-radius: 4px;
}
.journal__ligne + .journal__ligne { margin-top: 1px; }
.journal__heure { color: var(--text-3); flex: none; }
.journal__texte { color: var(--text-2); }
.journal__ligne.est-succes .journal__texte { color: var(--green); }
.journal__ligne.est-alerte .journal__texte { color: var(--amber); }
.journal__ligne.est-erreur { background: var(--red-bg); }
.journal__ligne.est-erreur .journal__texte { color: var(--red); font-weight: 600; }
.journal__charge {
  flex-basis: 100%; color: var(--text-3); font-size: 11px;
  overflow-wrap: anywhere;
}
.journal:empty::after {
  content: 'En attente…'; color: var(--text-3); font-size: 11px;
}

/* ---- Tableaux -------------------------------------------------------------- */
.tableau-defilant { overflow-x: auto; }
.tableau-defilant .ds-table { min-width: 380px; }
tr.est-erreur td { background: var(--red-bg); }
tr.est-alerte td { background: var(--amber-bg); }
tr.est-succes td { background: var(--green-bg); }

/* ---- Séquence guidée ------------------------------------------------------- */
.sequence {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--ds-space-2);
}
.sequence__etape {
  display: flex; align-items: center; gap: var(--ds-space-2);
  padding: var(--ds-space-2) var(--ds-space-3);
  border: 1px solid var(--border); border-radius: var(--ds-radius-pill);
  font-size: var(--ds-text-xs); color: var(--text-3);
  transition: all 0.15s ease;
}
.sequence__num {
  display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-3);
  font-size: 11px; font-weight: 700; flex: none;
}
.sequence__etape.est-faite { color: var(--text-2); border-color: var(--green); }
.sequence__etape.est-faite .sequence__num { background: var(--green-bg); color: var(--green); }
.sequence__etape.est-courante {
  color: var(--accent); border-color: var(--accent); background: var(--accent-bg);
  font-weight: 650;
}
.sequence__etape.est-courante .sequence__num { background: var(--accent); color: #fff; }

/* ---- Encart pédagogique ---------------------------------------------------- */
.encart {
  border-left: 3px solid var(--ton, var(--accent));
  background: var(--ton-bg, var(--accent-bg));
  padding: var(--ds-space-3) var(--ds-space-4);
  border-radius: 0 var(--ds-radius-sm) var(--ds-radius-sm) 0;
  font-size: var(--ds-text-sm);
}
.encart strong { display: block; color: var(--ton, var(--accent)); margin-bottom: 3px; }
.encart p { margin: 0; color: var(--text-2); }

/* ---- Panneau de contrôle d'une démo ---------------------------------------- */
.controles {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--ds-space-3);
  padding: var(--ds-space-3);
  background: var(--surface-2); border-radius: var(--ds-radius-sm);
}
.controles__groupe { display: flex; align-items: center; gap: var(--ds-space-2); }
.controles__label {
  font-size: var(--ds-text-xs); color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
}

/* ============================================================================
   DÉMOS — styles propres à chaque astuce
   ============================================================================ */

/* ---- Astuce 1 : blue/green ------------------------------------------------- */
.blue-green {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--ds-space-4); align-items: center;
}
@media (max-width: 900px) {
  .blue-green { grid-template-columns: minmax(0, 1fr); }
}

.env {
  border: 2px solid var(--border); border-radius: var(--ds-radius-lg);
  padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  opacity: 0.62;
}
.env.est-actif {
  border-color: var(--ton); opacity: 1;
  box-shadow: 0 0 0 4px var(--ton-bg);
}
.env__tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--ds-space-3); margin-bottom: var(--ds-space-3);
}
.env__nom { font-size: var(--ds-text-sm); color: var(--ton); }
.env__version { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.env__metriques { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ds-space-2); }
.env__metriques .ds-metric { border: none; background: var(--surface-2); padding: var(--ds-space-2) var(--ds-space-3); }
.env__courbe { margin-top: var(--ds-space-3); color: var(--ton); }
.env__courbe .courbe__trace { stroke: var(--ton); }

.repartiteur {
  display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-2);
  padding: var(--ds-space-3);
}
.repartiteur__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); font-weight: 700;
}
.repartiteur__piste {
  position: relative; width: 76px; height: 26px;
  border: 1px solid var(--border); border-radius: var(--ds-radius-pill);
  background: var(--surface-2);
}
.repartiteur__aiguille {
  position: absolute; top: 2px; left: 2px;
  width: 34px; height: 20px; border-radius: var(--ds-radius-pill);
  background: var(--accent);
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1), background 0.3s ease;
}
.repartiteur__aiguille.est-vert { background: var(--green); }
.repartiteur__cible { font-family: var(--font-mono); font-weight: 700; color: var(--text-2); }

.zone-encart:empty { display: none; }

/* ---- Astuce 2 : feature flags ---------------------------------------------- */
.champ { display: flex; flex-direction: column; gap: var(--ds-space-2); }
.separateur { border: none; border-top: 1px solid var(--border); margin: var(--ds-space-2) 0; }

.curseur { width: 100%; accent-color: var(--accent); }
.curseur__valeur {
  font-family: var(--font-mono); font-weight: 700; color: var(--accent);
  text-transform: none; letter-spacing: 0;
}
.case-segment {
  display: inline-flex; align-items: center; gap: var(--ds-space-2);
  font-size: var(--ds-text-sm); cursor: pointer;
}
.case-segment input { accent-color: var(--accent); }

.utilisateurs {
  display: grid; gap: var(--ds-space-2);
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}
.utilisateur {
  display: flex; align-items: center; gap: var(--ds-space-2);
  padding: var(--ds-space-2); border-radius: var(--ds-radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.utilisateur.est-expose { border-color: var(--green); background: var(--green-bg); }
.utilisateur__sceau {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  font-weight: 700; font-size: var(--ds-text-sm); color: var(--text-2);
}
.utilisateur.est-expose .utilisateur__sceau { background: var(--green); color: #fff; border-color: var(--green); }
.utilisateur__infos { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.utilisateur__infos strong { font-size: var(--ds-text-sm); }

/* ---- Astuce 3 : chaos monkey ----------------------------------------------- */
.chaine {
  display: flex; align-items: stretch; gap: var(--ds-space-2);
  flex-wrap: wrap;
}
.chaine__fleche { align-self: center; color: var(--text-3); font-size: var(--ds-text-lg); }
.noeud {
  flex: 1 1 140px;
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: var(--ds-space-3);
  border: 1px solid var(--border); border-left: 3px solid var(--green);
  border-radius: var(--ds-radius-sm); background: var(--surface-2);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.noeud.est-souffrant { border-left-color: var(--amber); background: var(--amber-bg); }
.noeud.est-mort { border-left-color: var(--red); background: var(--red-bg); opacity: 0.75; }
.noeud strong { font-size: var(--ds-text-sm); }

.ds-btn.est-enfonce {
  background: var(--red); border-color: var(--red); color: #fff;
}
.ds-btn.est-enfonce:hover { background: var(--red); filter: brightness(1.08); }

/* ---- Astuce 5 : télémétrie -------------------------------------------------- */
.mini-app {
  display: flex; flex-direction: column; gap: var(--ds-space-3);
  align-items: flex-start; min-height: 108px; justify-content: center;
  padding: var(--ds-space-4);
  border: 1px dashed var(--border); border-radius: var(--ds-radius-sm);
  background: var(--surface-2);
}

.entonnoir { display: flex; flex-direction: column; gap: var(--ds-space-3); }
.entonnoir__tete {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--ds-space-3); font-size: var(--ds-text-sm);
}
.entonnoir__tete code { font-size: 11.5px; color: var(--accent); }
.entonnoir__piste { height: 14px; background: var(--surface-2); border-radius: var(--ds-radius-pill); }
.entonnoir__barre {
  height: 100%; border-radius: var(--ds-radius-pill);
  background: var(--accent); transition: width 0.3s ease;
}
.entonnoir__barre.est-alerte { background: var(--amber); }
.entonnoir__chute { font-size: var(--ds-text-xs); color: var(--text-3); }
.entonnoir__chute.est-forte { color: var(--amber); font-weight: 650; }

.caviardage { display: flex; flex-direction: column; gap: var(--ds-space-2); }
.caviardage__fleche { font-size: var(--ds-text-xs); color: var(--text-3); }
.caviardage__sortie {
  font-family: var(--font-mono); font-size: var(--ds-text-sm);
  padding: var(--ds-space-2) var(--ds-space-3);
  background: var(--green-bg); color: var(--green);
  border-radius: var(--ds-radius-sm);
}

/* ---- Astuce 4 : fausse porte ------------------------------------------------ */
.faux-produit {
  border: 1px solid var(--border); border-radius: var(--ds-radius-sm);
  overflow: hidden; background: var(--surface);
}
.faux-produit__barre {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--ds-space-3); flex-wrap: wrap;
  padding: var(--ds-space-3); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.faux-produit__titre { font-weight: 650; font-size: var(--ds-text-sm); }
.faux-produit__actions { display: flex; gap: var(--ds-space-2); }
.faux-produit__corps { padding: var(--ds-space-4); display: grid; gap: var(--ds-space-3); }
.faux-produit__ligne { height: 10px; border-radius: var(--ds-radius-pill); background: var(--surface-2); }
.faux-produit__ligne.est-courte { width: 62%; }

.modale {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.45); padding: var(--ds-space-4);
}
.modale__boite {
  width: min(440px, 100%);
  display: flex; flex-direction: column; gap: var(--ds-space-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--ds-radius-lg); padding: var(--ds-space-5);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.modale__boite h4 { font-size: var(--ds-text-lg); }
.modale__actions { display: flex; gap: var(--ds-space-2); justify-content: flex-end; }

/* ---- Astuce 6 : magicien d'Oz ----------------------------------------------- */
.oz__panneau { display: flex; flex-direction: column; gap: var(--ds-space-3); min-height: 220px; }
.oz__bulle {
  padding: var(--ds-space-3) var(--ds-space-4);
  border-radius: var(--ds-radius-lg); font-size: var(--ds-text-sm);
}
.oz__bulle.est-utilisateur {
  background: var(--surface-2); align-self: flex-end;
  border-bottom-right-radius: var(--ds-space-1); max-width: 85%;
}
.oz__bulle.est-ia {
  background: var(--accent-bg); color: var(--text);
  border-bottom-left-radius: var(--ds-space-1); max-width: 92%;
}
.oz__signature {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--accent); margin-bottom: 4px;
}
.oz__attente {
  display: flex; align-items: center; gap: var(--ds-space-2);
  padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--accent-bg); border-radius: var(--ds-radius-lg);
  font-size: var(--ds-text-sm); color: var(--text-2);
}
.oz__points { display: inline-flex; gap: 3px; }
.oz__points i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  animation: oz-pulse 1.1s infinite ease-in-out;
}
.oz__points i:nth-child(2) { animation-delay: 0.18s; }
.oz__points i:nth-child(3) { animation-delay: 0.36s; }
@keyframes oz-pulse { 0%, 70%, 100% { opacity: 0.25; } 35% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .oz__points i { animation: none; opacity: 0.7; } }
.oz__chrono { margin-left: auto; font-variant-numeric: tabular-nums; }
.oz__demande {
  padding: var(--ds-space-3); border-radius: var(--ds-radius-sm);
  background: var(--amber-bg); border-left: 3px solid var(--amber);
}
.oz__demande p { margin: var(--ds-space-2) 0 0; font-size: var(--ds-text-sm); }
.oz__vide {
  display: grid; place-items: center; flex: 1; min-height: 120px;
  border: 1px dashed var(--border); border-radius: var(--ds-radius-sm);
  color: var(--text-3); font-size: var(--ds-text-sm);
}

/* ---- Astuce 8 : test A/B ---------------------------------------------------- */
.rejeu { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ds-space-4); }
.rejeu__colonne {
  display: flex; flex-direction: column; gap: var(--ds-space-2);
  padding: var(--ds-space-4); border-radius: var(--ds-radius-sm);
  background: var(--surface-2); text-align: center;
}
.rejeu__chiffre {
  font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.rejeu__chiffre.est-erreur { color: var(--red); }
.rejeu:empty::after { content: 'Clique « Rejouer » pour lancer la simulation.'; color: var(--text-3); }

.calculateur { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ds-space-3); }
.calculateur__sortie {
  display: flex; flex-direction: column; gap: var(--ds-space-1);
  margin-top: var(--ds-space-3); padding: var(--ds-space-3);
  background: var(--accent-bg); border-radius: var(--ds-radius-sm);
}
.calculateur__sortie strong { color: var(--accent); font-size: var(--ds-text-lg); }

/* ---- Astuce 7 : canari ------------------------------------------------------ */
.paliers { display: flex; gap: var(--ds-space-2); flex-wrap: wrap; }
.palier {
  flex: 1 1 90px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--ds-space-3) var(--ds-space-2);
  border: 1px solid var(--border); border-radius: var(--ds-radius-sm);
  background: var(--surface-2); color: var(--text-3);
  transition: all 0.2s ease;
}
.palier strong { font-size: var(--ds-text-lg); font-variant-numeric: tabular-nums; }
.palier.est-atteint { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.palier.est-courant {
  color: var(--accent); border-color: var(--accent); background: var(--accent-bg);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ---- Astuce 9 : dark launch ------------------------------------------------- */
.miroir {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: var(--ds-space-4); align-items: center;
}
@media (max-width: 760px) { .miroir { grid-template-columns: 1fr; } }
.miroir__branche {
  display: flex; flex-direction: column; gap: var(--ds-space-1);
  align-items: flex-start;
  padding: var(--ds-space-4); border-radius: var(--ds-radius-lg);
  border: 2px solid var(--border); background: var(--surface);
}
.miroir__branche.est-servie { border-color: var(--green); }
.miroir__branche.est-miroir { border-style: dashed; opacity: 0.8; }
.miroir__separateur { color: var(--text-3); font-size: 22px; text-align: center; }

.effets { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--ds-space-2); }
.effet {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: var(--ds-space-2);
  padding: var(--ds-space-2) var(--ds-space-3);
  border-radius: var(--ds-radius-sm); font-size: var(--ds-text-sm);
}
.effet.est-coupe { background: var(--green-bg); color: var(--green); }
.effet.est-actif { background: var(--red-bg); color: var(--red); font-weight: 600; }
.effet .ds-text-hint { color: inherit; opacity: 0.85; }

/* ---- Écran de synthèse ------------------------------------------------------ */
.deux-risques { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ds-space-4); }
@media (max-width: 760px) { .deux-risques { grid-template-columns: 1fr; } }
.risque {
  padding: var(--ds-space-4); border-radius: var(--ds-radius-lg);
  border-left: 3px solid var(--ton); background: var(--ton-bg);
}
.risque.est-marche { --ton: var(--accent); --ton-bg: var(--accent-bg); }
.risque.est-technique { --ton: var(--amber); --ton-bg: var(--amber-bg); }
.risque h4 { color: var(--ton); margin-bottom: var(--ds-space-2); font-size: var(--ds-text-base); }
.risque p { margin: 0; font-size: var(--ds-text-sm); color: var(--text-2); }

.lien-astuce {
  font: inherit; font-weight: 650; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer;
  text-align: left; text-decoration: underline; text-underline-offset: 2px;
}
.lien-astuce:hover { filter: brightness(1.15); }

/* ---- Section « Le code » (feature #333) ------------------------------------- */
.code-section { display: flex; flex-direction: column; gap: var(--ds-space-3); }
.code-section__tete {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: var(--ds-space-4);
}
.code-section__tete p { margin: 0; max-width: 58ch; font-size: var(--ds-text-sm); }

.fragment {
  margin: 0;
  border: 1px solid var(--border); border-radius: var(--ds-radius-lg);
  overflow: hidden; background: var(--surface);
}
.fragment__tete {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--ds-space-3);
  padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.fragment__tete strong { display: block; font-size: var(--ds-text-sm); }
.fragment__chemin { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

.bloc-code {
  margin: 0; padding: var(--ds-space-4);
  overflow-x: auto;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
  color: var(--text); tab-size: 2;
}
.bloc-code code { font: inherit; white-space: pre; }

/* Coloration : quatre rôles suffisent, tous pris dans les tokens sémantiques
   pour rester lisibles en clair comme en sombre.
   Les commentaires utilisent --text-2 et non --text-3 : dans ces extraits, le
   commentaire PORTE l'explication pédagogique. Avec --text-3 il tombait à 3,55
   de contraste en mode clair — sous le seuil AA, et illisible au projecteur. */
.jeton-commentaire { color: var(--text-2); font-style: italic; }
.jeton-chaine { color: var(--green); }
.jeton-motcle { color: var(--accent); font-weight: 600; }
.jeton-nombre { color: var(--amber); }

/* En présentation, le code reste visible et grossit : projeter le fragment est
   précisément l'usage visé. Seuls les longs textes de cours sont repliés. */
body.est-presentation .bloc-code { font-size: 17px; line-height: 1.7; }
body.est-presentation .fragment__tete strong { font-size: 19px; }

/* ---- Pied ------------------------------------------------------------------ */
.pied {
  display: flex; flex-wrap: wrap; gap: var(--ds-space-4);
  justify-content: space-between;
  padding: var(--ds-space-3) var(--ds-space-5);
  border-top: 1px solid var(--border);
  font-size: var(--ds-text-xs); color: var(--text-2);
}

/* ============================================================================
   MODE PRÉSENTATION
   Activé par la touche P. Objectif : lisible depuis le fond d'une salle.
   On grossit la typo, on replie les longs textes, on laisse la démo respirer.
   ============================================================================ */
body.est-presentation { font-size: calc(var(--ds-text-base) * 1.35); }
body.est-presentation .contenu { padding: var(--ds-space-5) var(--ds-space-5); max-width: none; }
body.est-presentation .page__titre { font-size: 42px; }
body.est-presentation .page__accroche { font-size: 24px; max-width: 44ch; }
body.est-presentation .barre-laterale { display: none; }
body.est-presentation .coquille { grid-template-columns: minmax(0, 1fr); }
body.est-presentation .pied { display: none; }
body.est-presentation .ds-metric__value { font-size: 34px; }
body.est-presentation .ds-metric__label { font-size: 14px; }
body.est-presentation .ds-btn { font-size: 17px; padding: var(--ds-space-3) var(--ds-space-5); }
body.est-presentation .sequence__etape { font-size: 16px; padding: var(--ds-space-2) var(--ds-space-4); }
body.est-presentation .journal { font-size: 15px; }
body.est-presentation .ds-table { font-size: 16px; }
body.est-presentation .encart { font-size: 18px; }
body.est-presentation .interrupteur__texte { font-size: 18px; }
/* Les blocs de lecture longue disparaissent : au projecteur, c'est le prof
   qui parle, l'écran ne doit porter que la démo. */
body.est-presentation .pliable { display: none; }

@media print { .barre-laterale, .entete__outils, .pied { display: none; } }
