/* =====================================================================
   Grimoire: Animationen (liegt über css/grimoire.css): Buch öffnen, Tinte, Glanz der Initialen, Abbildungen zeichnen,
   Codex-Kreise, Siegel brechen, Staub, Kerzenlicht. Alle aus bei html.reduce-motion bzw. prefers-reduced-motion (ganz unten).
   ===================================================================== */

/* ----- 1: Buch öffnet sich (Runde 5, überarbeitet) -----
   Ablauf in 1,7 s: das geschlossene Buch liegt mittig (nur die rechte Hälfte, sanft herabgesenkt) → der Einband hebt sich
   (Schatten wächst) und schwingt über den Falz → dabei gleitet das Buch an seinen Platz und gibt die linke Hälfte frei →
   ab der Mitte taucht der Einband UNTER die linke Seite (z-index), die linke Seite blendet weich ein → Licht beruhigt sich.
   Ein Ablauf für alles (gleiche Dauer und Kurve), damit Einband, Buch und Seite zusammenpassen. */
.tome-cover { display: none; }
/* Ohne Abschneiden: während des Öffnens zeichnet das Buch selbst keinen Einband. Rechts liegt der Buchrücken als eigene
   Fläche (::before, rechte Hälfte), links gibt es NUR die Innenseite des Einbands – so wächst links nichts nach. Am Ende
   liegt die Innenseite genau dort, wo das Buch seine linke Hälfte hat (Polster links = rechts = 24 px): kein Sprung. */
.tome.opening { animation: tome-unfold 1.7s var(--ease-out) both; }
/* linke Einbandhälfte: während des Öffnens unsichtbar (die Innenseite des Einbands liefert sie); sie erscheint in dem Moment,
   in dem die Innenseite gelandet ist (80 %), und liegt dann deckungsgleich darunter – kein Aufblinken am Ende */
.tome.opening::after { animation: left-half-in 1.7s linear both; }
/* Warten auf die Daten: Öffnen bei 0 % angehalten = geschlossenes Buch (js/grimoire.js openBookOnce) */
.tome.waiting, .tome.waiting::before, .tome.waiting::after,
.tome.waiting *, .tome.waiting *::before, .tome.waiting *::after { animation-play-state: paused !important; }
@keyframes left-half-in { 0%, 79% { opacity: 0; } 80%, 100% { opacity: 1; } }
@keyframes tome-unfold {
  0%   { transform: translate(-25%, -10px) scale(0.96); }
  18%  { transform: translate(-25%, 0) scale(1); }
  80%, 100% { transform: none; }
}
.tome.opening .tome-pages { box-shadow: none; }   /* gestapelte Papierkanten erst nach dem Öffnen … */
.tome-pages { transition: box-shadow 0.7s ease-out; }   /* … dann blenden sie weich ein (nur nach dem Öffnen, nicht beim Start) */
.tome.opening .tome-pages { transition: none; }
.tome.opening .tome-pages { perspective: 2200px; }
/* Einband = genau die rechte Hälfte des Buchs samt Lederrand (Polster des Buchs: 18/24/22/24 px), damit der geschlossene
   Band nur aus Einband besteht – kein zweiter Rand, keine Ecken des Buchs darüber */
