/* carousel-styles.css */

/* Masquage responsive */
@media (min-width: 768px) {
    .mobile-only { display: none !important; }
}

@media (max-width: 767px) {
    .desktop-only { display: none !important; }
}

/* Ajuster le container principal pour permettre le positionnement absolu */
.centered-container {
    position: relative;
}

/* Texte d'introduction en haut à gauche */
.intro-text {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 1.1em;
    line-height: 1.5;
    z-index: 1;
    max-width: 100%;
    text-align: left;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Version desktop - texte derrière le carrousel */
@media (min-width: 768px) {
    .desktop-only .intro-text {
        top: 30px;
        left: 30px;
        font-size: 1.2em;
        max-width: 100%;
        z-index: -1;
    }
    
    .desktop-only .carousel-container,
    .desktop-only .carousel-3d,
    .desktop-only .carousel-item,
    .desktop-only .carousel-item img {
        z-index: 999999 !important;
    }
}

/* Version mobile - texte devant le carrousel */
@media (max-width: 767px) {
    .mobile-only .intro-text {
        top: 15px;
        left: 15px;
        font-size: 1em;
        max-width: 70%;
        z-index: 2;
    }
    
    .mobile-only .carousel-container {
        z-index: 1;
    }
}

/* Styles communs */
.carousel-container {
    width: 100%;
    height: 70vh;
    min-height: 500px;
    max-height: 700px;
    perspective: 1200px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.carousel-3d {
    position: relative;
    transform-style: preserve-3d;
    margin: auto;
}

.carousel-item {
    position: absolute;
    left: 50%;
    top: 50%;
    transition: opacity 0.3s ease;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.carousel-item.replacing {
    opacity: 0;
    transform: scale(0.8);
}

/* ===== VERSION DESKTOP ===== */
@media (min-width: 768px) {
    .desktop-only .carousel-3d {
        width: min(60vw, 600px);
        height: min(60vw, 600px);
        animation: rotateVerticalManege 15s ease-in-out infinite;
    }

    .desktop-only .carousel-item {
        width: min(24vw, 280px);
        height: min(24vw, 280px);
        margin-left: min(-12vw, -140px);
        margin-top: min(-12vw, -140px);
        transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
    }

    .desktop-only .carousel-item:nth-child(1) { 
        transform: rotateY(0deg) translateZ(min(30vw, 300px));
    }
    .desktop-only .carousel-item:nth-child(2) { 
        transform: rotateY(72deg) translateZ(min(30vw, 300px)); 
    }
    .desktop-only .carousel-item:nth-child(3) { 
        transform: rotateY(144deg) translateZ(min(30vw, 300px)); 
    }
    .desktop-only .carousel-item:nth-child(4) { 
        transform: rotateY(216deg) translateZ(min(30vw, 300px)); 
    }
    .desktop-only .carousel-item:nth-child(5) { 
        transform: rotateY(288deg) translateZ(min(30vw, 300px)); 
    }
}

/* Écrans moyens desktop (768px - 1399px) */
@media (min-width: 768px) and (max-width: 1399px) {
    .desktop-only .carousel-container {
        height: 65vh;
        min-height: 480px;
    }
    
    .desktop-only .carousel-item {
        width: min(22vw, 240px);
        height: min(22vw, 240px);
        margin-left: min(-11vw, -120px);
        margin-top: min(-11vw, -120px);
    }
}

/* Grands écrans desktop (1400px et plus) */
@media (min-width: 1400px) {
    .desktop-only .carousel-item {
        width: 300px;
        height: 300px;
        margin-left: -150px;
        margin-top: -150px;
    }
    
    .desktop-only .carousel-3d {
        width: 650px;
        height: 650px;
    }
    
    .desktop-only .carousel-item:nth-child(1) { 
        transform: rotateY(0deg) translateZ(325px);
    }
    .desktop-only .carousel-item:nth-child(2) { 
        transform: rotateY(72deg) translateZ(325px); 
    }
    .desktop-only .carousel-item:nth-child(3) { 
        transform: rotateY(144deg) translateZ(325px); 
    }
    .desktop-only .carousel-item:nth-child(4) { 
        transform: rotateY(216deg) translateZ(325px); 
    }
    .desktop-only .carousel-item:nth-child(5) { 
        transform: rotateY(288deg) translateZ(325px); 
    }
}

@keyframes rotateVerticalManege {
    0% { transform: rotateY(0deg) rotateX(-15deg); }
    25% { transform: rotateY(90deg) rotateX(15deg); }
    50% { transform: rotateY(180deg) rotateX(-15deg); }
    75% { transform: rotateY(270deg) rotateX(15deg); }
    100% { transform: rotateY(360deg) rotateX(-15deg); }
}

/* ===== VERSION MOBILE ===== */
@media (max-width: 767px) {
    .mobile-only .carousel-3d {
        width: min(50vw, 250px);
        height: min(50vw, 250px);
        animation: rotateHorizontalManege 15s ease-in-out infinite;
    }

    .mobile-only .carousel-item {
        width: min(42vw, 220px);
        height: min(42vw, 220px);
        margin-left: min(-21vw, -110px);
        margin-top: min(-21vw, -110px);
        filter: blur(2px);
        animation: blurCycleMobile 15s ease-in-out infinite;
    }

    .mobile-only .carousel-item:nth-child(1) { 
        transform: rotateX(0deg) translateZ(min(45vw, 225px));
        animation-delay: 0s;
    }
    .mobile-only .carousel-item:nth-child(2) { 
        transform: rotateX(72deg) translateZ(min(45vw, 225px));
        animation-delay: -3s;
    }
    .mobile-only .carousel-item:nth-child(3) { 
        transform: rotateX(144deg) translateZ(min(45vw, 225px));
        animation-delay: -6s;
    }
    .mobile-only .carousel-item:nth-child(4) { 
        transform: rotateX(216deg) translateZ(min(45vw, 225px));
        animation-delay: -9s;
    }
    .mobile-only .carousel-item:nth-child(5) { 
        transform: rotateX(288deg) translateZ(min(45vw, 225px));
        animation-delay: -12s;
    }
}

/* Très petits écrans mobiles */
@media (max-width: 480px) {
    .mobile-only .carousel-container {
        height: 70vh;
        min-height: 420px;
        padding: 5px;
    }
    
    .mobile-only .carousel-item {
        width: min(44vw, 190px);
        height: min(44vw, 190px);
        margin-left: min(-22vw, -95px);
        margin-top: min(-22vw, -95px);
    }
}

/* Animation de rotation horizontale pour mobile */
@keyframes rotateHorizontalManege {
    0% { transform: rotateX(0deg); }
    8% { transform: rotateX(0deg); }
    20% { transform: rotateX(72deg); }
    28% { transform: rotateX(72deg); }
    40% { transform: rotateX(144deg); }
    48% { transform: rotateX(144deg); }
    60% { transform: rotateX(216deg); }
    68% { transform: rotateX(216deg); }
    80% { transform: rotateX(288deg); }
    88% { transform: rotateX(288deg); }
    100% { transform: rotateX(360deg); }
}

/* Animation de flou pour mobile - synchronisée avec les arrêts */
@keyframes blurCycleMobile {
    0% { filter: blur(0px); }      
    10% { filter: blur(0px); }     
    20% { filter: blur(5px); }     
    35% { filter: blur(10px); }    
    80% { filter: blur(5px); }     
    99% { filter: blur(0px); }     
    100% { filter: blur(0px); }
}
