/* ============================================================
   MDJLABS — ATELIER · scène de référence « Le moteur pédagogique »
   Une SEULE scène (#pl-moteur), épinglée, scrubée, réversible.
   Le moteur est UNE entité continue qui se construit état par état
   (pilotée par atelier-moteur.js via --tp) — jamais 3 visuels qui
   se remplacent. Le cœur persiste : il observe (signaux → profil),
   émet un parcours par candidat (chaîne recomposée en direct), puis
   nourrit le rappel au moment optimal (courbe de l'oubli aplatie).
   Réutilise la coquille .plx-* de prolearn-scroll.
   Base : tokens + site + v2 + brand + v3 + v4 + v5 + socle + home-v7
   + prolearn-scroll (coquille) + CE fichier (moteur continu + atelier).
   ============================================================ */

/* ---- chrome d'atelier : barre supérieure minimale ---- */
.atx-top { position: fixed; left: 0; right: 0; top: 0; z-index: 60; display: flex; align-items: center; gap: 16px; padding: 12px clamp(18px, 3vw, 34px); background: color-mix(in oklab, var(--bg-0) 78%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-weak); }
.atx-top .wm { font-size: clamp(15px, 1.6vw, 19px); letter-spacing: 0.02em; }
.atx-top .by { font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-3); }
.atx-tag { display: inline-flex; align-items: center; gap: 8px; font-family: var(--ff-mono); font-size: clamp(9px, .9vw, 11px); letter-spacing: 0.16em; text-transform: uppercase; color: var(--acc); border: 1px solid var(--acc-line); border-radius: var(--r-sm); padding: 5px 10px; }
.atx-tag i { width: 6px; height: 6px; border-radius: 999px; background: var(--acc); box-shadow: 0 0 8px var(--acc-glow); animation: mpulse 1.8s var(--ease) infinite; }
.atx-top .sp { flex: 1; }
.atx-tbtn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-2); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 11px; cursor: pointer; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.atx-tbtn:hover { color: var(--fg-0); border-color: var(--line-strong); }
.atx-tbtn:focus-visible { outline: none; box-shadow: var(--glow-focus); }
.atx-tbtn svg { width: 15px; height: 15px; }
@media (max-width: 620px) { .atx-top .by, .atx-tag { display: none; } }

/* ---- rail : marqueur « Le moteur » réel + repères fantômes (extensible ~13) ---- */
.plx-rail .ghost { pointer-events: none; }
.plx-rail .ghost .d { width: 6px; height: 6px; opacity: .5; }
.plx-rail .ghost .t { display: none; }
.plx-rail button.is-here .d { background: var(--acc); border-color: var(--acc); box-shadow: 0 0 12px var(--acc-glow); }
.plx-rail button.is-here { color: var(--acc); }
.plx-rail button.is-here .t { opacity: 1; transform: none; }

/* ---- intro (contexte atelier, court) ---- */
.atx-intro { position: relative; z-index: 2; min-height: 84vh; display: flex; align-items: center; padding: clamp(96px, 14vh, 150px) 0 clamp(40px, 6vh, 72px); }
.atx-eyebrow { font-family: var(--ff-mono); font-size: clamp(10px, 1vw, 12px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-2); margin: 0 0 clamp(18px, 3vh, 28px); display: inline-flex; align-items: center; gap: 10px; }
.atx-eyebrow b { color: var(--acc); font-weight: 500; }
.atx-intro h1 { font-size: clamp(40px, 7.4vw, 104px); font-weight: 700; letter-spacing: -0.04em; line-height: .94; margin: 0; color: var(--fg-0); text-wrap: balance; }
.atx-intro h1 em { font-style: normal; color: var(--pl); text-shadow: 0 0 48px var(--pl-glow); }
.atx-intro .lede { max-width: 64ch; margin: clamp(22px, 3.4vh, 36px) 0 0; font-size: clamp(15px, 1.6vw, 21px); line-height: 1.55; color: var(--fg-1); text-wrap: pretty; }
.atx-intro .lede b { color: var(--fg-0); font-weight: 600; }
.atx-cue { margin-top: clamp(26px, 4vh, 44px); display: inline-flex; align-items: center; gap: 12px; font-family: var(--ff-mono); font-size: clamp(11px, 1.1vw, 13px); letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-1); background: none; border: 0; cursor: pointer; padding: 0; }
.atx-cue:hover { color: var(--acc); }
.atx-cue:focus-visible { outline: none; color: var(--acc); }
.atx-cue .dsc { width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--acc-line); display: inline-flex; align-items: center; justify-content: center; color: var(--acc); }
.atx-cue:hover .dsc { background: var(--acc-soft); box-shadow: 0 0 14px -2px var(--acc-glow); }
.atx-cue .dsc svg { animation: plxbob 2.2s var(--ease) infinite; }

