.hero-lightbox-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.hero-lightbox-gallery__item {
    position: relative;
    display: block;
    min-width: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f4f6;
    text-decoration: none;
    isolation: isolate;
}

.hero-lightbox-gallery__item--hidden {
    display: none !important;
}

.hero-lightbox-gallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;

    /*
     * Keep the transform centered and prevent layout/compositing jitter
     */
    transform: translateZ(0) scale(1);
    transform-origin: center center;

    transition: transform 0.35s ease;

    /*
     * Promote image to its own compositor layer
     */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.hero-lightbox-gallery__overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.32);

    opacity: 0;
    transition: opacity 0.25s ease;

    /*
     * Prevent overlay from affecting layout
     */
    pointer-events: none;
    will-change: opacity;
}

.hero-lightbox-gallery__zoom {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;

    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;

    color: #fff;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;

    transform: translateZ(0) scale(0.85);
    transition: transform 0.25s ease;

    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.hero-lightbox-gallery__item:hover .hero-lightbox-gallery__image,
.hero-lightbox-gallery__item:focus-visible .hero-lightbox-gallery__image {
    transform: translateZ(0) scale(1.05);
}

.hero-lightbox-gallery__item:hover .hero-lightbox-gallery__overlay,
.hero-lightbox-gallery__item:focus-visible .hero-lightbox-gallery__overlay {
    opacity: 1;
}

.hero-lightbox-gallery__item:hover .hero-lightbox-gallery__zoom,
.hero-lightbox-gallery__item:focus-visible .hero-lightbox-gallery__zoom {
    transform: translateZ(0) scale(1);
}

.hero-lightbox-gallery__item:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

.hero-lightbox-gallery__empty {
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #64748b;
    text-align: center;
}


/*
 * Responsive
 */

@media (max-width: 768px) {
    .hero-lightbox-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .hero-lightbox-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}


/*
 * Respect users who prefer reduced motion
 */

@media (prefers-reduced-motion: reduce) {
    .hero-lightbox-gallery__image,
    .hero-lightbox-gallery__overlay,
    .hero-lightbox-gallery__zoom {
        transition: none;
    }

    .hero-lightbox-gallery__image {
        transform: none;
    }

    .hero-lightbox-gallery__zoom {
        transform: none;
    }
}