/* ==========================================================================
   ROYAL WINTER COUTURE — SAYED & ESRAA WEDDING INVITATION
   Palette: Deep Royal Emerald · Warm Cotton Ivory · Burnished Champagne Gold
   ========================================================================== */

:root {
    /* Dominant Royal Emerald System */
    --emerald-950: #071914;
    --emerald-900: #0B241E;
    --emerald-800: #11342B;
    --emerald-700: #18463A;

    /* Warm Cotton Ivory Stationery */
    --ivory-100: #FAF6EE;
    --ivory-200: #F4ECE0;
    --ivory-300: #EAE0D1;

    /* Burnished Champagne Gold */
    --gold-200: #EFE0B4;
    --gold-300: #DEC07A;
    --gold-400: #C8A04D;
    --gold-500: #A57E32;
    --gold-600: #7F5E1F;

    /* Ink & Muted Neutrals */
    --ink-dark: #142721;
    --ink-muted: #54665F;
    --ink-light: #F4EFE5;
    --ink-light-muted: rgba(244, 239, 229, 0.72);

    /* Surfaces & Borders */
    --gold-hairline: rgba(200, 160, 77, 0.38);
    --gold-hairline-strong: rgba(200, 160, 77, 0.68);
    --shadow-couture: 0 28px 65px rgba(3, 12, 9, 0.45), 0 6px 18px rgba(3, 12, 9, 0.28);

    /* Typography */
    --font-display: 'Aref Ruqaa', serif;
    --font-serif: 'Amiri', serif;
    --font-latin: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'El Messiri', sans-serif;

    /* Motion */
    --ease-couture: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-envelope: cubic-bezier(0.45, 0.05, 0.2, 1);
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--emerald-950);
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    color: var(--ink-light);
    background-color: var(--emerald-950);
    overflow-x: hidden;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

body.locked {
    overflow: hidden;
    height: 100dvh;
}

button {
    font-family: inherit;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--gold-300);
    outline-offset: 3px;
}

/* ==========================================================================
   CINEMATIC FOREGROUND FX: STARDUST CANVAS & TWIN GOLDEN BUTTERFLIES
   ========================================================================== */

#envelope-magic-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1080;
    pointer-events: none;
}

.butterfly-stage {
    position: fixed;
    inset: 0;
    z-index: 1120;
    pointer-events: none;
    overflow: hidden;
    perspective: 900px;
}

.butterfly-actor {
    position: absolute;
    top: 52%;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.15);
    will-change: transform, opacity, top, left;
}

.butterfly-primary {
    width: 104px;
    height: 94px;
    filter: drop-shadow(0 6px 18px rgba(222, 192, 122, 0.72));
}

.butterfly-secondary {
    width: 72px;
    height: 65px;
    filter: drop-shadow(0 4px 14px rgba(250, 240, 200, 0.65));
}

.butterfly-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.bf-wing {
    transform-box: view-box;
    transform-origin: 0px 0px;
}

.bf-wing-left {
    animation: bfFlapLeft 0.24s ease-in-out infinite alternate;
}

.bf-wing-right {
    animation: bfFlapRight 0.24s ease-in-out infinite alternate;
}

.butterfly-secondary .bf-wing-left {
    animation-duration: 0.2s;
}
.butterfly-secondary .bf-wing-right {
    animation-duration: 0.2s;
}

@keyframes bfFlapLeft {
    0% { transform: rotateY(4deg) scaleX(1); }
    100% { transform: rotateY(66deg) scaleX(0.42); }
}

@keyframes bfFlapRight {
    0% { transform: rotateY(-4deg) scaleX(1); }
    100% { transform: rotateY(-66deg) scaleX(0.42); }
}

/* Twin Flight Choreography on Envelope Open */
.butterfly-stage.flying .butterfly-primary {
    animation:
        bfPrimaryFlight 3.1s cubic-bezier(0.22, 0.85, 0.32, 1) 0.16s forwards,
        bfPrimaryHover 4.2s ease-in-out 3.26s infinite alternate;
}

.butterfly-stage.flying .butterfly-primary .bf-wing-left,
.butterfly-stage.flying .butterfly-primary .bf-wing-right {
    animation-duration: 0.22s;
}

.butterfly-stage.settled .butterfly-primary .bf-wing-left,
.butterfly-stage.settled .butterfly-primary .bf-wing-right {
    animation-duration: 0.75s;
}

.butterfly-stage.flying .butterfly-secondary {
    animation: bfSecondaryFlight 2.9s cubic-bezier(0.24, 0.82, 0.34, 1) 0.32s forwards;
}

