/* ================================================================
   v6-butterfly.css — Version 6 layer — "REAL BUTTERFLY FAREWELL"
   ================================================================
   Loaded LAST (after v5-envelope.css) so these rules win.

   V6 CHANGES:
   1. THE BUTTERFLY IS NOW A REAL MONARCH — a hand-drawn SVG asset
      (assets/butterfly.svg) with its own wingbeat physics inside:
      fast power downstroke / slower recovery, hindwings lagging the
      forewings, body pitch, antenna sway. This file drives the
      container: liftoff hover → wandering flight with two hover
      pauses, banking into every turn, depth scaling, exit top-right.
   2. SEQUENCE REORDERED — the butterfly now flies FIRST and the
      grand-reveal message appears only AFTER the flight completes
      (envelope → butterfly → flight → message reveal → website).
   3. THE LETTER dissolves into the morph flash (it no longer waits
      on screen during the flight).
   4. MODERN MESSAGE REVEAL — cinematic blur-rise: the card sharpens
      out of a blur, every line staggers up with a blur→sharp settle,
      the couple's names tighten their letter-spacing, a gold shimmer
      sweeps the card once, a soft bloom glows behind it, and a
      discreet "tap to continue" hint breathes at the bottom.
   ================================================================ */


/* ================================================================
   1. THE BUTTERFLY — monarch SVG (assets/butterfly.svg)
   ================================================================ */
/* v5 sized the CSS-drawn butterfly 1.55/1 — the monarch is 420/340.
   v5's aura ::before (soft gold glow) is kept — it reads beautifully
   behind the real wings. */
.inv-butterfly {
    aspect-ratio: 420 / 340;
    width: clamp(118px, 23vw, 172px);
    perspective: 720px;               /* gives .bfly-bank true 3D tilt */
}

/* banking wrapper — tilts into every turn of the flight path */
.bfly-bank {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    will-change: transform;
}

/* gentle whole-body float (on top of the SVG's internal body pitch) */
.bfly-bob6 {
    position: absolute;
    inset: 0;
    animation: bflyFloat6 0.52s ease-in-out infinite alternate;
}

@keyframes bflyFloat6 {
    from { transform: translateY(-2.2px) rotate(-1.2deg); }
    to   { transform: translateY(2.2px)  rotate(1.2deg); }
}

/* the monarch itself */
.bfly-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 16px rgba(30, 6, 0, 0.30));
}


/* ================================================================
   2. THE LETTER — dissolves into the morph (no longer waits)
   ================================================================ */
/* v5 kept the risen letter on screen until is-revealed; in V6 the
   flight comes first, so the letter melts away with the envelope. */
.invitation-stage.bfly-morph .env-card {
    animation: envLetterSparkle6 0.8s cubic-bezier(0.5, 0, 0.35, 1) forwards;
}

@keyframes envLetterSparkle6 {
    0%   { transform: translateY(-94%)  rotate(0deg)  scale(1.05); opacity: 1;  filter: blur(0); }
    100% { transform: translateY(-132%) rotate(2.5deg) scale(1.18); opacity: 0; filter: blur(6px); }
}

/* by reveal time the letter is long gone — kill v5's drift replay */
.invitation-stage.is-revealed .env-card {
    animation: none;
    opacity: 0;
}

/* the Open button must step aside with the rest of the text when the
   letter rises — in V6 the reveal is much later, so it needs its own
   letter-out exit (v5 only dismissed it at is-revealed). */
.invitation-stage.letter-out .inv-open-btn {
    animation: none;
    opacity: 0;
    transform: translateY(-2.5vh) scale(0.98);
    transition: opacity 0.55s ease, transform 0.55s ease;
    pointer-events: none;
}


/* ================================================================
   3. FLIGHT — liftoff hover → wander → bank → exit (5.4 s)
   ================================================================
   Real butterflies never fly straight: they flutter up, pause,
   drift, dip, then commit to a direction. Two hover pauses hold the
   position while the wings keep beating inside the SVG. */
.invitation-stage.bfly-fly .inv-butterfly {
    animation: bflyFlyPath6 5.4s cubic-bezier(0.45, 0.04, 0.55, 0.96) forwards;
}

