/* ================================================================
   v5-envelope.css — Version 5 polish layer
   ================================================================
   Loaded LAST (after v4.css) so these rules win the cascade.

   V5 CHANGES — "REAL OPEN + BUTTERFLY FAREWELL":
   1. Envelope opening is now physically correct:
      • Dual-face 3D flap (outer paper front + crimson-gold liner
        back) so the opened flap shows its real inner liner.
      • Flap z-layer switches to the BACK exactly mid-rotation
        (0.5s), so the rising letter never slides behind the flap.
      • Heading / hint text sit ABOVE the folding flap, so the flap
        folds behind the "You are Invited" writing like a real
        envelope opening away from the reader.
      • Gloss sheen lowered under the letter (no glass-over-paper).
   2. Wax seal now CRACKS: a pulse → jagged split → two wax halves
      tumble away with gold shard particles.
   3. Letter slides out through the pocket V (pocket occludes it
      while inside — real envelope physics), with a gentle sway.
   4. THE BUTTERFLY: after the letter leaves, the empty envelope
      folds into a gold-ivory butterfly (morph flash + gold dust),
      the wings unfurl, and it flutters away off the top-right of
      the page leaving a sparkle trail. Then the reveal continues.
   ================================================================ */


/* ================================================================
   0. TEXT LAYER — writing sits ABOVE the folding flap
   ================================================================ */
.inv-eyebrow,
.inv-heading,
.inv-heart-divider,
.inv-hint {
    position: relative;
    z-index: 6;
}

/* Gloss sheen was z8 (above the letter) → drop it under the letter
   but keep it over the closed pocket (pocket z3, letter z2). */
.envelope::before {
    z-index: 4;
}


/* ================================================================
   1. ENVELOPE — realism pass (idle float, paper grain)
   ================================================================ */
.envelope {
    animation: envIdleFloat 4.8s ease-in-out 1.6s infinite;
}

@keyframes envIdleFloat {
    0%, 100% { transform: translateY(0)     rotate(0deg); }
    50%      { transform: translateY(-6px)  rotate(-0.4deg); }
}

/* Stop floating as soon as the opening begins */
.invitation-stage.is-opening .envelope {
    animation: none;
}

/* Fine paper tooth on the back panel */
.env-back::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background-image: radial-gradient(rgba(160, 140, 95, 0.07) 1px, transparent 1px);
    background-size: 6px 6px;
    pointer-events: none;
}


/* ================================================================
   2. THE FLAP — dual-face 3D (outer + liner), correct layering
   ================================================================ */
.env-flap {
    z-index: 6;
    transform: rotateX(0deg);
    transform-style: preserve-3d;
    /* z-layer steps to the back exactly MID-rotation (0.5s), so the
       open flap is behind the envelope before the letter rises */
    transition:
        transform 1.05s cubic-bezier(0.68, -0.02, 0.32, 1.02),
        z-index 0s linear 0.5s;
    background: none;
}

/* Neutralise the V4 opening rule — rotation is driven by .flap-open */
.invitation-stage.is-opening .env-flap {
    transform: rotateX(0deg);
    z-index: 6;
}

.invitation-stage.flap-open .env-flap {
    transform: rotateX(180deg);
    z-index: 0;
}

/* Kill the V4 sheen pseudo on the flap parent — it would otherwise
   render mirrored over the liner once the flap flips. */
.env-flap::before {
    content: none !important;
}

/* ---- The two faces of the flap ----
   NO backface-visibility here: Chromium's flattened 3D context
   (ancestor filter) culls BOTH faces once the flap flips past 90°,
   making the opened flap invisible. The visible-side switch is done
   purely with the synced opacity crossfade below (front hides at
   mid-turn, liner shows — physically identical, works everywhere). */
.env-flap-face {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

/* Outer face — front paper with embossed edge + grain.
   Hides exactly at mid-rotation once .flap-open is set. */
.env-flap-front {
    background: linear-gradient(180deg, #f6eed9 0%, #f0e4c6 62%, #ecdfc0 100%);
    box-shadow:
        inset 0 0 0 1px rgba(228, 217, 188, 0.9),
        inset 0 -14px 22px rgba(160, 138, 90, 0.14);
    transition: opacity 0s linear 0.5s;
}

.invitation-stage.flap-open .env-flap-front {
    opacity: 0;
}

.env-flap-front::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    background-image: radial-gradient(rgba(160, 140, 95, 0.08) 1px, transparent 1px);
    background-size: 6px 6px;
}

.env-flap-front::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, transparent 42%);
}

