.gallery-page {
    max-width: 1120px;
}

.gallery-intro {
    position: relative;
    overflow: hidden;
    margin-bottom: 2.4rem;
    padding: clamp(2rem, 5vw, 4rem);
    border-radius: 26px;
    background:
        linear-gradient(115deg, rgba(83, 2, 18, 0.94), rgba(226, 22, 53, 0.88)),
        url("img/gal/20190913/189.jpg") center 43% / cover;
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.gallery-intro::after {
    content: "";
    position: absolute;
    inset: auto -5rem -7rem auto;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.11);
}

.gallery-intro h1 {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0;
    font-size: clamp(2.25rem, 6vw, 4.7rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.gallery-intro p:not(.gallery-eyebrow) {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin: 1.2rem 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1rem, 2vw, 1.18rem);
}

.gallery-eyebrow,
.gallery-kicker {
    margin: 0 0 0.55rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.gallery-eyebrow {
    position: relative;
    z-index: 1;
    color: #ffd4da;
}

.gallery-kicker {
    color: var(--color-primary);
}

.gallery-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.gallery-section-heading h2 {
    margin: 0;
    font-size: clamp(1.55rem, 4vw, 2.25rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.gallery-total {
    flex: 0 0 auto;
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    font-weight: 650;
}

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

.gallery-card {
    display: block;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: inherit;
    text-align: left;
    box-shadow: 0 14px 34px rgba(32, 19, 21, 0.1);
    font: inherit;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 42px rgba(32, 19, 21, 0.16);
}

.gallery-card:focus-visible,
.gallery-back:focus-visible,
.photo-button:focus-visible,
.lightbox-button:focus-visible {
    outline: 3px solid rgba(226, 22, 53, 0.42);
    outline-offset: 3px;
}

.gallery-card-image-wrap {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eadfe1;
}

.gallery-card-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 320ms ease;
}

.gallery-card:hover .gallery-card-image {
    transform: scale(1.035);
}

.gallery-card-count {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    padding: 0.28rem 0.64rem;
    border-radius: 999px;
    background: rgba(25, 17, 18, 0.82);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 750;
    backdrop-filter: blur(8px);
}

.gallery-card-content {
    display: block;
    padding: 1rem 1.1rem 1.15rem;
}

.gallery-card-date {
    display: block;
    margin: 0 0 0.2rem;
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 750;
}

.gallery-card-title {
    display: block;
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.3;
}

.gallery-detail {
    min-height: 40vh;
}

.gallery-back {
    margin: 0 0 1.4rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-primary-dark);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.gallery-description {
    max-width: 700px;
    margin: 0.65rem 0 0;
    color: var(--color-text-muted);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.72rem;
}

.photo-button {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #eadfe1;
    cursor: zoom-in;
}

.photo-button img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 220ms ease, filter 220ms ease;
}

.photo-button:hover img {
    transform: scale(1.04);
    filter: saturate(1.06);
}

.gallery-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 1.7rem 0 0;
}

.gallery-load-more {
    min-width: 190px;
}

.gallery-status {
    padding: 3rem 1rem;
    color: var(--color-text-muted);
    text-align: center;
}

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

.gallery-lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(12, 9, 10, 0.96);
    color: #fff;
}

.gallery-lightbox::backdrop {
    background: rgba(12, 9, 10, 0.96);
}

.gallery-lightbox[open] {
    display: grid;
    grid-template-columns: minmax(3.2rem, 0.12fr) minmax(0, 1fr) minmax(3.2rem, 0.12fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: center;
}

.lightbox-toolbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
    padding: 0.5rem 1rem 0.5rem 1.25rem;
}

.lightbox-counter {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    font-weight: 650;
}

.lightbox-button {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font: inherit;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 160ms ease;
}

.lightbox-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
    font-size: 1.8rem;
}

.lightbox-previous {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
}

.lightbox-next {
    grid-column: 3;
    grid-row: 2;
    justify-self: center;
}

.lightbox-figure {
    position: relative;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 0 1rem;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    place-items: center;
}

.lightbox-figure img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 7.5rem);
    object-fit: contain;
    opacity: 0;
    transition: opacity 160ms ease;
}

.lightbox-figure img.is-loaded {
    opacity: 1;
}

.lightbox-figure figcaption {
    min-height: 1.5rem;
    padding: 0.45rem 1rem 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.86rem;
    text-align: center;
}

.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.4rem;
    height: 2.4rem;
    margin: -1.2rem;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gallery-spin 0.8s linear infinite;
}

.lightbox-loader[hidden] {
    display: none;
}

@keyframes gallery-spin {
    to { transform: rotate(360deg); }
}

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

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

@media (max-width: 600px) {
    .gallery-intro {
        border-radius: 20px;
    }

    .gallery-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

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

    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }

    .photo-button {
        border-radius: 9px;
    }

    .gallery-lightbox[open] {
        grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem;
    }

    .lightbox-toolbar {
        padding-inline: 0.75rem;
    }

    .lightbox-button {
        width: 2.75rem;
        height: 2.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .gallery-card-image,
    .photo-button img,
    .lightbox-figure img {
        transition: none;
    }

    .lightbox-loader {
        animation-duration: 1.8s;
    }
}
