/* ==========================================================================
   Scenele animate din „Ce face CadHelp și nu găsești în alt program”
   O scenă = un SVG 800 x 600 (4:3, cât ecranul) + subtitrările pașilor (HTML, mari și pe telefon).
   Starea fără animație (fără JS, mișcare redusă, înainte de pornire) e starea FINALĂ: desenul gata și ultimul pas.
   `.ruleaza` (pus de scene.js) pornește animațiile; fiecare element își ia momentul din --t (și --t2 când iese).
   Reguli pentru desen:
   - un element animat nu poartă atributul transform (animația îl înlocuiește): se pune într-un <g> și transformul pe copil;
   - o singură clasă de animație pe element; pentru două efecte se îmbină grupuri;
   - zona de sus (y < 95) e a subtitrării, iar pe calculator cea de jos (y > 515) a legendei de sub ecran.
   ========================================================================== */
.animatie { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #fff; overflow: hidden; container-type: inline-size;
  /* cele 14 scene au ~2000 de noduri SVG: în afara ecranului nu se mai așază; mărimea o dă aspect-ratio */
  content-visibility: auto; contain-intrinsic-size: auto 400px auto 300px; }
.ecran > .ecran__media .animatie { position: absolute; inset: 0; aspect-ratio: auto; height: 100%; }
.animatie > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.animatie svg text { font-family: var(--font, "Archivo", "Segoe UI", system-ui, sans-serif); }

