.hero-carousel {
    --hero-height: 600px;
    --carousel-wipe-slant: calc(var(--hero-height) * 0.364);
    --carousel-wipe-half-slant: calc(var(--hero-height) * 0.182);
    position: relative;
    clear: both;
    height: var(--hero-height);
    overflow: hidden;
    background: #40678e;
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

.carousel-slide.is-active {
    z-index: 1;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.carousel-slide.is-exiting {
    visibility: visible;
}

.carousel-image,
.carousel-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-background {
    display: none;
    filter: blur(10px) brightness(30%);
    transform: scale(1.05);
}

.carousel-slide.is-contained .carousel-background {
    display: block;
}

.carousel-slide.is-contained .carousel-image {
    object-fit: contain;
}

.carousel-slide.align-top .carousel-image,
.carousel-slide.align-top .carousel-background {
    object-position: center top;
}

.carousel-slide.align-bottom .carousel-image,
.carousel-slide.align-bottom .carousel-background {
    object-position: center bottom;
}

.carousel-controls {
    position: absolute;
    z-index: 3;
    inset: 0;
    pointer-events: none;
}

.carousel-controls button {
    position: absolute;
    top: 50%;
    display: grid;
    width: 3rem;
    height: 3rem;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font: inherit;
    cursor: pointer;
    pointer-events: auto;
    transform: translateY(-50%);
}

.carousel-controls button:hover,
.carousel-controls button:focus-visible {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-controls [data-carousel-prev] { left: 1rem; }
.carousel-controls [data-carousel-next] { right: 1rem; }

@media only screen and (max-height: 799px) {
    .hero-carousel { --hero-height: 70vh; }
}

@media only screen and (max-width: 640px) {
    .hero-carousel { --hero-height: 60vw; }
}

@media screen and (min-width: 1200px) and (orientation: landscape) {
    .hero-carousel {
        --hero-height: calc(100svh - 252px);
    }

    .carousel-slide {
        transition: none;
    }

    .carousel-slide.is-exiting {
        z-index: 0;
        opacity: 1;
    }

    .carousel-slide.is-wiping {
        animation: carousel-screen-wipe 1.5s ease both;
    }

    .carousel-wipe-shadow {
        position: absolute;
        z-index: 2;
        top: 0;
        bottom: 0;
        width: 14px;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent);
        transform: skewX(-20deg);
        pointer-events: none;
        animation: carousel-wipe-shadow 1.5s ease both;
    }
}

@keyframes carousel-screen-wipe {
    from {
        clip-path: polygon(0 0, 0 0, calc(0% - var(--carousel-wipe-slant)) 100%, 0 100%);
    }
    to {
        clip-path: polygon(0 0, calc(100% + var(--carousel-wipe-slant) * 2) 0, calc(100% + var(--carousel-wipe-slant)) 100%, 0 100%);
    }
}

@keyframes carousel-wipe-shadow {
    from { left: calc(0% - var(--carousel-wipe-half-slant) - 7px); }
    to { left: calc(100% + var(--carousel-wipe-half-slant) + var(--carousel-wipe-slant) - 7px); }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-slide { transition: none; animation: none; }
}