@keyframes bfPrimaryFlight {
    0% {
        top: 52%;
        left: 50%;
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.18) rotate(-24deg);
    }
    14% {
        opacity: 1;
    }
    38% {
        top: 34%;
        left: 30%;
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.18) rotate(22deg);
    }
    68% {
        top: 20%;
        left: 68%;
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.02) rotate(-14deg);
    }
    100% {
        top: 11%;
        left: 84%;
        opacity: 0.92;
        transform: translate(-50%, -50%) scale(0.76) rotate(14deg);
    }
}

@keyframes bfPrimaryHover {
    0% {
        top: 11%;
        left: 84%;
        opacity: 0.92;
        transform: translate(-50%, -50%) scale(0.76) rotate(14deg);
    }
    100% {
        top: 13.5%;
        left: 81%;
        opacity: 0.82;
        transform: translate(-50%, -50%) scale(0.8) rotate(4deg);
    }
}

@keyframes bfSecondaryFlight {
    0% {
        top: 52%;
        left: 50%;
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.15) rotate(28deg);
    }
    16% {
        opacity: 0.95;
    }
    45% {
        top: 32%;
        left: 72%;
        opacity: 0.95;
        transform: translate(-50%, -50%) scale(1.08) rotate(-26deg);
    }
    78% {
        top: 14%;
        left: 28%;
        opacity: 0.85;
        transform: translate(-50%, -50%) scale(0.9) rotate(16deg);
    }
    100% {
        top: -8%;
        left: 14%;
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.65) rotate(-12deg);
    }
}

/* ==========================================================================
   STAGE 1: FULL-SCREEN 3D EMERALD LINEN ENVELOPE
   ========================================================================== */

.envelope-stage {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: radial-gradient(circle at 50% 42%, var(--emerald-800) 0%, var(--emerald-950) 85%);
    perspective: 1800px;
    overflow: hidden;
    transition: transform 1.15s var(--ease-couture), opacity 1s ease;
}

.envelope-ambient {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 52%, rgba(222, 192, 122, 0.16) 0%, transparent 46%),
        radial-gradient(circle at 18% 15%, rgba(200, 160, 77, 0.08) 0%, transparent 40%);
    z-index: 6;
    animation: ambientGlowPulse 5.5s ease-in-out infinite alternate;
}

@keyframes ambientGlowPulse {
    0% { opacity: 0.72; }
    100% { opacity: 1; }
}

/* Sweeping Diagonal Gold Foil Light Sheen Across Envelope */
.envelope-sheen {
    position: absolute;
    inset: -30%;
    z-index: 7;
    pointer-events: none;
    background: linear-gradient(
        118deg,
        transparent 38%,
        rgba(239, 224, 180, 0.06) 46%,
        rgba(239, 224, 180, 0.14) 50%,
        rgba(239, 224, 180, 0.06) 54%,
        transparent 62%
    );
    transform: translateX(-65%);
    animation: foilSheenSweep 5.8s ease-in-out infinite;
}

@keyframes foilSheenSweep {
    0%, 28% { transform: translateX(-68%); opacity: 0; }
    40% { opacity: 1; }
    68% { transform: translateX(68%); opacity: 1; }
    75%, 100% { transform: translateX(68%); opacity: 0; }
}

/* Golden Light Shockwave on Unseal */
.seal-shockwave {
    position: absolute;
    top: 52%;
    left: 50%;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 2px solid rgba(239, 224, 180, 0.9);
    background: radial-gradient(circle, rgba(239, 224, 180, 0.42) 0%, rgba(200, 160, 77, 0.12) 45%, transparent 72%);
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
    pointer-events: none;
    z-index: 9;
}

.seal-shockwave.active {
    animation: shockwaveExpand 0.95s var(--ease-couture) forwards;
}

@keyframes shockwaveExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.95;
    }
    100% {
        transform: translate(-50%, -50%) scale(5.4);
        opacity: 0;
    }
}

