/**
 * Shared Hero Slideshow
 */

:root {
    --hero-radial-gradient: radial-gradient(
        ellipse 85% 90% at left bottom,
        rgb(0 0 0 / 78%) 0%,
        rgb(0 0 0 / 58%) 30%,
        rgb(0 0 0 / 32%) 58%,
        transparent 100%
    );
    --project-hero-gradient: linear-gradient(
        90deg,
        rgb(0 0 0 / 42%) 0%,
        rgb(0 0 0 / 12%) 48%,
        rgb(0 0 0 / 5%) 100%
    );
}

#hero-section {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

#hero-section::after {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--hero-radial-gradient);
    content: "";
    pointer-events: none;
}

/*
 * Divi's existing section background remains underneath as the fallback.
 */
#hero-section .hero-slideshow {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

#hero-section .hero-slideshow__image {
    position: absolute;
    inset: -5%;
    display: block;
    width: 110%;
    max-width: none;
    height: 110%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1);
    transform-origin: center center;
    transition: opacity 1.5s ease;
    will-change: opacity, transform;
}

#hero-section .hero-slideshow__image.is-visible {
    opacity: 1;
}

#hero-section .hero-slideshow__image.is-active {
    animation-duration: 9s;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

#hero-section .hero-slideshow__image:nth-child(4n + 1).is-active {
    animation-name: hero-ken-burns-right;
}

#hero-section .hero-slideshow__image:nth-child(4n + 2).is-active {
    animation-name: hero-ken-burns-left;
}

#hero-section .hero-slideshow__image:nth-child(4n + 3).is-active {
    animation-name: hero-ken-burns-down;
}

#hero-section .hero-slideshow__image:nth-child(4n + 4).is-active {
    animation-name: hero-ken-burns-up;
}

@keyframes hero-ken-burns-right {
    from {
        transform: scale(1.02) translate3d(-1.5%, 0, 0);
    }

    to {
        transform: scale(1.14) translate3d(1.5%, 0, 0);
    }
}

@keyframes hero-ken-burns-left {
    from {
        transform: scale(1.02) translate3d(1.5%, 0, 0);
    }

    to {
        transform: scale(1.14) translate3d(-1.5%, 0, 0);
    }
}

@keyframes hero-ken-burns-down {
    from {
        transform: scale(1.02) translate3d(0, -1.5%, 0);
    }

    to {
        transform: scale(1.14) translate3d(0, 1.5%, 0);
    }
}

@keyframes hero-ken-burns-up {
    from {
        transform: scale(1.02) translate3d(0, 1.5%, 0);
    }

    to {
        transform: scale(1.14) translate3d(0, -1.5%, 0);
    }
}

html.hero-slideshow-paused #hero-section .hero-slideshow__image.is-active {
    animation-play-state: paused;
}

/*
 * Keep Divi's section content above the slideshow layers.
 */
#hero-section > .et_pb_row,
#hero-section > .et_pb_row_inner,
#hero-section > .et_pb_module,
#hero-section > .project-hero__inner {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    #hero-section .hero-slideshow__image.is-active {
        animation: none;
    }

    #hero-section .hero-slideshow__image {
        transition-duration: 0.2s;
    }
}
