/* =========================================================================
   RefurbIT · Innenleben – 3D-Explosionsansicht (Sektion #innenleben)
   -------------------------------------------------------------------------
   Grundzustand = Fallback (ohne JS, ohne WebGL, ?no3d): Bild + Liste.
   html.x3d      = 3D-Modus. Gesetzt vom Inline-Skript in index.html vor dem
                   ersten Zeichnen (Höhe reserviert, kein Layout-Sprung),
                   zurückgenommen von explosion3d.js (kompakter Fallback).
   ohne .is-live = Laden, Kontextverlust oder .is-still (Fallback bei gleicher
                   Höhe): Standbild in der Bühne, Desktop mit Prüfpunkten daneben.
   .is-live      = 3D-Bild steht, Canvas blendet über das Standbild.
   Scroll-Ablauf über natives position:sticky (wie der Prozess-Abschnitt).
   Die Liste ul.explode__list ist die Textquelle (auch für Screenreader):
   Desktop -> visuell versteckt, das Skript zeigt Kopien (Liste bzw. angeheftet).
   Mobil   -> sichtbar unter der Bühne, am Modell stehen Nummern.
   Farben nur aus Brand Board A, Tokens aus site.css.
   ========================================================================= */

.explode{background:var(--carbon);--x3d-top:80px;--x3d-col:220px;--x3d-len:300vh}
.explode .sec-head{margin-bottom:44px}

/* ---------- Bühne (Fallback: normaler Block im Seitenraster) ---------- */
.explode__track{position:relative}
/* sticky auch im Fallback (dort wirkungslos, Track = Bühnenhöhe): der Wechsel 3D -> kompakt ändert so
   nicht das Positionierungsschema, Chrome meldet sonst eine Layout-Verschiebung des Glows */
.explode__stage{position:sticky;top:0;max-width:1200px;margin:0 auto;padding:0 28px}
.explode__stage::before{content:"";position:absolute;inset:0;pointer-events:none;z-index:0;
  background:
    radial-gradient(ellipse 42% 40% at 50% 54%,rgba(246,245,248,.055),transparent 72%),
    radial-gradient(ellipse 30% 32% at 66% 30%,rgba(214,33,111,.10),transparent 70%),
    radial-gradient(ellipse 30% 30% at 32% 76%,rgba(20,168,116,.08),transparent 70%)}
.explode__fallback{position:relative;z-index:1;margin:0 auto;max-width:500px}
.explode__fallback img{display:block;width:100%;height:auto}
.explode__view,.explode__steps,.explode__labels,.explode__pre,.explode__caption{display:none}

