.property-gallery--main {
    display: flex;
    gap: 10px;
    width: 100%;
    height: 620px;
}

/*==================================================
PROPERTY GALLERY — MASONRY / ISOTOPE STYLE (DETAIL PAGE)
==================================================*/

.property-gallery--detail,
.property-gallery:not(.property-gallery--main) {
    column-count: 4;
    column-gap: 10px;
    width: 100%;
}

.property-gallery--detail .gallery-item,
.property-gallery:not(.property-gallery--main) .gallery-item {
    position: relative;
    overflow: hidden !important;
    cursor: pointer;
    break-inside: avoid;
    margin-bottom: 10px;
    border-radius: 8px !important;
    height: 260px;
    isolation: isolate;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.property-gallery--detail img,
.property-gallery--detail video,
.property-gallery:not(.property-gallery--main) img,
.property-gallery:not(.property-gallery--main) video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: 0.4s ease;
    border-radius: 8px !important;
}

/* Varied tile heights for masonry look */
.property-gallery--detail .gallery-item:nth-child(6n+1),
.property-gallery:not(.property-gallery--main) .gallery-item:nth-child(6n+1) { height: 420px; }

.property-gallery--detail .gallery-item:nth-child(6n+2),
.property-gallery:not(.property-gallery--main) .gallery-item:nth-child(6n+2) { height: 300px; }

.property-gallery--detail .gallery-item:nth-child(6n+3),
.property-gallery:not(.property-gallery--main) .gallery-item:nth-child(6n+3) { height: 220px; }

.property-gallery--detail .gallery-item:nth-child(6n+4),
.property-gallery:not(.property-gallery--main) .gallery-item:nth-child(6n+4) { height: 360px; }

.property-gallery--detail .gallery-item:nth-child(6n+5),
.property-gallery:not(.property-gallery--main) .gallery-item:nth-child(6n+5) { height: 260px; }

.property-gallery--detail .gallery-item:nth-child(6n+6),
.property-gallery:not(.property-gallery--main) .gallery-item:nth-child(6n+6) { height: 400px; }

.property-gallery--detail video,
.property-gallery:not(.property-gallery--main) video {
    pointer-events: none;
}

.property-gallery--detail .gallery-item:hover img,
.property-gallery--detail .gallery-item:hover video,
.property-gallery:not(.property-gallery--main) .gallery-item:hover img,
.property-gallery:not(.property-gallery--main) .gallery-item:hover video {
    transform: scale(1.05);
}

.property-gallery--detail .gallery-overlay,
.property-gallery:not(.property-gallery--main) .gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    transition: 0.3s;
}

.property-gallery--detail .gallery-item:hover .gallery-overlay,
.property-gallery:not(.property-gallery--main) .gallery-item:hover .gallery-overlay {
    background: rgba(0, 0, 0, 0.45);
}

.property-gallery--detail .play-icon,
.property-gallery:not(.property-gallery--main) .play-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: 0.3s;
    padding-left: 0;
}

.property-gallery--detail .gallery-item:hover .play-icon,
.property-gallery:not(.property-gallery--main) .gallery-item:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.08);
}

/*==================================================
COMMON GALLERY ELEMENTS
==================================================*/

.gallery-left,
.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: zoom-in;
}

.gallery-left {
    width: 50%;
    border-radius: 12px 0 0 12px;
}

.gallery-right {
    width: 50%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
}

.gallery-left img,
.gallery-left video,
.property-gallery--main .gallery-item img,
.property-gallery--main .gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-left::after,
.property-gallery--main .gallery-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

.gallery-left:hover img,
.gallery-left:hover video,
.property-gallery--main .gallery-item:hover img,
.property-gallery--main .gallery-item:hover video {
    transform: scale(1.05);
}

.gallery-left:hover::after,
.property-gallery--main .gallery-item:hover::after {
    background: rgba(0, 0, 0, 0.18);
}

.property-gallery--main .gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    pointer-events: none;
}

.property-gallery--main .gallery-item:hover .gallery-overlay,
.gallery-left:hover .gallery-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.property-gallery--main .play-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    color: #111827;
    font-size: 24px;
    line-height: 1;
    padding-left: 3px;
}

.see-all-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    white-space: nowrap;
    min-height: 46px;
    padding: 10px 24px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.76);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    pointer-events: none;
}

.video-thumb .gallery-overlay {
    pointer-events: none;
}

#galleryData {
    display: none;
}

#galleryLightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999;
}

.gallery-content {
    position: relative;
    width: min(90vw, 1200px);
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#galleryImage,
#galleryVideo {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 10px;
}

#galleryImage {
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

#galleryImage.show,
#galleryImage.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Spinner shown while loading */
#galleryLightbox.is-loading .gallery-content::after {
    content: "";
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: gallery-spin 0.8s linear infinite;
}

@keyframes gallery-spin {
    to { transform: rotate(360deg); }
}

#galleryVideo {
    display: none;
    background: #000;
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
    z-index: 99999;
}

.gallery-close::before {
    content: "\00D7";
    color: #fff;
    font-size: 34px;
    line-height: 1;
    position: relative;
    top: -2px;
}

.gallery-close:hover,
.gallery-prev:hover,
.gallery-next:hover {
    background: #fff;
    color: #000;
}

.gallery-close:hover::before {
    color: #000;
}

.gallery-prev,
.gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    transition: 0.3s;
    user-select: none;
}

.gallery-prev {
    left: 25px;
}

.gallery-next {
    right: 25px;
}

#galleryCounter {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.45);
    padding: 8px 18px;
    border-radius: 30px;
}

@media (max-width: 1100px) {
    .property-gallery--detail,
    .property-gallery:not(.property-gallery--main) {
        column-count: 3;
    }
}

@media (max-width: 767px) {
    .property-gallery--detail,
    .property-gallery:not(.property-gallery--main) {
        column-count: 2;
        column-gap: 8px;
    }

    .property-gallery--detail .gallery-item,
    .property-gallery:not(.property-gallery--main) .gallery-item {
        margin-bottom: 8px;
    }

    .property-gallery--detail .play-icon,
    .property-gallery:not(.property-gallery--main) .play-icon {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    .property-gallery--main {
        flex-direction: column;
        height: auto;
    }

    .gallery-left {
        width: 100%;
        height: 300px;
        border-radius: 12px;
    }

    .gallery-right {
        width: 100%;
    }

    .property-gallery--main .gallery-item {
        height: 160px;
    }

    .see-all-btn {
        min-width: 160px;
        min-height: 40px;
        font-size: 14px;
        padding: 8px 14px;
    }

    .gallery-prev,
    .gallery-next {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .gallery-prev {
        left: 10px;
    }

    .gallery-next {
        right: 10px;
    }

    .gallery-close {
        width: 42px;
        height: 42px;
        top: 15px;
        right: 15px;
    }

    .gallery-close::before {
        font-size: 28px;
    }

    #galleryCounter {
        font-size: 15px;
    }
}

@media (max-width: 420px) {
    .property-gallery--detail,
    .property-gallery:not(.property-gallery--main) {
        column-count: 1;
    }
}
