/**
 * WordPress Product Carousel Styles
 * Carousel with 5-slide layout, rotating SVG graphics, and responsive design
 */

/* Base Carousel Container */
.homepage-carousel-wrapper {
    width: 100%;
    height: 670px;
    position: relative;
    overflow: hidden;
    background-color: #000;
    min-height: 600px;
}

/* Ensure slides container is visible */
.homepage-carousel-slides {
    min-height: 600px;
}

.homepage-carousel-container {
    max-width: 2100px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    position: relative;
    padding: 0 60px;
    box-sizing: border-box;
}


/* Product Images Row - Always visible row of all product images */
.product-images-row {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    pointer-events: none;
    gap: 20px;
    padding: 0 60px;
    box-sizing: border-box;
}

.product-image-item {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s, opacity 0.8s ease-in-out 0.2s;
    transform-origin: center center;
    opacity: 0; /* Start hidden */
}

/* Disable transitions during initial load */
.homepage-carousel-wrapper.carousel-initializing .product-image-item {
    transition: none !important;
}

/* Fade in after initialization */
.homepage-carousel-wrapper.carousel-initialized .product-image-item {
    opacity: 1;
}

.product-image-item img {
    max-width: 380px; /* Default width, can be overridden by inline style from ACF */
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.product-image-placeholder {
    width: 200px;
    height: 200px;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

/* Scale adjustments for 5 slides */
.product-images-row[data-total-slides="5"] .product-image-item[data-product-index="0"],
.product-images-row[data-total-slides="5"] .product-image-item[data-product-index="4"] {
    transform: scale(0.4);
}

.product-images-row[data-total-slides="5"] .product-image-item[data-product-index="1"],
.product-images-row[data-total-slides="5"] .product-image-item[data-product-index="3"] {
    transform: scale(0.6);
}

.product-images-row[data-total-slides="5"] .product-image-item[data-product-index="2"] {
    transform: scale(1.0);
}

/* Scale adjustments for 4 slides */
.product-images-row[data-total-slides="4"] .product-image-item[data-product-index="0"],
.product-images-row[data-total-slides="4"] .product-image-item[data-product-index="3"] {
    transform: scale(0.5);
}

.product-images-row[data-total-slides="4"] .product-image-item[data-product-index="1"] {
    transform: scale(0.7);
}

.product-images-row[data-total-slides="4"] .product-image-item[data-product-index="2"] {
    transform: scale(1.0);
}

/* Scale adjustments for 3 slides */
.product-images-row[data-total-slides="3"] .product-image-item[data-product-index="0"],
.product-images-row[data-total-slides="3"] .product-image-item[data-product-index="2"] {
    transform: scale(0.6);
}

.product-images-row[data-total-slides="3"] .product-image-item[data-product-index="1"] {
    transform: scale(1.0);
}

/* Scale adjustments for 2 slides */
.product-images-row[data-total-slides="2"] .product-image-item[data-product-index="0"] {
    transform: scale(1.0);
}

.product-images-row[data-total-slides="2"] .product-image-item[data-product-index="1"] {
    transform: scale(0.7);
}

/* Slides Container */
.homepage-carousel-slides {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Individual Slide */
.carousel-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.7s ease-in-out 0s, transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0s;
    pointer-events: none;
    will-change: opacity, transform;
}

.carousel-slide-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 3;
}

/* Slide Positioning - Desktop (5 slides) */
@media (min-width: 769px) {
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="0"],
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="1"] {
        transform: translateX(-50%) scale(0.7);
        z-index: 1;
    }
    
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="0"] {
        left: 10%;
    }
    
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="1"] {
        left: 25%;
    }
    
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="2"] {
        transform: translateX(-50%) scale(1);
        left: 50%;
        z-index: 3;
    }
    
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="3"] {
        transform: translateX(-50%) scale(0.7);
        left: 75%;
        z-index: 1;
    }
    
    .homepage-carousel-slides[data-total-slides="5"] .carousel-slide[data-slide-index="4"] {
        transform: translateX(-50%) scale(0.7);
        left: 90%;
        z-index: 1;
    }
}