.tome.opening .tome-cover {
  display: block; position: absolute; top: -18px; bottom: -22px; left: 50%; width: calc(50% + 24px); z-index: 6;
  transform-origin: left center; transform-style: preserve-3d; pointer-events: none;
  animation: cover-open 1.7s var(--ease-out) both;
}
@keyframes cover-open {
  0%, 18% { transform: rotateY(0); z-index: 6; }
  24%  { transform: rotateY(-8deg) translateZ(14px); z-index: 6; }
  54%  { z-index: 6; }
  55%  { z-index: 1; }
  80%, 100% { transform: rotateY(-180deg); z-index: 1; }
}
.cover-front, .cover-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  /* Leder und Goldlinien wie der Einband des Buchs (.tome in css/grimoire.css) */
  background:
    var(--paper-noise),
    radial-gradient(ellipse at 45% 20%, color-mix(in srgb, var(--leather-hi) 70%, transparent), transparent 70%),
    linear-gradient(160deg, var(--leather), var(--leather-2) 70%, var(--leather-lo));
  box-shadow:
    inset 0 0 0 5px color-mix(in srgb, var(--desk) 25%, transparent),
    inset 0 0 0 7px color-mix(in srgb, var(--gold) 55%, transparent),
    inset 0 0 0 9px color-mix(in srgb, var(--desk) 20%, transparent),
    inset 0 0 0 10px color-mix(in srgb, var(--gold) 30%, transparent);
}
.cover-front {
  display: grid; place-items: center; border-radius: 3px 18px 18px 3px;
  box-shadow:
    inset 0 0 0 5px color-mix(in srgb, var(--desk) 25%, transparent),
    inset 0 0 0 7px color-mix(in srgb, var(--gold) 55%, transparent),
    inset 0 0 0 9px color-mix(in srgb, var(--desk) 20%, transparent),
    inset 0 0 0 10px color-mix(in srgb, var(--gold) 30%, transparent),
    inset 22px 0 22px -14px color-mix(in srgb, var(--desk) 85%, transparent),   /* Rücken/Falz */
    0 8px 16px color-mix(in srgb, var(--desk) 60%, transparent);
  animation: cover-lift 1.7s var(--ease-out) both;
}
/* Goldecken im Einband: dieselben Beschläge wie am Buch (.tome-corner), sie klappen mit */
.tome-cover .tome-corner { z-index: 1; }
.tome-cover .tome-corner.tr, .tome-cover .tome-corner.br { border-top-left-radius: 18px; }
/* Licht streift über den Einband, während er sich hebt */
.cover-front::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--gold-hi) 30%, transparent) 50%, transparent 70%) -120% 0 / 220% 100% no-repeat;
  animation: cover-sheen 1.7s ease-in-out both;
}
@keyframes cover-sheen { 0%, 8% { background-position: 140% 0; } 30%, 100% { background-position: -60% 0; } }
@keyframes cover-lift {
  0%, 18% { filter: brightness(1); }
  40% { filter: brightness(1.15); }
  60%, 100% { filter: brightness(0.7); }
}
.cover-frame {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 42px;
  border: 2px solid color-mix(in srgb, var(--gold) 70%, transparent); outline: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); outline-offset: 6px;
}
.cover-sym { font-size: 3rem; color: var(--gold); text-shadow: 0 1px 0 var(--desk); }
.cover-title { font-family: var(--font-deco); font-size: 2.6rem; letter-spacing: 0.06em; color: var(--gold-hi); text-shadow: 0 2px 0 var(--desk); }
.cover-orn { font-size: 1.1rem; letter-spacing: 0.5em; color: color-mix(in srgb, var(--gold) 80%, transparent); }
/* Innenseite: liegt nach dem Aufklappen links unter der Seite – sieht dort aus wie die linke Hälfte des Buchs */
.cover-back { transform: rotateY(180deg); border-radius: 12px 3px 3px 12px; }

/* Teile des Buchs, die nicht mitklappen, während des Öffnens verstecken:
   rechte Goldecken erscheinen, sobald der Einband sie freigibt; linke liegen bis zum Schluss auf der Innenseite des Einbands;
   die Lesebändchen fallen erst nach dem Öffnen aus dem Buch (.just-opened) */
/* Rechte Goldecken: die echten liegen über allem im Buch und würden über den schwingenden Einband gemalt. Während des Öffnens
   sind sie aus; an ihrer Stelle liegen Kopien im Buchblock (.page-corner, gleiche Lage: Polster 18/24/22 px + 3 px Überstand)
   UNTER dem Einband (z 5 < 6). Am Ende wechseln sie ohne Sprung zu den echten. */