/* ---------- Prüfpunkte als Liste ---------- */
.explode__list{position:relative;z-index:2;list-style:none;margin:30px 0 0;padding:0;
  display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
.explode__list li,.explode__label{display:grid}
.explode__list li,.explode__label,.explode__caption{grid-template-columns:22px minmax(0,1fr);column-gap:12px;row-gap:3px;
  align-items:start;align-content:start}
.explode__list li{padding:16px 18px;border-radius:14px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.08)}
.explode__list strong,.explode__label strong,.explode__caption strong{grid-column:2;font-family:'Sora',sans-serif;font-size:14.5px;font-weight:700;line-height:1.35;color:#fff}
.explode__list li > span:last-child,.explode__label > span:last-child,.explode__caption > span:last-child{grid-column:2;font-size:13.5px;line-height:1.5;color:var(--grau-d)}
/* Abzeichen „geprüft“: grüner Ring mit Haken; mobil im 3D-Modus mit Nummer */
.explode__n{grid-column:1;grid-row:1 / span 2;width:22px;height:22px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;font-family:'Sora',sans-serif;font-weight:700;font-size:0;line-height:1;color:transparent;
  border:1.5px solid rgba(46,204,143,.55);
  background:rgba(46,204,143,.12) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232ECC8F' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/12px 12px no-repeat}

/* =========================================================================
   3D-Modus
   ========================================================================= */
.x3d .explode__track{height:var(--x3d-len)}
.x3d .explode__stage{position:sticky;top:0;height:100vh;height:100svh;max-width:none;margin:0;padding:var(--x3d-top) 0 0;
  display:flex;flex-direction:column;overflow:hidden}
.x3d .explode__stage::before{top:var(--x3d-top)}
/* Standbild als Platzhalter in der Bühne (gleiche Fläche wie die Canvas, keine Höhenänderung) */
.x3d .explode__fallback{position:absolute;z-index:1;left:20px;right:20px;top:var(--x3d-top);bottom:0;max-width:none;margin:0;
  display:flex;align-items:center;justify-content:center;pointer-events:none;opacity:1;visibility:visible;transition:opacity .4s ease}
.x3d .explode__fallback img{width:auto;height:auto;max-width:100%;max-height:88%}
.x3d .explode.is-live .explode__fallback{opacity:0;visibility:hidden;transition:opacity .8s ease,visibility 0s linear .8s}
.x3d .explode__view{display:block;position:relative;z-index:1;flex:1 1 auto;min-height:0}
.x3d .explode__view canvas{position:absolute;inset:0;display:block;width:100%;height:100%;opacity:0;transition:opacity .8s ease}
.x3d .explode.is-live .explode__view canvas{opacity:1}

/* Leitlinien und Punkte (Desktop) */
.explode__lines{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;display:none}
.explode__line{fill:none;stroke:rgba(246,245,248,.42);stroke-width:1;opacity:0}
.explode__dot{fill:var(--gruen-hell);opacity:0}
.explode__ring{fill:none;stroke:rgba(46,204,143,.45);stroke-width:1;opacity:0}

/* Nummern-Marker an den Bauteilen (mobil) */
.explode__marker{position:absolute;left:0;top:0;width:22px;height:22px;border-radius:50%;display:none;
  align-items:center;justify-content:center;font-family:'Sora',sans-serif;font-size:11px;font-weight:700;line-height:1;color:#fff;
  background:rgba(20,18,28,.86);border:1.5px solid var(--gruen-hell);opacity:0;pointer-events:none;will-change:transform,opacity}

/* Phasenanzeige unten (Desktop) */
.explode__steps{position:absolute;z-index:3;left:50%;bottom:26px;transform:translateX(-50%);flex-direction:column;align-items:stretch;gap:10px;
  font-family:'Sora',sans-serif;font-size:11px;font-weight:700;letter-spacing:2.5px;text-transform:uppercase}
.explode__steps em{display:flex;gap:30px;justify-content:space-between;font-style:normal}
.explode__steps em span{color:rgba(246,245,248,.5);transition:color .35s}
.explode__steps em span.is-on{color:#fff}
.explode__steps i{display:block;height:2px;border-radius:2px;background:rgba(246,245,248,.12);overflow:hidden}
.explode__steps b{display:block;height:100%;background:var(--grad-reboot);transform:scaleX(0);transform-origin:0 50%}

/* ---------- Desktop: Beschriftungen seitlich, per Projektion angeheftet ---------- */
@media (min-width:861px){
  .x3d .explode__lines{display:block}
  .x3d .explode__steps{display:flex}
  .x3d .explode__labels{display:block;position:absolute;z-index:2;left:0;right:0;top:var(--x3d-top);bottom:0;pointer-events:none}
  .explode__label{position:absolute;left:0;top:0;width:var(--x3d-col);opacity:0;will-change:transform,opacity}
  .explode__label[data-side=l]{grid-template-columns:minmax(0,1fr) 22px;text-align:right}
  .explode__label[data-side=l] .explode__n{grid-column:2}
  .explode__label[data-side=l] strong,.explode__label[data-side=l] > span:last-child{grid-column:1}
  .explode__label > span:last-child{color:rgba(246,245,248,.74)}
  /* Quelle bleibt für Screenreader im DOM, sichtbar sind die Kopien */
  .x3d .explode__list{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}

  /* Nicht live (Laden, Kontextverlust, .is-still): Standbild links, Prüfpunkte als Liste rechts daneben.
     Wechsel nur über Deckkraft/Sichtbarkeit, keine Positionsänderung (kein Layout-Shift). */
  .x3d .explode{--x3d-edge:max(28px,calc(50% - 572px))}   /* Kante des Seitenrasters (.wrap) */
  .x3d .explode__fallback{left:var(--x3d-edge);right:calc(var(--x3d-edge) + var(--x3d-col) + 56px)}
  .x3d .explode__pre{display:flex;position:absolute;z-index:2;top:var(--x3d-top);bottom:0;right:var(--x3d-edge);width:var(--x3d-col);
    flex-direction:column;justify-content:center;gap:clamp(10px,2.2vh,20px);pointer-events:none;opacity:1;visibility:visible;transition:opacity .4s ease}
  .x3d .explode__pre .explode__label{position:relative;width:auto;opacity:1;will-change:auto}
  .x3d .explode.is-live .explode__pre{opacity:0;visibility:hidden;transition:opacity .6s ease,visibility 0s linear .6s}
  .x3d .explode:not(.is-live) .explode__labels,.x3d .explode:not(.is-live) .explode__lines,.x3d .explode:not(.is-live) .explode__steps{visibility:hidden}
}
@media (min-width:861px) and (max-width:1100px){
  .explode{--x3d-col:180px}
  .explode__label strong{font-size:13.5px}
  .explode__label > span:last-child{font-size:12.5px}
}

/* ---------- Mobil/Tablet: Nummern am Modell, Bildunterschrift, Liste darunter ---------- */
@media (max-width:860px){
  .explode{--x3d-len:280vh}
  .x3d .explode__marker{display:flex}
  /* feste Höhe: Textwechsel verschiebt nichts (kein Layout-Shift) */
  .x3d .explode__caption{display:grid;position:absolute;z-index:3;left:20px;right:20px;bottom:16px;height:80px;padding:12px 14px;align-content:start;
    border-radius:13px;background:rgba(20,18,28,.78);border:1px solid rgba(46,204,143,.3);
    -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);opacity:0;transform:translateY(8px);transition:opacity .35s ease,transform .35s ease}
  .x3d .explode__caption.is-on{opacity:1;transform:none}
  .x3d .explode__caption strong{font-size:13.5px}
  .x3d .explode__caption > span:last-child{font-size:12.5px;line-height:1.4;color:rgba(246,245,248,.78);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
  /* Nummer: Tiefschwarz auf Grün Hell (Kontrast ca. 8,9:1) */
  .x3d .explode__n{font-size:11px;color:var(--carbon);background:var(--gruen-hell);border-color:var(--gruen-hell);background-image:none}
  .x3d .explode__list{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px;margin-top:22px}
  .x3d .explode__list li{grid-template-columns:20px minmax(0,1fr);column-gap:9px;row-gap:1px;padding:10px 11px;border-radius:12px}
  .x3d .explode__list .explode__n{width:20px;height:20px;font-size:10.5px}
  .x3d .explode__list strong{font-size:13px;line-height:1.3}
  .x3d .explode__list li > span:last-child{font-size:12px;line-height:1.45}
  /* Nicht live: keine Nummern am Modell, keine Bildunterschrift */
  .x3d .explode:not(.is-live) .explode__marker,.x3d .explode:not(.is-live) .explode__caption{display:none}
}
@supports (height:100svh){
  .explode{--x3d-len:300svh}
  @media (max-width:860px){.explode{--x3d-len:280svh}}
}

/* ---------- Weniger Bewegung: Endzustand statisch, Sektion nicht überhoch ---------- */
@media (prefers-reduced-motion:reduce){
  .x3d .explode__track{height:auto}
  .x3d .explode__stage{height:auto;padding-top:0;--x3d-top:0px}
  .x3d .explode__view{flex:none;height:clamp(420px,72vh,760px)}
  .x3d .explode__steps,.x3d .explode__caption{display:none}
  .x3d .explode__view canvas,.x3d .explode__fallback,.x3d .explode.is-live .explode__fallback,.x3d .explode__pre,.x3d .explode.is-live .explode__pre{transition:none}
}
@media (prefers-reduced-motion:reduce) and (max-width:860px){
  .x3d .explode__view{height:clamp(340px,110vw,560px)}
}
