.gallery-main {
    max-width: 1180px;
    margin: 0 auto;
}

.gallery-main > h1 {
    margin-bottom: 10px;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.gallery-intro {
    max-width: 620px;
    margin: 0 auto;
    color: #475569;
}

.gallery-preview-note {
    display: inline-block;
    margin: 14px 0 0;
    padding: 6px 12px;
    border-left: 3px solid #ffcc00;
    border-radius: 3px;
    background: #fff8db;
    color: #475569;
    font-size: 0.85rem;
}

.gallery-categories {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 32px;
}

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

.gallery-all-photos-row {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.gallery-category,
.gallery-category-placeholder {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #173b32;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.gallery-category {
    padding: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-category:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(23, 59, 50, 0.12);
}

.gallery-all-photos-button {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid #173b32;
    border-radius: 5px;
    background: #ffffff;
    color: #173b32;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.gallery-all-photos-button:hover {
    background: #173b32;
    color: #ffffff;
}

.gallery-category img,
.gallery-placeholder-art {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: #e8eef0;
}

.gallery-placeholder-art {
    display: grid;
    place-items: center;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 600;
}

.gallery-category-copy {
    display: grid;
    grid-template-rows: auto 2.7em auto;
    align-content: start;
    gap: 5px;
    min-height: 126px;
    padding: 14px;
    border-top: 3px solid #ffcc00;
}

.gallery-category-copy strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
}

.gallery-category-copy > span:not(.gallery-category-count) {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.35;
}

.gallery-category-placeholder .gallery-category-copy {
    grid-template-rows: auto 2.7em;
}

.gallery-empty-placeholder {
    min-width: 0;
    min-height: 318px;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f4f9fd;
}

.gallery-category-count {
    align-self: end;
    margin-top: 0;
    color: #64748b;
    font-size: 0.82rem;
}

.gallery-category:focus-visible,
.gallery-all-photos-button:focus-visible,
.gallery-back:focus-visible,
.gallery-card:focus-visible,
.gallery-lightbox button:focus-visible {
    outline: 3px solid #ffcc00;
    outline-offset: 3px;
}

.gallery-photos[hidden],
.gallery-categories[hidden] {
    display: none;
}

.gallery-photos {
    margin-top: 26px;
}

.gallery-group + .gallery-group {
    margin-top: 32px;
}

.gallery-year-heading {
    margin: 0 0 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffcc00;
    color: #173b32;
    font-size: 1.5rem;
    text-align: left;
}

.gallery-subheading {
    margin: 0 0 14px;
    color: #173b32;
    font-size: 1.15rem;
    text-align: left;
}

.gallery-competition-group + .gallery-competition-group {
    margin-top: 28px;
}

.gallery-group[hidden],
.gallery-competition-group[hidden] {
    display: none;
}

.gallery-back {
    display: inline-block;
    margin: 0 0 12px;
    padding: 7px 12px;
    border: 1px solid #d8e2e8;
    border-radius: 5px;
    background: #ffffff;
    color: #173b32;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.gallery-back:hover {
    border-color: #173b32;
    background: #173b32;
    color: #ffffff;
}

.gallery-category-heading {
    margin: 0 0 4px;
    font-size: 1.6rem;
}

.gallery-count {
    min-height: 1.4em;
    margin: 0 0 18px;
    color: #64748b;
    font-size: 0.85rem;
}

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

.gallery-card {
    display: grid;
    grid-template-rows: 230px 1fr;
    overflow: hidden;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    color: #173b32;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(23, 59, 50, 0.12);
}

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

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

.gallery-card-caption {
    display: block;
    min-height: 54px;
    padding: 12px 14px;
    border-top: 3px solid #ffcc00;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 700;
}

.gallery-lightbox {
    width: min(94vw, 1000px);
    max-width: none;
    max-height: 92vh;
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 8px;
    background: #111111;
    color: #ffffff;
}

.gallery-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.86);
}

.gallery-lightbox-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 18px 58px 16px;
}

.gallery-lightbox figure {
    margin: 0;
    text-align: center;
}

.gallery-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 80px);
    margin: 0 auto;
    object-fit: contain;
}

.gallery-lightbox-caption {
    padding-top: 12px;
    color: #ffffff;
    font-size: 0.95rem;
}

.gallery-lightbox button {
    position: absolute;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: rgba(17, 17, 17, 0.8);
    color: #ffffff;
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-lightbox button:hover {
    background: #173b32;
}

.gallery-lightbox .gallery-close {
    top: 12px;
    right: 12px;
    z-index: 1;
    font-size: 1.8rem;
}

.gallery-lightbox .gallery-previous {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox .gallery-next {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

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

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

    .gallery-category img,
    .gallery-placeholder-art {
        height: 170px;
    }

    .gallery-empty-placeholder {
        min-height: 298px;
    }

    .gallery-card img {
        height: 210px;
    }

    .gallery-card {
        grid-template-rows: 210px 1fr;
    }
}

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

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-card img {
        height: 240px;
    }

    .gallery-card {
        grid-template-rows: 240px 1fr;
    }

    .gallery-lightbox-inner {
        padding: 60px 48px 14px;
    }

    .gallery-lightbox-image {
        max-height: calc(92vh - 130px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-category,
    .gallery-card {
        transition: none;
    }
}
