/* Motion of the public pages (partials/motion.blade.php): the home, the hosting, mailbox and WordPress offers, the rented
   site, the templates, the custom website offers, the service pages (domain…), the knowledge base, the contact page, the
   Offre Découverte and the hosting guides (seo/landing: /hebergement-web-pas-cher, /hebergement-site-vitrine…).
   What opens a page rises in on load, CSS alone; js/motion.js adds .motion-reveal to the blocks still below the fold and
   .is-visible when they come into view, which also takes them out of their load entrance (:not(.motion-reveal)). So
   nothing is hidden without the script, nor for blocks already on screen. Animations only fill backwards with opacity,
   translate and scale, so hover effects and the layout stay as they are; none of it runs with reduced motion. The
   home's own scenes stay in css/home.css. */

@media (prefers-reduced-motion: no-preference) {
    :root {
        --motion-ease: cubic-bezier(0.2, 0.75, 0.25, 1);
    }

    .motion-reveal:not(.is-visible) {
        opacity: 0;
    }

    .motion-reveal.is-visible {
        animation: motion-rise 0.8s var(--motion-ease) var(--reveal-delay, 0s) backwards;
    }

    /* Heroes: back link, kicker, title, lead and actions one after the other, then what stands beside them. */
    :is(.offer-hero, .service-page-copy, .guide-hero, .contact-hero-copy, .free-hosting-copy, .comparison-hero) > :not(.offer-hero-orbit),
    :is(.guide-shell, .comparison-shell) > .back-link,
    .free-hosting-visual,
    .comparison-shell > .plans > .plan:not(.motion-reveal),
    .guide-filter-bar,
    .service-page-card,
    .contact-visual > *,
    .offer-hero ~ .offer-container > .offer-nav:not(.motion-reveal),
    .offer-hero ~ .offer-container .offer-family > .offer-section-heading:not(.motion-reveal),
    .offer-hero ~ .offer-container .offer-grid > .offer-card:not(.motion-reveal),
    .service-page-section > .section-heading:not(.motion-reveal),
    .template-catalog-sidebar:not(.motion-reveal),
    .template-catalog-grid > .template-theme-card:not(.motion-reveal),
    .guide-level-heading:not(.motion-reveal),
    .guide-grid > .guide-card:not(.motion-reveal),
    .contact-section-heading:not(.motion-reveal) {
        animation: motion-rise 0.8s var(--motion-ease) var(--enter, 0s) backwards;
    }

    :is(.offer-hero, .service-page-copy, .guide-hero, .contact-hero-copy, .free-hosting-copy, .comparison-hero) > :nth-child(2) {
        --enter: 0.08s;
    }

    :is(.offer-hero, .service-page-copy, .guide-hero, .contact-hero-copy, .free-hosting-copy, .comparison-hero) > :nth-child(3) {
        --enter: 0.16s;
    }

    :is(.offer-hero, .service-page-copy, .guide-hero, .contact-hero-copy, .free-hosting-copy, .comparison-hero) > :nth-child(4) {
        --enter: 0.24s;
    }

    :is(.offer-hero, .service-page-copy, .guide-hero, .contact-hero-copy, .free-hosting-copy, .comparison-hero) > :nth-child(5) {
        --enter: 0.32s;
    }

    :is(.offer-hero, .service-page-copy, .guide-hero, .contact-hero-copy, .free-hosting-copy, .comparison-hero) > :nth-child(n + 6) {
        --enter: 0.4s;
    }

    .guide-hero > * {
        --enter: 0.08s;
    }

    .guide-hero > :nth-child(2) {
        --enter: 0.16s;
    }

    .guide-hero > :nth-child(n + 3) {
        --enter: 0.24s;
    }

    .guide-filter-bar {
        --enter: 0.34s;
    }

    .service-page-card,
    .contact-visual > .contact-console {
        --enter: 0.2s;
    }

    .offer-hero ~ .offer-container > .offer-nav,
    .template-catalog-sidebar {
        --enter: 0.36s;
    }

    .offer-hero ~ .offer-container .offer-family > .offer-section-heading,
    .service-page-section > .section-heading,
    .guide-level-heading,
    .contact-section-heading {
        --enter: 0.42s;
    }

    :is(.offer-grid > .offer-card, .template-catalog-grid > .template-theme-card, .guide-grid > .guide-card):nth-child(1) {
        --enter: 0.48s;
    }

    :is(.offer-grid > .offer-card, .template-catalog-grid > .template-theme-card, .guide-grid > .guide-card):nth-child(2) {
        --enter: 0.56s;
    }

    :is(.offer-grid > .offer-card, .template-catalog-grid > .template-theme-card, .guide-grid > .guide-card):nth-child(3) {
        --enter: 0.64s;
    }

    :is(.offer-grid > .offer-card, .template-catalog-grid > .template-theme-card, .guide-grid > .guide-card):nth-child(n + 4) {
        --enter: 0.72s;
    }

    /* The blue ring of the offer heroes swells in, then breathes. */
    .offer-hero-orbit {
        animation: motion-pop 1s var(--motion-ease) 0.3s backwards, motion-breathe 7s ease-in-out 1.3s infinite alternate;
    }

    /* Offer pages already entered in this tab (.offer-hero-seen, set by storefront/offers/page.blade.php): the hero and
       the family tabs stay still, the ring only breathes, and the family's heading and cards, which change from one
       page to the other, come in right away. */
    :root.offer-hero-seen .offer-hero > :not(.offer-hero-orbit),
    :root.offer-hero-seen .offer-hero ~ .offer-container > .offer-nav {
        animation: none;
    }

    :root.offer-hero-seen .offer-hero > .offer-hero-orbit {
        animation: motion-breathe 7s ease-in-out infinite alternate;
    }

    :root.offer-hero-seen .offer-hero ~ .offer-container .offer-family > .offer-section-heading {
        --enter: 0s;
    }

    :root.offer-hero-seen .offer-hero ~ .offer-container .offer-grid > .offer-card:nth-child(1) {
        --enter: 0.08s;
    }

    :root.offer-hero-seen .offer-hero ~ .offer-container .offer-grid > .offer-card:nth-child(2) {
        --enter: 0.16s;
    }

    :root.offer-hero-seen .offer-hero ~ .offer-container .offer-grid > .offer-card:nth-child(3) {
        --enter: 0.24s;
    }

    :root.offer-hero-seen .offer-hero ~ .offer-container .offer-grid > .offer-card:nth-child(n + 4) {
        --enter: 0.32s;
    }

    /* The service card: its icon pops, its highlights follow one another. */
    .service-page-icon {
        animation: motion-pop 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 0.6s backwards;
    }

    .service-page-card dl > div {
        animation: motion-rise-short 0.6s var(--motion-ease) var(--enter, 0.7s) backwards;
    }

    .service-page-card dl > div:nth-child(2) {
        --enter: 0.78s;
    }

    .service-page-card dl > div:nth-child(n + 3) {
        --enter: 0.86s;
    }

    /* Contact: the trust points pop, the console floats, the note slides in from the side. */
    .contact-trust-points span {
        animation: motion-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) var(--enter, 0.6s) backwards;
    }

    .contact-trust-points span:nth-child(2) {
        --enter: 0.7s;
    }

    .contact-trust-points span:nth-child(3) {
        --enter: 0.8s;
    }

    .contact-visual > .contact-console {
        animation: motion-rise 0.8s var(--motion-ease) 0.2s backwards, motion-float 7s ease-in-out 1.6s infinite alternate;
    }

    .contact-mini-card {
        animation: motion-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 0.75s backwards;
    }

    .contact-mini-card:nth-child(2) {
        animation-delay: 0.85s;
    }

    .contact-visual > .contact-floating-note {
        animation: motion-slide 0.8s var(--motion-ease) 0.55s backwards;
    }

    .contact-dialog[open] {
        animation: motion-dialog 0.28s var(--motion-ease);
    }

    .contact-dialog[open]::backdrop {
        animation: motion-fade 0.28s ease;
    }

    /* Offre Découverte: the window follows the text, its bar lights its three dots, its figures come one after the
       other, then it floats; the proof points pop; each step's number pops as the step comes in. */
    .free-hosting-visual {
        --enter: 0.2s;
    }

    .free-hosting-window {
        animation: motion-float 7s ease-in-out 1.8s infinite alternate;
    }

    .free-hosting-window-bar span {
        animation: motion-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) var(--enter, 0.6s) backwards;
    }

    .free-hosting-window-bar span:nth-child(2) {
        --enter: 0.68s;
    }

    .free-hosting-window-bar span:nth-child(3) {
        --enter: 0.76s;
    }

    .free-hosting-mini-stats > div {
        animation: motion-rise-short 0.6s var(--motion-ease) var(--enter, 0.8s) backwards;
    }

    .free-hosting-mini-stats > div:nth-child(2) {
        --enter: 0.88s;
    }

    .free-hosting-mini-stats > div:nth-child(n + 3) {
        --enter: 0.96s;
    }

    .free-hosting-proof-list li {
        animation: motion-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) var(--enter, 0.7s) backwards;
    }

    .free-hosting-proof-list li:nth-child(2) {
        --enter: 0.78s;
    }

    .free-hosting-proof-list li:nth-child(n + 3) {
        --enter: 0.86s;
    }

    .discovery-steps > li.is-visible small {
        animation: motion-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) calc(var(--reveal-delay, 0s) + 0.3s) backwards;
    }

    /* Hosting guides: the cards under the heading follow it on load, the « Recommandé » corner pops as its card comes in. */
    .comparison-shell > .plans > .plan:nth-child(1) {
        --enter: 0.4s;
    }

    .comparison-shell > .plans > .plan:nth-child(2) {
        --enter: 0.48s;
    }

    .comparison-shell > .plans > .plan:nth-child(n + 3) {
        --enter: 0.56s;
    }

    .seo-landing-section .plan.is-visible .label-corner {
        animation: motion-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) calc(var(--reveal-delay, 0s) + 0.35s) backwards;
    }

    /* The cards lift a little under the pointer, like the offer cards. */
    .service-feature-card,
    .template-theme-card,
    .guide-card,
    .contact-channel-card,
    .contact-guide-card,
    .discovery-included-grid > article,
    .discovery-use-list > article,
    .discovery-steps > li,
    :is(.comparison-shell, .seo-landing-section) .plans > .plan {
        transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
    }

    @media (hover: hover) and (pointer: fine) {
        .offer-hero ~ .offer-container .offer-card:hover,
        .service-feature-card:hover,
        .template-theme-card:hover,
        .guide-card:hover,
        .contact-channel-card:hover,
        .contact-guide-card:hover,
        .discovery-included-grid > article:hover,
        .discovery-use-list > article:hover,
        .discovery-steps > li:hover,
        :is(.comparison-shell, .seo-landing-section) .plans > .plan:hover {
            box-shadow: 0 18px 40px rgba(14, 21, 37, 0.09);
            transform: translateY(-4px);
        }
    }
}

@media print {
    .motion-reveal:not(.is-visible) {
        opacity: 1;
    }
}

@keyframes motion-rise {
    from {
        opacity: 0;
        translate: 0 26px;
    }
}

@keyframes motion-rise-short {
    from {
        opacity: 0;
        translate: 0 12px;
    }
}

@keyframes motion-slide {
    from {
        opacity: 0;
        translate: 32px 0;
    }
}

@keyframes motion-fade {
    from {
        opacity: 0;
    }
}

@keyframes motion-pop {
    from {
        opacity: 0;
        scale: 0.6;
    }
}

@keyframes motion-breathe {
    to {
        scale: 1.1;
    }
}

@keyframes motion-float {
    to {
        translate: 0 -8px;
    }
}

@keyframes motion-dialog {
    from {
        opacity: 0;
        translate: 0 16px;
        scale: 0.98;
    }
}