.tome.opening > .tome-corner.tr, .tome.opening > .tome-corner.br { opacity: 0; }
.page-corner { display: none; }
.tome.opening .page-corner { display: block; z-index: 5; }
.tome.opening .page-corner.tr { top: -21px; right: -27px; }
.tome.opening .page-corner.br { bottom: -25px; right: -27px; }
.tome.opening > .tome-corner.tl, .tome.opening > .tome-corner.bl { opacity: 0; }
.tome.opening .ribbons { opacity: 0; }
.tome.just-opened .ribbons { animation: ribbons-drop 0.7s var(--ease-pop) both; }
@keyframes ribbons-drop { from { opacity: 0; transform: translateY(-46px); } }
/* linke Seite: erst unsichtbar, taucht auf, sobald der Einband unter sie geschwungen ist */
.tome.opening .page-left { position: relative; z-index: 3; animation: open-reveal 1.7s ease-out both; }
@keyframes open-reveal { 0%, 74% { opacity: 0; } 86%, 100% { opacity: 1; } }   /* erst wenn die Innenseite gelandet ist */
/* rechte Seite: Schatten des Einbands zieht beim Aufklappen über sie weg */
.tome.opening .page-right::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, color-mix(in srgb, var(--desk) 65%, transparent), color-mix(in srgb, var(--desk) 25%, transparent));
  animation: cover-shadow 1.7s ease-in both;
}
@keyframes cover-shadow { 0%, 18% { opacity: 1; } 60%, 100% { opacity: 0; } }
/* während des Öffnens nichts Bewegtes im Buch (Staub und Licht erst danach) */
.tome.opening .candle-light { opacity: 0; animation: none; }

/* ----- 3: Tinte schreibt Titel und Initiale (bei jedem Umblättern und Sprung; js/grimoire.js afterRender) ----- */
.ink-in .chapter-title, .ink-in .lesson-title, .ink-in .tome-title {
  animation: ink-write 0.9s var(--ease-flight) both;
}
@keyframes ink-write {
  from { clip-path: inset(-20% 100% -20% 0); filter: blur(1.5px); opacity: 0.4; }
  70%  { filter: blur(0); opacity: 1; }
  to   { clip-path: inset(-20% 0 -20% 0); }
}
.ink-in .initial { animation: ink-drop 0.8s ease-out 0.3s both; }
@keyframes ink-drop {
  from { opacity: 0; transform: scale(0.85); filter: blur(2px) brightness(1.6); }
  60%  { opacity: 1; filter: blur(0) brightness(1.25); }
  to   { opacity: 1; transform: none; filter: none; }
}
.ink-in .chapter-kicker, .ink-in .fx-kind { animation: fade-in 0.6s ease-out both; }
/* ----- 4: Initiale als eigenes Element (js: fillPage umhüllt den ersten Buchstaben mit span.initial), weil Chrome
   ::first-letter nicht animiert. Aussehen wie bisher; darüber läuft ab und zu ein Lichtstreif übers Blattgold ----- */
.chapter-body p.lead.has-initial::first-letter {
  float: none; margin: 0; padding: 0; font: inherit; color: inherit; background: none; border: none; box-shadow: none;
}
.initial {
  float: left; position: relative; overflow: hidden; margin: 6px 10px 6px 0; padding: 4px 9px 2px;
  font-family: var(--font-deco); font-size: 3.4rem; line-height: 0.9; color: var(--seal-text);
  background: var(--wax);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px var(--parch), 0 0 0 4px var(--gold-lo);
}
.lesson .initial { font-size: 2.7rem; padding: 3px 7px 1px; }
/* Lichtstreif: breiter, heller Schimmer quer über Buchstabe und Goldrahmen, alle 6 s (Versatz je Initiale über --glint) */
.initial::after {
  content: ""; position: absolute; inset: -20%; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, color-mix(in srgb, var(--gold-hi) 25%, transparent) 43%,
    color-mix(in srgb, var(--parch-hi) 85%, transparent) 50%, color-mix(in srgb, var(--gold-hi) 25%, transparent) 57%, transparent 65%);
  mix-blend-mode: screen; transform: translateX(-120%);
  animation: initial-glint 6s ease-in-out infinite; animation-delay: var(--glint, 1.2s);
}
@keyframes initial-glint {
  0%, 70% { transform: translateX(-120%); }
  88%, 100% { transform: translateX(120%); }
}
/* der Goldrahmen blitzt mit, wenn der Streif drüberläuft */
.initial { animation: initial-rim 6s ease-in-out infinite; animation-delay: var(--glint, 1.2s); }
@keyframes initial-rim {
  0%, 74%, 100% { border-color: var(--gold); }
  80% { border-color: var(--gold-hi); box-shadow: 0 0 0 3px var(--parch), 0 0 0 4px var(--gold), 0 0 12px color-mix(in srgb, var(--gold-hi) 70%, transparent); }
}
.ink-in .initial { animation: ink-drop 0.8s ease-out 0.3s both, initial-rim 6s ease-in-out 1.2s infinite; }