/* Inner face — rich crimson-gold envelope liner (visible when open).
   Pre-rotated 180° so it faces the reader after the flip. The double
   flip (own + parent) mirrors the shape, so this face carries an
   INVERTED clip triangle: base at its bottom edge (which lands on the
   fold line) and apex at its top (the free tip of the opened flap). */
.env-flap-back {
    transform: rotateX(180deg);
    opacity: 0;
    clip-path: polygon(0 100%, 100% 100%, 50% 0);
    border-radius: 0 0 12px 12px;
    background:
        repeating-linear-gradient(45deg,
            rgba(240, 201, 110, 0.20) 0 9px,
            rgba(240, 201, 110, 0.05) 9px 13px,
            transparent 13px 24px),
        linear-gradient(180deg, #8a1126 0%, #6b0e1c 55%, #52091a 100%);
    box-shadow:
        inset 0 0 0 1px rgba(240, 201, 110, 0.28),
        inset 0 10px 24px rgba(30, 0, 8, 0.45);
    transition: opacity 0s linear 0.5s;
}

.invitation-stage.flap-open .env-flap-back {
    opacity: 1;
}


/* ================================================================
   3. WAX SEAL — press-in, pulse, jagged CRACK, halves tumble
   ================================================================ */
.env-seal {
    z-index: 7;
    /* container only — the two halves carry the wax look */
    background: none;
    box-shadow: none;
    transition: none;
    animation: sealPress 0.7s var(--ease-spring, ease) 1.15s both;
}

/* Remove the V4 "fade seal on is-opening" behaviour */
.invitation-stage.is-opening .env-seal {
    animation: sealResist 0.42s ease-in-out both;
    opacity: 1;
    transform: translate(-50%, -58%) scale(1);
    transition: none;
}

@keyframes sealResist {
    0%   { transform: translate(-50%, -58%) scale(1); }
    45%  { transform: translate(-50%, -58%) scale(1.14); }
    100% { transform: translate(-50%, -58%) scale(1.04); }
}

/* ---- The two cracked halves ---- */
.seal-half {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 30%, #d4536a 0%, #a8162a 45%, #7c0e1e 78%, #5f0a16 100%);
    box-shadow:
        inset 0 0 0 3px rgba(255, 226, 168, 0.35),
        inset 0 -6px 12px rgba(40, 0, 8, 0.5),
        inset 0 5px 10px rgba(255, 255, 255, 0.18),
        0 8px 18px rgba(90, 10, 24, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    backface-visibility: hidden;
}

/* dashed wax rim on each half */
.seal-half::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 1.5px dashed rgba(246, 223, 164, 0.5);
}

/* jagged crack edges — complementary zig-zags */
.seal-half.seal-left {
    clip-path: polygon(0 0, 56% 0, 46% 16%, 57% 33%, 45% 51%, 56% 69%, 46% 85%, 54% 100%, 0 100%);
}
.seal-half.seal-right {
    clip-path: polygon(56% 0, 100% 0, 100% 100%, 54% 100%, 46% 85%, 56% 69%, 45% 51%, 57% 33%, 46% 16%);
    animation-delay: 0.05s;
}

/* keep the monogram styling from the base layer (.env-seal span / i) */

/* ---- The break: halves tumble away with gravity ---- */
.invitation-stage.seal-split .env-seal {
    animation: none;
    transform: translate(-50%, -58%) scale(1.04);
}

/* crack flash — bright glint along the split */
.invitation-stage.seal-split .env-seal::before {
    content: '';
    position: absolute;
    inset: -14px;
    background: radial-gradient(circle, rgba(255, 240, 200, 0.95) 0%, rgba(240, 201, 110, 0.55) 30%, transparent 68%);
    animation: sealFlash 0.5s ease-out forwards;
    pointer-events: none;
}

@keyframes sealFlash {
    0%   { opacity: 0; transform: scale(0.4); }
    25%  { opacity: 1; }
    100% { opacity: 0; transform: scale(1.7); }
}

.invitation-stage.seal-split .seal-half.seal-left {
    animation: sealFallL 0.9s cubic-bezier(0.36, 0.62, 0.42, 1) 0.04s forwards;
}
.invitation-stage.seal-split .seal-half.seal-right {
    animation: sealFallR 0.9s cubic-bezier(0.36, 0.62, 0.42, 1) 0.09s forwards;
}

@keyframes sealFallL {
    0%   { transform: translate(0, 0) rotate(0deg);        opacity: 1; }
    100% { transform: translate(-34px, 52px) rotate(-30deg); opacity: 0; }
}
@keyframes sealFallR {
    0%   { transform: translate(0, 0) rotate(0deg);        opacity: 1; }
    100% { transform: translate(32px, 58px) rotate(26deg);  opacity: 0; }
}


/* ================================================================
   4. THE LETTER — slides out through the pocket V, gentle sway
   ================================================================ */
/* Letter stays UNDER the pocket (z2 < z3) while inside: the pocket
   occludes it exactly like a real envelope. It is already ABOVE the
   opened flap (z0), so it can never pass behind the flap again. */

.invitation-stage.letter-out .env-card {
    z-index: 2;
    animation: envLetterOut 1.18s cubic-bezier(0.24, 0.9, 0.32, 1) forwards;
}

@keyframes envLetterOut {
    0%   { transform: translateY(9%) rotate(0deg) scale(1); }
    58%  { transform: translateY(-46%) rotate(-1.8deg) scale(1.015); }
    80%  { transform: translateY(-80%) rotate(0.9deg) scale(1.03); }
    100% { transform: translateY(-94%) rotate(0deg) scale(1.05); }
}

/* As the reveal card appears, the letter drifts up & dissolves */
.invitation-stage.is-revealed .env-card {
    animation: envLetterDrift 0.9s var(--ease-smooth, ease) forwards;
}

@keyframes envLetterDrift {
    0%   { transform: translateY(-94%) rotate(0deg) scale(1.05); opacity: 1; }
    100% { transform: translateY(-118%) rotate(0deg) scale(1.12); opacity: 0; }
}


/* ================================================================
   5. REVEAL SEQUENCING — keep the envelope visible until the morph
   ================================================================ */
/* V4 faded the whole .inv-content (envelope included) — now we fade
   only the text + button, and let the morph choreograph the rest.
   NOTE: `animation: none` is required because the entrance keyframes
   use fill-mode: both, which would otherwise pin opacity at 1 and
   defeat the fade below. */
.invitation-stage.is-revealed .inv-content {
    opacity: 1;
    transform: none;
}

.invitation-stage.is-revealed .inv-eyebrow,
.invitation-stage.is-revealed .inv-heading,
.invitation-stage.is-revealed .inv-heart-divider,
.invitation-stage.is-revealed .inv-hint,
.invitation-stage.is-revealed .inv-open-btn {
    animation: none;
    opacity: 0;
    transform: translateY(-3vh) scale(0.97);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
}

/* As the letter rises, the page text gracefully steps aside —
   attention moves from the heading to the letter itself. */
.invitation-stage.letter-out .inv-eyebrow,
.invitation-stage.letter-out .inv-heading,
.invitation-stage.letter-out .inv-heart-divider,
.invitation-stage.letter-out .inv-hint {
    animation: none;
    opacity: 0;
    transform: translateY(-2.5vh) scale(0.98);
    transition: opacity 0.55s ease, transform 0.55s ease;
    pointer-events: none;
}

.invitation-stage.is-revealed .envelope-scene {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: none;
}

/* Reveal card rises from the letter's direction into center */
.inv-reveal {
    transform: scale(0.85) translateY(5vh);
    transition: opacity 0.8s ease, transform 0.95s var(--ease-smooth, ease);
}

.invitation-stage.is-revealed .inv-reveal {
    transform: scale(1) translateY(0);
}

/* Hide the float cue shadow once anything starts */
.invitation-stage.is-opening .envelope-scene::after,
.invitation-stage.seal-split .envelope-scene::after {
    animation: none;
    opacity: 0;
}


/* ================================================================
   6. ENVELOPE → BUTTERFLY MORPH
   ================================================================ */

/* ---- The butterfly (direct child of the stage, above reveal) ---- */
.inv-butterfly {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 9;
    width: clamp(96px, 20vw, 148px);
    aspect-ratio: 1.55 / 1;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.15);
    will-change: transform, opacity;
}