.envelope-top-note {
    position: absolute;
    top: max(28px, env(safe-area-inset-top, 28px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    pointer-events: none;
    transition: opacity 0.45s ease;
    animation: introSlideDown 0.9s var(--ease-couture) both;
}

@keyframes introSlideDown {
    0% { opacity: 0; transform: translate(-50%, -14px); }
    100% { opacity: 1; transform: translate(-50%, 0); }
}

.envelope-date-stamp {
    display: inline-block;
    font-family: var(--font-serif);
    font-size: 0.92rem;
    letter-spacing: 4px;
    color: var(--gold-200);
    padding: 5px 18px;
    border: 1px solid rgba(222, 192, 122, 0.35);
    border-radius: 999px;
    background: rgba(7, 25, 20, 0.45);
    backdrop-filter: blur(8px);
}

.envelope-body {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Interior ivory stationery peek */
.env-interior {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(circle at 50% 45%, var(--ivory-100) 0%, var(--ivory-200) 75%, var(--ivory-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.env-interior-frame {
    width: min(86%, 440px);
    height: 70%;
    border: 1px solid var(--gold-400);
    outline: 1px solid rgba(200, 160, 77, 0.3);
    outline-offset: -8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 14%;
    gap: 8px;
    background: rgba(250, 246, 238, 0.9);
    box-shadow: inset 0 0 40px rgba(165, 126, 50, 0.08);
    transform: translateY(18px);
    opacity: 0;
    transition: transform 0.9s var(--ease-couture) 0.25s, opacity 0.8s ease 0.25s;
}

.env-interior-label {
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--gold-500);
}

.env-interior-names {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 8vw, 3rem);
    color: var(--emerald-900);
}

.envelope-stage.open .env-interior-frame {
    transform: translateY(-18px);
    opacity: 1;
}

/* Envelope Flaps with Velvet-Linen Texture */
.flap {
    position: absolute;
    inset: -2%;
    width: 104%;
    height: 104%;
    pointer-events: none;
}

.flap-surface {
    width: 100%;
    height: 100%;
    background-color: var(--emerald-900);
    background-image:
        radial-gradient(circle at 50% 35%, rgba(24, 70, 58, 0.55), rgba(7, 25, 20, 0.92)),
        url('img/texture.png');
    background-blend-mode: soft-light, multiply;
    background-size: cover;
    background-position: center;
}

/* Delicate Gold Foil Seam Lines */
.flap-gold-seam {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gold-200), var(--gold-400), var(--gold-500), var(--gold-200));
    opacity: 0.65;
}

.flap-left {
    z-index: 2;
    filter: drop-shadow(8px 0 22px rgba(0, 0, 0, 0.6));
}
.clip-left {
    clip-path: polygon(0 0, 53% 50%, 0 100%);
}

.flap-right {
    z-index: 2;
    filter: drop-shadow(-8px 0 22px rgba(0, 0, 0, 0.6));
}
.clip-right {
    clip-path: polygon(100% 0, 47% 50%, 100% 100%);
}

.flap-bottom {
    z-index: 3;
    filter: drop-shadow(0 -8px 24px rgba(0, 0, 0, 0.65));
}
.clip-bottom {
    clip-path: polygon(0 100%, 50% 47%, 100% 100%);
}
.clip-bottom-seam {
    clip-path: polygon(0 100%, 50% 47%, 100% 100%, 99.6% 100%, 50% 47.45%, 0.4% 100%);
}

.flap-top {
    z-index: 4;
    pointer-events: auto;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.72));
    transform-origin: top center;
    transform-style: preserve-3d;
    transition: transform 0.95s var(--ease-envelope);
}
.clip-top {
    clip-path: polygon(0 0, 100% 0, 50% 54%);
}
.clip-top-seam {
    clip-path: polygon(0 0, 0.45% 0, 50% 53.5%, 99.55% 0, 100% 0, 50% 54.1%);
    opacity: 0.8;
}

.flap-inner {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--ivory-200) 0%, var(--ivory-300) 100%);
    transform: rotateX(180deg) translateZ(-1px);
    backface-visibility: hidden;
}

/* Rotating Ornamental Halo Around Wax Seal */
.seal-halo {
    position: absolute;
    top: 54%;
    left: 50%;
    width: 174px;
    height: 174px;
    transform: translate(-50%, -50%) translateZ(2px);
    pointer-events: none;
    z-index: 7;
    transition: opacity 0.4s ease, transform 0.55s var(--ease-couture);
}

.seal-halo-svg {
    width: 100%;
    height: 100%;
    animation: haloSpin 26s linear infinite;
}

.halo-ring-inner {
    transform-origin: 90px 90px;
    animation: haloSpinReverse 18s linear infinite;
}

