/* --- Gallery page --- */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: #e0e0e0;
}

.gallery-item.fade-in {
    animation: galleryFadeIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes galleryFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.03);
    filter: brightness(1.08);
}

/* --- Load More --- */

.gallery-load-more {
    text-align: center;
}

/* --- Lightbox --- */

.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.gallery-lightbox.active {
    display: flex;
}

.gallery-lightbox__img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.gallery-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
    z-index: 10000;
}

.gallery-lightbox__close:hover {
    opacity: 1;
}

/* --- Tablet: 2 columns --- */

@media (max-width: 1023px) and (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Mobile: single column --- */

@media (max-width: 767px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

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

    .gallery-lightbox__img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .gallery-lightbox__close {
        top: 0.5rem;
        right: 0.75rem;
        font-size: 2rem;
    }
}
