/* =========================================================
   Multiplinum — animations & effets visuels
   ========================================================= */

html {
    scroll-behavior: smooth;
}

/* ---------- Apparition des sections au défilement ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
}

main section.revealed {
    animation: fadeUp .8s cubic-bezier(.16, 1, .3, 1) both;
}

/* ---------- Cartes : léger soulèvement au survol ---------- */
main article {
    transition: transform .35s cubic-bezier(.16, 1, .3, 1), box-shadow .35s ease;
}

main article:hover {
    transform: translateY(-6px);
}

/* ---------- Boutons brillants ---------- */
@keyframes btnShine {
    0%, 15%   { transform: translateX(0) skewX(-20deg); }
    60%, 100% { transform: translateX(560%) skewX(-20deg); }
}

@keyframes btnGlow {
    0%, 100% { box-shadow: 0 8px 22px -8px rgba(31, 67, 245, .45); }
    50%      { box-shadow: 0 16px 38px -6px rgba(31, 67, 245, .75); }
}

.btn-shine,
a[class*="bg-brand-600"],
button[class*="bg-brand-600"] {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    animation: btnGlow 3.6s ease-in-out infinite;
}

.btn-shine::after,
a[class*="bg-brand-600"]::after,
button[class*="bg-brand-600"]::after {
    content: "";
    position: absolute;
    top: -25%;
    bottom: -25%;
    left: -45%;
    width: 42%;
    transform: skewX(-20deg);
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .6) 50%, rgba(255, 255, 255, 0) 100%);
    animation: btnShine 3.6s ease-in-out infinite;
    pointer-events: none;
}

/* Variante pour les boutons clairs (reflet bleu) */
.btn-shine::after {
    background: linear-gradient(100deg, rgba(31, 67, 245, 0) 0%, rgba(31, 67, 245, .32) 50%, rgba(31, 67, 245, 0) 100%);
}

/* ---------- Photo du hero : flottement + halo lumineux ---------- */
@keyframes heroFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-14px) rotate(-.7deg); }
}

@keyframes heroGlow {
    0%, 100% { filter: drop-shadow(0 14px 30px rgba(31, 67, 245, .22)); }
    50%      { filter: drop-shadow(0 26px 60px rgba(31, 67, 245, .55)); }
}

img[src$="hero.avif"] {
    animation: heroFloat 7s ease-in-out infinite, heroGlow 4.5s ease-in-out infinite;
    will-change: transform, filter;
}

/* ---------- Fenêtre modale « Demander un devis » ---------- */
#quoteModal {
    position: fixed;
    inset: 0;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease, visibility 0s linear .65s;
}

#quoteModal.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .28s ease, visibility 0s linear 0s;
}

/* La feuille descend du haut de l'écran */
#quoteSheet {
    transform: translateY(-115%);
    transition: transform .6s cubic-bezier(.16, 1, .3, 1);
    will-change: transform;
}

#quoteModal.is-open #quoteSheet {
    transform: translateY(0);
}

/* ---------- Bouton fermer animé ---------- */
@keyframes closePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(31, 67, 245, .35); }
    50%      { box-shadow: 0 0 0 9px rgba(31, 67, 245, 0); }
}

#quoteClose {
    animation: closePulse 2.6s ease-in-out infinite;
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), background-color .25s ease, color .25s ease, box-shadow .25s ease;
}

#quoteClose:hover,
#quoteClose:focus-visible {
    transform: rotate(90deg) scale(1.08);
    background-color: #1f43f5;
    color: #ffffff;
    box-shadow: 0 10px 24px -6px rgba(31, 67, 245, .65);
}

#quoteClose:active {
    transform: rotate(180deg) scale(.92);
}

/* ---------- Blocage du défilement quand la modale est ouverte ---------- */
body.no-scroll {
    overflow: hidden;
}

/* ---------- Respect des préférences d'accessibilité ---------- */
@media (prefers-reduced-motion: reduce) {
    main section.revealed,
    img[src$="hero.avif"],
    .btn-shine,
    a[class*="bg-brand-600"],
    button[class*="bg-brand-600"],
    .btn-shine::after,
    a[class*="bg-brand-600"]::after,
    button[class*="bg-brand-600"]::after,
    #quoteClose {
        animation: none;
    }

    #quoteSheet {
        transition: none;
    }
}

/* ---------- Bouton WhatsApp flottant (bas droite) ---------- */
@keyframes waBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* Ondes concentriques qui se propagent autour du bouton */
@keyframes waWave {
    0% {
        box-shadow: 0 10px 26px -8px rgba(37, 211, 102, .70),
                    0 0 0 0 rgba(37, 211, 102, .55),
                    0 0 0 0 rgba(37, 211, 102, .35);
    }
    100% {
        box-shadow: 0 10px 26px -8px rgba(37, 211, 102, .70),
                    0 0 0 14px rgba(37, 211, 102, 0),
                    0 0 0 30px rgba(37, 211, 102, 0);
    }
}