/* Slide Positioning - 4 slides */
@media (min-width: 769px) {
    .homepage-carousel-slides[data-total-slides="4"] .carousel-slide[data-slide-index="0"] {
        transform: translateX(-50%) scale(0.7);
        left: 15%;
        z-index: 1;
    }
    
    .homepage-carousel-slides[data-total-slides="4"] .carousel-slide[data-slide-index="1"] {
        transform: translateX(-50%) scale(0.7);
        left: 35%;
        z-index: 1;
    }
    
    .homepage-carousel-slides[data-total-slides="4"] .carousel-slide[data-slide-index="2"] {
        transform: translateX(-50%) scale(1);
        left: 50%;
        z-index: 3;
    }
    
    .homepage-carousel-slides[data-total-slides="4"] .carousel-slide[data-slide-index="3"] {
        transform: translateX(-50%) scale(0.7);
        left: 85%;
        z-index: 1;
    }
}

/* Slide Positioning - 3 slides */
@media (min-width: 769px) {
    .homepage-carousel-slides[data-total-slides="3"] .carousel-slide[data-slide-index="0"] {
        transform: translateX(-50%) scale(0.7);
        left: 20%;
        z-index: 1;
    }
    
    .homepage-carousel-slides[data-total-slides="3"] .carousel-slide[data-slide-index="1"] {
        transform: translateX(-50%) scale(1);
        left: 50%;
        z-index: 3;
    }
    
    .homepage-carousel-slides[data-total-slides="3"] .carousel-slide[data-slide-index="2"] {
        transform: translateX(-50%) scale(0.7);
        left: 80%;
        z-index: 1;
    }
}

/* Slide Positioning - 2 slides */
@media (min-width: 769px) {
    .homepage-carousel-slides[data-total-slides="2"] .carousel-slide {
        opacity: 1;
    }
    
    .homepage-carousel-slides[data-total-slides="2"] .carousel-slide[data-slide-index="0"] {
        transform: translateX(-50%) scale(1);
        left: 50%;
        z-index: 3;
    }
    
    .homepage-carousel-slides[data-total-slides="2"] .carousel-slide[data-slide-index="1"] {
        transform: translateX(-50%) scale(0.7);
        left: 80%;
        z-index: 1;
    }
}

/* Background Layer - Bottom layer (z-index: 1) - Full viewport width */
.slide-background {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    background-color: #1a1a1a; /* Fallback background if no image/video */
}

/* Ensure slide has minimum visibility */
.carousel-slide {
    min-height: 600px;
    transition: opacity 0.7s ease-in-out, transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.slide-video-wrapper,
.slide-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    transition: opacity 0.8s ease-in-out 0s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0s;
    will-change: opacity, transform;
}

/* Subtle zoom effect on background when slide becomes active */
.carousel-slide:not(.carousel-slide-active) .slide-video-wrapper,
.carousel-slide:not(.carousel-slide-active) .slide-image-wrapper {
    opacity: 0.3;
    transform: scale(1.05);
}

.carousel-slide-active .slide-video-wrapper,
.carousel-slide-active .slide-image-wrapper {
    opacity: 1;
    transform: scale(1);
}

/* Ensure background elements stretch full viewport width */
.carousel-slide .slide-background {
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
}

.carousel-slide .slide-background .slide-video-wrapper,
.carousel-slide .slide-background .slide-image-wrapper {
    width: 100%;
}

.slide-video-wrapper iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

/* Color Overlay - Layer 2 (z-index: 2) - on top of image/video */
.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    transition: opacity 0.8s ease-in-out 0.1s;
    will-change: opacity;
}

/* Rotating SVG Layer - Layer 3 (z-index: 3) - on top of overlay, beneath product images */
.slide-rotating-wrapper {
    position: absolute;
    top: 250px; /* Align with product images row (50px top + 200px to center of 400px height) */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    z-index: 3;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
    transition: opacity 0.8s ease-in-out 0.3s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
    will-change: opacity, transform;
}