/* ============================================================
   VIZ DU MOTEUR — surdimensionnée, iso 3D CSS, entité continue
   ============================================================ */
.mtx-viz { position: relative; aspect-ratio: 900 / 560; max-height: 66vh; width: 100%; margin: 0 auto; perspective: 1500px; }
.mtx-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  transform: rotateX(8deg) rotateZ(0deg); transform-origin: 50% 46%; will-change: transform; }
.mtx-svg.alive { animation: mtxdrift 14s var(--ease) infinite alternate; }
@keyframes mtxdrift { from { transform: rotateX(10deg) rotateZ(-1.2deg); } to { transform: rotateX(6deg) rotateZ(1.2deg); } }
/* vie en boucle = CSS uniquement (le scroll ne pilote QUE la construction) */
@keyframes mtxpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes mtxbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes mtxflow { to { stroke-dashoffset: -28; } }
@keyframes mtxring { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes mtxspin { to { transform: rotate(360deg); } }
.mtx-core-pulse { animation: mtxpulse 2.4s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
.mtx-cog { animation: mtxspin 22s linear infinite; transform-box: fill-box; transform-origin: center; }
.mtx-node-bob { animation: mtxbob 3.4s var(--ease) infinite; transform-box: fill-box; }

/* ---- cœur / moteur (tokens uniquement — theme-aware) ---- */
.mtx-core-glow { fill: var(--pl); opacity: .13; }
.mtx-core { fill: var(--pl-soft); stroke: var(--pl); stroke-width: 2.4; filter: drop-shadow(0 0 20px var(--pl-glow)); }
.mtx-core-cog { fill: none; stroke: var(--pl); stroke-width: 2.2; opacity: .8; }
.mtx-core-t { font-family: var(--ff-mono); fill: var(--pl); text-anchor: middle; font-weight: 600; letter-spacing: 0.04em; }
.mtx-core-cap { font-family: var(--ff-mono); fill: var(--fg-2); text-anchor: middle; letter-spacing: 0.08em; }

/* ---- signaux d'entrée (état 1 : réponses / hésitations / temps / relectures) ---- */
.mtx-sig { stroke: var(--pl); stroke-width: 1.5; fill: none; stroke-dasharray: 5 7; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--pl-glow)); }
.mtx-svg.alive .mtx-sig { animation: mtxflow 1.1s linear infinite; }
.mtx-sig-dot { fill: var(--fg-0); }
.mtx-sig-l { font-family: var(--ff-mono); fill: var(--fg-3); font-size: 9px; letter-spacing: 0.04em; }

/* ---- profil de mémorisation (état 1 : rétention J+7 par format) ---- */
.mtx-prof-fr { fill: none; stroke: var(--pl-line); stroke-width: 1.4; }
.mtx-prof-hd { font-family: var(--ff-mono); fill: var(--pl); font-size: 10px; letter-spacing: 0.12em; }
.mtx-prof-ic { font-family: var(--ff-mono); fill: var(--fg-0); text-anchor: middle; font-weight: 600; font-size: 13px; }
.mtx-prof-fmt { font-family: var(--ff-mono); fill: var(--fg-2); font-size: 9px; letter-spacing: 0.05em; }
.mtx-prof-bg { fill: var(--bg-3); }
.mtx-prof-fill { fill: var(--pl); filter: drop-shadow(0 0 6px var(--pl-glow)); }
.mtx-prof-fill.low { fill: var(--line-strong); filter: none; }
.mtx-prof-val { font-family: var(--ff-mono); fill: var(--fg-1); font-size: 10px; text-anchor: end; }
.mtx-prof-val.top { fill: var(--pl); }