@keyframes haloSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes haloSpinReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Sculptural Wax Seal with Custom Embossed "س & إ" Monogram */
.wax-seal {
    position: absolute;
    top: 54%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(4px);
    width: 106px;
    height: 106px;
    border-radius: 50%;
    overflow: hidden;
    background:
        radial-gradient(circle at 30% 28%, #F6E2A4 0%, #D9B05B 36%, #B48430 72%, #795418 100%);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.55),
        0 0 0 0 rgba(222, 192, 122, 0.55),
        inset 0 2px 6px rgba(255, 250, 232, 0.72),
        inset 0 -6px 14px rgba(84, 54, 11, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.45s var(--ease-couture), opacity 0.45s ease, box-shadow 0.4s ease;
    animation: sealEntrance 0.95s var(--ease-couture) 0.15s both, sealBreathe 2.6s ease-in-out 1.1s infinite;
    z-index: 8;
}

@keyframes sealEntrance {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.75) translateZ(4px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) translateZ(4px);
    }
}

.wax-seal-shine {
    position: absolute;
    inset: -20%;
    background: linear-gradient(
        115deg,
        transparent 32%,
        rgba(255, 252, 238, 0.55) 48%,
        transparent 62%
    );
    transform: translateX(-120%);
    animation: sealGlint 3.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes sealGlint {
    0%, 58% { transform: translateX(-125%); }
    82%, 100% { transform: translateX(125%); }
}

.wax-seal-ring {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 245, 210, 0.52);
    box-shadow:
        inset 0 2px 5px rgba(86, 56, 12, 0.45),
        0 1px 2px rgba(255, 248, 224, 0.45);
    pointer-events: none;
}

.wax-seal-monogram {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    direction: rtl;
    color: #4D3208;
    text-shadow:
        0 1px 1px rgba(255, 244, 206, 0.65),
        0 -1px 1px rgba(68, 42, 6, 0.38);
}

.seal-letter {
    font-family: var(--font-serif);
    font-size: 1.72rem;
    font-weight: 700;
    line-height: 1;
}

.seal-amp {
    font-family: var(--font-latin);
    font-size: 1.08rem;
    font-style: italic;
    font-weight: 600;
    line-height: 1;
    opacity: 0.9;
}

.wax-seal:hover {
    transform: translate(-50%, -50%) scale(1.07) translateZ(4px);
}

.wax-seal:active {
    transform: translate(-50%, -50%) scale(0.96) translateZ(4px);
}

.envelope-stage.open .seal-halo {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.65) translateZ(2px);
}

.envelope-stage.open .envelope-sheen {
    opacity: 0;
}

@keyframes sealBreathe {
    0%, 100% {
        box-shadow:
            0 12px 28px rgba(0, 0, 0, 0.55),
            0 0 0 0 rgba(222, 192, 122, 0.5),
            inset 0 2px 6px rgba(255, 250, 232, 0.72),
            inset 0 -6px 14px rgba(84, 54, 11, 0.78);
    }
    55% {
        box-shadow:
            0 14px 32px rgba(0, 0, 0, 0.58),
            0 0 0 20px rgba(222, 192, 122, 0),
            inset 0 2px 6px rgba(255, 250, 232, 0.72),
            inset 0 -6px 14px rgba(84, 54, 11, 0.78);
    }
}