/* Only show rotating wrapper and circle on active slide */
.carousel-slide:not(.carousel-slide-active) .slide-rotating-wrapper {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none !important;
    transform: translate(-50%, -50%) translateY(20px);
    transition: opacity 0.8s ease-in-out 0s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0s, visibility 0s linear 0.8s;
}

.carousel-slide-active .slide-rotating-wrapper {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    transform: translate(-50%, -50%) translateY(0);
    transition: opacity 0.8s ease-in-out 0.3s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s, visibility 0s linear 0s;
}

/* Allow circle to cross-fade by keeping it visible during transition */
.carousel-slide:not(.carousel-slide-active) .slide-center-circle {
    opacity: 0;
    transition: opacity 0.6s ease-in-out 0s, background-color 1s ease-in-out 0s;
}

.carousel-slide-active .slide-center-circle {
    opacity: 1;
    transition: opacity 0.6s ease-in-out 0.3s, background-color 1s ease-in-out 0.3s;
}

.slide-rotating-svg {
    width: 50%;
    height: 50%;
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 3;
    visibility: visible !important;
    opacity: 1 !important;
}

.rotating-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: rotate 10s linear infinite;
    transform-origin: center center;
    position: relative;
    z-index: 3;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Color Circle - Layer 4 (z-index: 4) - inside SVG, on top of SVG, directly under product image */
.slide-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    border-radius: 50%;
    z-index: 4;
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
    background-color: inherit; /* Will be overridden by inline style */
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.4s, 
                opacity 0.7s ease-in-out 0.4s, 
                background-color 1s ease-in-out 0.3s;
    will-change: transform, opacity, background-color;
}

/* Ensure smooth color transition when slide becomes active */
.carousel-slide-active .slide-center-circle {
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.4s, 
                opacity 0.7s ease-in-out 0.4s, 
                background-color 1s ease-in-out 0.3s;
}

/* Product Image Layer - Layer 5 (z-index: 5) - on top of circle */
.slide-product-image {
    position: relative;
    z-index: 5;
    max-width: 300px;
    max-height: 400px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: visible;
    opacity: 1;
}

.slide-product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 5;
    visibility: visible;
    opacity: 1;
}

/* Content Layer - Layer 5 (z-index: 5) - positioned below product images */
.slide-content {
    position: absolute;
    top: 450px; /* Below product images row (50px top + 400px height) */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    color: #ffffff;
    padding: 0 20px;
    width: calc(100% - 40px); /* Account for padding */
    box-sizing: border-box;
    pointer-events: none; /* Allow clicks to pass through container */
    transition: opacity 0.8s ease-in-out 0.5s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
    will-change: opacity, transform;
}

.slide-content * {
    pointer-events: auto; /* Re-enable pointer events for child elements */
}

/* Add subtle movement to content when slides change */
.carousel-slide:not(.carousel-slide-active) .slide-content {
    opacity: 0;
    transform: translateX(-50%) translateY(25px);
    transition: opacity 0.8s ease-in-out 0s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0s;
}

.carousel-slide-active .slide-content {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.8s ease-in-out 0.5s, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
}

.slide-headline {
    font-size: 48px;
    font-family: 'Oswald', sans-serif;
    margin: 0 0 10px 0;
    line-height: 1.2;
    font-weight: 300;
    opacity: 0;
    transition: opacity 0.6s ease-in-out 0.2s;
    will-change: opacity;
}

.slide-byline {
    font-size: 24px;
    font-family: 'Oswald', sans-serif;
    margin: 0 0 25px 0;
    line-height: 1.2;
    font-weight: 300;
    opacity: 0;
    transition: opacity 0.6s ease-in-out 0.4s;
    will-change: opacity;
}

/* Fade in headline, byline, and button sequentially on active slide */
.carousel-slide-active .slide-headline {
    opacity: 1;
    transition: opacity 0.6s ease-in-out 0.2s;
}

.carousel-slide-active .slide-byline {
    opacity: 1;
    transition: opacity 0.6s ease-in-out 0.4s;
}