@keyframes bflyFlyPath6 {
    0%   { transform: translate(-50%, -50%) translate3d(0, 0, 0)          scale(1);     animation-timing-function: ease-in-out; }
    9%   { transform: translate(-50%, -50%) translate3d(1vw, -5vh, 0)     scale(0.99);  animation-timing-function: ease-in-out; }
    17%  { transform: translate(-50%, -50%) translate3d(2.6vw, -7.5vh, 0) scale(0.975); animation-timing-function: ease-in-out; }
    23%  { transform: translate(-50%, -50%) translate3d(1.4vw, -8.6vh, 0) scale(0.97);  animation-timing-function: ease-in-out; }
    33%  { transform: translate(-50%, -50%) translate3d(-9vw, -13.5vh, 0) scale(0.93);  animation-timing-function: ease-in-out; }
    42%  { transform: translate(-50%, -50%) translate3d(-12vw, -9.5vh, 0) scale(0.9);   animation-timing-function: ease-in-out; }
    48%  { transform: translate(-50%, -50%) translate3d(-12.6vw, -8.8vh, 0) scale(0.9); animation-timing-function: ease-in-out; }
    58%  { transform: translate(-50%, -50%) translate3d(-3vw, -19vh, 0)   scale(0.85);  animation-timing-function: ease-in-out; }
    69%  { transform: translate(-50%, -50%) translate3d(9vw, -32vh, 0)    scale(0.75);  animation-timing-function: cubic-bezier(0.5, 0, 0.72, 0.4); }
    81%  { transform: translate(-50%, -50%) translate3d(24vw, -55vh, 0)   scale(0.56);  animation-timing-function: cubic-bezier(0.55, 0, 0.75, 0.45); }
    100% { transform: translate(-50%, -50%) translate3d(47vw, -112vh, 0)  scale(0.3); }
}

/* banking into every turn — roll (rotate) + 3D yaw (rotateY) */
.invitation-stage.bfly-fly .bfly-bank {
    animation: bflyBank6 5.4s cubic-bezier(0.45, 0.04, 0.55, 0.96) forwards;
}

@keyframes bflyBank6 {
    0%   { transform: rotate(0deg)    rotateY(0deg); }
    9%   { transform: rotate(-5deg)   rotateY(9deg); }
    17%  { transform: rotate(4deg)    rotateY(-7deg); }
    23%  { transform: rotate(0deg)    rotateY(0deg); }
    33%  { transform: rotate(-12deg)  rotateY(15deg); }
    42%  { transform: rotate(-7deg)   rotateY(9deg); }
    48%  { transform: rotate(-4deg)   rotateY(4deg); }
    58%  { transform: rotate(8deg)    rotateY(-11deg); }
    69%  { transform: rotate(14deg)   rotateY(-16deg); }
    81%  { transform: rotate(20deg)   rotateY(-20deg); }
    100% { transform: rotate(25deg)   rotateY(-22deg); }
}

/* hover flutter before liftoff is just the float bob (always on) */


/* ================================================================
   4. MODERN MESSAGE REVEAL — cinematic blur-rise (after the flight)
   ================================================================ */

/* container: no scale spring — the card choreographs itself now */
.inv-reveal {
    transform: none;
    transition: opacity 0.45s ease;
}

/* soft golden bloom behind the card */
.inv-reveal::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(120vw, 940px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(240, 201, 110, 0.17) 0%,
        rgba(240, 201, 110, 0.055) 42%,
        transparent 68%);
    transform: translate(-50%, -50%) scale(0.55);
    opacity: 0;
    pointer-events: none;
}

.invitation-stage.is-revealed .inv-reveal::before {
    animation: rcBloom6 1.7s ease-out 0.1s forwards;
}

@keyframes rcBloom6 {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.55); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* the card sharpens out of a blur while rising */
.inv-reveal-card {
    opacity: 0;
    transform: translateY(4.5vh) scale(0.9);
    filter: blur(18px) saturate(1.18);
}

.invitation-stage.is-revealed .inv-reveal-card {
    animation: rcCard6 1.05s cubic-bezier(0.19, 1, 0.22, 1) 0.05s forwards;
}

@keyframes rcCard6 {
    0%   { opacity: 0; transform: translateY(4.5vh) scale(0.9); filter: blur(18px) saturate(1.18); }
    55%  { opacity: 1; }
    100% { opacity: 1; transform: translateY(0) scale(1);        filter: blur(0) saturate(1); }
}

/* one elegant gold shimmer sweeping across the card */
.inv-rc-shine {
    position: absolute;
    top: -22%;
    bottom: -22%;
    left: 0;
    width: 30%;
    pointer-events: none;
    background: linear-gradient(105deg,
        transparent 0%,
        rgba(255, 236, 180, 0.30) 42%,
        rgba(255, 248, 220, 0.5) 50%,
        rgba(255, 236, 180, 0.30) 58%,
        transparent 100%);
    transform: translateX(-160%) rotate(8deg);
    mix-blend-mode: screen;
}