/* Bottom Prompt */
.envelope-prompt {
    position: absolute;
    bottom: max(38px, env(safe-area-inset-bottom, 38px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.envelope-prompt p {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    color: var(--gold-200);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.prompt-line {
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
}

/* Envelope Open & Dismiss Sequence */
.envelope-stage.open .flap-top {
    transform: rotateX(176deg);
}

.envelope-stage.open .wax-seal {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.38) translateZ(4px);
}

.envelope-stage.open .envelope-prompt,
.envelope-stage.open .envelope-top-note {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}

.envelope-stage.dismissed {
    transform: translateY(108vh) scale(0.98);
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   STAGE 2: ROYAL EMERALD BACKDROP & EDITORIAL SHELL
   ========================================================================== */

.invitation-shell {
    position: relative;
    min-height: 100dvh;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 1s var(--ease-couture), transform 1s var(--ease-couture);
}

.invitation-shell.reveal {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.royal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(170deg, #071914 0%, #0D2A22 48%, #071A15 100%);
}

.backdrop-radial {
    position: absolute;
    inset: -15%;
    background:
        radial-gradient(ellipse 65% 45% at 50% 10%, rgba(222, 192, 122, 0.12) 0%, transparent 65%),
        radial-gradient(ellipse 55% 40% at 85% 65%, rgba(24, 70, 58, 0.42) 0%, transparent 70%),
        radial-gradient(ellipse 50% 45% at 15% 85%, rgba(200, 160, 77, 0.08) 0%, transparent 65%);
}

/* Subtle Architectural Diamond Lattice Watermark */
.backdrop-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.055;
    background-image: url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23DEC07A' stroke-width='0.75'%3E%3Cpath d='M36 0L72 36L36 72L0 36Z'/%3E%3Cpath d='M36 14L58 36L36 58L14 36Z' opacity='0.5'/%3E%3Ccircle cx='36' cy='36' r='2' fill='%23DEC07A'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 72px 72px;
}

.backdrop-grain {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image: radial-gradient(rgba(255, 255, 255, 0.6) 0.5px, transparent 0.5px);
    background-size: 4px 4px;
}

#gold-embers {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ==========================================================================
   FLOATING MUSIC PILL (FIXED & STYLED)
   ========================================================================== */

.music-pill {
    position: fixed;
    top: max(18px, env(safe-area-inset-top, 18px));
    left: 18px;
    z-index: 200;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 15px;
    border-radius: 999px;
    background: rgba(7, 25, 20, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--gold-hairline-strong);
    color: var(--gold-200);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36);
    transition: transform 0.25s var(--ease-couture), background-color 0.25s ease, border-color 0.25s ease;
}

.music-pill:hover {
    transform: translateY(-2px);
    background: rgba(17, 52, 43, 0.92);
    border-color: var(--gold-300);
}

.music-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.music-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2.5px;
    height: 14px;
}

.music-bars i {
    display: block;
    width: 2.5px;
    height: 5px;
    border-radius: 2px;
    background: var(--gold-300);
    transition: height 0.25s ease;
}

.music-bars i:nth-child(2) { height: 10px; }
.music-bars i:nth-child(3) { height: 7px; }
.music-bars i:nth-child(4) { height: 4px; }

.music-pill.playing {
    border-color: var(--gold-300);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), 0 0 18px rgba(200, 160, 77, 0.22);
}

.music-pill.playing .music-bars i {
    animation: eqPulse 0.9s ease-in-out infinite alternate;
}
.music-pill.playing .music-bars i:nth-child(1) { animation-delay: 0s; }
.music-pill.playing .music-bars i:nth-child(2) { animation-delay: 0.2s; }
.music-pill.playing .music-bars i:nth-child(3) { animation-delay: 0.4s; }
.music-pill.playing .music-bars i:nth-child(4) { animation-delay: 0.15s; }

@keyframes eqPulse {
    0% { height: 4px; }
    100% { height: 14px; }
}

/* ==========================================================================
   EDITORIAL LAYOUT COLUMN
   ========================================================================== */

.editorial-column {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 72px 16px 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Reveal Choreography */
.reveal-item {
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 0.85s var(--ease-couture), transform 0.85s var(--ease-couture);
}

.reveal-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   SURFACE A: WARM COTTON-IVORY COUTURE STATIONERY SHEET
   ========================================================================== */

.stationery-sheet {
    position: relative;
    background:
        radial-gradient(circle at 50% 0%, #FDFBF6 0%, var(--ivory-100) 45%, var(--ivory-200) 100%);
    color: var(--ink-dark);
    border-radius: 6px;
    padding: 13px;
    box-shadow: var(--shadow-couture);
    border: 1px solid rgba(222, 192, 122, 0.45);
}

.sheet-inner-frame {
    position: relative;
    border: 1px solid rgba(165, 126, 50, 0.46);
    padding: 36px 22px 34px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(234, 224, 209, 0.18) 100%);
}

.sheet-inner-frame::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 0.6px solid rgba(165, 126, 50, 0.24);
    pointer-events: none;
}

/* Corner Filigree Ornaments */
.corner-ornament {
    position: absolute;
    width: 34px;
    height: 34px;
    color: var(--gold-500);
    pointer-events: none;
}

.corner-ornament.top-right {
    top: 10px;
    right: 10px;
    transform: scaleX(-1);
}
.corner-ornament.top-left {
    top: 10px;
    left: 10px;
}
.corner-ornament.bottom-right {
    bottom: 10px;
    right: 10px;
    transform: rotate(180deg);
}
.corner-ornament.bottom-left {
    bottom: 10px;
    left: 10px;
    transform: scaleY(-1);
}

/* ==========================================================================
   SECTION 1: HERO SHEET CONTENT
   ========================================================================== */

.hero-kicker {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    color: var(--emerald-800);
    letter-spacing: 0.4px;
    margin-bottom: 14px;
}

/* Royal Monogram Crest Badge */
.top-monogram-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 22px;
}

.monogram-wing {
    width: 44px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-400), transparent);
}

.monogram-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--emerald-800), var(--emerald-950));
    border: 1.5px solid var(--gold-400);
    box-shadow: 0 4px 14px rgba(11, 36, 30, 0.25), inset 0 0 0 3px rgba(222, 192, 122, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gold-200);
    font-family: var(--font-display);
    font-size: 1.05rem;
    line-height: 1;
}