/* ----- 5: Abbildungen zeichnen sich ----- */
.plate-fig .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-line 1.1s ease-out 0.2s forwards; }
.fig-arrow.draw { animation-delay: 0.9s; animation-duration: 0.5s; }
.cycle-svg .fig-arrow.draw:nth-of-type(1) { animation-delay: 0.3s; }
.cycle-svg .fig-arrow.draw:nth-of-type(2) { animation-delay: 0.8s; }
.cycle-svg .fig-arrow.draw:nth-of-type(3) { animation-delay: 1.3s; }
.fig-step.draw { animation-duration: 1.8s; }
.chain li { animation: rise-in 0.4s ease-out both; --rise: -6px; }
.chain li:nth-child(1) { animation-delay: 0.15s; } .chain li:nth-child(2) { animation-delay: 0.3s; }
.chain li:nth-child(3) { animation-delay: 0.45s; } .chain li:nth-child(4) { animation-delay: 0.6s; }
.chain li:nth-child(5) { animation-delay: 0.75s; } .chain li:nth-child(6) { animation-delay: 0.9s; }
.chain::before { transform-origin: top; animation: grow-y 1s ease-out 0.1s both; }
.chain-result .chain-seal { animation: stamp-in 0.45s var(--ease-pop) 1.2s both; --stamp-rot: -20deg; --stamp-scale: 1.8; }
.fig-drop { transform-box: fill-box; transform-origin: center bottom; animation: drop-in 0.5s var(--ease-pop) both; }
.fig-drop-text { animation: fade-in 0.4s both; }
.fig-svg g:nth-of-type(1) > * { animation-delay: 0.3s; }
.fig-svg g:nth-of-type(2) > * { animation-delay: 0.6s; }
.fig-svg g:nth-of-type(3) > * { animation-delay: 0.9s; }
.fig-svg g:nth-of-type(4) > * { animation-delay: 1.2s; }
.fig-svg g:nth-of-type(5) > * { animation-delay: 1.5s; }
.fig-dot { animation: fade-in 0.5s ease-out 1s both; }
.cycle-st { animation: fade-in 0.5s ease-out both; }
.st-bazaar { animation-delay: 0.6s; } .st-lab { animation-delay: 1.1s; }
/* ----- 8: Codex-Kreise glimmen nacheinander auf ----- */
.rc:not(.unknown) .rc-ring.draw, .rc:not(.unknown) .rc-tri.draw {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw-line 0.9s ease-out forwards; animation-delay: calc(0.15s + var(--i, 0) * 0.25s);
}
.rc:not(.unknown) .rc-result { animation: rc-glow 1.4s ease-out both; animation-delay: calc(0.7s + var(--i, 0) * 0.25s); }
@keyframes rc-glow {
  0%   { box-shadow: 0 0 0 2px var(--gold), 0 0 0 transparent; opacity: 0.4; }
  40%  { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 26px color-mix(in srgb, var(--gold-hi) 90%, transparent); opacity: 1; }
  100% { box-shadow: 0 0 0 2px var(--gold), 0 0 14px color-mix(in srgb, var(--gold-hi) 55%, transparent); }
}

