.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: 1.5rem 0 2rem;
}

.gallery-filter {
    min-height: 44px;
    border: 1px solid #00695c;
    border-radius: 2rem;
    padding: 0.55rem 1rem;
    background: #fff;
    color: #00574f;
    font: inherit;
    cursor: pointer;
}

.gallery-filter[aria-pressed="true"] {
    background: #00695c;
    color: #fff;
}

.gallery-filter:focus-visible,
.gallery-photo:focus-visible,
.gallery-viewer button:focus-visible {
    outline: 3px solid #ffb300;
    outline-offset: 3px;
}

.gallery-results {
    margin: 0 0 1rem;
    text-align: center;
}

.gallery-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 1.25rem;
    margin: 0 0 2.5rem;
}

.gallery-card {
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgb(0 0 0 / 16%);
    text-align: left;
}

.gallery-card[hidden] {
    display: none;
}

.gallery-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.gallery-card-link:focus-visible {
    outline: 3px solid #ffb300;
    outline-offset: -3px;
}

.gallery-card img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: #e8eeee;
}

.gallery-card-content {
    padding: 1rem 1.1rem 1.2rem;
}

.gallery-card h2 {
    margin: 0 0 0.45rem;
    color: #263238;
    font-size: 1.3rem;
}

.gallery-card p {
    margin: 0;
    color: #455a64;
}

.gallery-category {
    display: inline-block;
    margin-top: 0.8rem;
    border-radius: 1rem;
    padding: 0.2rem 0.65rem;
    background: #e0f2f1;
    color: #004d40;
    font-size: 0.85rem;
}

.photo-gallery {
    padding: 1.5rem 0 2rem;
}

.photo-gallery .gallery-count {
    margin: 0 0 1.2rem;
    color: #455a64;
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 1rem;
}

.gallery-photo {
    position: relative;
    display: block;
    overflow: hidden;
    min-height: 180px;
    border-radius: 5px;
    background: #263238;
}

.gallery-photo img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 180ms ease;
}

.gallery-photo:hover img {
    transform: scale(1.035);
}

.gallery-photo span {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 0.45rem 0.65rem;
    background: linear-gradient(transparent, rgb(0 0 0 / 75%));
    color: #fff;
    font-size: 0.9rem;
    text-align: left;
}

.gallery-empty,
.gallery-error {
    padding: 1.5rem;
    border-radius: 5px;
    background: #f5f5f5;
    color: #37474f;
    text-align: center;
}

.gallery-viewer[hidden] {
    display: none;
}

.gallery-viewer {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 0.75rem;
    background: rgb(0 0 0 / 94%);
    color: #fff;
}

.gallery-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: min(100%, 1200px);
    margin: 0 auto;
}

.gallery-viewer button {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid rgb(255 255 255 / 55%);
    border-radius: 4px;
    background: rgb(30 30 30 / 85%);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.gallery-viewer .gallery-viewer-close {
    padding: 0.4rem 0.8rem;
}

.gallery-viewer-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.35rem, 3vw, 2rem);
    min-height: 0;
    padding: 0.75rem 0;
}

.gallery-viewer-image {
    display: block;
    max-width: min(100%, 1100px);
    max-height: 100%;
    object-fit: contain;
}

.gallery-viewer-caption {
    min-height: 1.5rem;
    margin: 0;
    padding: 0.25rem 0 0.5rem;
    color: #fff;
    text-align: center;
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .gallery-photo {
        min-height: 130px;
    }

    .gallery-photo img {
        height: 150px;
    }

    .gallery-viewer {
        padding: 0.5rem;
    }

    .gallery-viewer-stage {
        gap: 0.35rem;
    }

    .gallery-viewer-image {
        max-width: calc(100% - 5.5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-photo img {
        transition: none;
    }
}
