/* --- Styles de la Page Galerie --- */
.galerie-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* --- En-tête de la Galerie à 2 colonnes --- */
.galerie-header {
    margin-bottom: 4rem;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: center;
}

.header-text {
    flex: 1;
}

.header-text h1 {
    font-family: var(--font-title);
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.header-text p {
    font-size: 1.1rem;
    color: #444;
    font-style: italic;
    line-height: 1.7;
    margin-bottom: 2rem;
    text-align: justify;
}

/* Boutons de filtre (alignés à gauche par défaut sur desktop) */
.gallery-filters {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.filter-btn:hover, .filter-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Cadre de l'image de mise en avant sur le côté */
.header-featured-image {
    flex: 0 0 320px;
    width: 100%;
    max-width: 360px;
}

.featured-frame {
    position: relative;
    background: #ffffff;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    border: 1px solid var(--border-color);
}

.featured-frame img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.featured-caption {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    font-family: var(--font-title);
    color: var(--accent-color);
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Disposition côte à côte sur grand écran (Desktop) */
@media (min-width: 880px) {
    .header-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 3.5rem;
    }
    
    .header-text h1 {
        text-align: left;
    }
}

/* Adaptation sur Mobile */
@media (max-width: 879px) {
    .header-text h1 {
        text-align: center;
    }

    .gallery-filters {
        justify-content: center; /* Centrer les filtres sur mobile pour plus d'harmonie */
    }
    
    .header-featured-image {
        margin: 0 auto;
    }
}

/* Grille de la galerie */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.gallery-item {
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover .image-wrapper img {
    transform: scale(1.05);
}

/* Effet au survol sur l'image */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 44, 44, 0.75);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 1rem;
}

.gallery-item:hover .image-overlay {
    opacity: 1;
}

.zoom-icon {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    color: var(--accent-color);
}

.image-overlay h3 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.image-overlay p {
    font-size: 0.95rem;
    font-style: italic;
    color: #ddd;
}

/* --- Modale Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 75vh;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#lightbox-caption {
    margin: 15px auto;
    text-align: center;
    color: #ccc;
    font-size: 1.2rem;
    font-family: var(--font-title);
    width: 80%;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 45px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: var(--accent-color);
}

/* --- Indicateur de défilement (Chevron) --- */
.scroll-down-indicator {
    text-align: center;
    margin-top: 2rem;
}

.scroll-down-indicator a {
    display: inline-block;
    color: var(--accent-color);
    font-size: 2.5rem;
    transition: color 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

.scroll-down-indicator a:hover {
    color: var(--text-color);
}

/* Animation fluide du chevron de haut en bas */
@keyframes bounceArrow {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(8px);
    }
    60% {
        transform: translateY(4px);
    }
}

.animated-arrow {
    animation: bounceArrow 2s infinite;
}

/* --- Bouton "Retour en haut" (Back to top) --- */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    background-color: var(--accent-color);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#back-to-top:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px);
}

/* Classe ajoutée par le JS pour l'afficher */
#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* Désactivation totale sur mobile et tablettes (< 768px) */
@media (max-width: 767px) {
    #back-to-top {
        display: none !important;
    }
}