/*
Gallery grid for the {{< gallery >}} / {{< artwork >}} shortcodes.
*/
.gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.gallery figure {
    position: relative;
    aspect-ratio: 1;
    margin: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(20, 20, 20, 0.08);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.dark .gallery figure {
    background: rgba(32, 32, 36, 0.86);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.gallery a {
    position: absolute;
    inset: 8px;
}
.gallery img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Caption appears on hover */
.gallery figcaption {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 5px;
    color: #fff;
    text-align: center;
    font-size: 75%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
.gallery figure:not(:hover) figcaption {
    opacity: 0;
}

/* Lightbox caption, registered in static/js/gallery.js */
.pswp__caption {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 4px 12px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
}
.pswp__caption:empty {
    display: none;
}
