/* ============================================================
   MDJLABS — ATELIER · « Creator Studio » (scène PL.3, isolée)
   ------------------------------------------------------------
   UNE seule scène (#pl-studio), épinglée, scrubée, réversible.
   Le studio est UNE entité continue : un tableau de bord qui se
   construit et travaille au fil du scroll (piloté par --tp via
   atelier-studio.js) — jamais 4 captures qui se remplacent. Les
   10 entités (6 éléments + 4 jalons) traversent les 4 états :
   clips de montage → jalons sur le parcours → nœuds du graphe →
   nœuds audités par l'IA. Le noyau (coquille studio) persiste.
   Réutilise la coquille .plx-* de prolearn-scroll + le chrome
   d'atelier .atx-* de atelier-atome. CE fichier = studio + scène.
   ============================================================ */

/* ---- lockup d'en-tête : CREATOR STUDIO by PROLEARN ---- */
.stu-lockup { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-family: var(--ff-mono); margin: 0 0 clamp(16px, 2.4vh, 26px); line-height: 1; }
.stu-lockup .cs { font-size: clamp(20px, 2.5vw, 34px); font-weight: 600; letter-spacing: 0.06em; color: var(--fg-0); }
.stu-lockup .by { font-size: clamp(9px, .9vw, 11px); letter-spacing: 0.24em; text-transform: uppercase; color: var(--fg-3); margin: 3px 0; }
.stu-lockup .wm { font-size: clamp(18px, 2.2vw, 30px); font-weight: 700; letter-spacing: 0.02em; color: var(--fg-1); }
.stu-lockup .wm b { color: var(--pl); font-weight: 700; text-shadow: 0 0 30px var(--pl-glow); }

/* ============================================================
   COQUILLE STUDIO — persistante, « capture réelle de l'alpha »
   Iso 3D CSS : le panneau arrive de la tranche (--ep) puis dérive.
   ============================================================ */
.stu-wrap { position: relative; width: 100%; perspective: 1700px; transform-style: preserve-3d; }
.stu-wrap.alive { animation: studrift 15s var(--ease) infinite alternate; }
@keyframes studrift { from { transform: rotateZ(-0.5deg) translateY(-2px); } to { transform: rotateZ(0.5deg) translateY(2px); } }
.stu-panel { position: relative; display: flex; flex-direction: column; border: 1px solid var(--pl-line); border-radius: var(--r-md); background: var(--bg-1); overflow: hidden;
  box-shadow: 0 46px 110px -55px rgba(0,0,0,.9), 0 0 0 1px var(--pl-soft);
  transform: rotateY(calc(-13deg + var(--ep, 1) * 13deg)) rotateX(calc(6deg - var(--ep, 1) * 6deg)) translateY(calc((1 - var(--ep, 1)) * 6%));
  transform-origin: left center; opacity: clamp(0, calc(var(--ep, 1) * 1.6), 1); will-change: transform; }
html[data-theme="light"] .stu-panel { box-shadow: 0 30px 76px -42px rgba(20,30,18,.34); }

/* barre de fenêtre */
.stu-bar { height: 30px; display: flex; align-items: center; gap: 7px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); flex: none; }
.stu-bar i { width: 7px; height: 7px; border-radius: 999px; background: var(--bg-4); flex: none; }
.stu-bar .url { margin-left: 8px; font-family: var(--ff-mono); font-size: 8.5px; letter-spacing: 0.06em; color: var(--fg-3); background: var(--bg-3); border-radius: 3px; padding: 2px 10px; }
.stu-bar .live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--ff-mono); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pl); }
.stu-bar .live i { background: var(--pl); box-shadow: 0 0 7px var(--pl-glow); animation: mpulse 1.8s var(--ease) infinite; }

