.loma-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--loma-gallery-columns, 4), minmax(0, 1fr));
    gap: 12px;
}

.loma-gallery-thumb {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
}

.loma-gallery .loma-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (hover: hover) {
    .loma-gallery .loma-gallery-thumb img {
        transition: transform 220ms ease, filter 220ms ease;
    }

    .loma-gallery-hover-darken .loma-gallery-thumb:hover img {
        filter: brightness(0.72);
    }

    .loma-gallery-motion-shrink .loma-gallery-thumb img {
        transform: scale(1.08);
    }

    .loma-gallery-motion-shrink .loma-gallery-thumb:hover img {
        transform: scale(1);
    }

    .loma-gallery-motion-zoom .loma-gallery-thumb:hover img {
        transform: scale(1.08);
    }

    .loma-gallery-hover-brighten .loma-gallery-thumb:hover img {
        filter: brightness(1.2);
    }

    .loma-gallery-hover-grayscale .loma-gallery-thumb:hover img {
        filter: grayscale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loma-gallery .loma-gallery-thumb img {
        transition: none;
    }
}

.loma-gallery-viewer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: white;
}

.loma-gallery-viewer[open] {
    display: grid;
    place-items: center;
}

.loma-gallery-viewer::backdrop {
    background: rgb(0 0 0 / 92%);
}

html:has(.loma-gallery-viewer[open]) {
    overflow: hidden;
}

.loma-gallery .loma-gallery-photo {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100% - 112px);
    max-height: calc(100% - 112px);
    object-fit: contain;
}

.loma-gallery-viewer button {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #a6a6a6;
    border-radius: 50%;
    background: #202020;
    color: white;
    font: 32px/1 system-ui, sans-serif;
    cursor: pointer;
}

.loma-gallery-viewer button[hidden] {
    display: none;
}

.loma-gallery-viewer button:focus-visible {
    outline: 2px solid white;
    outline-offset: 3px;
}

.loma-gallery-close {
    top: 12px;
    right: 10px;
}

.loma-gallery-prev {
    left: 6px;
}

.loma-gallery-next {
    right: 6px;
}

.loma-gallery-count {
    position: absolute;
    bottom: 16px;
}