.monogram-circle small {
    font-family: var(--font-latin);
    font-style: italic;
    font-size: 0.72rem;
    color: var(--gold-300);
}

/* Architectural Double-Gold Arch Framing the Couple Illustration */
.portrait-arch-stage {
    position: relative;
    width: min(268px, 78%);
    margin: 0 auto 24px;
    padding-top: 10px;
}

.arch-crown-star {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: var(--ivory-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-500);
    z-index: 3;
}

.portrait-arch-outer {
    position: relative;
    padding: 10px;
    border: 1.5px solid var(--gold-400);
    border-radius: 150px 150px 10px 10px;
    background: linear-gradient(180deg, rgba(200, 160, 77, 0.1) 0%, rgba(200, 160, 77, 0.02) 100%);
    box-shadow: 0 14px 32px rgba(11, 36, 30, 0.14);
}

.arch-diamond {
    position: absolute;
    top: 56%;
    width: 8px;
    height: 8px;
    background: var(--gold-400);
    transform: translateY(-50%) rotate(45deg);
    z-index: 3;
}

.arch-diamond.left { left: -4.5px; }
.arch-diamond.right { right: -4.5px; }

.portrait-arch-inner {
    position: relative;
    border-radius: 140px 140px 6px 6px;
    overflow: hidden;
    aspect-ratio: 1 / 1.02;
    background-color: #ECE1D6;
    border: 1px solid rgba(165, 126, 50, 0.35);
}

.couple-illustration {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    filter: contrast(1.03) saturate(1.02);
}

/* Soft bottom vignette so illustration settles seamlessly into the frame */
.portrait-arch-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 22px rgba(236, 225, 214, 0.55);
    pointer-events: none;
}

/* Invitation Eyebrow & Monumental Couple Names */
.invitation-eyebrow {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 2.2px;
    color: var(--gold-500);
    margin-bottom: 6px;
}

.couple-names {
    font-family: var(--font-display);
    font-size: clamp(3rem, 11.5vw, 4.15rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--emerald-900);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 14px;
    margin-bottom: 2px;
}

.names-amp {
    font-family: var(--font-latin);
    font-style: italic;
    font-weight: 500;
    font-size: 0.68em;
    background: linear-gradient(135deg, var(--gold-500), var(--gold-300), var(--gold-600));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.couple-names-latin {
    font-family: var(--font-latin);
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: 4.5px;
    text-transform: uppercase;
    color: var(--gold-500);
    margin-bottom: 22px;
}

/* Personal Romantic Lines */
.romantic-dedication {
    padding: 16px 14px;
    margin: 0 auto 18px;
    border-top: 1px solid rgba(165, 126, 50, 0.25);
    border-bottom: 1px solid rgba(165, 126, 50, 0.25);
    background: rgba(200, 160, 77, 0.055);
}

.dedication-lead {
    font-family: var(--font-serif);
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--emerald-900);
    margin-bottom: 4px;
}

.dedication-sub {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--ink-muted);
    margin-bottom: 6px;
}

.dedication-accent {
    font-family: var(--font-display);
    font-size: 1.38rem;
    color: var(--gold-500);
}

/* Gold Ornamental Divider */
.gold-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 18px auto;
    color: var(--gold-400);
}

.gold-divider span {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-400), transparent);
}

/* Quranic Verse Block */
.quran-block {
    margin: 6px 0 18px;
}

.quran-verse {
    font-family: var(--font-serif);
    font-size: 1.12rem;
    line-height: 2;
    color: var(--emerald-900);
    padding: 0 6px;
}

.quran-ref {
    display: block;
    font-style: normal;
    font-size: 0.8rem;
    color: var(--gold-500);
    margin-top: 4px;
}

.invitation-copy {
    font-size: 0.94rem;
    line-height: 1.9;
    color: var(--ink-muted);
    max-width: 390px;
    margin: 0 auto;
}

/* ==========================================================================
   SURFACE B: ROYAL EMERALD EDITORIAL PANEL (DATE + CALENDAR + COUNTDOWN)
   ========================================================================== */

.emerald-panel {
    position: relative;
    background:
        linear-gradient(155deg, rgba(17, 52, 43, 0.92) 0%, rgba(7, 25, 20, 0.96) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--gold-hairline);
    border-radius: 6px;
    padding: 36px 24px 32px;
    text-align: center;
    box-shadow: var(--shadow-couture);
}

.emerald-panel::before {
    content: '';
    position: absolute;
    inset: 7px;
    border: 0.6px solid rgba(222, 192, 122, 0.18);
    pointer-events: none;
}

