/* ============================================================================
   circuit.css — "How the circuit decides"
   Explicatif animé du circuit de régulation EndoLore (23 étapes, 5 actes).

   Tout est préfixé .cx- pour ne jamais entrer en conflit avec site.css /
   page.css. Le balisage SVG est injecté par circuit.js ; ce fichier ne
   contient que l'apparence et la grammaire de mouvement.

   Grammaire de mouvement (cf. README du handoff) : cinq gestes seulement,
   jamais de fondu d'opacité comme mécanisme principal de révélation.
     tracé       -> stroke-dashoffset 1 -> 0
     déploiement -> clip-path inset(0 100% 0 0) -> inset(0 0% 0 0)
     montée      -> translateY(12px) -> 0
     surgissement-> @keyframes pop
     rétraction  -> le geste inverse, jamais un fondu
   ========================================================================== */

.cx {
  /* design system EndoLore */
  --cx-violet: #5a1faf;
  --cx-violet-mid: #9959d1;
  --cx-violet-pale: #d3b8ff;
  --cx-lavande: #f3ebff;
  --cx-jaune: #edd84a;
  --cx-jaune-pale: #fbf7c8;
  --cx-creme: #fffcf6;
  --cx-beige: #f0e9d8;
  --cx-encre: #1b1024;
  --cx-gris: #6b6478;
  /* deux couleurs fonctionnelles hors DS */
  --cx-gfp: #a9e3c1;
  --cx-gfp-stroke: #3fb56b;
  --cx-mirna: #e0513f;

  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 0 24px;
  box-sizing: border-box;
}

/* ── en-tête ─────────────────────────────────────────────────────────────── */
.cx-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.cx-eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--cx-gris);
}
.cx-h { font-family: 'Arapey', serif; font-weight: 400; font-size: clamp(28px, 4.4vw, 46px); line-height: 1.05; margin: 0; color: var(--cx-encre); }
.cx-sub { font-family: 'Arapey', serif; font-style: italic; font-size: clamp(16px, 2vw, 21px); margin: 0; color: var(--cx-gris); }

/* ── pastilles d'actes ───────────────────────────────────────────────────── */
.cx-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cx-act {
  display: flex; align-items: center; gap: 9px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--cx-violet-pale); background: var(--cx-lavande); color: var(--cx-violet);
  cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: .14em;
}
.cx-act:hover { border-color: var(--cx-violet); }
.cx-act:focus-visible { outline: 2px solid var(--cx-violet); outline-offset: 2px; }
.cx-act i { width: 6px; height: 6px; border-radius: 50%; background: var(--cx-violet); opacity: .22; transition: opacity .3s; }
.cx-act span { opacity: .55; transition: opacity .3s; }
.cx-act[aria-current="true"] i,
.cx-act[aria-current="true"] span { opacity: 1; }

/* ── scène ───────────────────────────────────────────────────────────────── */
.cx-stage {
  position: relative; background: var(--cx-creme); border: 1px solid var(--cx-beige);
  border-radius: 18px; box-shadow: 0 2px 14px rgba(27, 16, 36, .05);
  padding: 10px 6px; box-sizing: border-box;
}
.cx-svg { display: block; width: 100%; height: auto; }
.cx-legend {
  display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 8px 12px 4px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--cx-gris);
}
.cx-legend b { display: inline-flex; align-items: center; gap: 7px; font-weight: 400; }
.cx-legend svg { flex: none; }

/* ── zone de légende : hauteur fixe pour que la page ne saute jamais ─────── */
.cx-cap { min-height: 118px; padding: 20px 2px 6px; }
.cx-cap-lbl {
  display: block; margin-bottom: 8px; font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--cx-violet);
}
.cx-cap-txt {
  margin: 0; font-family: 'Arapey', serif; font-size: clamp(18px, 2.3vw, 27px);
  line-height: 1.4; max-width: 62ch; text-wrap: pretty; color: var(--cx-encre);
  transition: opacity .4s;
}