/* sélecteur d'entité (une coquille, des éditeurs) */
.stu-tabs { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg-1); overflow: hidden; flex: none; }
.stu-tab { display: inline-flex; align-items: center; gap: 6px; font-family: var(--ff-mono); font-size: clamp(8px, .82vw, 9.5px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 5px 9px; background: var(--bg-2); white-space: nowrap; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.stu-tab .d { width: 5px; height: 5px; border-radius: 999px; background: var(--line-strong); flex: none; transition: all var(--dur) var(--ease); }
.stu-tab.on { color: var(--pl); border-color: var(--pl-line); background: var(--pl-soft); }
.stu-tab.on .d { background: var(--pl); box-shadow: 0 0 7px var(--pl-glow); }
@media (max-width: 1160px) { .stu-tab { font-size: 8px; padding: 5px 7px; } }

/* corps : dock + canvas */
.stu-body { display: grid; grid-template-columns: 46px 1fr; min-height: clamp(320px, 46vh, 468px); }
.stu-dock { border-right: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 12px 0; }
.stu-dock .tool { width: 26px; height: 26px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-1); color: var(--fg-2); display: flex; align-items: center; justify-content: center; font-family: var(--ff-mono); font-size: 11px; }
.stu-dock .tool.on { color: var(--pl); border-color: var(--pl-line); background: var(--pl-soft); box-shadow: 0 0 9px -2px var(--pl-glow); }
.stu-dock .sep { width: 20px; height: 1px; background: var(--line); }

.stu-canvas { position: relative; overflow: hidden; background:
    linear-gradient(var(--line-weak) 1px, transparent 1px), linear-gradient(90deg, var(--line-weak) 1px, transparent 1px), var(--bg-1);
  background-size: 30px 30px, 30px 30px, auto; }
.stu-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* badge éditeur courant (top-left) + roll multi-domaines (état 1) */
.stu-edlabel { position: absolute; left: 12px; top: 11px; z-index: 4; display: inline-flex; align-items: center; gap: 7px; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pl); border: 1px solid var(--pl-line); border-radius: var(--r-xs); padding: 4px 9px; background: color-mix(in oklab, var(--bg-1) 74%, transparent); }
.stu-edlabel b { color: var(--fg-0); font-weight: 600; }
.stu-roll { position: absolute; left: 50%; top: 13px; transform: translateX(-50%); z-index: 3; width: min(74%, 420px); text-align: center; pointer-events: none; transition: opacity .4s var(--ease); }
.stu-roll .k { display: block; font-family: var(--ff-mono); font-size: 8px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 5px; }
.stu-roll .roll { position: relative; height: 26px; }
.stu-roll .roll span { position: absolute; left: 0; right: 0; top: 0; font-family: var(--ff-mono); font-size: clamp(11px, 1.2vw, 14px); font-weight: 500; color: var(--fg-0); opacity: 0; transform: translateY(7px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.stu-roll .roll span.on { opacity: 1; transform: none; }
.stu-roll .roll span b { color: var(--pl); font-weight: 500; }

/* pied : statut de composition */
.stu-foot { height: 30px; display: flex; align-items: center; gap: 16px; padding: 0 13px; border-top: 1px solid var(--line); background: var(--bg-2); font-family: var(--ff-mono); font-size: 8.5px; letter-spacing: 0.08em; color: var(--fg-3); flex: none; }
.stu-foot .g { display: inline-flex; align-items: center; gap: 6px; }
.stu-foot .g b { color: var(--pl); font-weight: 500; font-feature-settings: "tnum"; }
.stu-foot .g .dot { width: 5px; height: 5px; border-radius: 999px; background: var(--pl); box-shadow: 0 0 6px var(--pl-glow); }
.stu-foot .sp { flex: 1; }

/* légende sous le panneau */
.stu-cap { position: absolute; left: 2px; bottom: -24px; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--fg-3); white-space: nowrap; }
.stu-cap .real { color: var(--pl); margin-left: 10px; }

/* ============================================================
   PANNEAU D'ANALYSE IA (état 4) — overlay HTML crisp
   ============================================================ */
.stu-audit { position: absolute; right: 14px; top: 52px; z-index: 5; width: min(52%, 316px); border: 1px solid var(--acc-line); border-radius: var(--r-sm); background: color-mix(in oklab, var(--bg-1) 90%, transparent); backdrop-filter: blur(5px); padding: 12px 13px; box-shadow: 0 26px 66px -32px var(--acc-glow); opacity: 0; transform: translateX(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); pointer-events: none; }
.stu-audit.on { opacity: 1; transform: none; }
.stu-audit .ah { display: flex; align-items: center; gap: 8px; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--acc); margin-bottom: 10px; }
.stu-audit .ah svg { width: 13px; height: 13px; }
.stu-audit .abar { height: 5px; border-radius: 3px; background: var(--bg-3); overflow: hidden; margin-bottom: 11px; }
.stu-audit .abar b { display: block; height: 100%; width: var(--scan, 0%); background: linear-gradient(90deg, var(--acc), var(--pl)); box-shadow: 0 0 8px var(--acc-glow); border-radius: 3px; transition: width .12s linear; }
.stu-audit .al { display: flex; align-items: flex-start; gap: 8px; font-size: 10.5px; line-height: 1.35; color: var(--fg-1); margin-bottom: 8px; opacity: 0; transform: translateY(4px); transition: opacity .4s var(--ease), transform .4s var(--ease); }
.stu-audit .al.on { opacity: 1; transform: none; }
.stu-audit .al:last-child { margin-bottom: 0; }
.stu-audit .al .ic { font-family: var(--ff-mono); font-size: 11px; flex: none; margin-top: 1px; line-height: 1.1; }
.stu-audit .al.warn .ic { color: var(--pf, #E0B45F); }
.stu-audit .al.ai .ic { color: var(--acc); }
.stu-audit .al.ok .ic { color: var(--pl); }
.stu-audit .al small { font-family: var(--ff-mono); font-size: 8px; letter-spacing: 0.06em; color: var(--fg-3); display: block; margin-top: 2px; }
.stu-audit .al b { color: var(--fg-0); font-weight: 600; }

/* ============================================================
   CLASSES SVG DU STUDIO (tokens uniquement — theme-aware)
   ============================================================ */
.su-lane { fill: none; stroke: var(--line); stroke-width: 1; }
.su-lanelbl { font-family: var(--ff-mono); font-size: 8px; letter-spacing: 0.06em; fill: var(--fg-3); text-anchor: end; }
.su-play { stroke: var(--acc); stroke-width: 2; filter: drop-shadow(0 0 7px var(--acc-glow)); }
.su-playcap { fill: var(--acc); }
.su-path { fill: none; stroke: var(--pl-line); stroke-width: 2; stroke-linecap: round; }
.su-path.on { stroke: var(--pl); filter: drop-shadow(0 0 6px var(--pl-glow)); }

.su-card { fill: var(--bg-2); stroke: var(--pl-line); stroke-width: 1.4; }
.su-card.warn { stroke: var(--pf, #E0B45F); }
.su-card.heal { fill: var(--pl-soft); stroke: var(--pl); filter: drop-shadow(0 0 10px var(--pl-glow)); }
.su-mile { fill: var(--acc-soft); stroke: var(--acc); stroke-width: 1.5; }
.su-mile.node { fill: var(--bg-2); stroke: var(--acc-line); }
.su-lbl { font-family: var(--ff-mono); fill: var(--fg-0); text-anchor: middle; font-weight: 500; }
.su-tag { font-family: var(--ff-mono); fill: var(--fg-3); text-anchor: middle; letter-spacing: 0.06em; }
.su-tag.acc { fill: var(--pl); }
.su-icon { font-family: var(--ff-mono); text-anchor: middle; font-weight: 600; fill: var(--acc); }
.su-dot { fill: var(--pl); filter: drop-shadow(0 0 6px var(--pl-glow)); }
.su-open { fill: var(--bg-1); stroke: var(--acc-line); stroke-width: 1.2; }
.su-openlbl { font-family: var(--ff-mono); font-size: 8.5px; text-anchor: middle; fill: var(--acc); letter-spacing: 0.04em; }

.su-edge { stroke: var(--pl-line); fill: none; opacity: .55; }
.su-edge.hot { stroke: var(--pl); filter: drop-shadow(0 0 5px var(--pl-glow)); opacity: 1; }
.su-wlbl { font-family: var(--ff-mono); font-size: 7px; fill: var(--fg-3); text-anchor: middle; }

.su-scan { stroke: var(--acc); stroke-width: 1.6; stroke-dasharray: 4 5; filter: drop-shadow(0 0 6px var(--acc-glow)); }
.su-badge { font-family: var(--ff-mono); font-weight: 600; text-anchor: middle; }
.su-badge.warn { fill: var(--pf, #E0B45F); }
.su-badge.ai { fill: var(--acc); }
.su-badge.ok { fill: var(--pl); }
.su-badgebg { fill: var(--bg-0); stroke: var(--line-strong); stroke-width: 1; }
.su-badgebg.warn { stroke: var(--pf, #E0B45F); }
.su-badgebg.ai { stroke: var(--acc); }
.su-badgebg.ok { stroke: var(--pl); }

/* preview « canvas central » (état 1) : l'atome se compose */
.su-pv { fill: var(--bg-1); stroke: var(--pl-line); stroke-width: 1.4; }
.su-pvh { font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.06em; fill: var(--fg-2); text-anchor: start; }
.su-pvblock { fill: var(--bg-3); }
.su-pvblock.acc { fill: var(--pl-soft); stroke: var(--pl-line); stroke-width: 1; }
.su-pvbar { fill: var(--pl); }
.su-cursor { fill: var(--pl); }
.su-wave { stroke: var(--pl); stroke-width: 2; stroke-linecap: round; fill: none; }

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

/* ============================================================
   RESPONSIVE / REPLI — html.plx-flat : studio figé lisible,
   4 temps empilés, panneau à plat, audit visible.
   ============================================================ */
.stu-canvas { min-height: clamp(300px, 44vh, 440px); }
html.plx-flat .stu-wrap { animation: none !important; transform: none !important; }
html.plx-flat .stu-panel { transform: none !important; opacity: 1 !important; }
html.plx-flat .stu-body { min-height: 0; }
html.plx-flat .stu-canvas { min-height: clamp(300px, 80vw, 400px); }
html.plx-flat .stu-svg { }
html.plx-flat .stu-roll { display: none; }
html.plx-flat .stu-audit { display: none; }
html.plx-flat .stu-edlabel { position: static; margin: 11px 0 0 12px; }

@media (prefers-reduced-motion: reduce) {
  .stu-wrap, .stu-panel { animation: none !important; }
  .stu-bar .live i { animation: none !important; }
}

/* viewports courts : borner le studio pour tenir dans 100vh */
@media (min-width: 961px) and (max-height: 820px) {
  .stu-body { min-height: clamp(280px, 40vh, 400px); }
  .stu-canvas { min-height: clamp(280px, 40vh, 400px); }
}

/* ============================================================
   MOBILE (≤960) — repli figé : la coquille .plx-flat gère le
   dé-pin + l'empilement. Ici on borne juste la coquille studio.
   ============================================================ */
@media (max-width: 620px) {
  .stu-tab { font-size: 7.5px; padding: 4px 6px; }
  .stu-tab:nth-child(n+4) { display: none; }
}