.section-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--gold-300);
    margin-bottom: 4px;
}

.section-tag.dark-tag {
    color: var(--gold-500);
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.95rem;
    font-weight: 700;
    color: var(--ivory-100);
    margin-bottom: 24px;
}

.section-title.dark-title {
    color: var(--emerald-900);
}

/* Editorial Date Lockup */
.editorial-date-lockup {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    padding: 18px 8px;
    margin-bottom: 24px;
    border-top: 1px solid var(--gold-hairline);
    border-bottom: 1px solid var(--gold-hairline);
}

.date-side {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.date-side-label {
    font-size: 0.74rem;
    color: var(--ink-light-muted);
    letter-spacing: 1px;
}

.date-side strong {
    font-family: var(--font-serif);
    font-size: 1.24rem;
    color: var(--gold-200);
    font-weight: 700;
}

.date-centerpiece {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 18px;
    border-right: 1px solid var(--gold-hairline);
    border-left: 1px solid var(--gold-hairline);
}

.date-month-top {
    font-size: 0.82rem;
    color: var(--gold-300);
    letter-spacing: 1.5px;
}

.date-big-num {
    font-family: var(--font-serif);
    font-size: 3.35rem;
    font-weight: 700;
    line-height: 1.05;
    background: linear-gradient(180deg, #F6E6B4 0%, #C8A04D 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.date-year-bottom {
    font-family: var(--font-serif);
    font-size: 0.92rem;
    letter-spacing: 3px;
    color: var(--ink-light-muted);
}

/* Authentic RTL Calendar */
.calendar-wrapper {
    background: rgba(7, 25, 20, 0.52);
    border: 1px solid rgba(222, 192, 122, 0.24);
    border-radius: 4px;
    padding: 18px 14px 16px;
    margin-bottom: 24px;
}

.calendar-caption {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--gold-200);
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    row-gap: 8px;
    column-gap: 4px;
    align-items: center;
}

.cal-head {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gold-300);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(222, 192, 122, 0.16);
    margin-bottom: 4px;
}

.cal-day {
    font-family: var(--font-latin);
    font-size: 0.98rem;
    font-weight: 500;
    color: rgba(244, 239, 229, 0.84);
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-day.highlight-day {
    position: relative;
}

.cal-day.highlight-day span {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F0DA98 0%, #C8A04D 65%, #A57E32 100%);
    color: var(--emerald-950);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 4px rgba(222, 192, 122, 0.2), 0 6px 14px rgba(0, 0, 0, 0.4);
}

/* Countdown Ribbon */
.countdown-strip {
    margin-bottom: 24px;
}

.countdown-kicker {
    font-size: 0.82rem;
    color: var(--ink-light-muted);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid rgba(222, 192, 122, 0.28);
    border-radius: 4px;
    background: rgba(7, 25, 20, 0.48);
    overflow: hidden;
    direction: rtl;
}

.cd-unit {
    padding: 14px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
}

.cd-unit + .cd-unit::before {
    content: '';
    position: absolute;
    right: 0;
    top: 22%;
    height: 56%;
    width: 1px;
    background: rgba(222, 192, 122, 0.22);
}

.cd-num {
    font-family: var(--font-latin);
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--gold-200);
    font-variant-numeric: tabular-nums;
}

.cd-label {
    font-size: 0.72rem;
    color: var(--ink-light-muted);
}

/* ==========================================================================
   SECTION 3: VENUE & MAP IVORY SHEET
   ========================================================================== */

.venue-identity {
    margin-bottom: 22px;
}

.venue-pin-crest {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--emerald-900);
    border: 1.5px solid var(--gold-400);
    color: var(--gold-200);
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(11, 36, 30, 0.18);
}

.venue-name {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--emerald-900);
    margin-bottom: 4px;
}

.venue-hall {
    display: inline-block;
    font-family: var(--font-serif);
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--gold-600);
    padding: 2px 16px;
    border-radius: 999px;
    background: rgba(200, 160, 77, 0.14);
    border: 1px solid rgba(165, 126, 50, 0.35);
    margin: 4px 0 10px;
}

.venue-address {
    font-size: 0.94rem;
    color: var(--ink-muted);
    margin-bottom: 12px;
}

.venue-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--emerald-800);
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(17, 52, 43, 0.08);
}

.map-frame {
    position: relative;
    height: 225px;
    border-radius: 4px;
    overflow: hidden;
    border: 1.5px solid rgba(165, 126, 50, 0.45);
    box-shadow: 0 12px 26px rgba(11, 36, 30, 0.12);
    margin-bottom: 20px;
    background: var(--ivory-300);
}

