.gallery-page {
    position: relative;
    padding: 3.5rem 0 4.8rem;
    background:
        radial-gradient(circle at 12% 18%, rgba(232, 87, 67, 0.17), transparent 30%),
        radial-gradient(circle at 88% 12%, rgba(31, 42, 99, 0.16), transparent 28%),
        linear-gradient(165deg, #f8f1f0 0%, #f3f5fb 48%, #eef3f4 100%);
    overflow: hidden;
}

.gallery-page__container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
}

.gallery-page__halo {
    position: absolute;
    border-radius: 999px;
    filter: blur(90px);
    pointer-events: none;
}

.gallery-page__halo--a {
    width: 260px;
    height: 260px;
    top: 120px;
    right: 4%;
    background: rgba(231, 76, 60, 0.14);
}

.gallery-page__halo--b {
    width: 240px;
    height: 240px;
    bottom: 60px;
    left: 2%;
    background: rgba(59, 130, 246, 0.12);
}

.gallery-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.gallery-hero__eyebrow {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(231, 76, 60, 0.12);
    color: #cd4333;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
}

.gallery-hero h1 {
    margin: 0;
    font-family: "Montserrat", sans-serif;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #202020;
    font-size: clamp(2.2rem, 6vw, 4rem);
}

.gallery-hero p {
    margin: 1rem auto 0;
    max-width: 690px;
    color: #4a4a4a;
    font-size: 1.03rem;
}

.gallery-year-switch {
    margin: 1rem auto 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid rgba(27, 27, 27, 0.2);
    background: rgba(255, 255, 255, 0.72);
}

.gallery-year-switch label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #353535;
}

.gallery-year-switch select {
    border: 1px solid rgba(27, 27, 27, 0.25);
    background: #fff;
    color: #222;
    font-size: 0.82rem;
    padding: 0.32rem 0.4rem;
    outline: none;
}

.gallery-year-switch span {
    font-size: 0.75rem;
    color: #ce4a3a;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gallery-hero__nav {
    margin-top: 1.3rem;
    display: inline-flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.gallery-chip {
    padding: 0.55rem 1rem;
    border-radius: 0;
    color: #2a2a2a;
    border: 1px solid rgba(42, 42, 42, 0.18);
    background: rgba(255, 255, 255, 0.6);
    font-size: 0.86rem;
    font-weight: 600;
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.gallery-chip:hover {
    transform: translateY(-2px);
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.gallery-block + .gallery-block {
    margin-top: 1.8rem;
}

.gallery-block__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gallery-block__head h2 {
    margin: 0;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    color: #1f1f1f;
    letter-spacing: -0.02em;
}

.gallery-block__head span {
    color: #d24c3c;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.gallery-grid {
    display: grid;
    gap: 0.75rem;
    grid-auto-flow: row;
    grid-auto-rows: 8px;
    align-items: start;
}

.gallery-empty {
    margin: 0;
    padding: 1rem 1.1rem;
    border: 1px dashed rgba(210, 76, 60, 0.4);
    background: rgba(255, 255, 255, 0.72);
    color: #5b4b47;
    font-size: 0.95rem;
}

.gallery-grid--personal {
    grid-template-columns: 1.25fr 1fr 1fr;
}

.gallery-grid--sport {
    grid-template-columns: 1.5fr 1fr 1fr;
}

.gallery-card {
    position: relative;
    height: auto;
    aspect-ratio: var(--gallery-image-ratio, 4 / 3);
    min-height: 140px;
    border-radius: 0;
    overflow: hidden;
    border: 0;
    box-shadow: none;
    filter: none;
    isolation: isolate;
    background: #111;
    cursor: zoom-in;
}

.gallery-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
    image-rendering: auto;
    box-shadow: none;
    filter: none;
    transform: none;
    transition: transform 0.4s ease;
}

.gallery-card--accent::after {
    content: "";
    position: absolute;
    inset: auto auto 14px 14px;
    width: 62px;
    height: 62px;
    border-radius: 0;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.48), rgba(253, 196, 66, 0.38));
    z-index: 2;
}

.gallery-card:hover img {
    transform: scale(1.02);
}

.gallery-card:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.42);
    outline-offset: 2px;
}

.gallery-card__overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1rem 1rem 1.1rem;
    color: #fff;
}

.gallery-card__overlay h3 {
    margin: 0;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
}

.gallery-card__overlay p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    opacity: 0.92;
}

.gallery-card--empty {
    min-height: 220px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(245, 237, 236, 0.98));
    border: 1px solid rgba(42, 42, 42, 0.08);
}

.gallery-card--empty::before,
.gallery-card--empty::after {
    display: none;
}

.gallery-card__overlay--static {
    position: static;
    color: #1f1f1f;
    padding: 1.4rem;
}

.gallery-card__overlay--static p {
    color: #575757;
    opacity: 1;
}

body.gallery-modal-open {
    overflow: hidden;
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.gallery-modal[hidden] {
    display: none;
}

.gallery-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(13, 13, 18, 0.82);
    backdrop-filter: blur(6px);
}

.gallery-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 1240px);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

.gallery-modal__figure {
    margin: 0;
    display: grid;
    gap: 0.85rem;
    justify-items: center;
}

.gallery-modal__image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(78vh, 920px);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
    background: #111;
}

.gallery-modal__caption {
    min-height: 1.4rem;
    text-align: center;
    color: #f5f4f2;
    font-size: 0.95rem;
}

.gallery-modal__close,
.gallery-modal__nav {
    border: 0;
    cursor: pointer;
    color: #fff;
}

.gallery-modal__close {
    position: absolute;
    top: -0.35rem;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.9rem;
    line-height: 1;
}

.gallery-modal__nav {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 2rem;
    line-height: 1;
}

.gallery-modal__close:hover,
.gallery-modal__nav:hover,
.gallery-modal__close:focus-visible,
.gallery-modal__nav:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

@media (max-width: 1024px) {
    .gallery-grid--personal,
    .gallery-grid--sport {
        grid-template-columns: 1fr 1fr;
    }

    .gallery-modal__dialog {
        width: min(100%, 960px);
    }
}

@media (max-width: 700px) {
    .gallery-page {
        padding: 2.5rem 0 3.3rem;
    }

    .gallery-block__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .gallery-year-switch {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .gallery-grid--personal,
    .gallery-grid--sport {
        grid-template-columns: 1fr;
    }

    .gallery-card {
        aspect-ratio: var(--gallery-image-ratio, 4 / 3);
    }

    .gallery-modal {
        padding: 1rem;
    }

    .gallery-modal__dialog {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .gallery-modal__nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
        width: 44px;
        height: 44px;
    }

    .gallery-modal__nav--prev {
        left: 0.35rem;
    }

    .gallery-modal__nav--next {
        right: 0.35rem;
    }

    .gallery-modal__image {
        max-height: 72vh;
    }

    .gallery-page__halo {
        display: none;
    }
}
