.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 2.5rem 1.5rem 1rem;
}

.gallery-filter {
    padding: 0.5rem 1.25rem;
    border: 1px solid #d1d5db;
    background: transparent;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.gallery-filter.active,
.gallery-filter:hover {
    background: #1f2937;
    color: #ffffff;
    border-color: #1f2937;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1rem 1.5rem 5rem;
}

/* Every tile is the same square; the whole picture shows inside it */
.gallery-item {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
    background: #ffffff;
    text-decoration: none;
    color: inherit;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
}

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

/* Album tiles: photo count badge and title over the picture */
.gallery-album-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.2rem 0.6rem;
    background: rgba(31, 41, 55, 0.85);
    color: #ffffff;
    font-size: 0.7rem;
    border-radius: 999px;
}

.gallery-album-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem 0.9rem 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.3;
}

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


.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    box-sizing: border-box;
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-caption {
    color: #fff;
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
    max-width: 60ch;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.gallery-item-photo {
    cursor: pointer;
}