.invitation-stage.is-revealed .inv-rc-shine {
    animation: rcShine6 1.5s cubic-bezier(0.3, 0, 0.2, 1) 1.1s forwards;
}

@keyframes rcShine6 {
    to { transform: translateX(480%) rotate(8deg); }
}

/* ---- staggered lines: every element blur-rises into place ---- */
.inv-rc-orn,
.inv-rc-bn,
.inv-rc-kick,
.inv-rc-rule,
.inv-rc-date,
.inv-rc-day,
.inv-rc-note {
    animation: none;
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
}

/* the hint rises WITHOUT the blur treatment (its animation is a
   simple opacity/transform fade — a blurred hint would look smudged) */
.inv-rc-hint {
    animation: none;
    opacity: 0;
    transform: translateY(8px);
}

/* the couple's names: blur-rise + letter-spacing tightening */
.inv-rc-names {
    animation: none;
    opacity: 0;
    filter: blur(14px);
    transform: translateY(22px) scale(0.975);
    letter-spacing: 0.16em;
}

.invitation-stage.is-revealed .inv-rc-orn   { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 0.25s forwards; }
.invitation-stage.is-revealed .inv-rc-bn    { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 0.37s forwards; }
.invitation-stage.is-revealed .inv-rc-kick  { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 0.49s forwards; }
.invitation-stage.is-revealed .inv-rc-names { animation: rcNames6 1.15s cubic-bezier(0.19, 1, 0.22, 1) 0.62s forwards; }
.invitation-stage.is-revealed .inv-rc-rule  { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 0.80s forwards; }
.invitation-stage.is-revealed .inv-rc-date  { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 0.92s forwards; }
.invitation-stage.is-revealed .inv-rc-day   { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 1.04s forwards; }
.invitation-stage.is-revealed .inv-rc-note  { animation: rcItem6 0.9s  cubic-bezier(0.19, 1, 0.22, 1) 1.16s forwards; }
.invitation-stage.is-revealed .inv-rc-hint  { animation: rcHint6 1.0s  ease 1.55s forwards; }

@keyframes rcItem6 {
    0%   { opacity: 0; filter: blur(10px); transform: translateY(20px); }
    100% { opacity: 1; filter: blur(0);    transform: translateY(0); }
}

@keyframes rcNames6 {
    0%   { opacity: 0; filter: blur(14px); transform: translateY(22px) scale(0.975); letter-spacing: 0.16em; }
    100% { opacity: 1; filter: blur(0);    transform: translateY(0) scale(1);         letter-spacing: 0.015em; }
}

@keyframes rcHint6 {
    0%   { opacity: 0;   transform: translateY(8px); }
    100% { opacity: 0.8; transform: translateY(0); }
}

/* the discreet "tap to continue" hint */
.inv-rc-hint {
    margin-top: 16px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(0.8rem, 2.6vw, 0.95rem);
    letter-spacing: 0.14em;
    color: #b49a5e;
}


/* ================================================================
   5. RESPONSIVE
   ================================================================ */
@media (max-height: 760px) {
    .inv-butterfly { width: clamp(100px, 19vw, 142px); }
}

@media (max-width: 480px) {
    .inv-butterfly { width: clamp(92px, 27vw, 124px); }
}


/* ================================================================
   6. REDUCED MOTION — v5 already hides the butterfly; keep the
      message reveal but make it a calm, quick, unblurred fade.
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .bfly-bob6 { animation: none !important; }

    .invitation-stage.is-revealed .inv-reveal-card,
    .invitation-stage.is-revealed .inv-rc-orn,
    .invitation-stage.is-revealed .inv-rc-bn,
    .invitation-stage.is-revealed .inv-rc-kick,
    .invitation-stage.is-revealed .inv-rc-names,
    .invitation-stage.is-revealed .inv-rc-rule,
    .invitation-stage.is-revealed .inv-rc-date,
    .invitation-stage.is-revealed .inv-rc-day,
    .invitation-stage.is-revealed .inv-rc-note,
    .invitation-stage.is-revealed .inv-rc-hint {
        animation-duration: 0.35s !important;
        animation-delay: 0s !important;
        filter: none !important;
        transform: none !important;
    }

    .inv-reveal-card { filter: none !important; }
}
