/* --- Styles pour la Page Galerie --- */

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.gallery-header {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-header h1 {
    font-family: var(--font-title);
    font-size: 3rem;
    color: var(--primary-color);
}

/* --- Style des Boutons de Filtre --- */
.filter-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.filter-btn {
    font-family: var(--font-tech, 'Source Code Pro', monospace);
    background-color: var(--light-bg);
    color: var(--text-color);
    border: 1px solid #333;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: var(--primary-color);
    color: var(--dark-bg);
    border-color: var(--primary-color);
}

.filter-btn.active {
    background-color: var(--fpv-green);
    color: var(--dark-bg);
    border-color: var(--fpv-green);
    box-shadow: 0 0 15px rgba(0, 255, 106, 0.3);
}

/* --- Style de la Grille Masonry --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    grid-auto-rows: 250px; /* Hauteur de base des lignes */
}

.gallery-item {
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Calcul de la hauteur pour l'effet Masonry (géré par JS) */
/* Exemple : un item qui s'étend sur 2 rangées */
.gallery-item.span-2 { grid-row: span 2; }
/* Exemple : un item qui s'étend sur 3 rangées */
.gallery-item.span-3 { grid-row: span 3; }


.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item.hidden {
    transform: scale(0);
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

/* --- Styles de la Lightbox --- */
#lightbox {
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}
#lightbox.hidden { display: none; }

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 5px;
}

#lightbox-caption {
    position: absolute;
    bottom: 5vh;
    color: white;
    font-family: var(--font-body);
    font-size: 1.1rem;
    text-align: center;
    background: rgba(0,0,0,0.5);
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
    cursor: pointer;
    position: absolute;
    color: white;
    font-size: 3rem;
    user-select: none;
    transition: color 0.3s;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
    color: var(--primary-color);
}
.lightbox-close { top: 2rem; right: 3rem; }
.lightbox-prev { left: 2rem; }
.lightbox-next { right: 2rem; }

/* ========================================================== */
/* ==       STYLES RESPONSIVE POUR LA PAGE GALERIE         == */
/* ========================================================== */

@media (max-width: 768px) {

    .gallery-container {
        padding: 4rem 1rem; /* On réduit le padding sur les côtés */
    }

    .gallery-header h1 {
        font-size: 2.5rem; /* On réduit la taille du titre */
    }

    /* On empile les boutons de filtre verticalement */
    .filter-controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* On simplifie la grille pour un affichage en 2 colonnes */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        /* On annule la hauteur de ligne fixe pour laisser les images s'adapter */
        grid-auto-rows: auto; 
    }

    /* On s'assure que toutes les images sont carrées et prennent la même place */
    .gallery-item,
    .gallery-item.span-2,
    .gallery-item.span-3 {
        grid-row: auto;      /* Annule l'effet Masonry */
        aspect-ratio: 1 / 1; /* Force toutes les images à être carrées */
    }

    /* On ajuste les contrôles de la Lightbox pour les petits écrans */
    .lightbox-close {
        top: 1rem;
        right: 1.5rem;
        font-size: 2.5rem;
    }
    .lightbox-prev, .lightbox-next {
        font-size: 2rem;
    }
    .lightbox-prev { left: 1rem; }
    .lightbox-next { right: 1rem; }
}