/* Container */
.masonry-gallery {
    column-count: 4;
    column-gap: 16px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Prevent items from breaking */
.masonry-item {
    break-inside: avoid;
    margin-bottom: 16px;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    background: #f2f2f2;
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
    transition: transform 0.25s ease;
}

.masonry-item:hover {
    transform: translateY(-4px);
}

/* Base image */
.masonry-item img {
    width: 100%;
    display: block;
    object-fit: cover;
    transition: transform .35s ease;
}

.masonry-item:hover img {
    transform: scale(1.04);
}

/* Different image proportions */

.masonry-item.landscape img {
    height: 220px;
}

.masonry-item.square img {
    height: 320px;
}

.masonry-item.portrait img {
    height: 500px;
}

/* Tablet */
@media (max-width: 1200px) {
    .masonry-gallery {
        column-count: 3;
    }
}

/* Small tablet */
@media (max-width: 768px) {
    .masonry-gallery {
        column-count: 2;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .masonry-gallery {
        column-count: 1;
        padding: 10px;
    }
}