/* Des mouvements doux, actifs uniquement quand la section est à l’écran. */
#invitation #presence { overflow: clip; }
#invitation #presence::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: -15%;
    border-radius: 50%;
    background: radial-gradient(ellipse, #e4ce9c52 0%, #f4ead933 35%, transparent 65%);
    pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
    .motion-active .greeting-active .envelope-caption {
        animation: greeting-enter .9s .4s both;
    }
    .motion-active #invitation #presence::before {
        animation: confirmation-light 14s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active #invitation #closing {
        animation: closing-drape 26s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active #invitation #closing .closing-monogram {
        animation: monogram-float 7s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active #invitation #welcome.motion-in-view .intro-corner {
        animation: arabesque-arrive 1.6s ease-out both;
    }
    .motion-active #invitation #welcome.motion-in-view .corner-bottom-right {
        animation-delay: .2s;
    }
    .motion-active #invitation #presence.motion-in-view::before,
    .motion-active #invitation #closing.motion-in-view,
    .motion-active #invitation #closing.motion-in-view .closing-monogram {
        animation-play-state: running;
    }
}

/* Les propriétés individuelles laissent intacte la transition d’apparition. */
@keyframes monogram-float {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -6px; }
}
@keyframes closing-drape {
    0%, 100% { background-position: center, 46% center; }
    50% { background-position: center, 54% center; }
}
@keyframes confirmation-light {
    0%, 100% { opacity: .4; transform: translate(-4%, -3%) scale(.96); }
    50% { opacity: .9; transform: translate(4%, 3%) scale(1.04); }
}
@keyframes arabesque-arrive {
    from { opacity: 0; translate: 0 12px; }
    to { opacity: .9; translate: 0 0; }
}