/* subtitrarea: un pas pe rând, sus, pe toată lățimea pe telefon */
.animatie__pasi { position: absolute; z-index: 2; left: 3.4cqw; right: 3.4cqw; top: 3.2cqw; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.animatie__pasi li { position: absolute; left: 0; top: 0; max-width: 100%; display: flex; align-items: center; gap: 0.6em; padding: 0.5em 0.9em 0.5em 0.5em; border-radius: 9px; background: #0E3A60; color: #fff; font-size: clamp(12.5px, 3.25cqw, 21px); font-weight: 700; line-height: 1.25; box-shadow: 0 8px 20px -6px rgba(8, 36, 64, 0.35); opacity: 0; }
.animatie__pasi li b { flex: none; display: grid; place-items: center; width: 1.75em; height: 1.75em; border-radius: 50%; background: #FFB24D; color: #0E3A60; font-weight: 850; }
.animatie:not(.ruleaza) .animatie__pasi li.ultim { opacity: 1; }
/* progresul ciclului, o linie subțire sub subtitrare */
.animatie__progres { position: absolute; z-index: 2; left: 0; top: 0; width: 100%; height: 4px; background: #FFB24D; transform-origin: left; transform: scaleX(0); pointer-events: none; }

/* ---------- starea finală: elementele care există doar în timpul animației stau ascunse */
.animatie .sc-trecator, .animatie .sc-initial, .animatie .sc-clic { opacity: 0; }

/* ---------- elementele animate se scalează și se mută față de propriul contur */
.animatie :is(.sc-apare, .sc-pop, .sc-din, .sc-trecator, .sc-clic, .sc-puls, .sc-creste) { transform-box: fill-box; transform-origin: center; }
.animatie .sc-creste { transform-origin: var(--o, left center); }

.animatie.ruleaza .animatie__progres { animation: sc-progres var(--durata, 10s) linear both; }
.animatie.ruleaza .sc-pas { animation: sc-pas-intra 0.5s var(--e-iesire) var(--t, 0s) both, sc-iese 0.3s ease var(--t2, 999s) forwards; }
.animatie.ruleaza .sc-apare { animation: sc-apare var(--d, 0.55s) var(--e-iesire) var(--t, 0s) both; }
.animatie.ruleaza .sc-pop { animation: sc-pop var(--d, 0.55s) var(--e-arc) var(--t, 0s) both; }
.animatie.ruleaza .sc-traseaza { stroke-dasharray: 1 1; animation: sc-traseaza var(--d, 1s) var(--e-mers) var(--t, 0s) both; }
.animatie.ruleaza .sc-umple { animation: sc-umple var(--d, 0.6s) var(--e-iesire) var(--t, 0s) both; }
.animatie.ruleaza .sc-din { animation: sc-din var(--d, 0.8s) var(--e-iesire) var(--t, 0s) both; }
.animatie.ruleaza .sc-creste { animation: sc-creste var(--d, 0.7s) var(--e-iesire) var(--t, 0s) both; }
.animatie.ruleaza .sc-muta { animation: sc-muta var(--d, 0.8s) var(--e-mers) var(--t, 0s) both; }
.animatie.ruleaza .sc-trecator { animation: sc-apare var(--d, 0.4s) var(--e-iesire) var(--t, 0s) both, sc-iese 0.35s ease var(--t2, 999s) forwards; }
.animatie.ruleaza .sc-initial { opacity: 1; animation: sc-iese 0.4s ease var(--t2, 999s) forwards; }
.animatie.ruleaza .sc-clic { animation: sc-clic 0.6s var(--e-iesire) var(--t, 0s) forwards; }
.animatie.ruleaza .sc-puls { animation: sc-puls 0.9s ease-in-out var(--t, 0s) var(--n, 2) both; }
.animatie.ruleaza .sc-scrie { animation: sc-scrie var(--d, 1.2s) steps(var(--pasi, 20), end) var(--t, 0s) both; }

/* oprit de om: totul stă pe loc */
.animatie.oprita, .animatie.oprita * { animation-play-state: paused !important; }

@keyframes sc-progres { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sc-pas-intra { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes sc-apare { from { opacity: 0; transform: translateY(var(--sy, 12px)); } to { opacity: 1; transform: none; } }
@keyframes sc-iese { to { opacity: 0; } }
@keyframes sc-pop { 0% { opacity: 0; transform: scale(0.2); } 60% { opacity: 1; } 100% { opacity: 1; transform: scale(1); } }
@keyframes sc-traseaza { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes sc-umple { from { fill-opacity: 0; } to { fill-opacity: var(--fo, 1); } }
@keyframes sc-din { from { opacity: var(--o0, 1); transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(var(--s, 1)) rotate(var(--r, 0deg)); } to { opacity: 1; transform: none; } }
@keyframes sc-creste { from { transform: scale(var(--sx0, 0), var(--sy0, 1)); } to { transform: none; } }
@keyframes sc-muta { from { transform: translate(0px, 0px); } to { transform: translate(var(--dx, 0px), var(--dy, 0px)); } }
@keyframes sc-clic { 0% { opacity: 0.85; transform: scale(0.25); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes sc-puls { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes sc-scrie { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* butonul de oprire, ca la filmele de dinainte */
/* jos în dreapta, peste legenda figurii: sus e subtitrarea, iar în colțul de sus desenul */
.animatie-gazda .feature-gif-toggle { z-index: 3; top: auto; bottom: 7px; right: 8px; width: 34px; height: 34px; }
.functie__media.animatie-gazda figcaption, .ecran > .ecran__media.animatie-gazda figcaption { padding-right: 52px; }

/* mișcare redusă: regula generală din ruloul.css face animațiile instantanee, iar momentele (--t) rămân, deci pașii tot
   apar pe rând; aici doar apar și dispar printr-o estompare scurtă, fără alunecări, măriri sau cursorul care se mișcă */
@media (prefers-reduced-motion: reduce) {
  .animatie__progres { display: none; }
  .animatie.ruleaza :is(.sc-apare, .sc-pop, .sc-din, .sc-creste) { animation-name: sc-estompare !important; animation-duration: 0.35s !important; }
  .animatie.ruleaza :is(.sc-trecator, .sc-pas) { animation-name: sc-estompare, sc-iese !important; animation-duration: 0.35s !important; }
}
@keyframes sc-estompare { from { opacity: 0; } to { opacity: 1; } }