/* ---- chaîne d'atomes recomposée (état 2 : un parcours par candidat) ---- */
.mtx-bond { stroke: var(--pl); stroke-width: 1.6; fill: none; stroke-dasharray: 4 4; filter: drop-shadow(0 0 5px var(--pl-glow)); }
.mtx-atom { fill: var(--bg-1); stroke: var(--line-strong); stroke-width: 1.6; }
.mtx-atom.done { fill: var(--pl-soft); stroke: var(--pl); filter: drop-shadow(0 0 7px var(--pl-glow)); }
.mtx-atom.now { fill: var(--acc-soft); stroke: var(--acc); filter: drop-shadow(0 0 8px var(--acc-glow)); }
.mtx-atom.remed { fill: var(--acc-soft); stroke: var(--acc); stroke-dasharray: 4 3; }
.mtx-atom-g { font-family: var(--ff-mono); fill: var(--fg-0); text-anchor: middle; font-weight: 600; font-size: 12px; }
.mtx-atom-l { font-family: var(--ff-mono); fill: var(--fg-2); text-anchor: middle; font-size: 8px; letter-spacing: 0.02em; }
.mtx-atom-l .dom { fill: var(--fg-3); }
.mtx-clab { font-family: var(--ff-mono); fill: var(--pl); text-anchor: end; font-size: 9px; letter-spacing: 0.1em; }
.mtx-clab.b { fill: var(--fg-2); }
.mtx-div { font-family: var(--ff-mono); fill: var(--acc); font-size: 8.5px; letter-spacing: 0.06em; }

/* ---- rappel au moment optimal (état 3 : courbe de l'oubli) ---- */
.mtx-axis { stroke: var(--line-strong); stroke-width: 1.4; }
.mtx-curve-old { fill: none; stroke: var(--fg-3); stroke-width: 1.6; stroke-dasharray: 4 4; }
.mtx-curve-new { fill: none; stroke: var(--pl); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 7px var(--pl-glow)); }
.mtx-clabel { font-family: var(--ff-mono); font-size: 10px; text-anchor: start; }
.mtx-mnode { fill: var(--bg-1); stroke: var(--line-strong); stroke-width: 1.6; }
.mtx-mnode.on { fill: var(--pl-soft); stroke: var(--pl); filter: drop-shadow(0 0 9px var(--pl-glow)); }
.mtx-micon { font-family: var(--ff-mono); text-anchor: middle; font-weight: 600; font-size: 13px; fill: var(--fg-2); }
.mtx-micon.on { fill: var(--pl); }
.mtx-mtick { font-family: var(--ff-mono); fill: var(--fg-3); text-anchor: middle; font-size: 10px; letter-spacing: 0.05em; }
.mtx-mtick.on { fill: var(--pl); }
.mtx-gap { font-family: var(--ff-mono); fill: var(--fg-3); text-anchor: middle; font-size: 8px; letter-spacing: 0.04em; }
.mtx-play { stroke: var(--acc); stroke-width: 2; filter: drop-shadow(0 0 7px var(--acc-glow)); }
.mtx-recall-ring { fill: none; stroke: var(--acc); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.mtx-svg.alive .mtx-recall-ring.on { animation: mtxring 1.6s var(--ease) infinite; }

/* ---- légende FIG ---- */
.mtx-cap { position: static; margin-top: 12px; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--fg-3); white-space: nowrap; }
.mtx-cap .real { color: var(--pl); margin-left: 10px; }

/* ---- overlay HTML : candidat anonymisé + bandeau multi-domaines ---- */
.mtx-ov { position: absolute; left: 0; right: 0; top: 2%; z-index: 3; display: flex; justify-content: center; pointer-events: none; }
.mtx-cand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--ff-mono); font-size: clamp(9px, .9vw, 11px); letter-spacing: 0.14em; text-transform: uppercase; color: var(--pl); border: 1px solid var(--pl-line); border-radius: var(--r-sm); padding: 4px 11px; background: color-mix(in oklab, var(--bg-1) 70%, transparent); transition: opacity .4s var(--ease); }
.mtx-cand i { width: 6px; height: 6px; border-radius: 999px; background: var(--pl); box-shadow: 0 0 7px var(--pl-glow); animation: mpulse 1.8s var(--ease) infinite; }
.mtx-cand b { color: var(--fg-0); font-weight: 600; }
.mtx-dom { position: absolute; left: 0; right: 0; bottom: 2%; z-index: 3; text-align: center; pointer-events: none; font-family: var(--ff-mono); font-size: clamp(8.5px, .85vw, 10px); letter-spacing: 0.06em; color: var(--fg-3); text-wrap: balance; }
.mtx-dom b { color: var(--pl); font-weight: 500; }

