/* ========================================================
   TEMPLATE MOSAIC - STYLES
   Spécifique pour galeries avec design mosaïque
   ======================================================== */

/* Réinitialiser les styles du body pour permettre le scroll */
body, html {
    height: auto !important;
    overflow: visible !important;
    overflow-y: auto !important;
    min-height: 100vh;
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    background-color: white;
    min-height: 100vh;
}

.gallery-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 0 20px;
}

.gallery-header h1 {
    font-size: 2.5rem;
    color: black;
    margin-bottom: 20px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.gallery-description {
    font-size: 1.1rem;
    color: #333;
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto 30px;
}

.gallery-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.meta-item {
    font-size: 0.95rem;
    color: #666;
}

.meta-label {
    font-weight: 600;
    color: black;
}

.meta-value {
    color: #444;
}

/* Grille d'images - Mosaïque propre */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.gallery-item {
    position: relative;
    background-color: #f5f5f5;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding-bottom: 40px; /* Espace réservé pour le titre */
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 4/3;
}

/* Titre apparaissant au survol - EN DESSOUS de l'image */
.image-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    color: transparent;
    padding: 0 15px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.gallery-item:hover .image-title-overlay {
    color: black;
    background-color: #e0e0e0;
}

/* Bouton retour */
.gallery-back {
    text-align: center;
    padding: 20px;
}

.btn-back {
    display: inline-block;
    padding: 12px 30px;
    background-color: white;
    color: black;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    border: none;
}

.btn-back:hover {
    background-color: #f5f5f5;
    color: black;
}

/* Message si pas d'images */
.no-images {
    text-align: center;
    font-size: 1.2rem;
    color: #999;
    padding: 60px 20px;
}

/* ========================================================
   LIGHTBOX avec bouton info
   ======================================================== */

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    padding: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
}

.lightbox.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: 300;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
}

.lightbox-caption {
    position: fixed;
    top: 50%;
    left: 0;
    width: 50%;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.35);
    color: white;
    padding: 40px 60px;
    text-align: left;
    max-height: 80vh;
    overflow-y: auto;
    transform: translate(-100%, -50%);
    transition: transform 0.4s ease;
    z-index: 10000;
}

.lightbox-caption.visible {
    transform: translate(0, -50%);
}

.lightbox-caption h3 {
    margin: 0 0 15px 0;
    font-size: 1.6rem;
    font-weight: 500;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    line-height: 1.3;
}

.lightbox-caption p {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
    line-height: 1.2;
    white-space: pre-line;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Bouton info pour afficher/masquer les infos */
.lightbox-info-toggle {
    position: fixed;
    top: 80px;
    right: 30px;
    background-color: #ffffff;
    color: #000000;
    border: 3px solid #000000;
    border-radius: 6px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
    display: block !important;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.lightbox-info-toggle:hover {
    background-color: #000000;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.9);
}

.lightbox-info-toggle.active {
    background-color: #000000;
    color: #ffffff;
}

.lightbox-info-toggle.hidden {
    display: none !important;
}

.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: 300;
    font-size: 40px;
    transition: 0.3s ease;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.5);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-prev {
    left: 0;
}

.lightbox-next {
    right: 0;
}

/* ========================================================
   RESPONSIVE
   ======================================================== */

@media screen and (max-width: 900px) {
    .gallery-header h1 {
        font-size: 2rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 30px;
        padding: 12px;
    }
}

@media screen and (max-width: 700px) {
    .gallery-container {
        padding: 20px 10px;
    }

    .gallery-header h1 {
        font-size: 1.5rem;
    }

    .gallery-description {
        font-size: 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gallery-item img {
        aspect-ratio: 16/9;
    }

    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 24px;
        padding: 8px;
    }
    
    .lightbox-info-toggle {
        top: 60px;
        right: 15px;
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .lightbox-caption {
        top: 0;
        left: 0;
        width: 100%;
        padding: 60px 15px 20px;
        max-height: 50vh;
        background-color: rgba(0, 0, 0, 0.75);
        transform: translateY(-100%);
    }
    
    .lightbox-caption.visible {
        transform: translateY(0);
    }
    
    .lightbox-caption h3 {
        font-size: 1.2rem;
    }
    
    .lightbox-caption p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}
