/* Szenen und Symbole (partials/scenes.ejs). Einzige Quelle fuer Szenen-Gestalt und -Bewegung. Katalog: docs/ANIMATIONEN.md.
   Farben nur aus den Tokens in app.css. Ohne Bewegung (prefers-reduced-motion) steht jede Szene als fertiges Standbild. */

.scene {
  --sc-bg: var(--ground); --sc-sf: var(--surface); --sc-ink: var(--ink); --sc-mu: var(--muted); --sc-rule: var(--rule);
  --sc-ac: var(--brand); --sc-ok: var(--ok); --sc-warn: var(--warn); --sc-crit: var(--crit); --sc-pr: var(--violet); --sc-on: var(--surface);
  display: block; width: 100%; height: auto; background: var(--sc-bg); border-radius: 12px;
}
/* Variante auf Navy: gleiche Zeichnung, andere Variablen. Linien hell, Blickfang weiss. */
.scene-dark {
  --sc-bg: var(--navy); --sc-sf: var(--shell-hover); --sc-ink: var(--shell-text); --sc-mu: var(--shell-muted); --sc-rule: var(--muted);
  --sc-ac: var(--surface); --sc-on: var(--navy);
}
.scene :where(path, circle, rect, ellipse, line) { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scene .k { stroke: var(--sc-ink); } .scene .km { stroke: var(--sc-mu); } .scene .kr { stroke: var(--sc-rule); }
.scene .ka { stroke: var(--sc-ac); } .scene .ko { stroke: var(--sc-ok); } .scene .kw { stroke: var(--sc-warn); }
.scene .kc { stroke: var(--sc-crit); } .scene .kp { stroke: var(--sc-pr); } .scene .kn { stroke: var(--sc-on); }
.scene .kamber { stroke: #c98a1b; } .scene .kmute { stroke: var(--shell-muted); }
.scene .fs { fill: var(--sc-sf); } .scene .fk { fill: var(--sc-ink); } .scene .fa { fill: var(--sc-ac); } .scene .fm { fill: var(--sc-mu); }
.scene .fo { fill: var(--sc-ok); } .scene .fw { fill: var(--sc-warn); } .scene .fc { fill: var(--sc-crit); } .scene .fp { fill: var(--sc-pr); }
.scene .fn { fill: var(--sc-on); } .scene .famber { fill: #c98a1b; } .scene .fnavy { fill: var(--navy); } .scene .foff { fill: var(--shell-hover); }
.scene .fh-a { fill: url(#scp-ne-a); } .scene .fh-b { fill: url(#scp-ne-b); }
.scene .fwedge { fill: var(--sc-ac); fill-opacity: .14; stroke: none; }
.scene .w3 { stroke-width: 3; } .scene .w8 { stroke-width: 8; }
.scene .dash { stroke-dasharray: 4 5; }
.scene text { font-family: var(--sans); stroke: none; }
.scene .tx { font-size: 13px; font-weight: 600; fill: var(--sc-mu); }
.scene .tx-strong { font-size: 15px; font-weight: 700; fill: var(--sc-ink); }
.scene .tx-big { font-size: 26px; font-weight: 700; fill: var(--sc-ink); letter-spacing: -0.02em; }
/* Standbild: nur Bewegungs-Hilfslinien (mo) sind verborgen, der Inhalt steht im Endzustand. */
.scene .mo { opacity: 0; }
.scene .halo { opacity: .35; }
.scene .shackle-open { transform: translateY(-12px); }
.scene--ampel-lage { background: transparent; }

/* Symbole im Text (32x32) */
.sym { display: block; flex: none; width: 28px; height: 28px; color: var(--muted); }
.sym * { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sym .sa { stroke: var(--brand); }
.mb-none .sym { color: var(--ok); }
.doc-three .sym { width: 44px; height: 44px; color: var(--ink); }

/* Groessen je Einsatzort */
.vb-light { width: 132px; }
.vb-light .scene { width: 100%; }
.mc-intro .scene, .mc .empty-state .scene { width: 176px; flex: none; }
.mc .step-scene .scene { width: 160px; }
.mc .step.is-todo .scene { opacity: .55; }
.mc .privacy-card .scene { width: 132px; margin-bottom: 16px; }
.doc-head-row .scene { --sc-bg: var(--surface); width: 128px; flex: none; }
.wiz-pic .scene { max-width: 200px; }
/* Kleine Einsatzorte: kurze Beschriftungen waeren unter 9 px, die Szene spricht dort allein. */
:is(.doc-head-row, .mc-intro, .wiz-pic, .step-scene, .privacy-card) .scene :is(.tx, .tx-strong) { display: none; }
@media (max-width: 960px) { .vb-light { width: 96px; } }
@media (max-width: 700px) { .mc-intro .scene { width: 112px; } }
@media (max-width: 640px) { .doc-head-row .scene { width: 84px; } .wiz-pic .scene { max-width: 96px; } }
@media print { .doc-head-row .scene { display: none; } }

@media (prefers-reduced-motion: no-preference) {
  .scene * { transform-box: fill-box; transform-origin: center; }
  /* Aufbau (einmal) */
  .scene .a-draw { stroke-dasharray: 1 1; animation: sc-draw .9s var(--ease-out) both; }
  .scene .a-undraw { stroke-dasharray: 1 1; animation: sc-undraw .5s var(--ease-out) both; }
  .scene .a-fade { animation: sc-fade .6s var(--ease-out) both; }
  .scene .a-pop { animation: sc-pop .6s var(--ease-out) both; }
  .scene .a-rise { animation: sc-rise .7s var(--ease-out) both; }
  .scene .a-grow { transform-origin: left center; animation: sc-grow .8s var(--ease-out) both; }
  .scene .a-slide { animation: sc-slide .8s var(--ease-out) both; }
  .scene .a-slide2 { animation: sc-slide2 .9s var(--ease-out) both; }
  /* Kernaktion (einmal) */
  .scene .a-snap { animation: sc-snap .5s var(--ease-out) both; }
  .scene .a-stamp { animation: sc-stamp .55s var(--ease-out) both; }
  .scene .a-ping { animation: sc-ping 1s var(--ease-out) forwards; }
  .scene .a-vanish { animation: sc-vanish 2.2s var(--ease-out) .2s both; }
  .scene .l-close { stroke-dasharray: 1 1; animation: sc-close 1.2s var(--ease-out) .6s both; }
  .scene .key-turn { animation: sc-turn .6s var(--ease-out) 1s both; }
  .scene .shackle-open { animation: sc-unlatch .5s var(--ease-out) 1.6s both; }
  .scene .needle { transform-box: view-box; transform-origin: 160px 150px; animation: sc-needle 2.4s var(--ease-out) .3s both, sc-idle 7s var(--ease-out) 4s infinite; }
  /* Ruhige Schleife (6 bis 8 s) */
  .scene .l-scan { animation: sc-scan 7s var(--ease-out) .8s infinite; }
  .scene--schild-wirkung .l-scan { --dy: 118px; }
  .scene--anmeldung-identitaet .l-scan { --dy: 94px; }
  .scene .l-sweep { transform-box: view-box; transform-origin: 160px 95px; animation: sc-spin 6s linear infinite; }
  .scene .l-blip { animation: sc-pulse-loop 6s var(--ease-out) .85s infinite; }
  .scene .l-spin { animation: sc-spin 4s var(--ease-out) infinite; }
  .scene .l-flow { stroke-dasharray: 4 6; animation: sc-flow 2s linear infinite; }
  .scene .l-travel { animation: sc-travel 6s var(--ease-out) 1.6s infinite; }
  .scene--tenant-verbinden .l-travel { --tx: -88px; }
  .scene--kunden-db .l-travel { --tx: 76px; }
  .scene .pk1 { --tx: 30px; }
  .scene .pk2 { --tx: 30px; animation-delay: 3.4s; }
  .scene .l-ping { animation: sc-ping-loop 7s var(--ease-out) 1.2s infinite; }
  .scene .l-lift { animation: sc-lift 6s var(--ease-out) 1.2s infinite; }
  .scene .l-reach { animation: sc-reach 6s var(--ease-out) 1s infinite; }
  .scene .l-feed { animation: sc-feed 7s var(--ease-out) infinite; }
  .scene .l-nudge { animation: sc-nudge 6s var(--ease-out) 1.4s infinite; }
  .scene--ampel-kritisch .halo { animation: sc-pulse-loop 7s var(--ease-out) .6s infinite; }
  .scene--ampel-abweichung .halo { animation: sc-pulse 1.6s var(--ease-out) .6s both; }

  .scene .t1 { animation-delay: .15s; } .scene .t2 { animation-delay: .3s; } .scene .t3 { animation-delay: .45s; }
  .scene .t4 { animation-delay: .6s; } .scene .t5 { animation-delay: .8s; } .scene .t6 { animation-delay: 1s; }
  .scene .t7 { animation-delay: 1.2s; } .scene .t8 { animation-delay: 1.45s; } .scene .t9 { animation-delay: 1.7s; }
  .scene .t10 { animation-delay: 2.05s; } .scene .t11 { animation-delay: 2.4s; } .scene .t12 { animation-delay: 3s; }

  /* Szenen ausserhalb des Bildes warten (public/js/scenes.js); ohne Skript laufen sie sofort. */
  .sc-js .scene:not(.is-seen) * { animation-play-state: paused; }

  @keyframes sc-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes sc-undraw { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 1; } }
  @keyframes sc-fade { from { opacity: 0; } }
  @keyframes sc-pop { from { opacity: 0; transform: scale(.5); } }
  @keyframes sc-rise { from { opacity: 0; transform: translateY(12px); } }
  @keyframes sc-grow { from { transform: scaleX(0); } }
  @keyframes sc-slide { from { opacity: 0; transform: translateX(-34px); } }
  @keyframes sc-slide2 { from { opacity: 0; transform: translateX(-50px); } }
  @keyframes sc-snap { 0% { transform: translateY(-14px); } 65% { transform: translateY(2px); } 100% { transform: none; } }
  @keyframes sc-stamp { 0% { opacity: 0; transform: scale(1.6); } 60% { opacity: 1; transform: scale(.94); } 100% { opacity: 1; transform: none; } }
  @keyframes sc-ping { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
  @keyframes sc-vanish { 0%, 50% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes sc-close { from { stroke-dashoffset: .24; } to { stroke-dashoffset: 0; } }
  @keyframes sc-turn { 0%, 100% { transform: none; } 50% { transform: scaleY(.3); } }
  @keyframes sc-unlatch { from { transform: none; } to { transform: translateY(-12px); } }
  @keyframes sc-needle { 0% { transform: rotate(-90deg); } 45% { transform: rotate(78deg); } 72% { transform: rotate(-8deg); } 88% { transform: rotate(3deg); } 100% { transform: none; } }
  @keyframes sc-idle { 0%, 90%, 100% { transform: none; } 94% { transform: rotate(3deg); } }
  @keyframes sc-scan { 0% { opacity: 0; transform: none; } 6% { opacity: 1; } 32% { opacity: 1; transform: translateY(var(--dy, 100px)); } 38%, 100% { opacity: 0; transform: translateY(var(--dy, 100px)); } }
  @keyframes sc-spin { to { transform: rotate(360deg); } }
  @keyframes sc-pulse { 0% { opacity: .35; transform: none; } 45% { opacity: 0; transform: scale(1.35); } 46% { opacity: 0; transform: none; } 100% { opacity: .35; transform: none; } }
  @keyframes sc-pulse-loop { 0% { opacity: .35; transform: none; } 14% { opacity: 0; transform: scale(1.35); } 15% { opacity: 0; transform: none; } 30%, 100% { opacity: .35; transform: none; } }
  @keyframes sc-flow { to { stroke-dashoffset: -20; } }
  @keyframes sc-travel { 0% { opacity: 0; transform: none; } 10% { opacity: 1; } 55% { opacity: 1; transform: translateX(var(--tx, 40px)); } 65%, 100% { opacity: 0; transform: translateX(var(--tx, 40px)); } }
  @keyframes sc-ping-loop { 0% { opacity: .6; transform: none; } 18%, 100% { opacity: 0; transform: scale(1.8); } }
  @keyframes sc-lift { 0% { opacity: 0; transform: translateY(10px); } 25%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-4px); } }
  @keyframes sc-reach { 0%, 100% { transform: none; } 40%, 60% { transform: translateX(8px); } }
  @keyframes sc-feed { 0% { opacity: 0; transform: translateX(-12px); } 25%, 100% { opacity: 1; transform: none; } }
  @keyframes sc-nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateX(4px); } }
}