/* ----- 9: Siegel brechen auf (neu freigeschaltet seit dem letzten Besuch) ----- */
.toc-sym, .glyph-row .d-ability-icon { position: relative; }
.seal-break { position: absolute; inset: -6px; z-index: 3; pointer-events: none; }
.seal-half {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--wax);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold-hi) 45%, transparent), 0 2px 4px color-mix(in srgb, var(--desk) 50%, transparent);
  animation: 1.1s ease-in-out both;
}
.seal-half.l { clip-path: polygon(0 0, 55% 0, 42% 35%, 58% 60%, 45% 100%, 0 100%); animation-name: seal-l; }
.seal-half.r { clip-path: polygon(55% 0, 100% 0, 100% 100%, 45% 100%, 58% 60%, 42% 35%); animation-name: seal-r; }
@keyframes seal-l { 0%, 30% { transform: none; opacity: 1; } 100% { transform: translate(-16px, 18px) rotate(-35deg); opacity: 0; } }
@keyframes seal-r { 0%, 30% { transform: none; opacity: 1; } 100% { transform: translate(16px, 22px) rotate(30deg); opacity: 0; } }
.seal-crumb { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border-radius: 40%; background: var(--wine); opacity: 0; animation: 1.1s ease-out both; }
.seal-crumb.c1 { animation-name: crumb-1; } .seal-crumb.c2 { animation-name: crumb-2; } .seal-crumb.c3 { animation-name: crumb-3; }
@keyframes crumb-1 { 0%, 30% { opacity: 0; } 40% { opacity: 1; } 100% { transform: translate(-24px, 26px); opacity: 0; } }
@keyframes crumb-2 { 0%, 30% { opacity: 0; } 40% { opacity: 1; } 100% { transform: translate(20px, 30px); opacity: 0; } }
@keyframes crumb-3 { 0%, 30% { opacity: 0; } 40% { opacity: 1; } 100% { transform: translate(2px, 34px); opacity: 0; } }
.fresh-unlock { animation: fresh-glow 2.6s ease-out both; }
@keyframes fresh-glow { 0%, 45% { background-color: transparent; } 60% { background-color: color-mix(in srgb, var(--gold-hi) 28%, transparent); } 100% { background-color: transparent; } }

/* ----- 10: Staub im Licht und Kerzenflackern (stärker: mehr und hellere Körnchen, warmer Schein mit Flackern) ----- */
.grimoire-stage { position: relative; isolation: isolate; }
.dust { position: absolute; inset: -60px -2% 0; z-index: 7; pointer-events: none; overflow: hidden; }
.dust span {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--parch-hi), color-mix(in srgb, var(--gold-hi) 80%, transparent) 55%, transparent 75%);
  box-shadow: 0 0 5px 0.5px color-mix(in srgb, var(--gold-hi) 55%, transparent);
  animation-name: dust-drift, dust-twinkle; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite;
}
@keyframes dust-drift { from { transform: translate(0, 0); } 50% { transform: translate(calc(var(--dx) * -0.5), -170px); } to { transform: translate(var(--dx), -340px); } }
@keyframes dust-twinkle { 0%, 100% { opacity: 0.16; } 50% { opacity: 0.75; } }
/* Lichtkegel der Kerze auf dem Buch (oben links), flackert unregelmäßig */
.candle-light {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(ellipse 60% 55% at 32% 28%, color-mix(in srgb, var(--gold-hi) 38%, transparent), transparent 70%),
    radial-gradient(ellipse 120% 90% at 32% 28%, transparent 55%, color-mix(in srgb, var(--desk) 30%, transparent));
  mix-blend-mode: overlay; animation: candle 5.5s ease-in-out infinite;
}
/* warmer Kerzenschein über den ganzen Bildschirm (fest am Fenster, keine Kante – auch bei 1440p und größer);
   liegt als weiches Licht über allem (soft-light), Klicks gehen durch */