.wa-float {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 9999px;
    background-color: #25d366;
    color: #ffffff;
    text-decoration: none;
    isolation: isolate;
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background-color .25s ease, box-shadow .3s ease;
    animation: waBob 3.2s ease-in-out infinite, waWave 2.4s ease-out infinite;
    will-change: transform, box-shadow;
}

.wa-float__icon {
    width: 1.9rem;
    height: 1.9rem;
    display: block;
}

.wa-float:hover,
.wa-float:focus-visible {
    background-color: #1ebe5b;
    transform: scale(1.1);
    animation: waWave 1.6s ease-out infinite;
    outline: none;
}

.wa-float:active {
    transform: scale(.96);
}

@media (min-width: 640px) {
    .wa-float {
        right: 1.75rem;
        bottom: 1.75rem;
        width: 4rem;
        height: 4rem;
    }

    .wa-float__icon {
        width: 2.1rem;
        height: 2.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-float,
    .wa-float:hover,
    .wa-float:focus-visible {
        animation: none;
        box-shadow: 0 10px 26px -8px rgba(37, 211, 102, .70);
    }
}

/* =========================================================
   Menu mobile — icône hamburger animée (onde + rotation)
   ========================================================= */

#menuBtn {
    position: relative;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
    transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), background-color .3s ease;
}

#menuBtn:active {
    transform: scale(.9);
}

/* Onde « burst » déclenchée à chaque clic */
#menuBtn::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 9999px;
    border: 2px solid rgba(31, 67, 245, .55);
    opacity: 0;
    pointer-events: none;
}

#menuBtn.is-active::after {
    animation: menuBurst .75s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes menuBurst {
    0%   { opacity: .95; transform: scale(.45); border-width: 3px; }
    100% { opacity: 0;   transform: scale(2.1); border-width: 1px; }
}

/* Les trois traits */
.menu-toggle__box {
    position: relative;
    display: block;
    width: 1.5rem;
    height: 1.5rem;
    transition: transform .5s cubic-bezier(.68, -.55, .27, 1.55);
}

#menuBtn.is-active .menu-toggle__box {
    animation: menuFlip .65s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes menuFlip {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(200deg) scale(1.2); }
    100% { transform: rotate(180deg) scale(1); }
}

.menu-toggle__bar {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 9999px;
    background-color: #0b1020;
    transform-origin: center;
    transition: top .35s ease, width .35s ease, opacity .25s ease,
                transform .45s cubic-bezier(.68, -.55, .27, 1.55),
                background-color .3s ease;
}

.menu-toggle__bar:nth-child(1) { top: 4px; }
.menu-toggle__bar:nth-child(2) { top: 11px; width: 72%; }
.menu-toggle__bar:nth-child(3) { top: 18px; }

#menuBtn:hover .menu-toggle__bar {
    background-color: #1f43f5;
}

#menuBtn.is-active .menu-toggle__bar {
    background-color: #1f43f5;
}

#menuBtn.is-active .menu-toggle__bar:nth-child(1) {
    top: 11px;
    transform: rotate(45deg);
}

#menuBtn.is-active .menu-toggle__bar:nth-child(2) {
    top: 11px;
    width: 100%;
    opacity: 0;
    transform: scaleX(0);
}

#menuBtn.is-active .menu-toggle__bar:nth-child(3) {
    top: 11px;
    transform: rotate(-45deg);
}

/* ---------- Panneau mobile : entrée en cascade ---------- */
#mobileMenu {
    overflow: hidden;
}

#mobileMenu.is-open .menu-item {
    animation: menuItemIn .5s cubic-bezier(.16, 1, .3, 1) both;
}

#mobileMenu.is-open .menu-item:nth-child(1) { animation-delay: .04s; }
#mobileMenu.is-open .menu-item:nth-child(2) { animation-delay: .09s; }
#mobileMenu.is-open .menu-item:nth-child(3) { animation-delay: .14s; }
#mobileMenu.is-open .menu-item:nth-child(4) { animation-delay: .19s; }
#mobileMenu.is-open .menu-item:nth-child(5) { animation-delay: .24s; }
#mobileMenu.is-open .menu-item:nth-child(6) { animation-delay: .29s; }

@keyframes menuItemIn {
    from { opacity: 0; transform: translateY(-16px) scale(.94); }
    to   { opacity: 1; transform: none; }
}

#mobileMenu.is-closing .menu-item {
    animation: menuItemOut .22s ease-in both;
}

@keyframes menuItemOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(-12px) scale(.96); }
}

@media (prefers-reduced-motion: reduce) {
    #menuBtn::after,
    #menuBtn.is-active .menu-toggle__box,
    #mobileMenu.is-open .menu-item,
    #mobileMenu.is-closing .menu-item {
        animation: none;
    }

    #menuBtn,
    .menu-toggle__box,
    .menu-toggle__bar {
        transition: none;
    }
}
