/* hereby — invitation motion layer, shared by every template.
   1. Envelope: tap, the wax seal lifts off whole or the ribbon unties (per design, section 1c), the flap lifts, the envelope slides away and the cover arrives.
   2. Cover entrance and swipe up to enter.
   3. Scroll reveals: each block rises into view in a short stagger; the countdown counts up, then ticks.
   4. Floating music button (only when config.js names a track).
   Uses the individual translate / scale properties so template transforms (tilted cards etc.) are untouched. */

.inv .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 1. Envelope ---------- */
.inv { --env-paper: url("env-paper.webp"); --env-liner: url("env-liner.webp"); --rib-filter: none; --env-ink: var(--chocolate); --env-stage: #5E4E41; }
.inv-env { position: absolute; inset: 0; z-index: 6; display: none; overflow: hidden; container-type: size; perspective: 1600px; background: var(--env-stage); color: var(--env-ink); -webkit-tap-highlight-color: transparent; }
.inv.env-shut .inv-env { display: block; }
.inv.env-shut .inv-music { display: none; }
.env-wrap { position: absolute; inset: 0; transform-style: preserve-3d; box-shadow: 0 24px 60px rgba(20, 14, 10, 0.4); }
.env-back { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(74, 58, 45, 0.3), rgba(74, 58, 45, 0) 50%), var(--env-liner) center top / cover no-repeat, #E9DCCB; }

/* pocket: everything below the V, with a soft shadow along its top edges */
.env-body { position: absolute; inset: 0; filter: drop-shadow(0 -3px 5px rgba(60, 44, 32, 0.22)); }
.env-pf { position: absolute; inset: 0; background: var(--env-paper) center / var(--env-paper-size, cover), var(--env-paper-bg, #F6EEE2); clip-path: polygon(0 0, 50% 47%, 100% 0, 100% 100%, 0 100%); }
.env-pf svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.env-pf path { fill: none; stroke: rgba(74, 58, 45, 0.16); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.env-note { position: absolute; left: 10%; right: 10%; bottom: 13%; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.env-to { font-style: italic; font-size: clamp(16px, 5cqw, 24px); }
.inv[lang="zh-Hant"] .env-to { font-style: normal; letter-spacing: 0.1em; }
.env-names { font-family: var(--hand); font-size: clamp(28px, 10cqw, 52px); line-height: 1.1; }
.env-names em { font-style: normal; font-size: 0.6em; color: var(--rose-deep); padding: 0 0.12em; }
.inv[lang="zh-Hant"] .env-names { font-family: var(--serif); font-size: clamp(22px, 7cqw, 36px); letter-spacing: 0.16em; }
.inv[lang="zh-Hant"] .env-names em { font-family: var(--serif); }

/* flap: the top triangle, hinged at the top edge. Paper outside, the painted liner inside. */
.env-flap { position: absolute; inset: 0 0 auto 0; height: 100%; transform-origin: 50% 0; filter: drop-shadow(0 4px 6px rgba(60, 44, 32, 0.28)); z-index: 2; }
.env-face, .env-liner { position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 50% 57%); }
.env-face { background: var(--env-paper) center / var(--env-paper-size, cover), var(--env-paper-bg, #F6EEE2); }
.env-liner { background: var(--env-liner) center bottom / cover no-repeat, #E9DCCB; clip-path: polygon(0 57%, 100% 57%, 50% 0); transform: scaleY(-1); transform-origin: 50% 28.5%; opacity: 0; }

/* ribbon: a band across the flap's tip in two halves, tied with a painted bow */
.env-rib { position: absolute; z-index: 3; overflow: hidden; filter: var(--rib-filter) drop-shadow(0 2px 2px rgba(60, 44, 32, 0.25)); }
.env-rib b { position: absolute; background: var(--env-ribbon, url("env-ribbon.webp")) 0 50% / auto 100% repeat-x; }
.env-rib.h { top: calc(57% - 5cqw); height: 10cqw; width: 50%; }
.env-rib.h.a { left: 0; } .env-rib.h.b { right: 0; }
.env-rib.h b { inset: 0; }
.env-rib.h.b b { background-position: 100% 50%; }
.env-bow { position: absolute; z-index: 4; left: 50%; top: 57%; width: 54cqw; aspect-ratio: 700 / 520; translate: -50% -38%; background: var(--env-bow-art, url("floral-bow.webp")) center / contain no-repeat; filter: var(--rib-filter) drop-shadow(0 4px 5px rgba(60, 44, 32, 0.3)); animation: env-breathe 2.8s ease-in-out infinite; }
@keyframes env-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.04; } }

.env-tap { position: absolute; inset: 0; z-index: 7; border: none; background: transparent; cursor: pointer; }
.env-tap:focus-visible { outline: 2px solid var(--rose-deep); outline-offset: -6px; }
.env-hint { position: absolute; z-index: 7; left: 0; right: 0; bottom: max(4%, 18px); text-align: center; pointer-events: none; font-size: 13px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; color: var(--env-ink); animation: env-hint 2.4s ease-in-out infinite; }
.inv[lang="zh-Hant"] .env-hint { font-size: 15px; font-weight: 400; letter-spacing: 0.4em; }
@keyframes env-hint { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.env-skip { z-index: 8; color: var(--env-ink); }

/* the opening, about 3 s */
.inv.env-opening .env-tap, .inv.env-opening .env-skip { pointer-events: none; }
.inv.env-opening .env-hint, .inv.env-opening .env-skip { opacity: 0; transition: opacity 0.3s ease; }
.inv.env-opening .env-wrap { animation: env-step-back 3s cubic-bezier(0.45, 0, 0.2, 1) forwards; }
.inv.env-opening .env-bow { animation: env-untie 0.8s cubic-bezier(0.5, 0, 0.75, 0) forwards; }
/* the ribbon loosens and falls away as one band; it is never pulled apart or shown cut (Bo, 2026-11-27: 意頭) */
.inv.env-opening .env-rib.h { animation: env-rib-fall 0.7s cubic-bezier(0.4, 0, 0.6, 1) 0.15s forwards; }
.inv.env-opening .env-flap { animation: env-flap 1.1s cubic-bezier(0.4, 0, 0.2, 1) 0.85s forwards; }
.inv.env-opening .env-face { animation: env-face 1.1s linear 0.85s forwards; }
.inv.env-opening .env-liner { animation: env-liner 1.1s linear 0.85s forwards; }
.inv.env-opening .inv-env { animation: env-stage 3s ease forwards; }
@keyframes env-untie { 0% { scale: 1; rotate: 0deg; opacity: 1; } 30% { scale: 1.12; rotate: -4deg; opacity: 1; } 100% { scale: 0.5; rotate: 14deg; opacity: 0; translate: -50% -10%; } }
@keyframes env-rib-fall { 0% { translate: 0 0; opacity: 1; } 100% { translate: 0 60%; opacity: 0; } }
/* the step back happens first so the lifting flap stays in view */
@keyframes env-step-back { 0% { scale: 1; translate: 0 0; } 25% { scale: 0.8; translate: 0 6%; } 62% { scale: 0.8; translate: 0 6%; opacity: 1; } 100% { scale: 0.86; translate: 0 92%; opacity: 0; } }
@keyframes env-flap { 0% { transform: rotateX(0deg); } 100% { transform: rotateX(-178deg); } }
@keyframes env-face { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes env-liner { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes env-stage { 0%, 55% { background-color: var(--env-stage); } 100% { background-color: transparent; } }

/* ---------- 2. Cover entrance ---------- */
.inv.cover-in:not(.open) .inv-cover { animation: inv-cover-in 1.3s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.inv.cover-in:not(.open) .inv-cover > * { animation: inv-rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(2) { animation-delay: 0.08s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(3) { animation-delay: 0.16s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(4) { animation-delay: 0.24s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(5) { animation-delay: 0.32s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(6) { animation-delay: 0.4s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(7) { animation-delay: 0.5s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(8) { animation-delay: 0.6s; }
.inv.cover-in:not(.open) .inv-cover > :nth-child(n+9) { animation-delay: 0.7s; }
@keyframes inv-cover-in { from { scale: 1.05; } }
@keyframes inv-rise { from { opacity: 0; translate: 0 22px; } }

/* ---------- 3. Scroll reveals ---------- */
.inv.rv-on .inv-body [data-rv]:not(.in) { opacity: 0; }
.inv.rv-on .inv-body [data-rv].in { animation: inv-rv 0.95s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: calc(var(--rv-i, 0) * 110ms); }
@keyframes inv-rv { from { opacity: 0; translate: 0 30px; } }
/* a ticking countdown digit drops in */
.inv-count b.flip { animation: inv-flip 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes inv-flip { from { translate: 0 -35%; opacity: 0; } }

/* ---------- 4. Music ---------- */
.inv-music { position: absolute; z-index: 5; left: max(14px, env(safe-area-inset-left, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); width: 46px; height: 46px; padding: 0; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(74, 58, 45, 0.25); border-radius: 50%; background: rgba(248, 243, 233, 0.82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--chocolate); box-shadow: 0 4px 14px rgba(60, 44, 32, 0.18); }
.inv-music[hidden] { display: none; }
.inv-music svg { width: 22px; height: 22px; }
.inv-music[aria-pressed="true"] svg { animation: inv-spin 6s linear infinite; }
.inv-music[aria-pressed="false"]::after { content: ""; position: absolute; width: 26px; height: 1.4px; background: currentColor; rotate: -45deg; }
@keyframes inv-spin { to { rotate: 360deg; } }

/* ---------- Per-template envelope: liner painting, ribbon colour, stage tint ---------- */
.inv[data-layout="rococo"] { --env-liner: url("ro-cover.jpg"); --env-stage: #1E2619; --rib-filter: hue-rotate(115deg) saturate(0.55) brightness(0.62); }
.inv[data-layout="lace"] { --env-liner: url("lace-satin.jpg"); --env-stage: #6B4A50; }
.inv[data-layout="floral"] { --env-liner: url("floral-scatter.jpg"); --env-stage: #8C7466; }
.inv[data-layout="collage"] { --env-liner: url("collage-scene.jpg"); --env-stage: #6F7863; --rib-filter: hue-rotate(75deg) saturate(0.45) brightness(0.85); }
.inv[data-layout="azure"] { --env-liner: url("azure-villa.jpg"); --env-stage: #1F3557; --rib-filter: hue-rotate(232deg) saturate(1.2) brightness(0.55); }
.inv[data-layout="ink"] { --env-stage: #2A2622; --rib-filter: grayscale(1) brightness(0.42) contrast(1.25); }
/* 1b. The opening frame follows the theme: each envelope is made of that template's own paper.
   floral keeps the pink watercolour paper; minimal designs get plain ivory. */
.inv[data-layout="rococo"] { --env-paper: linear-gradient(rgba(243, 236, 220, 0.5), rgba(243, 236, 220, 0.5)), url("ro-toile.jpg"); --env-paper-size: 340px; --env-paper-bg: #F3ECDC; }
.inv[data-layout="lace"] { --env-paper: linear-gradient(rgba(247, 242, 235, 0.08), rgba(247, 242, 235, 0.08)), url("lace-satin.jpg"); --env-paper-bg: #8F6670; --env-ink: #FBF5EF; }
.inv[data-layout="lace"] .env-names em { color: #F1D9DC; }
.inv[data-layout="lace"] .env-pf path { stroke: rgba(255, 248, 240, 0.28); }
.inv[data-layout="collage"] { --env-paper: url("collage-linen.jpg"); --env-paper-size: 420px; --env-paper-bg: #DCE1D2; --env-ink: #3F4A35; }
.inv[data-layout="azure"] { --env-paper: url("azure-wash.jpg"); --env-paper-bg: #D5DFEC; --env-ink: #1F3557; }
.inv[data-layout="azure"] .env-names em { color: #58779F; }
.inv[data-layout="ink"] { --env-paper: none; --env-paper-bg: #F7F4EC; --env-liner: url("sc-ink-a.webp"); --env-ink: #2B2420; }
.inv[data-layout="ink"] .env-names em { color: #2B2420; }
.inv[data-layout="ink"] .env-pf path { stroke: rgba(43, 36, 32, 0.55); stroke-width: 1.4; }
.inv[data-layout="rococo"] .env-note { padding: 22px 0 26px; background: radial-gradient(closest-side, rgba(243, 236, 220, 0.96) 62%, rgba(243, 236, 220, 0)); }
.inv[data-layout="rococo"] .env-hint { color: #2F3B2A; text-shadow: 0 0 6px #F3ECDC, 0 0 12px #F3ECDC; }
.inv[data-layout="ink"] .env-names { font-family: var(--ink-hand); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.inv[data-layout="ink"] .env-names em { font-family: var(--serif); font-style: italic; text-transform: none; }
.inv[data-layout="ink"] .env-hint { font-family: var(--ink-hand); }
/* 2026-11-25 templates */
.inv[data-layout="dove"] { --env-paper: url("dove-emboss.jpg"); --env-paper-size: 420px; --env-paper-bg: #93A6C8; --env-liner: url("dove-emboss.jpg"); --env-stage: #2E3F66; --env-ink: #FBF8F1; --rib-filter: hue-rotate(232deg) saturate(1.2) brightness(0.55); }
.inv[data-layout="dove"] .env-names em { color: #E4E9F3; }
.inv[data-layout="dove"] .env-pf path { stroke: rgba(251, 248, 241, 0.4); }
.inv[data-layout="sage"] { --env-paper: linear-gradient(rgba(156, 175, 146, 0.8), rgba(156, 175, 146, 0.8)), url("env-paper.webp"); --env-paper-bg: #9CAF92; --env-liner: url("sage-paper.jpg"); --env-stage: #4E6146; --env-ink: #FFFDF8; }
.inv[data-layout="sage"] .env-names em { color: #F6E9E4; }
.inv[data-layout="sage"] .env-pf path { stroke: rgba(255, 253, 248, 0.45); }
.inv[data-layout="garden"] { --env-paper: none; --env-paper-bg: #FBF8EE; --env-liner: linear-gradient(#3D6B47, #3D6B47); --env-stage: #335C3C; --env-ink: #3D6B47; --rib-filter: hue-rotate(75deg) saturate(0.6) brightness(0.6); }
.inv[data-layout="garden"] .env-names em { color: #3D6B47; }
.inv[data-layout="garden"] .env-pf path { stroke: rgba(61, 107, 71, 0.55); stroke-width: 1.4; }
.inv[data-layout="amour"] { --env-paper: none; --env-paper-bg: #FBF5EA; --env-liner: linear-gradient(#A3141C, #A3141C); --env-stage: #7E0E14; --env-ink: #A3141C; --rib-filter: saturate(1.8) brightness(0.6); }
.inv[data-layout="amour"] .env-names, .inv[data-layout="amour"] .env-names em { font-family: var(--am-hand); color: #A3141C; }
.inv[lang="zh-Hant"][data-layout="amour"] .env-names, .inv[lang="zh-Hant"][data-layout="amour"] .env-names em { font-family: var(--serif); }
.inv[data-layout="amour"] .env-pf path { stroke: rgba(163, 20, 28, 0.5); stroke-width: 1.4; }
.inv[data-layout="story"] { --env-paper: url("story-sky.jpg"); --env-paper-bg: #D3E6F2; --env-liner: url("story-hills.webp"); --env-stage: #7F94B6; --env-ink: #4D5F80; --rib-filter: hue-rotate(205deg) saturate(0.55) brightness(0.9); }
.inv[data-layout="story"] .env-names em { color: #7F94B6; }
.inv[data-layout="magnolia"] { --env-paper: url("magnolia-paper.jpg"); --env-paper-bg: #F2ECE1; --env-liner: url("sc-magnolia-a.webp"); --env-stage: #6E5F52; --env-ink: #4A3D2F; --rib-filter: grayscale(0.85) brightness(1.3); }
.inv[data-layout="magnolia"] .env-names em { color: #A88C5F; }

/* 1c. Closures (2026-11-26): each design is closed either with a wax seal (火漆印, config.js closure: "seal")
   or a ribbon and bow in its own colours. Art is baked by tools/build-closures.py into assets/closure/,
   recoloured from the painted originals (gate-seal, sage-seal, env-ribbon, floral-bow), so no CSS hue filters. */
.env-wax { display: none; position: absolute; z-index: 4; left: 50%; top: 57%; width: min(34cqw, 160px); aspect-ratio: 1; translate: -50% -50%; filter: drop-shadow(0 5px 6px rgba(40, 28, 20, 0.35)); animation: env-breathe 2.8s ease-in-out infinite; }
.env-wax b { position: absolute; inset: 0; background: var(--env-seal-art, url("gate-seal.webp")) center / contain no-repeat; }
.inv[data-closure="seal"] .env-wax { display: block; }
.inv[data-closure="seal"] .env-rib, .inv[data-closure="seal"] .env-bow { display: none; }
/* opening: the seal is pressed, then lifts off the flap in one piece and fades before the flap opens.
   Never crack or split it: a broken seal is bad luck (意頭唔好) for a wedding (Bo, 2026-11-27). */
.inv.env-opening .env-wax { animation: env-wax-press 0.32s ease-out forwards; }
.inv.env-opening .env-wax b { animation: env-wax-lift 0.75s cubic-bezier(0.4, 0, 0.6, 1) 0.3s forwards; }
@keyframes env-wax-press { 0% { scale: 1; } 55% { scale: 0.93; } 100% { scale: 1.02; } }
@keyframes env-wax-lift { 0% { translate: 0 0; scale: 1; opacity: 1; } 40% { translate: 0 -10%; scale: 1.08; opacity: 1; } 100% { translate: 0 -34%; scale: 1.12; opacity: 0; } }

/* wax colour per design */
.inv[data-layout="rococo"] { --env-seal-art: url("closure/seal-rococo.webp"); }
.inv[data-layout="azure"] { --env-seal-art: url("closure/seal-azure.webp"); }
.inv[data-layout="azure"][data-cw="sage"] { --env-seal-art: url("closure/seal-azure-sage.webp"); }
.inv[data-layout="azure"][data-cw="rose"] { --env-seal-art: url("closure/seal-azure-rose.webp"); }
.inv[data-layout="ink"] { --env-seal-art: url("closure/seal-ink.webp"); }
.inv[data-layout="sage"] { --env-seal-art: url("sage-seal.webp"); }
.inv[data-layout="amour"] { --env-seal-art: url("closure/seal-amour.webp"); }
.inv[data-layout="magnolia"] { --env-seal-art: url("closure/seal-magnolia.webp"); }
/* ribbon colour per design (floral keeps the original blush satin) */
.inv[data-layout="lace"] { --env-ribbon: url("closure/ribbon-lace.webp"); --env-bow-art: url("closure/bow-lace.webp"); --rib-filter: none; }
.inv[data-layout="collage"] { --env-ribbon: url("closure/ribbon-collage.webp"); --env-bow-art: url("closure/bow-collage.webp"); --rib-filter: none; }
.inv[data-layout="dove"] { --env-ribbon: url("closure/ribbon-dove.webp"); --env-bow-art: url("closure/bow-dove.webp"); --rib-filter: none; }
.inv[data-layout="story"] { --env-ribbon: url("closure/ribbon-story.webp"); --env-bow-art: url("closure/bow-story.webp"); --rib-filter: none; }
/* garden is line-drawn: an outlined green band and the painted line bow */
.inv[data-layout="garden"] { --env-bow-art: url("garden-bow.webp"); --rib-filter: none; }
.inv[data-layout="garden"] .env-rib.h { top: calc(57% - 2.4cqw); height: 4.8cqw; filter: none; }
.inv[data-layout="garden"] .env-rib b { background: #FBF8EE; border-block: 1.6px solid #3D6B47; }
.inv[data-layout="garden"] .env-bow { width: 46cqw; aspect-ratio: 560 / 431; translate: -50% -42%; filter: none; }

@media (prefers-reduced-motion: reduce) {
  .env-bow, .env-wax, .env-hint, .inv-music[aria-pressed="true"] svg { animation: none; }
  .inv.env-opening .env-wrap, .inv.env-opening .env-bow, .inv.env-opening .env-wax, .inv.env-opening .env-wax b, .inv.env-opening .env-rib, .inv.env-opening .env-flap, .inv.env-opening .env-face, .inv.env-opening .env-liner, .inv.env-opening .inv-env { animation: none; }
  .inv.env-opening .inv-env { opacity: 0; transition: opacity 0.45s ease; }
}

/* ---------- 5. Painted scene bands between sections (two per template, demo-style) ---------- */
.inv { --scene-a: url("sc-floral-a.webp"); --scene-b: url("sc-floral-b.webp"); }
.inv-scene { position: relative; align-self: stretch; margin: -12px calc(50% - min(50cqw, 330px)); aspect-ratio: 3 / 2; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%); }
.inv-scene i { position: absolute; inset: -9% 0; background: var(--scene-a) center / cover no-repeat; translate: 0 calc(var(--sp, 0) * -7%); will-change: translate; }
.inv-scene[data-scene="b"] i { background-image: var(--scene-b); }
.inv[data-layout="rococo"] { --scene-a: url("sc-rococo-a.webp"); --scene-b: url("sc-rococo-b.webp"); }
.inv[data-layout="lace"] { --scene-a: url("sc-lace-a.webp"); --scene-b: url("sc-lace-b.webp"); }
.inv[data-layout="collage"] { --scene-a: url("sc-collage-a.webp"); --scene-b: url("sc-collage-b.webp"); }
.inv[data-layout="azure"] { --scene-a: url("sc-azure-a.webp"); --scene-b: url("sc-azure-b.webp"); }
.inv[data-layout="ink"] { --scene-a: url("sc-ink-a.webp"); --scene-b: url("sc-ink-b.webp"); }
.inv[data-layout="sage"] { --scene-a: url("sc-sage-a.webp"); }
.inv[data-layout="story"] { --scene-a: url("story-hills.webp"); --scene-b: url("sc-story-b.webp"); }
.inv[data-layout="magnolia"] { --scene-a: url("sc-magnolia-a.webp"); }
@media (prefers-reduced-motion: reduce) { .inv-scene i { translate: none; } }
/* designs with no painted band of their own skip the bands between sections */
.inv[data-layout="dove"] .inv-scene, .inv[data-layout="garden"] .inv-scene, .inv[data-layout="amour"] .inv-scene, .inv[data-layout="sage"] .inv-scene[data-scene="b"], .inv[data-layout="magnolia"] .inv-scene[data-scene="b"] { display: none; }

/* ---------- 6. Blooming flowers (assets/inv-blooms.js, art assets/bl-*.webp) ---------- */
.bl-layer { position: absolute; inset: 0; z-index: 7; overflow: hidden; pointer-events: none; }
.bl-pops { position: absolute; top: 0; left: 0; width: 100%; overflow: clip; pointer-events: none; z-index: 2; }
.bl-layer img, .bl-pops img { position: absolute; display: block; height: auto; user-select: none; }
/* a flower popping open at a section's edge, then swaying on its stem */
.bl-pop { rotate: var(--rot, 0deg); filter: drop-shadow(0 3px 4px rgba(60, 44, 32, 0.12)); animation: bl-pop 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d, 0s) backwards, bl-sway var(--sway, 4s) ease-in-out calc(var(--d, 0s) + 0.9s) infinite alternate; transform-origin: 50% 90%; }
@keyframes bl-pop { 0% { scale: 0; opacity: 0; translate: 0 30%; } 60% { opacity: 1; } 100% { scale: 1; translate: 0 0; } }
@keyframes bl-sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
/* tap: a flower opens where the guest touched, lifts and fades */
.bl-tap { animation: bl-tap 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; rotate: var(--rot, 0deg); filter: drop-shadow(0 4px 6px rgba(60, 44, 32, 0.18)); }
@keyframes bl-tap { 0% { scale: 0; opacity: 0; } 22% { scale: 1.12; opacity: 1; } 34% { scale: 1; } 70% { opacity: 1; translate: 0 -8px; } 100% { opacity: 0; translate: 0 -40px; scale: 0.92; } }
.bl-burst { width: 22px; animation: bl-burst 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
@keyframes bl-burst { 0% { opacity: 0; translate: 0 0; scale: 0.4; } 20% { opacity: 1; } 100% { opacity: 0; translate: var(--dx) var(--dy); scale: 1; rotate: 160deg; } }
/* petals drifting down */
.bl-petal { top: -40px; opacity: 0.9; animation: bl-fall var(--fall, 12s) linear forwards; }
@keyframes bl-fall { 0% { translate: 0 0; rotate: 0deg; opacity: 0; } 8% { opacity: 0.9; } 50% { translate: var(--drift) 55cqh; } 90% { opacity: 0.9; } 100% { translate: calc(var(--drift) * -0.4) 110cqh; rotate: var(--spin); opacity: 0; } }
.bl-layer { container-type: size; }
/* butterfly across the cover, wings beating */
.bl-fly { position: absolute; left: -60px; top: 62%; width: 46px; animation: bl-fly 8s cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards; }
.bl-fly.up { top: 38%; animation-name: bl-fly-up; }
/* once the guest has entered, a flyer still crossing fades out instead of passing over the text */
.inv.open .bl-fly { opacity: 0; transition: opacity 0.6s ease; }
.bl-fly img { position: static; width: 100%; animation: bl-wings 0.22s ease-in-out infinite alternate; }
@keyframes bl-wings { from { scale: 1 1; } to { scale: 0.28 1; } }
@keyframes bl-fly { 0% { translate: 0 0; rotate: 70deg; } 30% { translate: 34cqw -14cqh; rotate: 80deg; } 55% { translate: 58cqw -4cqh; rotate: 95deg; } 80% { translate: 84cqw -22cqh; rotate: 70deg; } 100% { translate: 118cqw -30cqh; rotate: 75deg; } }
@keyframes bl-fly-up { 0% { translate: 0 0; rotate: 100deg; } 35% { translate: 40cqw 12cqh; rotate: 95deg; } 70% { translate: 74cqw -2cqh; rotate: 80deg; } 100% { translate: 118cqw 8cqh; rotate: 90deg; } }
/* footer art: in the column after the credit line (assets/inv-blooms.js foot()), so it never sits over the reply form */
.inv-foot-art { position: relative; align-self: stretch; pointer-events: none; display: flex; justify-content: center; align-items: flex-end; gap: 4%; }
.inv-foot-art img { display: block; height: auto; user-select: none; }
.inv-foot-art.meadow { height: 150px; margin: 8px calc(50% - min(50cqw, 330px)) 0; overflow: hidden; }
.inv-foot-art.meadow img { position: absolute; }
.bl-stem { bottom: 0; width: auto; transform-origin: 50% 100%; rotate: var(--rot, 0deg); scale: 1 0; opacity: 0; }
.inv-foot-art.meadow.in .bl-stem { animation: bl-grow 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) forwards, bl-sway 4.6s ease-in-out calc(var(--d, 0s) + 1.3s) infinite alternate; }
@keyframes bl-grow { 0% { scale: 1 0; opacity: 0; } 30% { opacity: 1; } 100% { scale: 1 1; opacity: 1; } }
.bl-strip { left: -4%; bottom: -6px; width: 108%; transform-origin: 50% 100%; scale: 1 0; opacity: 0; }
.inv-foot-art.meadow.in .bl-strip { animation: bl-grow 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.inv-foot-art.piece { padding: 18px 0 26px; }
.bl-foot { opacity: 0; translate: 0 16px; transition: opacity 1.1s ease, translate 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bl-foot.mirror { scale: -1 1; transition-delay: 0.15s; }
.inv-foot-art.in .bl-foot { opacity: 1; translate: 0 0; }
/* doves and other wide pieces glide instead of beating their wings */
.bl-fly.glide img { animation: bl-glide 1.6s ease-in-out infinite alternate; }
.bl-fly.glide { left: -140px; animation-name: bl-fly-glide; }
@keyframes bl-fly-glide { 0% { translate: 0 0; } 50% { translate: 60cqw -10cqh; } 100% { translate: 140cqw -18cqh; } }
@keyframes bl-glide { from { translate: 0 -3px; } to { translate: 0 3px; } }
@media (prefers-reduced-motion: reduce) { .bl-layer, .bl-pops { display: none; } .bl-foot { opacity: 1; translate: none; transition: none; } .bl-stem, .bl-strip { scale: 1; opacity: 1; } }

/* QA 2026-11-25: the music button steps aside over the reply form (invitation.js adds .music-away) */
.inv-music { transition: opacity 0.3s ease, translate 0.3s ease; }
.inv.music-away .inv-music { opacity: 0; translate: -8px 0; pointer-events: none; }

/* QA 2026-11-25: the envelope follows the chosen colourway (it stayed pink paper + pink ribbon on Mist blue).
   Hand-written here, not in colourways.css, which tools/build-colourways.mjs rewrites. */
.inv[data-layout="floral"][data-cw="mist"] { --env-paper: linear-gradient(rgba(205, 217, 232, 0.62), rgba(205, 217, 232, 0.62)), url("env-paper.webp"); --env-paper-bg: #E3E8EF; --rib-filter: none; --env-ribbon: url("closure/ribbon-floral-mist.webp"); --env-bow-art: url("closure/bow-floral-mist.webp"); --env-ink: #3F4C5B; }
.inv[data-layout="floral"][data-cw="champagne"] { --env-paper: linear-gradient(rgba(240, 226, 202, 0.55), rgba(240, 226, 202, 0.55)), url("env-paper.webp"); --env-paper-bg: #F5E6D3; --rib-filter: none; --env-ribbon: url("closure/ribbon-floral-champagne.webp"); --env-bow-art: url("closure/bow-floral-champagne.webp"); --env-ink: #6E5532; }
.inv[data-layout="azure"][data-cw="sage"] { --env-paper: linear-gradient(rgba(214, 224, 204, 0.7), rgba(214, 224, 204, 0.7)), url("azure-wash.jpg"); --env-paper-bg: #DCE4D2; --rib-filter: hue-rotate(95deg) saturate(0.5) brightness(0.62); --env-ink: #2F3B2A; }
.inv[data-layout="azure"][data-cw="rose"] { --env-paper: linear-gradient(rgba(240, 214, 210, 0.72), rgba(240, 214, 210, 0.72)), url("azure-wash.jpg"); --env-paper-bg: #F1DAD6; --rib-filter: hue-rotate(10deg) saturate(0.8) brightness(0.7); --env-ink: #5A2E2C; }