/* soft golden aura */
.inv-butterfly::before {
    content: '';
    position: absolute;
    inset: -34%;
    background: radial-gradient(circle, rgba(240, 201, 110, 0.4) 0%, rgba(240, 201, 110, 0.12) 42%, transparent 70%);
    animation: bflyAura 1.6s ease-in-out infinite alternate;
}

@keyframes bflyAura {
    from { opacity: 0.55; transform: scale(0.92); }
    to   { opacity: 1;    transform: scale(1.08); }
}

.bfly-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    perspective: 620px;
}

/* ---- Wing pairs — fold at the body axis, flap in 3D ---- */
.bfly-wingpair {
    position: absolute;
    top: 4%;
    bottom: 4%;
    width: 46%;
    transform-style: preserve-3d;
    transform: rotateY(78deg);              /* folded, pre-unfurl */
    will-change: transform;
}

.bfly-left {
    right: 50%;
    transform-origin: right center;
    animation: bflyFlapL 0.34s ease-in-out infinite alternate;
}

.bfly-right {
    left: 50%;
    transform-origin: left center;
    animation: bflyFlapR 0.34s ease-in-out infinite alternate;
}

@keyframes bflyFlapL {
    from { transform: rotateY(16deg); }
    to   { transform: rotateY(74deg); }
}
@keyframes bflyFlapR {
    from { transform: rotateY(-16deg); }
    to   { transform: rotateY(-74deg); }
}

