/**
 * 3D Coverflow Carousel
 * iTunes/Apple TV style carousel with perspective rotation
 * ZHP Hufiec Warmia
 * @version 1.0.0
 */

/* Container */
.coverflow-section {
    padding: 80px 0;
    overflow: hidden;
}

.coverflow-container {
    width: 100%;
    max-width: 1200px;
    height: 380px;
    margin: 0 auto;
    perspective: 1000px;
    position: relative;
}

.coverflow-track {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

/* Individual slides */
.coverflow-slide {
    position: absolute;
    width: 380px;
    height: 280px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform, opacity;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    background: #1a1a1a;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.coverflow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Gradient overlay for depth */
.coverflow-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

/* Position states - 5 visible slides */
.coverflow-slide[data-pos="-3"] {
    transform: translateX(-600px) rotateY(50deg) scale(0.5);
    opacity: 0;
    pointer-events: none;
}

.coverflow-slide[data-pos="-2"] {
    transform: translateX(-480px) rotateY(45deg) scale(0.65);
    opacity: 0.4;
    z-index: 1;
}

.coverflow-slide[data-pos="-1"] {
    transform: translateX(-300px) rotateY(35deg) scale(0.8);
    opacity: 0.7;
    z-index: 2;
}

.coverflow-slide[data-pos="0"] {
    transform: translateX(0) rotateY(0deg) scale(1);
    opacity: 1;
    z-index: 5;
    box-shadow: 0 30px 60px rgba(220, 38, 38, 0.25), 0 15px 40px rgba(0,0,0,0.5);
}

.coverflow-slide[data-pos="1"] {
    transform: translateX(300px) rotateY(-35deg) scale(0.8);
    opacity: 0.7;
    z-index: 2;
}

.coverflow-slide[data-pos="2"] {
    transform: translateX(480px) rotateY(-45deg) scale(0.65);
    opacity: 0.4;
    z-index: 1;
}

.coverflow-slide[data-pos="3"] {
    transform: translateX(600px) rotateY(-50deg) scale(0.5);
    opacity: 0;
    pointer-events: none;
}

/* Navigation arrows */
.coverflow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.coverflow-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
}

.coverflow-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.coverflow-nav svg {
    width: 24px;
    height: 24px;
    stroke: #111;
    stroke-width: 2.5;
    fill: none;
}

.coverflow-nav--prev {
    left: 20px;
}

.coverflow-nav--next {
    right: 20px;
}

/* Dots indicator */
.coverflow-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.coverflow-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.coverflow-dot:hover {
    background: rgba(255,255,255,0.4);
}

.coverflow-dot.active {
    background: #ef4444;
    width: 28px;
    border-radius: 5px;
}

/* Counter */
.coverflow-counter {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}

/* Swipe hint */
.coverflow-hint {
    text-align: center;
    margin-top: 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
}

/* Mobile adjustments */
@media (max-width: 1024px) {
    .coverflow-container {
        height: 320px;
    }
    
    .coverflow-slide {
        width: 300px;
        height: 220px;
    }
    
    .coverflow-slide[data-pos="-2"],
    .coverflow-slide[data-pos="2"] {
        opacity: 0.3;
    }
    
    .coverflow-slide[data-pos="-1"] {
        transform: translateX(-220px) rotateY(35deg) scale(0.8);
    }
    
    .coverflow-slide[data-pos="1"] {
        transform: translateX(220px) rotateY(-35deg) scale(0.8);
    }
}

@media (max-width: 768px) {
    .coverflow-container {
        height: 280px;
    }
    
    .coverflow-slide {
        width: 260px;
        height: 195px;
    }
    
    .coverflow-slide[data-pos="-2"],
    .coverflow-slide[data-pos="2"] {
        opacity: 0;
        pointer-events: none;
    }
    
    .coverflow-slide[data-pos="-1"] {
        transform: translateX(-160px) rotateY(30deg) scale(0.75);
        opacity: 0.5;
    }
    
    .coverflow-slide[data-pos="1"] {
        transform: translateX(160px) rotateY(-30deg) scale(0.75);
        opacity: 0.5;
    }
    
    .coverflow-nav {
        width: 42px;
        height: 42px;
    }
    
    .coverflow-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .coverflow-nav--prev {
        left: 10px;
    }
    
    .coverflow-nav--next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .coverflow-container {
        height: 240px;
    }
    
    .coverflow-slide {
        width: 220px;
        height: 165px;
    }
    
    .coverflow-slide[data-pos="-1"] {
        transform: translateX(-120px) rotateY(25deg) scale(0.7);
        opacity: 0.4;
    }
    
    .coverflow-slide[data-pos="1"] {
        transform: translateX(120px) rotateY(-25deg) scale(0.7);
        opacity: 0.4;
    }
}

/* Fast transitions during momentum scrolling */
.coverflow-container.momentum .coverflow-slide {
    transition-duration: 0.18s;
    transition-timing-function: linear;
}

/* Disable transitions during active drag for zero-lag feel */
.coverflow-container.dragging .coverflow-slide {
    transition-duration: 0s;
}
