.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5em;
    padding-top: 1em;
    padding-bottom: 1em;
}

.gallery img,
.gallery video {
    max-width: 100%;
}

.gallery .gallery-item {
    position: relative;
}

.gallery .gallery-item .preview {
    overflow: hidden;
    color: white;
}

.gallery .gallery-item .preview,
.gallery .gallery-item .preview .preview-content,
.gallery .gallery-item .gallery-title {
    position: absolute;
}

.gallery .gallery-item .preview,
.gallery .gallery-item .preview .preview-content {
    top: 0;
    left: 0;
}

.gallery figure {
    margin: 0;
}

.gallery .gallery-item .main-img {
    z-index: 0;
    display: block;
    min-height: 100%;
    max-width: 100%;
    width: 100%;
    object-fit: cover;
}

.gallery .gallery-shadow {
    box-shadow: 8px 8px 24px var(--bg-black);
}

.gallery .gallery-item .preview {
    visibility: hidden;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 12px;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-item:hover .preview,
.gallery-item.hover .preview {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery .gallery-item .preview {
    display: block;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
}

.gallery .gallery-item .preview .preview-content {
    z-index: 2;
    height: 100%;
    width: 100%;
    padding: 1.5em;
    box-sizing: border-box;
    text-align: justify;
    mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 1) 80%,
        rgba(0, 0, 0, 0.5) 90%,
        transparent 95%);
}

.gallery .gallery-item .gallery-title {
    z-index: 0;
    bottom: 0;
    right: 0;
    margin: 1em;
    text-align: right;
    hyphens: none;
    text-shadow:
        4px 4px 0px var(--bg-black),
        4px 4px 8px var(--bg-black);
    color: white;
}

.gallery .gallery-item .gallery-title h2 {
    margin: 0;
    font-weight: normal;
}

.gallery .gallery-item .preview .gallery {
    gap: 0.5em;
    padding: 0;
    margin-top: 0;
    margin-bottom: 1.5em;
}
