/* ===== IMPROVED MASONRY LAYOUT ===== */
.cmg-horizontal-gallery {
    column-count: 4;
    column-gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    /* 🔥 FIX: Remove column-fill to let items flow naturally */
}

/* Responsive columns */
@media (max-width: 1200px) {
    .cmg-horizontal-gallery { column-count: 3; }
}
@media (max-width: 768px) {
    .cmg-horizontal-gallery { column-count: 2; }
}
@media (max-width: 480px) {
    .cmg-horizontal-gallery { column-count: 1; }
}

/* Masonry item */
.cmg-item {
    display: inline-block; /* 🔥 CHANGED from block to inline-block */
    width: 100%;
    margin-bottom: 16px;
    break-inside: avoid;
    page-break-inside: avoid; /* 🔥 ADDED for better browser support */
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    position: relative;
    vertical-align: top; /* 🔥 ADDED to prevent baseline alignment issues */
}

/* 🔥 Better handling of last items */
.cmg-item:last-child {
    margin-bottom: 16px; /* Keep consistent spacing */
}

/* Media keeps natural ratio */
.cmg-item img,
.cmg-item video {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform .4s ease;
}

/* Hover zoom */
.cmg-item:hover img,
.cmg-item:hover video {
    transform: scale(1.04);
}

/* Overlay */
.cmg-item::after {
    content: "+";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.35);
    color: #fff;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none; /* 🔥 ADDED to prevent click interference */
}

.cmg-item:hover::after {
    opacity: 1;
}