.map-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    filter: sepia(14%) saturate(88%) contrast(102%);
    transition: filter 0.35s ease;
}

.map-frame:hover iframe {
    filter: none;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.btn-gold-solid,
.btn-gold-outline,
.btn-emerald-solid,
.btn-emerald-outline {
    flex: 1 1 170px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: transform 0.25s var(--ease-couture), box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.btn-gold-solid ion-icon,
.btn-gold-outline ion-icon,
.btn-emerald-solid ion-icon,
.btn-emerald-outline ion-icon {
    font-size: 1.15rem;
}

.btn-gold-solid {
    background: linear-gradient(135deg, #E3C784 0%, #C49B46 100%);
    color: var(--emerald-950);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.btn-gold-solid:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.38);
}

.btn-gold-outline {
    border: 1px solid var(--gold-hairline-strong);
    color: var(--gold-200);
    background: rgba(200, 160, 77, 0.06);
}

.btn-gold-outline:hover {
    transform: translateY(-2px);
    background: rgba(200, 160, 77, 0.16);
}

.btn-emerald-solid {
    background: linear-gradient(135deg, var(--emerald-800), var(--emerald-950));
    color: var(--gold-200);
    border: 1px solid var(--gold-500);
    box-shadow: 0 8px 20px rgba(11, 36, 30, 0.22);
}

.btn-emerald-solid:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, var(--emerald-700), var(--emerald-900));
}

.btn-emerald-outline {
    border: 1px solid rgba(17, 52, 43, 0.35);
    color: var(--emerald-900);
    background: transparent;
}

.btn-emerald-outline:hover {
    transform: translateY(-2px);
    background: rgba(17, 52, 43, 0.07);
    border-color: var(--emerald-900);
}

/* ==========================================================================
   CLOSING FOOTER & DEVELOPER SIGNATURE
   ========================================================================== */

.closing-footer {
    text-align: center;
    padding: 20px 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.closing-monogram {
    font-family: var(--font-display);
    font-size: 2.1rem;
    color: var(--gold-300);
    letter-spacing: 2px;
}

.closing-wish {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--ivory-200);
    max-width: 340px;
}

.replay-envelope-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--gold-hairline);
    background: rgba(17, 52, 43, 0.55);
    color: var(--gold-200);
    font-size: 0.82rem;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.replay-envelope-btn:hover {
    background: rgba(24, 70, 58, 0.85);
    transform: translateY(-1px);
}

.developer-signature {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(7, 25, 20, 0.65);
    border: 1px solid rgba(222, 192, 122, 0.22);
    font-size: 0.74rem;
    color: var(--ink-light-muted);
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.developer-signature:hover {
    border-color: var(--gold-300);
    transform: translateY(-1px);
}

.dev-by {
    opacity: 0.75;
}

.dev-name {
    color: var(--ivory-100);
    font-weight: 600;
}

.dev-sep {
    color: var(--gold-400);
}

.dev-phone {
    color: var(--gold-300);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   FLOATING BOTTOM NAVIGATION CAPSULE & TOAST
   ========================================================================== */

.nav-spacer {
    height: 86px;
}

.bottom-nav {
    position: fixed;
    bottom: max(18px, env(safe-area-inset-bottom, 18px));
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 340px);
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(7, 25, 20, 0.86);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--gold-hairline-strong);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.48);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    z-index: 200;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 999px;
    color: rgba(244, 239, 229, 0.62);
    font-size: 0.72rem;
    font-weight: 500;
    transition: color 0.25s ease, background-color 0.25s ease;
}

.nav-item ion-icon {
    font-size: 1.25rem;
}

.nav-item.active {
    color: var(--gold-200);
    background: rgba(200, 160, 77, 0.16);
}

.toast-banner {
    position: fixed;
    bottom: 92px;
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: var(--ivory-100);
    color: var(--emerald-950);
    border: 1px solid var(--gold-400);
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    z-index: 300;
    transition: opacity 0.3s ease, transform 0.3s var(--ease-couture);
}

.toast-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   RESPONSIVE & REDUCED MOTION
   ========================================================================== */

@media (max-width: 400px) {
    .editorial-column {
        padding: 66px 12px 24px;
    }

    .sheet-inner-frame {
        padding: 30px 16px 28px;
    }

    .emerald-panel {
        padding: 30px 16px 26px;
    }

    .date-big-num {
        font-size: 2.85rem;
    }

    .cd-num {
        font-size: 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