.candle-room {
  position: fixed; inset: 0; z-index: 4; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(ellipse 75vmax 65vmax at 40% 45%, color-mix(in srgb, var(--gold-hi) 42%, transparent), color-mix(in srgb, var(--gold-hi) 10%, transparent) 55%, transparent 100%);
  animation: candle 5.5s ease-in-out infinite reverse;
}
@keyframes candle {
  0%, 100% { opacity: 0.8; } 8% { opacity: 1; } 13% { opacity: 0.6; } 21% { opacity: 0.95; } 34% { opacity: 0.72; }
  41% { opacity: 1; } 47% { opacity: 0.66; } 60% { opacity: 0.9; } 68% { opacity: 0.58; } 79% { opacity: 1; } 90% { opacity: 0.74; }
}

/* ----- Alles aus bei reduzierten Animationen ----- */
html.reduce-motion .tome-cover, html.reduce-motion .dust, html.reduce-motion .candle-light, html.reduce-motion .candle-room, html.reduce-motion .seal-break { display: none !important; }
html.reduce-motion .initial, html.reduce-motion .initial::after { animation: none; }
html.reduce-motion .plate-fig .draw, html.reduce-motion .rc .draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
html.reduce-motion .chain li, html.reduce-motion .chain::before, html.reduce-motion .chain-seal, html.reduce-motion .fig-svg g > *,
html.reduce-motion .fig-dot, html.reduce-motion .cycle-st, html.reduce-motion .rc-result, html.reduce-motion .fresh-unlock { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .dust, .candle-light, .tome-cover { display: none !important; }
  .initial, .initial::after { animation: none; }
  .candle-room { display: none; }
  .plate-fig .draw, .rc .draw { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
}

/* Nur Testseite: Knopf zum Abspielen der Öffnen-Animation (am PC; am Handy gibt es die Animation nicht) */
.test-bar { display: flex; justify-content: flex-end; margin: -18px 0 10px; }
.test-bar button { font-size: 0.75rem; padding: 5px 12px; }
@media (max-width: 860px) { .test-bar { display: none; } }

/* Öffnen: Überschriften und Initialen bleiben unsichtbar, bis ihre Seite frei wird – dann schreibt die Tinte (js setzt .ink-in) */
.ink-wait .chapter-title, .ink-wait .lesson-title, .ink-wait .tome-title, .ink-wait .initial, .ink-wait .chapter-kicker, .ink-wait .fx-kind { opacity: 0; }
/* Blätterpfeile erscheinen erst mit der linken Seite (sonst schwebt der linke Pfeil neben dem geschlossenen Buch) */
.tome.opening .turn-arrow { animation: open-reveal 1.7s ease-out both; }

/* ===== Aufbrechen beim ersten Besuch nach dem Öffnen – an Ort und Stelle, nichts springt =====
   Versiegelter und offener Eintrag liegen übereinander in .unseal-stack (gleiche Rasterzelle, Titel an derselben Stelle).
   js: .wax-piece.l/.r + .unseal-crack + Krümel ins Siegel, jede Schnur als .cut-l/.cut-r doppelt, dann .breaking; nach 2 s bleibt nur der offene.
   Ablauf: Siegel zittert (0–0,5 s) → Goldriss, die Stücke fallen, Schnur schnurrt von der Mitte nach außen zurück
   → Blindtext und blasser Titel verblassen, der offene Eintrag kommt darunter hervor (Titel dunkelt dabei nach). */
.unseal-stack { display: grid; }
.unseal-stack > * { grid-area: 1 / 1; min-width: 0; }
.unseal-stack.full { flex: 1; }
.unseal-stack:not(.breaking):not(.done) > :not(.sealed-entry) { visibility: hidden; }
.unseal-stack.breaking > :not(.sealed-entry) { animation: unseal-open 2s ease-out both; }
@keyframes unseal-open { 0%, 38% { opacity: 0; } 85%, 100% { opacity: 1; } }
.unseal-stack.breaking .sealed-entry { pointer-events: none; z-index: 1; }
.breaking .sealed-entry > :not(.sealed-veil), .breaking .sealed-veil > :not(.wax-lock):not(.sealed-cord) { animation: unseal-fade 2s ease-in both; }
@keyframes unseal-fade { 0%, 30% { opacity: 1; } 72%, 100% { opacity: 0; } }

/* Siegel: das Wachs selbst wird zu zwei Stücken an genau seinem Platz */
.breaking .wax-lock { background: none; box-shadow: none; animation: unseal-shake 0.5s ease-in-out both; }
.breaking .wax-lock > .seal-keyhole, .breaking .wax-lock.lg::after { visibility: hidden; }
@keyframes unseal-shake {
  0% { transform: rotate(-8deg); } 15% { transform: rotate(-13deg) translateX(-1px); } 32% { transform: rotate(-3deg) translateX(1px); }
  50% { transform: rotate(-12deg); } 70% { transform: rotate(-5deg); } 100% { transform: rotate(-8deg); }
}
.wax-piece {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
  background: var(--wax); box-shadow: var(--wax-shadow);
  animation: 2s ease-in both;
}
.wax-piece.l { clip-path: polygon(0 0, 55% 0, 42% 35%, 58% 60%, 45% 100%, 0 100%); animation-name: piece-l; }
.wax-piece.r { clip-path: polygon(55% 0, 100% 0, 100% 100%, 45% 100%, 58% 60%, 42% 35%); animation-name: piece-r; }
@keyframes piece-l { 0%, 27% { transform: none; opacity: 1; } 45% { transform: translate(-6px, 2px) rotate(-12deg); } 70% { opacity: 1; } 100% { transform: translate(-30px, 56px) rotate(-60deg); opacity: 0; } }
@keyframes piece-r { 0%, 27% { transform: none; opacity: 1; } 45% { transform: translate(6px, 3px) rotate(10deg); } 70% { opacity: 1; } 100% { transform: translate(28px, 62px) rotate(45deg); opacity: 0; } }
.unseal-crack {   /* Goldriss im Moment des Bruchs */
  position: absolute; left: 50%; top: 8%; bottom: 8%; width: 3px; margin-left: -1.5px; z-index: 2; border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--gold-hi), transparent); box-shadow: 0 0 10px var(--gold-hi);
  transform: scaleY(0); opacity: 0; animation: unseal-crack 2s ease-out both;
}
@keyframes unseal-crack { 0%, 22% { transform: scaleY(0); opacity: 0; } 28% { transform: scaleY(1); opacity: 1; } 42%, 100% { transform: scaleY(1); opacity: 0; } }
.wax-lock .seal-crumb { z-index: 2; animation-duration: 2s; }
.wax-lock .seal-crumb.c4 { animation-name: crumb-4; } .wax-lock .seal-crumb.c5 { animation-name: crumb-5; }
@keyframes crumb-4 { 0%, 28% { opacity: 0; } 36% { opacity: 1; } 100% { transform: translate(-40px, 44px); opacity: 0; } }
@keyframes crumb-5 { 0%, 28% { opacity: 0; } 36% { opacity: 1; } 100% { transform: translate(36px, 48px); opacity: 0; } }

/* Schnur: gleiche Lage wie vorher, jede Hälfte schnurrt von der Mitte nach außen zurück */
.breaking .sealed-cord.cut-l { animation: cut-l 2s ease-in both; }
.breaking .sealed-cord.cut-r { animation: cut-r 2s ease-in both; }
@keyframes cut-l { 0%, 27% { clip-path: inset(-6px 50% -6px 0); opacity: 1; } 60% { clip-path: inset(-6px 92% -6px 0); opacity: 0.8; } 100% { clip-path: inset(-6px 100% -6px 0); opacity: 0; } }
@keyframes cut-r { 0%, 27% { clip-path: inset(-6px 0 -6px 50%); opacity: 1; } 60% { clip-path: inset(-6px 0 -6px 92%); opacity: 0.8; } 100% { clip-path: inset(-6px 0 -6px 100%); opacity: 0; } }

/* reduzierte Bewegung: js tauscht sofort, ohne Animation */
html.reduce-motion .sealed-entry:hover .wax-lock { animation: none; }
@media (prefers-reduced-motion: reduce) { .sealed-entry:hover .wax-lock { animation: none; } }
