.content-gallery {
    margin-top: 2rem;
    margin-bottom: 4rem;
}

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

.content-gallery__item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #eef1f5;
    border: 0;
    border-radius: 8px;
    cursor: zoom-in;
    box-shadow: 0 2px 8px rgba(3, 39, 90, 0.08);
}

.content-gallery__thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    border: 0 !important;
    object-fit: cover;
    transition: transform 220ms ease;
}

.content-gallery__zoom {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    color: #fff;
    background: rgba(3, 39, 90, 0.82);
    border-radius: 50%;
    opacity: 0;
    place-items: center;
    transform: translateY(4px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.content-gallery__item:hover .content-gallery__thumbnail,
.content-gallery__item:focus-visible .content-gallery__thumbnail {
    transform: scale(1.035);
}

.content-gallery__item:hover .content-gallery__zoom,
.content-gallery__item:focus-visible .content-gallery__zoom {
    opacity: 1;
    transform: translateY(0);
}

.content-gallery__item:focus-visible,
.content-gallery__close:focus-visible,
.content-gallery__control:focus-visible {
    outline: 3px solid #f8c400;
    outline-offset: 3px;
}

.content-gallery__lightbox[hidden] {
    display: none;
}

.content-gallery__lightbox {
    position: fixed;
    z-index: 10050;
    inset: 0;
    display: grid;
    padding: 3rem clamp(1.5rem, 4vw, 4rem);
    place-items: center;
}

.content-gallery__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 15, 36, 0.94);
}

.content-gallery__viewer {
    position: relative;
    display: flex;
    width: min(1120px, 100%);
    height: min(780px, calc(100vh - 6rem));
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.content-gallery__stage {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1;
    align-items: center;
    justify-content: center;
}

.content-gallery__image {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: calc(100% - 9rem);
    max-height: calc(100vh - 10rem);
    margin: 0 !important;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.content-gallery__close,
.content-gallery__control {
    display: grid;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 50%;
    place-items: center;
    transition: background-color 160ms ease;
}

.content-gallery__close:hover,
.content-gallery__control:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.26);
}

.content-gallery__close {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.25rem;
}

.content-gallery__control {
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.15rem;
    transform: translateY(-50%);
}

.content-gallery__control--previous {
    left: 0;
}

.content-gallery__control--next {
    right: 0;
}

.content-gallery__control[hidden] {
    display: none;
}

.content-gallery__counter {
    min-height: 1.5rem;
    margin-top: 0.75rem;
    color: #fff;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

body.content-gallery-is-open {
    overflow: hidden;
}

@media (max-width: 991.98px) {
    .content-gallery__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .content-gallery {
        margin-bottom: 2.5rem;
    }

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

    .content-gallery__lightbox {
        padding: 0.75rem;
    }

    .content-gallery__viewer {
        height: calc(100vh - 1.5rem);
    }

    .content-gallery__image {
        max-width: 100%;
        max-height: calc(100vh - 7rem);
    }

    .content-gallery__close {
        top: 0.25rem;
        right: 0.25rem;
    }

    .content-gallery__control {
        top: auto;
        bottom: 0.25rem;
        width: 2.75rem;
        height: 2.75rem;
        background: rgba(3, 39, 90, 0.82);
        transform: none;
    }

    .content-gallery__control--previous {
        left: 0.25rem;
    }

    .content-gallery__control--next {
        right: 0.25rem;
    }

    .content-gallery__counter {
        position: absolute;
        bottom: 0.9rem;
        left: 50%;
        margin: 0;
        transform: translateX(-50%);
    }
}

@media (max-width: 399.98px) {
    .content-gallery__grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .content-gallery__thumbnail,
    .content-gallery__zoom,
    .content-gallery__close,
    .content-gallery__control {
        transition: none;
    }
}
