* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #fff;
}

.gallery-main {
    padding-top: 74px;
    min-height: 100vh;
    background: #fff;
}

/* Gallery Section - collé à gauche avec marge */
.gallery-section {
    padding: 80px 150px;
    background: #fff;
    margin-left: 0;
    margin-right: auto;
}

.gallery-section .title {
    margin-bottom: 60px;
}

/* Grille uniforme (sans mosaïque) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 250px;
    gap: 20px;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Gallery Item */
.gallery-item {
    position: relative;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition-delay: var(--delay, 0s);
}

.gallery-item-inner {
    position: relative;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    height: 100%;
}

.gallery-item-inner:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-inner:hover img {
    transform: scale(1.08);
}

/* Overlay */
.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    pointer-events: none; /* Ne pas bloquer les clics sur l'image */
}

.gallery-item-inner:hover .gallery-overlay {
    opacity: 1;
}

.gallery-caption {
    color: white;
    font-size: 1rem;
    font-weight: 500;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-inner:hover .gallery-caption {
    transform: translateY(0);
}

.gallery-expand {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a2c7c;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto; /* Permettre les clics sur le bouton */
}

.gallery-expand svg {
    width: 20px;
    height: 20px;
}

.gallery-item-inner:hover .gallery-expand {
    transform: scale(1);
    transition-delay: 0.1s;
}

.gallery-expand:hover {
    background: white;
    transform: scale(1.1) rotate(90deg);
}

/* Empty State */
.gallery-empty {
    text-align: center;
    padding: 100px 20px;
    color: #999;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.gallery-empty svg {
    margin-bottom: 24px;
    opacity: 0.5;
    color: #ccc;
}

.gallery-empty p {
    font-size: 1.1rem;
    color: #999;
}

/* Lightbox - reste identique */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    backdrop-filter: blur(10px);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: lightboxZoom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lightboxZoom {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lightbox-caption {
    color: white;
    font-size: 1.2rem;
    margin-top: 24px;
    text-align: center;
    font-weight: 500;
    opacity: 0.9;
    animation: fadeInUp 0.5s ease-out 0.2s backwards;
}

/* Conteneur pour le compteur et les boutons navigation */
.lightbox-bottom-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
    animation: fadeInUp 0.5s ease-out 0.3s backwards;
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 500;
}

/* Lightbox Controls */
.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
}

.lightbox-nav {
    position: relative;
    top: auto;
    transform: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-prev {
    left: auto;
}

.lightbox-next {
    right: auto;
}

/* Responsive */
@media (max-width: 1200px) {
    .gallery-section {
        padding: 80px 80px;
    }

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

@media (max-width: 768px) {
    .gallery-section {
        padding: 60px 40px;
    }

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

    .gallery-expand {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 10px;
    }

    .gallery-expand svg {
        width: 18px;
        height: 18px;
    }

    .gallery-caption {
        font-size: 0.95rem;
    }

    .lightbox-close {
        top: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        z-index: 99999;
    }

    .lightbox-nav {
        width: 48px;
        height: 48px;
    }

    .lightbox-content img {
        max-height: 60vh;
    }

    .lightbox-caption {
        font-size: 1rem;
        padding: 0 15px;
        margin-top: 20px;
    }

    .lightbox-bottom-controls {
        gap: 20px;
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-section {
        padding: 40px 16px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 320px;
        gap: 12px;
    }

    .gallery-caption {
        font-size: 0.9rem;
    }

    .gallery-expand {
        width: 32px;
        height: 32px;
    }

    .gallery-expand svg {
        width: 16px;
        height: 16px;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .lightbox-nav svg {
        width: 24px;
        height: 24px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }

    .lightbox-content img {
        max-height: 55vh;
    }

    .lightbox-bottom-controls {
        gap: 16px;
    }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
