.gallery-page {
    --gallery-forest: var(--forest, #173a2a);
    --gallery-leaf: var(--leaf, #35634a);
    --gallery-mist: var(--mist, #f3f5ef);
    --gallery-sandstone: var(--sandstone, #d2a266);
    --gallery-ink: var(--ink, #172019);
    --gallery-focus: var(--focus, #0d75a8);
    background: var(--gallery-mist);
    color: var(--gallery-ink);
    padding: clamp(3.5rem, 8vw, 7rem) 1.25rem;
}

.gallery-page *,
.gallery-page *::before,
.gallery-page *::after {
    box-sizing: border-box;
}

.gallery-page__inner {
    margin: 0 auto;
    max-width: 74rem;
}

.gallery-page__intro {
    margin: 0 auto clamp(2.5rem, 6vw, 4.5rem);
    max-width: 48rem;
    text-align: center;
}

.gallery-page__eyebrow {
    color: var(--gallery-leaf);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
}

.gallery-page__intro h1,
.gallery-collection__heading h2 {
    color: var(--gallery-forest);
    font-family: inherit;
    line-height: 1.08;
    margin: 0;
}

.gallery-page__intro h1 {
    font-size: clamp(2.25rem, 6vw, 4.75rem);
    letter-spacing: -0.04em;
}

.gallery-page__intro > :last-child {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.7;
    margin: 1.25rem auto 0;
    max-width: 41rem;
}

.gallery-filters {
    border-block: 1px solid color-mix(in srgb, var(--gallery-forest) 22%, transparent);
    margin: 0 0 clamp(2rem, 5vw, 3.5rem);
    padding: 1.25rem 0;
}

.gallery-filters fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

.gallery-filters legend {
    color: var(--gallery-forest);
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.gallery-filters__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.gallery-filter,
.gallery-load-more,
.gallery-dialog__close {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid currentColor;
    border-radius: 999px;
    color: var(--gallery-forest);
    cursor: pointer;
    font: inherit;
    font-size: 0.93rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.gallery-filter {
    background: transparent;
    padding: 0.6rem 0.9rem;
}

.gallery-filter:hover,
.gallery-filter[aria-pressed="true"] {
    background: var(--gallery-forest);
    border-color: var(--gallery-forest);
    color: #fff;
}

.gallery-filter:active,
.gallery-load-more:active,
.gallery-dialog__close:active {
    transform: translateY(1px);
}

.gallery-page :is(a, button):focus-visible {
    outline: 3px solid var(--gallery-focus);
    outline-offset: 3px;
}

.gallery-collection__heading {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 2rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.gallery-collection__heading h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.gallery-collection__count {
    color: color-mix(in srgb, var(--gallery-ink) 76%, transparent);
    font-size: 0.94rem;
    margin: 0;
}

.gallery-grid {
    display: grid;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.gallery-card {
    background: #fff;
    box-shadow: 0 0.5rem 1.5rem rgb(23 32 25 / 8%);
    min-width: 0;
}

.gallery-card__image-link {
    background: color-mix(in srgb, var(--gallery-forest) 20%, #000);
    display: block;
    overflow: hidden;
    position: relative;
}

.gallery-card__image-link::before {
    content: "";
    display: block;
    padding-top: 75%;
}

.gallery-card__image-link img {
    height: 100%;
    inset: 0;
    object-fit: cover;
    position: absolute;
    transition: transform 240ms ease;
    width: 100%;
}

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

.gallery-card__view {
    align-items: center;
    background: rgb(23 58 42 / 82%);
    color: #fff;
    display: flex;
    font-size: 0.85rem;
    font-weight: 700;
    inset: 0;
    justify-content: center;
    letter-spacing: 0.03em;
    opacity: 0;
    position: absolute;
    text-transform: uppercase;
    transition: opacity 180ms ease;
}

.gallery-card__image-link:hover .gallery-card__view,
.gallery-card__image-link:focus-visible .gallery-card__view {
    opacity: 1;
}

.gallery-card__caption {
    padding: 0.9rem 1rem 1rem;
}

.gallery-card__caption p {
    margin: 0;
}

.gallery-card__caption > :first-child {
    color: var(--gallery-ink);
    font-size: 0.94rem;
    font-weight: 650;
    line-height: 1.4;
}

.gallery-card__category {
    color: var(--gallery-leaf);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1.3;
    margin-top: 0.45rem !important;
    text-transform: uppercase;
}

.gallery-collection__more {
    display: flex;
    justify-content: center;
    padding-top: clamp(2rem, 5vw, 3.25rem);
}

.gallery-load-more {
    background: var(--gallery-forest);
    border-color: var(--gallery-forest);
    color: #fff;
    padding: 0.8rem 1.2rem;
}

.gallery-load-more:hover {
    background: var(--gallery-leaf);
    border-color: var(--gallery-leaf);
    color: #fff;
}

.gallery-load-more[aria-busy="true"] {
    cursor: progress;
    opacity: 0.7;
}

.gallery-empty {
    border-left: 0.3rem solid var(--gallery-sandstone);
    margin: 0;
    padding: 1rem 1.2rem;
}

.gallery-page__sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.gallery-dialog {
    background: transparent;
    border: 0;
    max-height: 100vh;
    max-width: min(96vw, 78rem);
    padding: 1rem;
    width: 100%;
}

.gallery-dialog::backdrop {
    background: rgb(8 21 15 / 86%);
}

.gallery-dialog__frame {
    background: #fff;
    box-shadow: 0 1rem 4rem rgb(0 0 0 / 35%);
    margin: 0 auto;
    max-width: 72rem;
    padding: clamp(1rem, 2vw, 1.5rem);
    position: relative;
}

.gallery-dialog__close {
    background: #fff;
    color: var(--gallery-forest);
    margin-left: auto;
    padding: 0.5rem 0.8rem;
}

.gallery-dialog__close:hover {
    background: var(--gallery-forest);
    color: #fff;
}

.gallery-dialog__figure {
    margin: 0.75rem 0 0;
}

.gallery-dialog__figure img {
    display: block;
    height: auto;
    margin: 0 auto;
    max-height: min(72vh, 52rem);
    max-width: 100%;
    object-fit: contain;
}

.gallery-dialog__figure figcaption {
    padding: 0.9rem 0 0.2rem;
}

.gallery-dialog__figure figcaption p {
    margin: 0;
}

.gallery-dialog__figure figcaption > :first-child {
    color: var(--gallery-ink);
    font-weight: 700;
    line-height: 1.45;
}

.gallery-dialog__category {
    color: var(--gallery-leaf);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-top: 0.35rem !important;
    text-transform: uppercase;
}

@media (max-width: 42rem) {
    .gallery-page {
        padding-inline: 1rem;
    }

    .gallery-filters__buttons {
        gap: 0.5rem;
    }

    .gallery-filter {
        font-size: 0.87rem;
        padding: 0.55rem 0.75rem;
    }

    .gallery-collection__heading {
        align-items: start;
        flex-direction: column;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-card__caption {
        padding: 0.75rem;
    }

    .gallery-card__caption > :first-child {
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-page *,
    .gallery-page *::before,
    .gallery-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
