/**
 * Mosaic Image - Frontend Styles (Masonry Version)
 * Author: reZeta Sites
 */

/* Mosaic Gallery Container - True Masonry with CSS Columns */
.mosaic-image-gallery {
    column-count: 3;
    column-gap: 12px;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Mosaic Item - Masonry cards */
.mosaic-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 8px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mosaic-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Image - Natural height, no cropping */
.mosaic-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .mosaic-image-gallery {
        column-count: 2;
        column-gap: 10px;
        padding: 20px 15px;
    }

    .mosaic-item {
        margin-bottom: 10px;
        border-radius: 10px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .mosaic-image-gallery {
        column-count: 2;
        column-gap: 8px;
        padding: 15px 10px;
    }

    .mosaic-item {
        margin-bottom: 8px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .mosaic-item:hover {
        transform: none;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .mosaic-image-gallery {
        column-count: 1;
        column-gap: 0;
        padding: 10px;
    }

    .mosaic-item {
        margin-bottom: 12px;
        border-radius: 10px;
    }
}

/* Size classes not needed - masonry handles sizing automatically */

/* Mosaic Link */
.mosaic-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    cursor: zoom-in;
}

/* Mosaic Image - Natural proportions for masonry */
.mosaic-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.mosaic-item:hover .mosaic-img {
    transform: scale(1.05);
}

/* Overlay */
.mosaic-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            transparent 0%,
            transparent 50%,
            rgba(0, 0, 0, 0.5) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mosaic-item:hover .mosaic-overlay {
    opacity: 1;
}

/* Zoom Icon */
.mosaic-zoom {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mosaic-item:hover .mosaic-zoom {
    transform: scale(1);
}

.mosaic-zoom svg {
    width: 24px;
    height: 24px;
    color: #333;
}

/* ================================================
   LIGHTBOX STYLES
   ================================================ */

.mosaic-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mosaic-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Content */
.mosaic-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mosaic-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mosaic-lightbox.active .mosaic-lightbox-img {
    transform: scale(1);
    opacity: 1;
}

/* Lightbox Buttons */
.mosaic-lightbox-close,
.mosaic-lightbox-prev,
.mosaic-lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mosaic-lightbox-close:hover,
.mosaic-lightbox-prev:hover,
.mosaic-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.mosaic-lightbox-close {
    top: 20px;
    right: 20px;
}

.mosaic-lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.mosaic-lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.mosaic-lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.mosaic-lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.mosaic-lightbox-close svg,
.mosaic-lightbox-prev svg,
.mosaic-lightbox-next svg {
    width: 24px;
    height: 24px;
}

/* Counter */
.mosaic-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Mobile adjustments */
@media (max-width: 768px) {

    .mosaic-lightbox-prev,
    .mosaic-lightbox-next {
        top: auto;
        bottom: 70px;
        transform: none;
    }

    .mosaic-lightbox-prev {
        left: 30%;
        transform: translateX(-50%);
    }

    .mosaic-lightbox-prev:hover {
        transform: translateX(-50%) scale(1.1);
    }

    .mosaic-lightbox-next {
        right: auto;
        left: 70%;
        transform: translateX(-50%);
    }

    .mosaic-lightbox-next:hover {
        transform: translateX(-50%) scale(1.1);
    }
}

/* Loading animation */
@keyframes mosaicFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mosaic-item {
    animation: mosaicFadeIn 0.5s ease forwards;
}

.mosaic-item:nth-child(1) {
    animation-delay: 0.05s;
}

.mosaic-item:nth-child(2) {
    animation-delay: 0.1s;
}

.mosaic-item:nth-child(3) {
    animation-delay: 0.15s;
}

.mosaic-item:nth-child(4) {
    animation-delay: 0.2s;
}

.mosaic-item:nth-child(5) {
    animation-delay: 0.25s;
}

.mosaic-item:nth-child(6) {
    animation-delay: 0.3s;
}

.mosaic-item:nth-child(7) {
    animation-delay: 0.35s;
}

.mosaic-item:nth-child(8) {
    animation-delay: 0.4s;
}

.mosaic-item:nth-child(n+9) {
    animation-delay: 0.45s;
}

/* Loading placeholder while images load */
.mosaic-item.loading {
    min-height: 150px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}