.gallery-masonry {
    column-count: 2;
    column-gap: 12px;
}

@media (min-width: 768px) {
    .gallery-masonry {
        column-count: 3;
    }
}

@media (min-width: 992px) {
    .gallery-masonry {
        column-count: 4;
    }
}

.gallery-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin: 0 0 12px;
    display: block;
}

.gallery-card {
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    height: auto;
    position: relative;
    transition: transform .12s ease, box-shadow .12s ease;
}

.gallery-card:hover {
    transform: translateY(-2px);
}

.gallery-thumb {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-body {
    padding: .75rem .9rem;
}

.gallery-title {
    font-size: .95rem;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, .18), rgba(0, 0, 0, 0));
}

.gallery-card:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    width: 100%;
    padding: .75rem .9rem;
    color: #fff;
}

.gallery-overlay-title {
    font-size: .95rem;
    margin: 0 0 .25rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-overlay-desc {
    margin: 0;
    font-size: .85rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}