/*
 * Frontend styles for the massundmoritz Gallery plugin.
 *
 * New version: full-width masonry-style layout with 5 columns,
 * no background on the container, no rounded corners on images,
 * entrance animation, lightbox overlay and subtle column parallax.
 */

.massundmoritz-gallery {
    width: 100%;
    max-width: 100%;
    padding: 40px 0;
    margin: 0;
    box-sizing: border-box;
}

/* Filter bar at the bottom center */
.massundmoritz-gallery-filters {
    position: sticky;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #ffffff;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 5;
}

.massundmoritz-gallery-filters button {
    border: none;
    background: transparent;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    color: #444;
    white-space: nowrap;
}

.massundmoritz-gallery-filters button:hover {
    background: #f2f2f2;
}

.massundmoritz-gallery-filters button.active {
    background: #000;
    color: #fff;
    transform: translateY(-1px);
}

/* Masonry grid: 5 columns via flex + column wrappers */
.massundmoritz-gallery-grid {
    display: flex;
    align-items: flex-start;
    gap: 16px;          /* whatever spacing you like */
    overflow: hidden;   /* IMPORTANT: so moving columns don't change height */
    width: 100%;
}

.mm-gallery-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    will-change: transform;
    transition: transform 0.35s ease-out;
}

/* Gallery items */
.massundmoritz-gallery-item {
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    animation: mm-fadeUp 0.7s ease-out forwards;
    animation-delay: calc(var(--mm-index, 0) * 40ms);
}

.massundmoritz-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 0; /* remove rounding */
}

/* Lightbox overlay */
.mm-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 9999;
}

.mm-lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mm-lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.mm-lightbox-inner img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
}

.mm-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #000;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Entrance animation */
@keyframes mm-fadeUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tablet: 2 columns (flex: 0 0 50% each visually) */
@media (max-width: 1023px) {
    .massundmoritz-gallery-grid {
        gap: 16px;
    }
    .mm-gallery-column {
        transition: none;  /* no scroll animation anyway */
        flex-basis: 50%;
    }
}


}


/* Mobile: layout + Swiper styles */
@media (max-width: 639px) {
    /* For mobile grid mode we still use columns; JS sets columnCount = 2 */
    .mm-gallery-column {
        flex-basis: 50%;
    }

    .massundmoritz-gallery-grid {
        overflow: visible;
    }

    .mm-mobile-swiper {
        position: relative;
        width: 100%;
        box-sizing: border-box;
        padding: 0 32px 24px 32px; /* room for arrows */
    }

    .mm-mobile-swiper .swiper-wrapper {
        align-items: flex-start;
    }

    .mm-mobile-swiper .swiper-slide {
        width: 75%; /* one main slide + visible neighbours */
    }

    .mm-mobile-swiper .swiper-slide .massundmoritz-gallery-item {
        width: 100%;
    }

    .mm-mobile-swiper img {
        width: 100%;
        height: auto;
        display: block;
        /* white glow + soft drop shadow */
        box-shadow:
            0 0 0 6px rgba(255, 255, 255, 0.95),
            0 8px 20px rgba(0, 0, 0, 0.25);
    }

    .mm-mobile-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
        border-radius: 999px;
        border: none;
        background: rgba(255, 255, 255, 0.95);
        color: #222;
        font-size: 18px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        z-index: 5;
    }

    .mm-mobile-prev {
        left: 8px;
    }

    .mm-mobile-next {
        right: 8px;
    }
}