/* ---- outro : liens de reprise ---- */
.atx-outro { position: relative; z-index: 2; padding: clamp(56px, 9vh, 110px) 0 clamp(70px, 12vh, 140px); }
.atx-outro-in { max-width: 900px; margin: 0 auto; }
.atx-outro .k { font-family: var(--ff-mono); font-size: clamp(10px, 1vw, 12px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--acc); display: inline-flex; align-items: center; gap: 10px; }
.atx-outro .k::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--acc); box-shadow: 0 0 12px var(--acc-glow); }
.atx-outro h2 { font-size: clamp(26px, 4vw, 48px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.04; margin: 18px 0 16px; text-wrap: balance; }
.atx-outro p { font-size: clamp(14px, 1.4vw, 18px); line-height: 1.6; color: var(--fg-1); margin: 0 0 clamp(24px, 3.6vh, 36px); max-width: 64ch; text-wrap: pretty; }
.atx-outro-links { display: flex; flex-wrap: wrap; gap: 12px; }
.atx-outro-links a { display: inline-flex; align-items: center; gap: 10px; font-family: var(--ff-mono); font-size: clamp(11px, 1.1vw, 13px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-1); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 16px; background: var(--bg-1); transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.atx-outro-links a.pri { color: var(--pl); border-color: var(--pl-line); background: var(--pl-soft); }
.atx-outro-links a:hover { color: var(--fg-0); border-color: var(--line-strong); }
.atx-outro-links a.pri:hover { color: var(--pl); border-color: var(--pl); }
.atx-outro-links a .arr { transition: transform var(--dur) var(--ease); }
.atx-outro-links a:hover .arr { transform: translateX(4px); }

/* focus visibles partout */
.plx-step:focus-visible, .plx-rail button:focus-visible, .plx-link:focus-visible { outline: none; box-shadow: var(--glow-focus); border-radius: var(--r-sm); }

/* ---- responsive : mobile garde l'anim (écran au-dessus, texte dessous) ---- */
@media (max-width: 960px) {
  .mtx-viz { max-height: 38vh; }
  .plx-pin { padding: 64px 0 58px; }
  .plx-stage { gap: 16px; }
  .plx-side .plx-txts { min-height: clamp(120px, 22vh, 180px); }
  .plx-txt { font-size: clamp(17px, 4.6vw, 26px); }
  .plx-txt small { font-size: clamp(12px, 3.4vw, 14.5px); margin-top: 10px; }
  .plx-cap, .mtx-cap { display: none; }
  .mtx-dom { display: none; }
}
@media (max-width: 960px) and (max-height: 720px) {
  .mtx-viz { max-height: 32vh; }
  .plx-txt small { display: none; }
}

/* ============================================================
   REPLI — html.plx-flat / reduced-motion : moteur figé lisible,
   3 temps empilés en liste, pas de scrub.
   ============================================================ */
html.plx-flat .mtx-svg { animation: none !important; transform: none !important; position: static; width: 100%; height: clamp(320px, 78vw, 480px); }
html.plx-flat .mtx-core-pulse, html.plx-flat .mtx-cog, html.plx-flat .mtx-node-bob { animation: none !important; }
html.plx-flat .mtx-viz { aspect-ratio: auto; max-height: none; height: auto; margin-bottom: 26px; }
html.plx-flat .mtx-ov { position: static; margin-bottom: 10px; }
html.plx-flat .mtx-dom { position: static; margin-top: 8px; }
html.plx-flat .plx-txt small { color: var(--fg-1); }
html.plx-flat .atx-intro { min-height: auto; }

@media (prefers-reduced-motion: reduce) {
  .mtx-svg, .mtx-core-pulse, .mtx-cog, .mtx-node-bob, .mtx-sig, .mtx-recall-ring { animation: none !important; }
  .atx-tag i, .atx-cue .dsc svg, .mtx-cand i { animation: none !important; }
}
