.gallery a {
    display: flex;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 200px;
    background: #1f1f1f;
    color: #fff;
    font-style: normal;
}

.gallery a img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    transition: transform 300ms ease, opacity 300ms ease;
}

.gallery a::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.45));
    opacity: 0;
    transition: opacity 300ms ease;
}

.gallery a i {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: 48px;
    height: 48px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: #fff;
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.8);
    transition: opacity 300ms ease, transform 300ms ease;
}

.gallery a i::before,
.gallery a i::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
}

.gallery a i::before {
    top: 10px;
    left: 10px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
}

.gallery a i::after {
    right: 10px;
    bottom: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

@media (hover: hover) {
    .gallery a:hover img {
        opacity: 0.72;
        transform: scale(1.06);
    }

    .gallery a:hover::after,
    .gallery a:hover i {
        opacity: 1;
    }

    .gallery a:hover i {
        transform: translate(-50%, -50%) scale(1);
    }
}

.gallery a:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

.gallery a:focus-visible img {
    opacity: 0.72;
    transform: scale(1.06);
}

.gallery a:focus-visible::after,
.gallery a:focus-visible i {
    opacity: 1;
}

.gallery a:focus-visible i {
    transform: translate(-50%, -50%) scale(1);
}

*:has(>.gallery) {
    container-type: inline-size;
    container-name: gallery;
}

.gallery {
    display: grid;
    gap: 1rem;
    margin: 2rem 0;
}

.gallery.cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.gallery.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gallery.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@container gallery (max-width: 991.98px) {
    .gallery.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@container gallery (max-width: 575.98px) {
    .gallery.cols-3 {
        grid-template-columns: repeat(1, 1fr);
    }

    .gallery.cols-4 {
        grid-template-columns: repeat(1, 1fr);
    }
}
