.kng-gallery {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
}

.kng-gallery__item {
    appearance: none;
    aspect-ratio: 1 / 1;
    background: #f3f4f5;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
    display: block;
    line-height: 0;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    transform: translateY(0);
    transition:
        box-shadow 220ms ease,
        transform 220ms ease;
    width: 100%;
}

.kng-gallery__item::after {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.12),
        rgba(0, 0, 0, 0.2)
    );
    bottom: 0;
    content: "";
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    transition: opacity 220ms ease;
    z-index: 1;
}

.kng-gallery__image {
    display: block;
    filter: saturate(1);
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: center;
    transform: scale(1);
    transition:
        filter 220ms ease,
        transform 360ms cubic-bezier(0.2, 0.7, 0.2, 1);
    width: 100% !important;
}

.kng-gallery__item:hover,
.kng-gallery__item:focus-visible {
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
    transform: translateY(-3px);
}

.kng-gallery__item:hover::after,
.kng-gallery__item:focus-visible::after {
    opacity: 1;
}

.kng-gallery__item:hover .kng-gallery__image,
.kng-gallery__item:focus-visible .kng-gallery__image {
    filter: saturate(1.08) contrast(1.03);
    transform: scale(1.055);
}

.kng-gallery__item:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.72);
    outline-offset: 4px;
}

.kng-lightbox {
    align-items: center;
    background: rgba(0, 0, 0, 0.84);
    bottom: 0;
    box-sizing: border-box;
    display: none;
    justify-content: center;
    left: 0;
    padding: 28px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 99999;
}

.kng-lightbox.is-open {
    display: flex;
}

.kng-lightbox__image {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    display: block;
    height: auto;
    max-height: calc(100vh - 56px);
    max-width: calc(100vw - 56px);
    object-fit: contain;
    width: auto;
}

.kng-lightbox__close {
    align-items: center;
    appearance: none;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 30px;
    height: 44px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    position: absolute;
    right: 18px;
    top: 18px;
    width: 44px;
}

.kng-lightbox__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

body.kng-lightbox-open {
    overflow: hidden;
}

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

    .kng-gallery__item:hover,
    .kng-gallery__item:focus-visible {
        transform: none;
    }

    .kng-lightbox {
        padding: 18px;
    }

    .kng-lightbox__image {
        max-height: calc(100vh - 36px);
        max-width: calc(100vw - 36px);
    }
}
