.carousel-wrapper {
    margin-top: 50px;
    width: 80%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    overflow: visible; 
}

.carousel {
    position: relative;
    width: 100%;
    height: 360px;
    perspective: 1000px;
    overflow: visible; 
}

.carousel::before,
.carousel::after {
    content: '⮜';
    position: absolute;
    top: 50%;
    width: 32px;
    height: 32px;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    color: #9b59ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    pointer-events: none;
    transition: background 0.3s, color 0.3s;
    z-index: 1000;
}

.carousel::before {
    left: calc((100% - 60%) / 2 - 80px);
}

.carousel::after {
    content: '⮞';
    right: calc((100% - 60%) / 2 - 80px);
}

.carousel:hover::before,
.carousel:hover::after {
    background: rgba(0,0,0,0.2);
    color: #9b59ff;
}

.carousel__inner {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.carousel__item {
    --rz: 0deg;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 75%;
    border-radius: 10px;
    overflow: hidden;
    backface-visibility: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: transform 0.6s ease;
    
    transform: translate(-50%, -50%)
               rotateY(var(--rz))
               translateZ(300px);
    background: transparent;
}

.carousel__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.carousel__item:nth-child(1) { --rz:   0deg; }
.carousel__item:nth-child(2) { --rz:  90deg; }
.carousel__item:nth-child(3) { --rz: 180deg; }
.carousel__item:nth-child(4) { --rz: 270deg; }

.thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    max-width: 100%;
    overflow-x: auto; 
}

.thumb {
    width: 80px;
    height: 60px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border 0.3s, opacity 0.3s, transform 0.3s;
    opacity: 0.6;
    flex-shrink: 0;
}

.thumb.active {
    border-color: #9b59ff;
    opacity: 1;
    transform: scale(1.1);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

@media (max-width: 700px) {
    .carousel-wrapper { 
        width: 100%; 
        overflow: hidden;
    }
    
    .carousel { 
        height: 280px; 
    }
    
    .carousel__item {
        width: 60%;
        height: 65%;
        
        transform: translate(-50%, -50%)
                   rotateY(var(--rz))
                   translateZ(180px); 
    }
  

    .carousel::before { left: 10px; }
    .carousel::after { right: 10px; }

    .thumbnails .thumb {
        width: 60px;
        height: 45px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .carousel__inner {
        transform: none !important;
    }
    .carousel__item {
        position: static;
        transform: none !important;
        margin: 10px auto;
        box-shadow: none;
        transition: none;
        width: 80%;
        height: auto;
    }
    .thumbnails {
        margin-top: 10px;
    }

    .carousel::before,
    .carousel::after {
        display: none;
    }
}