/* ==========================================================================
   CARROUSEL : Harmonisé avec la charte graphique (#E6C84F, #444, #F2F2F2)
   ========================================================================== */

/* 1. Wrapper : Le cadre fixe du carrousel */
.carousel-wrapper {
    position: relative;
    max-width: 720px; /* Aligné sur la largeur max de vos autres images */
    margin: 20px auto;
    border-radius: 10px; 
    overflow: hidden;
    aspect-ratio: 4 / 3; 
    background-color: #F2F2F2; 
    border: 1px solid #E6C84F; /* Bordure jaune */
}

/* Style de l'année */
.carousel-year {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px; /* Espace sous l'année */
    font-size: 1.2rem;  
    font-weight: bold;
    color: #333; 
    width: 100%;
}

/* 2. Conteneur scrollable */
.carousel-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-container::-webkit-scrollbar {
    display: none;
}

/* 3. Slides : Chaque conteneur de photo */
.carousel-container .photo-container-carousel {
    flex: 0 0 100%;
    min-width: 100%;
    height: 100%;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;   /* Aligne l'année au-dessus de l'image */
    justify-content: flex-start; /* Aligne le contenu depuis le haut pour éviter le chevauchement */
    align-items: center;
    padding-top: 15px;         /* Zone de sécurité en haut pour le texte */
    box-sizing: border-box;    /* Inclut le padding dans le calcul de la hauteur */
    background: radial-gradient(circle, #ffffff 0%, #F9F9F9 100%);
}

/* 4. Images : Avec le cadre Jaune Or du site */
.carousel-container .photo-container-carousel img {
    max-width: 90%; 
    max-height: 75%; /* Ajusté à 75% pour laisser le texte respirer */
    width: auto;
    height: auto;
    flex-grow: 1;    /* Permet à l'image de s'adapter si le cadre rétrécit */
    object-fit: contain; 
    display: block;
    user-select: none;
    -webkit-user-drag: none;

    /* Cadre jaune autour de l'image */
    padding: 6px;
    background-color: #E6C84F;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* 5. Boutons de navigation (Flèches) */
.prev, .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(68, 68, 68, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    padding: 0;
}

.prev:hover, .next:hover {
    background: #E6C84F; 
    color: #444; 
    box-shadow: 0 0 12px rgba(230, 200, 79, 0.7);
    transform: translateY(-50%) scale(1.1); /* Correction du scale en conservant le centrage vertical */
}

.prev { left: 15px; }
.next { right: 15px; }

/* 6. Adaptabilité Mobile */
@media (max-width: 480px) {
    .carousel-wrapper {
        border-radius: 0;
        margin: 10px auto;
        border-left: none;
        border-right: none; 
    }
    
    .carousel-container .photo-container-carousel {
        padding-top: 10px; /* Plus petit espace en haut sur mobile */
    }

    .carousel-year {
        font-size: 1rem;   /* Texte plus discret */
        margin-bottom: 6px;
    }
    
    .carousel-container .photo-container-carousel img {
        max-width: 95%; 
        max-height: 72%;   /* Réduit pour ne pas saturer l'écran vertical des mobiles */
        padding: 4px; 
    }

    .prev, .next {
        width: 38px;
        height: 38px;
        font-size: 18px;
        background: rgba(68, 68, 68, 0.4); 
    }
    
    .prev { left: 8px; }
    .next { right: 8px; }
}
/* ==========================================================================
   LIGHTBOX (Affichage de l'image en grand au clic)
   ========================================================================== */

/* Le fond noir transparent */
.lightbox {
    display: none; /* Caché par défaut */
    position: fixed;
    z-index: 9999; /* Par-dessus absolument tout */
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); /* Fond noir à 90% d'opacité */
}

/* L'image agrandie */
.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85vh; /* Évite que l'image dépasse de l'écran en hauteur */
    object-fit: contain;
    border-radius: 4px;
    
    /* Animation d'apparition fluide */
    animation-name: zoom;
    animation-duration: 0.25s;
}

@keyframes zoom {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Bouton de fermeture (La croix) */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    user-select: none;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #E6C84F; /* Devient jaune or au survol */
    text-decoration: none;
}

/* Ajustements pour mobiles */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95%;
        margin-top: 15vh; /* Aligne un peu plus bas sur smartphone */
    }
    .lightbox-close {
        top: 15px;
        right: 25px;
        font-size: 35px;
    }
}