/**
 * Cover Block Carousel - Frontend Styles
 */

/* Carousel container setup */
.wp-block-cover.has-carousel {
    --cbc-transition-duration: 1000ms;
}

.wp-block-cover.has-carousel .cbc-carousel-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.wp-block-cover.has-carousel .cbc-carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity var(--cbc-transition-duration) ease-in-out,
                transform var(--cbc-transition-duration) ease-in-out;
}

.wp-block-cover.has-carousel .cbc-carousel-image--active {
    opacity: 1;
    z-index: 1;
}

.wp-block-cover.has-carousel .cbc-carousel-image--leaving {
    z-index: 0;
}

.wp-block-cover.has-carousel .cbc-carousel-image--next {
    opacity: 0;
}

/* Hide the default background image when carousel is active */
.wp-block-cover.has-carousel > .wp-block-cover__image-background,
.wp-block-cover.has-carousel > video.wp-block-cover__video-background {
    opacity: 0;
}

/* Ensure content stays above carousel */
.wp-block-cover.has-carousel > .wp-block-cover__inner-container {
    z-index: 2;
    position: relative;
}

/* Ensure overlay stays above carousel images */
.wp-block-cover.has-carousel > .wp-block-cover__background,
.wp-block-cover.has-carousel > span[aria-hidden="true"] {
    z-index: 1;
}

/* ==================== */
/* Transition: Fade     */
/* ==================== */
.wp-block-cover.has-carousel.cbc-transition-fade .cbc-carousel-image {
    transform: none;
}

/* ==================== */
/* Transition: Slide Left */
/* ==================== */
.wp-block-cover.has-carousel.cbc-transition-slide-left .cbc-carousel-image {
    transform: translateX(100%);
    opacity: 1;
}

.wp-block-cover.has-carousel.cbc-transition-slide-left .cbc-carousel-image--active {
    transform: translateX(0);
}

.wp-block-cover.has-carousel.cbc-transition-slide-left .cbc-carousel-image--leaving {
    transform: translateX(-100%);
}

/* ==================== */
/* Transition: Slide Right */
/* ==================== */
.wp-block-cover.has-carousel.cbc-transition-slide-right .cbc-carousel-image {
    transform: translateX(-100%);
    opacity: 1;
}

.wp-block-cover.has-carousel.cbc-transition-slide-right .cbc-carousel-image--active {
    transform: translateX(0);
}

.wp-block-cover.has-carousel.cbc-transition-slide-right .cbc-carousel-image--leaving {
    transform: translateX(100%);
}

/* ==================== */
/* Transition: Slide Up */
/* ==================== */
.wp-block-cover.has-carousel.cbc-transition-slide-up .cbc-carousel-image {
    transform: translateY(100%);
    opacity: 1;
}

.wp-block-cover.has-carousel.cbc-transition-slide-up .cbc-carousel-image--active {
    transform: translateY(0);
}

.wp-block-cover.has-carousel.cbc-transition-slide-up .cbc-carousel-image--leaving {
    transform: translateY(-100%);
}

/* ==================== */
/* Transition: Slide Down */
/* ==================== */
.wp-block-cover.has-carousel.cbc-transition-slide-down .cbc-carousel-image {
    transform: translateY(-100%);
    opacity: 1;
}

.wp-block-cover.has-carousel.cbc-transition-slide-down .cbc-carousel-image--active {
    transform: translateY(0);
}

.wp-block-cover.has-carousel.cbc-transition-slide-down .cbc-carousel-image--leaving {
    transform: translateY(100%);
}

/* ==================== */
/* Transition: Zoom     */
/* ==================== */
.wp-block-cover.has-carousel.cbc-transition-zoom .cbc-carousel-image {
    transform: scale(1.2);
}

.wp-block-cover.has-carousel.cbc-transition-zoom .cbc-carousel-image--active {
    transform: scale(1);
}

.wp-block-cover.has-carousel.cbc-transition-zoom .cbc-carousel-image--leaving {
    transform: scale(0.8);
    opacity: 0;
}

/* ==================== */
/* Reduced Motion       */
/* ==================== */
@media (prefers-reduced-motion: reduce) {
    .wp-block-cover.has-carousel .cbc-carousel-image {
        transition: opacity 0.3s ease-in-out;
        transform: none !important;
    }
}