.slide-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: transparent;
    color: #ffffff !important;
    border: 2px solid #ffffff;
    text-decoration: none;
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease, opacity 0.6s ease-in-out 0.6s;
    cursor: pointer;
    visibility: visible;
    opacity: 0;
    position: relative;
    z-index: 10 !important;
    pointer-events: auto !important;
    font-family: 'Oswald', sans-serif;
    font-weight: 300;  
    font-size: 21px;
}

/* Fade in button last on active slide */
.carousel-slide-active .slide-button {
    opacity: 1;
    transition: all 0.3s ease, opacity 0.6s ease-in-out 0.6s;
}

.slide-button:hover {
    background-color: #083157;
    color: #ffffff;
}

/* Navigation Arrows */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 1);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.carousel-nav:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

.carousel-nav:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.carousel-nav-prev {
    left: 10px; /* Default position, will be overridden by JavaScript */
}

.carousel-nav-next {
    right: 10px; /* Default position, will be overridden by JavaScript */
}

.carousel-nav svg {
    width: 24px;
    height: 24px;
}

/* Tablet Styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .homepage-carousel-container {
        padding: 0 40px;
    }
    
    .slide-rotating-wrapper {
        width: 300px;
        height: 300px;
    }
    
    .slide-center-circle {
        width: 150px;
        height: 150px;
    }
    
    .slide-product-image {
        max-width: 250px;
        max-height: 350px;
    }
    
    .slide-headline {
        font-size: 2em;
    }
    
    .slide-byline {
        font-size: 1em;
    }
    
    .carousel-nav {
        width: 40px;
        height: 40px;
    }
    
    .carousel-nav svg {
        width: 20px;
        height: 20px;
    }
}

/* Mobile Styles - Single Slide View */
@media (max-width: 768px) {
    .homepage-carousel-wrapper {
        height: 500px;
    }
    
    .homepage-carousel-container {
        padding: 0 20px;
    }
    
    /* Show only active slide on mobile */
    .carousel-slide {
        opacity: 0;
        transform: translateX(-50%) scale(1) !important;
        left: 50% !important;
    }
    
    .carousel-slide-active {
        opacity: 1;
    }
    
    /* Hide side slides completely */
    .carousel-slide:not(.carousel-slide-active) {
        display: none;
    }
    
    .slide-rotating-wrapper {
        width: 250px;
        height: 250px;
    }
    
    .slide-center-circle {
        width: 150px;
        height: 150px;
    }
    
    .slide-product-image {
        max-width: 200px;
        max-height: 280px;
        margin-bottom: 15px;
    }
    
    .slide-content {
        top: 450px;
        max-width: 100%;
        padding: 0 15px;
    }
    
    .slide-headline {
        font-size: 1.5em;
        margin-bottom: 8px;
    }
    
    .slide-byline {
        font-size: 0.9em;
        margin-bottom: 15px;
    }
    
    .slide-button {
        padding: 10px 25px;
        font-size: 0.9em;
    }
    
    .carousel-nav {
        width: 35px;
        height: 35px;
    }
    
    .carousel-nav-prev {
        left: 5px;
    }
    
    .carousel-nav-next {
        right: 5px;
    }
    
    .carousel-nav svg {
        width: 18px;
        height: 18px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .homepage-carousel-wrapper {
        height: 450px;
    }
    
    .slide-rotating-wrapper {
        width: 200px;
        height: 200px;
    }
    
    .slide-center-circle {
        width: 150px;
        height: 150px;
    }
    
    .slide-product-image {
        max-width: 150px;
        max-height: 220px;
    }
    
    .slide-headline {
        font-size: 1.2em;
    }
    
    .slide-byline {
        font-size: 0.85em;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide,
    .rotating-image,
    .slide-button {
        animation: none !important;
        transition: none !important;
    }
    
    .rotating-image {
        animation: rotate 20s linear infinite !important;
    }
}

/* Print Styles */
@media print {
    .homepage-carousel-wrapper {
        height: auto;
        overflow: visible;
    }
    
    .carousel-nav {
        display: none;
    }
    
    .carousel-slide {
        position: relative;
        opacity: 1;
        transform: none !important;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
}