/* ── contrôles ───────────────────────────────────────────────────────────── */
.cx-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.cx-btn {
  border-radius: 999px; cursor: pointer; font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: .14em; padding: 11px 16px;
  border: 1px solid var(--cx-violet-pale); background: var(--cx-creme); color: var(--cx-violet);
}
.cx-btn:hover { border-color: var(--cx-violet); background: var(--cx-lavande); }
.cx-btn:focus-visible { outline: 2px solid var(--cx-violet); outline-offset: 2px; }
.cx-btn--play {
  background: var(--cx-violet); color: var(--cx-creme); border-color: var(--cx-violet);
  padding: 11px 20px; text-transform: uppercase; min-width: 92px;
}
.cx-btn--play:hover { background: var(--cx-violet-mid); border-color: var(--cx-violet-mid); }
.cx-btn--play:focus-visible { outline-color: var(--cx-encre); }
.cx-btn--wide { text-transform: uppercase; padding: 11px 20px; }
.cx-count {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--cx-gris);
}
.cx-bar { flex: 1 1 160px; height: 3px; border-radius: 2px; background: var(--cx-beige); overflow: hidden; }
.cx-bar i { display: block; height: 100%; background: var(--cx-violet); transition: width .3s linear; }

/* ── repli texte (sans JS, lecteurs d'écran, juge pressé) ────────────────── */
.cx-fb { margin-top: 22px; padding: 16px 20px; background: var(--cx-lavande); border-radius: 14px; max-width: 66ch; }
.cx-fb > summary {
  cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--cx-violet);
}
.cx-fb > summary:focus-visible { outline: 2px solid var(--cx-violet); outline-offset: 3px; }
.cx-fb p { font-family: 'Arapey', serif; font-size: 16.5px; line-height: 1.55; color: #3a3145; margin: 12px 0 0; }
.cx-fb ol { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; }
.cx-fb li { font-family: 'Arapey', serif; font-size: 16.5px; line-height: 1.55; color: #3a3145; }

/* ── keyframes : la grammaire de mouvement ───────────────────────────────── */
@keyframes cx-pop     { 0% { transform: scale(0); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes cx-popout  { to { transform: translateY(-120px) scale(.4); opacity: 0; } }
@keyframes cx-shake   { 0%, 100% { transform: translateX(-2.5px); } 50% { transform: translateX(2.5px); } }
@keyframes cx-pulse   { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
@keyframes cx-halo    { 0%, 100% { opacity: .3; } 50% { opacity: .85; } }
@keyframes cx-travel  { from { offset-distance: 0%; } to { offset-distance: 100%; } }
@keyframes cx-drift   { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
@keyframes cx-splitL  { to { transform: translate(-120px, 40px); opacity: 0; } }
@keyframes cx-splitR  { to { transform: translate(120px, 40px); opacity: 0; } }

/* les éléments qui se déforment doivent pivoter sur leur propre centre */
.cx-svg [data-pop], .cx-svg [data-spin] { transform-box: fill-box; transform-origin: center; }

/* la caméra : le viewBox ne bouge pas, c'est ce groupe qui se déplace */
#cx-cam { transform-box: view-box; transform-origin: 0 0; transition: transform .6s cubic-bezier(.4, 0, .2, 1); }

/* ── mouvement réduit ────────────────────────────────────────────────────────
   Chaque étape se résout en son état statique correct : on coupe les
   animations et les transitions, mais aucune valeur finale ne change, donc
   la navigation par pastilles et par flèches reste entièrement utilisable.
   NB : le PC de Gabriel a "Effets d'animation" DÉSACTIVÉ dans Windows 11 —
   il verra donc des images fixes. Ce n'est pas un bug.
   ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .cx *, .cx *::before, .cx *::after { animation: none !important; transition: none !important; }
}

/* ── petits écrans ───────────────────────────────────────────────────────────
   Le schéma n'est pas redessiné : circuit.js recadre le viewBox sur le module
   actif de l'étape en cours (effet caméra). Les coordonnées restent les mêmes.
   ------------------------------------------------------------------------ */
@media (max-width: 700px) {
  .cx-cap { min-height: 150px; padding-top: 16px; }
  .cx-ctl { gap: 8px; }
  .cx-bar { flex-basis: 100%; order: 10; }
  .cx-legend { font-size: 10px; gap: 6px 14px; }
}