/* ---- Wing shapes (forewing + hindwing) ---- */
.bfly-fore,
.bfly-hind {
    position: absolute;
    pointer-events: none;
}

.bfly-fore {
    top: 0;
    left: 0;
    width: 100%;
    height: 64%;
    border-radius: 88% 18% 22% 64% / 96% 30% 26% 58%;
    background:
        radial-gradient(circle at 30% 72%, rgba(168, 22, 42, 0.5) 0%, transparent 34%),
        linear-gradient(135deg, #fdf9ec 0%, #f4e8c8 46%, #e6d3a2 78%, #d8bf85 100%);
    box-shadow:
        inset 0 0 0 1.5px rgba(180, 154, 94, 0.55),
        inset 4px 6px 12px rgba(255, 255, 255, 0.65),
        0 3px 10px rgba(84, 66, 30, 0.22);
}

/* gold vein */
.bfly-fore::before {
    content: '';
    position: absolute;
    left: 12%;
    bottom: 10%;
    width: 62%;
    height: 1.5px;
    background: linear-gradient(90deg, rgba(180, 154, 94, 0.85), transparent);
    transform: rotate(28deg);
    border-radius: 2px;
}

/* tiny heart on each forewing */
.bfly-fore::after {
    content: '♥';
    position: absolute;
    right: 16%;
    top: 26%;
    font-size: clamp(8px, 1.4vw, 12px);
    color: #a8162a;
    opacity: 0.85;
    text-shadow: 0 1px 2px rgba(120, 10, 26, 0.4);
}

.bfly-hind {
    bottom: 0;
    left: 7%;
    width: 76%;
    height: 48%;
    border-radius: 24% 60% 70% 26% / 34% 62% 74% 40%;
    background: linear-gradient(150deg, #faf3de 0%, #eedfb4 55%, #dcc48c 100%);
    box-shadow:
        inset 0 0 0 1.2px rgba(180, 154, 94, 0.5),
        inset 3px 4px 9px rgba(255, 255, 255, 0.55),
        0 2px 8px rgba(84, 66, 30, 0.18);
}

.bfly-hind::before {
    content: '';
    position: absolute;
    left: 16%;
    top: 22%;
    width: 54%;
    height: 1.2px;
    background: linear-gradient(90deg, rgba(180, 154, 94, 0.7), transparent);
    transform: rotate(-22deg);
}

/* ---- Body + head + antennae ---- */
.bfly-body {
    position: absolute;
    left: 46.75%;
    top: 22%;
    width: 6.5%;
    height: 56%;
    border-radius: 46% 46% 50% 50% / 30% 30% 72% 72%;
    background: linear-gradient(90deg, #4d0813 0%, #7c1020 45%, #3c050e 100%);
    box-shadow:
        inset 0 2px 3px rgba(240, 201, 110, 0.45),
        0 2px 6px rgba(30, 0, 8, 0.4);
    z-index: 2;
}

.bfly-body::before {
    content: '';
    position: absolute;
    top: -22%;
    left: 8%;
    width: 84%;
    height: 26%;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 32%, #8a1126, #3c050e 78%);
}

.bfly-body::after {
    content: '';
    position: absolute;
    top: -46%;
    left: 30%;
    width: 1.4px;
    height: 34%;
    background: linear-gradient(180deg, transparent 0%, rgba(90, 60, 20, 0) 0%, #6b4a1e 55%);
    border-radius: 2px;
    box-shadow:
        -4px -1px 0 -0.2px #6b4a1e,
        4px 1px 0 -0.2px #6b4a1e;
    transform: rotate(0deg);
    opacity: 0.9;
}

/* ---- Unfurl: butterfly emerges as the envelope folds away ---- */
.invitation-stage.bfly-morph .inv-butterfly {
    opacity: 1;
    animation: bflyUnfurl 0.62s var(--ease-spring, ease) 0.08s forwards;
}

@keyframes bflyUnfurl {
    0%   { transform: translate(-50%, -50%) scale(0.15); opacity: 0; }
    55%  { transform: translate(-50%, -50%) scale(1.1);  opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}

/* wings spring open the moment the morph starts */
.invitation-stage.bfly-morph .bfly-wingpair {
    animation-duration: 0.3s;
}

/* ---- The envelope folds into the butterfly ---- */
.invitation-stage.bfly-morph .envelope {
    animation: envToButterfly 0.68s cubic-bezier(0.5, 0, 0.3, 1) forwards;
}

@keyframes envToButterfly {
    0%   { transform: scale(1) translateY(0);      opacity: 1; }
    34%  { transform: scale(0.93) translateY(3px); opacity: 1; }
    100% { transform: scale(0.18) translateY(2.5vh); opacity: 0; }
}

/* a tiny paper-crumple jiggle before the fold */
.invitation-stage.bfly-morph .envelope-scene {
    animation: envCrumple 0.3s ease-out 0.05s;
}

@keyframes envCrumple {
    0%   { transform: rotate(0deg); }
    30%  { transform: rotate(-1.6deg); }
    65%  { transform: rotate(1.2deg); }
    100% { transform: rotate(0deg); }
}


/* ================================================================
   7. FLIGHT — swooping path off the top-right, banking turns
   ================================================================ */
.invitation-stage.bfly-fly .inv-butterfly {
    animation: bflyFlyPath 2.75s cubic-bezier(0.42, 0.02, 0.58, 0.98) forwards;
}

@keyframes bflyFlyPath {
    0%   { transform: translate(-50%, -50%) translate3d(0, 0, 0)          rotate(0deg)    scale(1); }
    14%  { transform: translate(-50%, -50%) translate3d(-5vw, -9vh, 0)    rotate(-15deg)  scale(0.97); }
    32%  { transform: translate(-50%, -50%) translate3d(4vw, -19vh, 0)    rotate(11deg)   scale(0.88); }
    52%  { transform: translate(-50%, -50%) translate3d(-3vw, -30vh, 0)   rotate(-9deg)   scale(0.78); }
    74%  { transform: translate(-50%, -50%) translate3d(17vw, -52vh, 0)   rotate(13deg)   scale(0.62); }
    100% { transform: translate(-50%, -50%) translate3d(58vw, -98vh, 0)   rotate(19deg)   scale(0.36); }
}

/* faster wingbeats while flying */
.invitation-stage.bfly-fly .bfly-wingpair {
    animation-duration: 0.24s;
}

/* organic bobbing nested inside the flight path */
.invitation-stage.bfly-morph .bfly-inner {
    animation: bflyBob 0.5s ease-in-out infinite alternate;
}

@keyframes bflyBob {
    from { transform: translateY(-3px) rotate(-2deg); }
    to   { transform: translateY(3px)  rotate(2deg); }
}


/* ================================================================
   8. FX PARTICLES — seal shards, morph dust, sparkle trail
   ================================================================ */
.fx-particle {
    position: absolute;
    z-index: 8;
    pointer-events: none;
    will-change: transform, opacity;
}

/* broken wax shards + one gold flash ring */
.fx-shard {
    width: 9px;
    height: 9px;
    margin: -4.5px;
    border-radius: 3px 6px 3px 6px;
    background: var(--clr, #a8162a);
    box-shadow: 0 1px 4px rgba(40, 0, 8, 0.35), inset 0 1px 1px rgba(255, 226, 168, 0.4);
    animation: fxTumble 0.9s cubic-bezier(0.3, 0.55, 0.4, 1) forwards;
}

.fx-shard.gold {
    width: 6px;
    height: 6px;
    margin: -3px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #ffe9ad, #c9943a 70%);
    box-shadow: 0 0 6px rgba(240, 201, 110, 0.7);
}

@keyframes fxTumble {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translate3d(var(--dx, 0px), var(--dy, 40px), 0) rotate(var(--rot, 90deg)) scale(0.35); opacity: 0; }
}

.fx-flash {
    width: 22px;
    height: 22px;
    margin: -11px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 244, 214, 0.95) 0%, rgba(240, 201, 110, 0.6) 34%, transparent 70%);
    animation: fxFlash 0.55s ease-out forwards;
}

@keyframes fxFlash {
    0%   { transform: scale(0.35); opacity: 0; }
    22%  { opacity: 1; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* gold dust at the envelope→butterfly morph */
.fx-dust {
    width: 7px;
    height: 7px;
    margin: -3.5px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 32%, #fff3cf 0%, #e9be5f 58%, rgba(201, 148, 58, 0.1) 100%);
    box-shadow: 0 0 8px rgba(240, 201, 110, 0.75);
    animation: fxDust 1.05s ease-out forwards;
}

@keyframes fxDust {
    0%   { transform: translate3d(0, 0, 0) scale(0.4); opacity: 1; }
    70%  { opacity: 0.85; }
    100% { transform: translate3d(var(--dx, 0px), var(--dy, -40px), 0) scale(1.05); opacity: 0; }
}

/* sparkle trail left by the flying butterfly */
.fx-spark {
    width: 8px;
    height: 8px;
    margin: -4px;
    border-radius: 50%;
    background: radial-gradient(circle at 36% 32%, #fff8e0 0%, #f0c96e 55%, rgba(201, 148, 58, 0.12) 100%);
    box-shadow: 0 0 9px rgba(240, 201, 110, 0.85), 0 0 3px rgba(255, 244, 214, 0.9);
    animation: fxSpark 0.72s ease-out forwards;
}

.fx-spark.star {
    width: 11px;
    height: 11px;
    margin: -5.5px;
    border-radius: 50% 0 50% 50%;
    background: linear-gradient(135deg, #fff6d8 0%, #e9be5f 100%);
    transform: rotate(14deg);
}

@keyframes fxSpark {
    0%   { transform: scale(0.25) rotate(0deg);            opacity: 0.95; }
    55%  { transform: scale(1.1)  rotate(40deg);           opacity: 0.75; }
    100% { transform: scale(0.2)  translate3d(2px, -16px, 0) rotate(80deg); opacity: 0; }
}


/* ================================================================
   9. RESPONSIVE
   ================================================================ */
@media (max-height: 760px) {
    .inv-butterfly { width: clamp(84px, 17vw, 124px); }
}

@media (max-width: 480px) {
    .inv-butterfly { width: clamp(78px, 24vw, 110px); }
    .bfly-fore::after { font-size: 8px; }
}


/* ================================================================
   10. REDUCED MOTION — calm, instant, no butterfly flight
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .inv-butterfly,
    .fx-particle {
        display: none !important;
    }

    .invitation-stage.flap-open .env-flap { transition-duration: 0.3s !important; }
    .invitation-stage.letter-out .env-card { animation-duration: 0.3s !important; }
    .invitation-stage.bfly-morph .envelope { animation-duration: 0.3s !important; }
    .invitation-stage.bfly-morph .bfly-inner { animation: none !important; }
    .envelope { animation: none !important; }
}
