.gallery-intro {
    padding: 64px 0 54px;
    background: #f6f3eb;
    border-bottom: 1px solid #e8e3d8;
}

.gallery-intro-inner {
    max-width: 760px;
}

.gallery-intro h1 {
    margin: 5px 0 14px;
    color: var(--green-dark);
    font-size: clamp(34px, 5vw, 50px);
    line-height: 1.12;
    letter-spacing: -1.2px;
}

.gallery-intro-inner > p:last-child {
    max-width: 650px;
    color: #656b60;
    font-size: 16px;
    line-height: 1.85;
}

.gallery-section {
    padding-block: 52px 82px;
}

.gallery-topline {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.gallery-topline h2 {
    margin-bottom: 4px;
    color: var(--green-dark);
    font-size: clamp(23px, 3vw, 30px);
    letter-spacing: -.5px;
}

.gallery-topline p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.gallery-count {
    padding-bottom: 5px;
    color: #7a6b54;
    font-size: 13px;
    white-space: nowrap;
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 25px;
}

.gallery-filter {
    padding: 9px 14px;
    border: 1px solid #dedfd5;
    border-radius: 6px;
    background: #fff;
    color: #4c5449;
    font-size: 13px;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.gallery-filter:hover,
.gallery-filter:focus-visible {
    border-color: #84967b;
    outline: none;
}

.gallery-filter.active {
    border-color: var(--green-dark);
    background: var(--green-dark);
    color: #fff;
}

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

.gallery-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e7e5dc;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(45, 57, 43, .035);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.gallery-card:hover {
    border-color: #d4d9cb;
    box-shadow: 0 12px 28px rgba(45, 57, 43, .09);
    transform: translateY(-3px);
}

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

.gallery-photo-button {
    position: relative;
    display: block;
    width: 100%;
    flex: 0 0 auto;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: #e9e6dc;
    cursor: zoom-in;
}

.gallery-photo-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.gallery-photo-button:hover img,
.gallery-photo-button:focus-visible img {
    transform: scale(1.04);
}

.gallery-photo-button:focus-visible,
.gallery-open-photo:focus-visible,
.gallery-read-more:focus-visible {
    outline: 3px solid #9bb28e;
    outline-offset: 3px;
}

.gallery-zoom {
    position: absolute;
    right: 11px;
    bottom: 11px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 5px;
    background: rgba(31, 56, 39, .9);
    color: #fff;
    font-size: 12px;
    opacity: 0;
    transition: opacity .2s ease;
}

.gallery-photo-button:hover .gallery-zoom,
.gallery-photo-button:focus-visible .gallery-zoom {
    opacity: 1;
}

.gallery-caption {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    overflow-wrap: anywhere;
}

.gallery-category-label {
    display: inline-block;
    margin-bottom: 9px;
    padding: 5px 8px;
    border-radius: 4px;
    background: #f1f3eb;
    color: #61734f;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .65px;
    line-height: 1.4;
    text-transform: uppercase;
}

.gallery-caption h3 {
    display: block;
    margin: 0;
    color: #303b30;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 21px;
    font-weight: 500;
    line-height: 1.38;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.gallery-caption p {
    margin: 10px 0 0;
    color: #62685e;
    font-size: 14px;
    line-height: 1.75;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.gallery-caption .gallery-no-summary {
    color: #808477;
    font-style: italic;
}

.gallery-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 14px;
    width: 100%;
    margin-top: auto;
    padding-top: 18px;
}

.gallery-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 13px;
    border: 1px solid #35563a;
    border-radius: 5px;
    background: #35563a;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease;
}

.gallery-read-more:hover {
    border-color: #243c28;
    background: #243c28;
}

.gallery-read-more span {
    color: inherit;
    font-size: 16px;
    letter-spacing: 0;
    text-transform: none;
}

.gallery-open-photo {
    padding: 7px 0;
    border: 0;
    background: transparent;
    color: #5f6f54;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.gallery-open-photo:hover {
    color: #263f2b;
    text-decoration: underline;
}

.gallery-empty {
    padding: 30px 0;
    color: var(--muted);
    text-align: center;
}

.gallery-dialog {
    position: fixed;
    width: min(900px, calc(100% - 30px));
    max-width: none;
    max-height: calc(100% - 30px);
    margin: auto;
    padding: 14px;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 9px;
    background: #fffdf8;
    color: var(--text);
    box-shadow: 0 20px 70px rgba(0, 0, 0, .32);
}

.gallery-dialog::backdrop {
    background: rgba(16, 26, 18, .78);
}

.gallery-dialog form {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.gallery-dialog-close {
    padding: 7px 12px;
    border: 1px solid #dfe0d7;
    border-radius: 5px;
    background: #fff;
    color: #394338;
    cursor: pointer;
}

.gallery-dialog > img {
    display: block;
    width: 100%;
    max-height: 72vh;
    border-radius: 5px;
    background: #eee;
    object-fit: contain;
}

.gallery-dialog > p {
    padding: 12px 3px 2px;
    color: #4f554c;
    font-size: 14px;
    line-height: 1.7;
}

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

@media (max-width: 560px) {
    .gallery-intro {
        padding: 46px 0 38px;
    }

    .gallery-section {
        padding-block: 35px 54px;
    }

    .gallery-topline {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .gallery-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .gallery-caption {
        padding: 17px;
    }

    .gallery-caption h3 {
        font-size: 20px;
    }

    .gallery-caption p {
        font-size: 14px;
    }

    .gallery-zoom {
        opacity: 1;
    }

    .gallery-card-actions {
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .gallery-photo-button img,
    .gallery-zoom,
    .gallery-filter,
    .gallery-read-more {
        transition: none;
    }

    .gallery-card:hover {
        transform: none;
    }
}

.gallery-download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid #d6ddcf;
    border-radius: 5px;
    background: #f8f8f3;
    color: #36583b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
}

.gallery-download-link:hover,
.gallery-download-link:focus-visible {
    background: #eaf0e5;
    border-color: #456d48;
}

.gallery-download-link:focus-visible {
    outline: 3px solid #9bb28e;
    outline-offset: 3px;
}