/* Poussière d’or et faisceau de lumière, derrière le contenu de chaque écran. */
#envelope-cover > .wow-atmosphere,
#cover > .wow-atmosphere,
#invitation :is(#welcome, .count-section, #reception, #presence, #closing) > .wow-atmosphere {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
}
#envelope-cover .envelope-caption { position: relative; z-index: 1; }
#cover .cover-inner { z-index: 1; }
.wow-atmosphere::after {
    content: '';
    position: absolute;
    inset: -35%;
    background: linear-gradient(115deg, transparent 40%, #d7b66e08 45%, #fff8e6a6 50%, #d7b66e0d 55%, transparent 60%);
    opacity: 0;
}
.wow-particle {
    position: absolute;
    left: var(--dust-x);
    top: var(--dust-y);
    width: var(--dust-size);
    height: var(--dust-size);
    border-radius: 50%;
    background: #b38b43;
    box-shadow: 0 0 12px 2px #d9b36650;
    opacity: 0;
}
.wow-star {
    border-radius: 0;
    background: #b28a44;
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
.wow-action { position: relative; overflow: hidden; }
.wow-action::after {
    content: '';
    position: absolute;
    inset: -50% auto -50% -45%;
    width: 30%;
    background: linear-gradient(100deg, transparent, #fff9e9a6, transparent);
    pointer-events: none;
    opacity: 0;
    transform: skewX(-18deg) translateX(-200%);
}

@media (prefers-reduced-motion: no-preference) {
    .motion-active #envelope-cover > .wow-atmosphere,
    .motion-active #cover > .wow-atmosphere,
    .motion-active #invitation :is(#welcome, .count-section, #reception, #presence, #closing) > .wow-atmosphere {
        display: block;
    }
    .motion-active .wow-atmosphere::after {
        animation: wow-light-pass 13s -8.4s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active .wow-particle {
        animation: wow-gold-drift var(--dust-duration) var(--dust-delay) ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active .wow-action::after {
        animation: wow-button-shine 7s -4.7s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active .motion-in-view > .wow-atmosphere::after,
    .motion-active .motion-in-view .wow-particle,
    .motion-active .motion-in-view .wow-action::after {
        animation-play-state: running;
    }
    .motion-active .wow-entered .wow-reveal {
        animation: wow-rise 1.15s var(--wow-delay, 0ms) cubic-bezier(.16, 1, .3, 1) both;
    }
    .motion-active #welcome.wow-entered .wow-reveal {
        animation-name: wow-side-arrive;
        --wow-side: -28px;
    }
    .motion-active #welcome.wow-entered .wow-reveal:nth-child(even) { --wow-side: 28px; }
    .motion-active #welcome.wow-entered .wedding-announcement,
    .motion-active #closing.wow-entered .signature {
        animation-name: wow-calligraphy;
        animation-duration: 1.5s;
    }
    body.motion-active #cover.wow-entered .cover-inner > .wow-reveal {
        animation: wow-rise 1.4s var(--wow-delay, 0ms) cubic-bezier(.16, 1, .3, 1) both;
    }
    body.motion-active #cover.wow-entered .cover-inner > :is(.bismillah, .quran-verse) {
        animation-name: wow-soft-arrive;
    }
    body.motion-active #cover.wow-entered .cover-inner > h1 {
        animation-name: wow-calligraphy;
        animation-duration: 1.8s;
    }
    .motion-active .count-section.wow-entered .countdown > div {
        animation-name: wow-count-arrive;
        animation-duration: 1.3s;
    }
    .motion-active .count-section .countdown b {
        animation: wow-count-glow 5s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active .count-section.motion-in-view .countdown b { animation-play-state: running; }
    .motion-active #reception .courtyard img {
        animation: wow-photo-depth 16s ease-in-out infinite;
        animation-play-state: paused;
    }
    .motion-active #reception.motion-in-view .courtyard img { animation-play-state: running; }
    .motion-active #presence.wow-entered .rsvp-card {
        animation-name: wow-card-arrive;
        animation-duration: 1.4s;
    }
    .motion-active #invitation #closing.wow-entered .closing-monogram {
        animation: wow-monogram-arrive 1.6s cubic-bezier(.16, 1, .3, 1) both, monogram-float 7s ease-in-out infinite;
    }
    .motion-active #envelope-cover.unsealed {
        animation: wow-envelope-open .95s cubic-bezier(.4, 0, .2, 1) both;
    }
    .motion-active #envelope-cover.unsealed .envelope-artwork {
        animation: wow-envelope-lift .95s cubic-bezier(.4, 0, .2, 1) both;
    }
    .motion-active #envelope-cover.unsealed .wow-atmosphere::after {
        animation: wow-opening-light .95s ease-out both;
    }
    /* Un contrôle au clavier reste toujours immédiatement visible. */
    .motion-active .wow-reveal:has(:focus),
    .motion-active .wow-reveal:is(a, button, summary, input, select, textarea):focus {
        animation: none !important;
        opacity: 1;
        transform: none;
        filter: none;
        clip-path: none;
    }
    @media (hover: hover) {
        .motion-active .wow-action { transition: translate .3s ease, box-shadow .3s ease; }
        .motion-active .wow-action:hover {
            translate: 0 -3px;
            box-shadow: 0 8px 24px #9d7b3326;
        }
    }
}
@keyframes wow-rise {
    from { opacity: 0; transform: translateY(40px) scale(.96); filter: blur(5px); }
    to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes wow-soft-arrive {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}
@keyframes wow-side-arrive {
    from { opacity: 0; transform: translate(var(--wow-side), 18px); filter: blur(4px); }
    to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes wow-calligraphy {
    from { opacity: 0; clip-path: inset(-25% 50%); transform: translateY(14px) scale(1.04); }
    to { opacity: 1; clip-path: inset(-25% -10%); transform: none; }
}
@keyframes wow-count-arrive {
    0% { opacity: 0; transform: perspective(600px) rotateX(-45deg) translateY(44px) scale(.8); }
    70% { opacity: 1; transform: perspective(600px) rotateX(5deg) translateY(-4px) scale(1.03); }
    100% { opacity: 1; transform: none; }
}
@keyframes wow-card-arrive {
    from { opacity: 0; transform: perspective(900px) rotateX(9deg) translateY(48px) scale(.94); }
    to { opacity: 1; transform: none; }
}
@keyframes wow-monogram-arrive {
    from { opacity: 0; transform: rotate(-12deg) scale(.65); filter: blur(7px) brightness(1.4); }
    to { opacity: 1; transform: none; filter: blur(0) brightness(1); }
}
@keyframes wow-gold-drift {
    0%, 100% { opacity: 0; transform: translate3d(-5px, 20px, 0) scale(.5); }
    25% { opacity: .6; }
    65% { opacity: .35; }
    80% { opacity: 0; transform: translate3d(14px, -60px, 0) scale(1.1); }
}
@keyframes wow-light-pass {
    0%, 65%, 100% { opacity: 0; transform: translateX(-55%); }
    72% { opacity: .65; }
    88% { opacity: 0; transform: translateX(55%); }
}
@keyframes wow-button-shine {
    0%, 72%, 100% { opacity: 0; transform: skewX(-18deg) translateX(-200%); }
    76% { opacity: .7; }
    90% { opacity: 0; transform: skewX(-18deg) translateX(650%); }
}
@keyframes wow-count-glow {
    0%, 100% { text-shadow: 0 0 0 #c9a35600; }
    50% { text-shadow: 0 0 24px #c9a35666, 0 2px 1px #fff9; }
}
@keyframes wow-photo-depth {
    0%, 100% { transform: scale(1.05) translateX(-.5%); }
    50% { transform: scale(1.13) translateX(.5%); }
}
@keyframes wow-envelope-lift {
    0% { transform: none; filter: brightness(1); }
    55% { transform: translateY(-18px) scale(1.06); filter: brightness(1.08); }
    100% { transform: translateY(-42px) scale(1.16); filter: brightness(1.2); }
}
@keyframes wow-envelope-open {
    0%, 50% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes wow-opening-light {
    0% { opacity: 0; transform: translateX(-45%); }
    50% { opacity: 1; }
    100% { opacity: 0; transform: translateX(45%); }
}
