.gallery-page .page-intro h1 {
    color: var(--secondary);
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0 26px;
}

.gallery-filters button,
.gallery-item {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.gallery-filters button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--secondary);
    font: inherit;
    font-size: 14px;
}

.gallery-filters button.is-active,
.gallery-filters button:hover {
    border-color: var(--primary);
    background: var(--surface);
    color: var(--primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    text-align: left;
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(44, 30, 22, 0.06);
}

.gallery-item.is-open {
    box-shadow: 0 0 0 2px var(--primary), 0 12px 30px rgba(44, 30, 22, 0.06);
}

.gallery-photo {
    position: relative;
    display: block;
    height: 220px;
    overflow: hidden;
}

.gallery-item img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.gallery-caption {
    display: grid;
    gap: 4px;
    padding: 14px 16px 16px;
}

.gallery-caption strong {
    color: var(--secondary);
    font-family: var(--heading-font);
    font-size: 1.15rem;
    font-weight: 500;
}

.gallery-caption em {
    color: var(--primary);
    font-family: var(--body-font);
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gallery-caption span,
.lightbox-note {
    color: var(--foreground);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.5;
    text-transform: none;
    white-space: pre-line;
}

.gallery-empty {
    margin: 0 0 18px;
    color: var(--foreground);
}

.gallery-item.is-hidden {
    display: none;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(44, 30, 22, 0.88);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-frame {
    display: grid;
    gap: 0;
    width: fit-content;
    max-width: min(860px, calc(100% - 8px));
    margin: 0;
    overflow: hidden;
    background: var(--secondary);
    border-radius: 16px;
}

.lightbox img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(58vh, 480px);
    object-fit: contain;
}

.lightbox figcaption {
    display: grid;
    gap: 4px;
    padding: 16px 20px 18px;
    text-align: center;
    background: var(--secondary);
}

.lightbox-title {
    color: var(--background);
    font-family: var(--heading-font);
    font-size: 1.6rem;
    font-weight: 500;
}

.lightbox-category {
    color: var(--accent);
    font-family: var(--body-font);
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.lightbox-note {
    color: var(--background);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 18px;
    border: 0;
    background: transparent;
    color: var(--background);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
}

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

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

    .gallery-photo {
        height: 200px;
    }
}
