/* =========================================
   GALLERY GRID
========================================= */

.matrix-gallery-grid {
    --gallery-gap: 16px;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gallery-gap);
}

.matrix-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--image-radius, 6px);
    aspect-ratio: 1.58 / 1;
    background: #eee;
}

.matrix-gallery-item-main {
    grid-column: 1 / -1;
}

.matrix-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}


/* =========================================
   EXPAND BUTTON
========================================= */

.matrix-gallery-grid button.matrix-gallery-expand {
    position: absolute;
    left: 10px;
    bottom: 10px;

    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: 0;
    border-radius: 5px;

    background: rgba(255, 255, 255, 0.92);
    color: #222;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.matrix-gallery-grid button.matrix-gallery-expand:hover {
    background: #fff;
    transform: scale(1.05);
}

.matrix-gallery-grid button.matrix-gallery-expand svg {
    width: 14px;
    height: 14px;
}


/* =========================================
   MODAL
========================================= */

.matrix-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;

    display: none;

    padding: 30px;

    background: rgba(0, 0, 0, 0.82);

    align-items: center;
    justify-content: center;
}

.matrix-gallery-modal.is-open {
    display: flex;
}


/* Overlay */

.matrix-gallery-modal-overlay {
    position: absolute;
    inset: 0;
}


/* =========================================
   MODAL CONTAINER
========================================= */
.matrix-gallery-lightbox {
    text-align: center;
}

.matrix-gallery-modal-container {
    position: relative;
    z-index: 2;

    width: min(1200px, 100%);
    max-height: calc(100vh - 20px);

    padding: 50px 16px 16px;

    background: #E7E2D9;

    border-radius: 8px;

    box-sizing: border-box;
    overflow-y: auto;
}


/* =========================================
   CLOSE
========================================= */

.matrix-gallery-modal  .matrix-gallery-close {
    position: absolute;

    top: 15px;
    right: 15px;

    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 3px;

    background: #333;
    color: #fff;

    cursor: pointer;

    z-index: 10;
}

.matrix-gallery-modal  .matrix-gallery-close:hover {
    background: #333;
    color: #fff;
}


/* =========================================
   MAIN SWIPER
========================================= */

.matrix-gallery-main {
    width: 100%;
    overflow: hidden;
    height: calc(100vh - 160px); 
    border-radius: 8px;
}

 


.matrix-gallery-main .swiper-slide {
    width: auto;
    height: auto;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
    border-radius: 8px;

    flex-shrink: 0;
}

.matrix-gallery-main .swiper-slide img {
    display: block;

    width: 100%;
    height: auto;

    max-height: 80vh;

 
    border-radius: 8px;

    object-fit:cover;

}


/* =========================================
   NAVIGATION
========================================= */

.matrix-gallery-modal .matrix-gallery-main .matrix-gallery-prev,
.matrix-gallery-modal .matrix-gallery-main .matrix-gallery-next {
    position: absolute;

    top: 50%;
    transform: translateY(-50%);

    z-index: 10;

    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 3px;

    background: rgba(40, 40, 40, 0.9);
    color: #fff;

    cursor: pointer;

    font-size: 18px;
    line-height: 1;
}

.matrix-gallery-modal .matrix-gallery-main .matrix-gallery-prev {
    left: 16px;
}

.matrix-gallery-modal .matrix-gallery-main .matrix-gallery-next {
    right: 16px;
}

.matrix-gallery-modal .matrix-gallery-main .matrix-gallery-prev:hover,
.matrix-gallery-modal .matrix-gallery-main .matrix-gallery-next:hover {
    background: #222;
}


/* =========================================
   THUMBNAILS
========================================= */

.matrix-gallery-thumbs {
    margin-top: 10px;

    width: 100%;

    overflow: hidden;
}

.matrix-gallery-thumbs .swiper-wrapper {
    align-items: center;
}

.matrix-gallery-thumbs .swiper-slide {
    width: 80px;
    height: 60px;

    flex-shrink: 0;

    overflow: hidden;

    border-radius: 8px;

    cursor: pointer;

    opacity: 1;

    border: 0px solid transparent;

    box-sizing: border-box;

    transition:
        opacity 0.2s ease,
        border-color 0.2s ease;
}

.matrix-gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: #555;
    position: relative;
}

.matrix-gallery-thumbs .swiper-slide img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* =========================================
   BODY LOCK
========================================= */

body.matrix-gallery-modal-open {
    overflow: hidden;
}


.matrix-gallery-lightbox  .matrix-gallery-view-all{
    margin: 16px 0;
    background: transparent;
    border: 2px solid #333333;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    font-family: "Inter", sans-serif;
    color: #333333;
}
.matrix-gallery-lightbox  .matrix-gallery-view-all:hover{
    background: transparent;
}
.matrix-gallery-lightbox  .matrix-gallery-view-all img{
    margin-right: 5px;
}


/* =========================================
   VERTICAL GALLERY
========================================= */

.matrix-gallery-direction-vertical {
    width: min(830px, 100%);
    height: calc(100vh - 40px);

    padding: 20px;

    overflow: hidden;
}

.matrix-gallery-direction-vertical .matrix-gallery-main {
    width: 100%;
    height: 100%;

    overflow: hidden;
}

.matrix-gallery-direction-vertical
.matrix-gallery-main
.swiper-wrapper {
    height: 100%;
}

.matrix-gallery-direction-vertical
.matrix-gallery-main
.swiper-slide {
    width: 100%;
    height: auto;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 8px;
}

.matrix-gallery-direction-vertical
.matrix-gallery-main
.swiper-slide img {
    display: block;

    width: 100%;
    height: auto;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    border-radius: 8px;
}


/* .matrix-gallery-direction-vertical
.matrix-gallery-main
.swiper-slide {
    height: 210px;
} */
.matrix-gallery-modal .swiper-vertical .matrix-gallery-prev,
.matrix-gallery-modal .swiper-vertical .matrix-gallery-next{
    display: none;
}
/* =========================================
   MOBILE
========================================= */

@media (max-width: 767px) {

    .matrix-gallery-grid {
        --gallery-gap: 6px;
    }

    button.matrix-gallery-expand {
        left: 7px;
        bottom: 7px;

        width: 25px;
        height: 25px;
    }

    .matrix-gallery-modal {
          width: 100%;
        height: 100dvh;

        padding: 0;

        align-items: center;
        justify-content: center;

        overflow: hidden;
    }

    .matrix-gallery-modal-container {
         width: 100%;
        height: 100dvh;

        max-height: 100dvh;

        border-radius: 0;

        overflow: hidden;

        box-sizing: border-box;
    }

    .matrix-gallery-main{
        height: auto;
    }

    .matrix-gallery-main .swiper-slide img {
        max-height: 80vh;
    }

    .matrix-gallery-prev {
        left: 8px;
    }

    .matrix-gallery-next {
        right: 8px;
    }
    .matrix-gallery-thumbs{
        display: none;
    }

    .matrix-gallery-thumbs .swiper-slide {
        width: 55px;
        height: 42px;
    }



/* =========================================
   VERTICAL GALLERY - MOBILE
========================================= */

 

    .matrix-gallery-direction-vertical {
        width: 100%;
        height: 100dvh;

        max-height: 100dvh;

        box-sizing: border-box;

        padding: 45px 12px 20px;

        overflow: hidden;
    }

    .matrix-gallery-direction-vertical
    .matrix-gallery-main {
        width: 100%;
        height: 100%;

        min-height: 0;

        overflow: hidden;
    }

    .matrix-gallery-direction-vertical
    .matrix-gallery-main
    .swiper-wrapper {
        height: 100%;
    }

    .matrix-gallery-direction-vertical
    .matrix-gallery-main
    .swiper-slide {
        width: 100%;
        height: auto;

        display: flex;
        align-items: center;
        justify-content: center;

        box-sizing: border-box;

        overflow: hidden;

        border-radius: 8px;
    }

    .matrix-gallery-direction-vertical
    .matrix-gallery-main
    .swiper-slide img {
        display: block;

        width: 100%;
        height: auto;

        max-width: 100%;
        max-height: 100%;

        object-fit: contain;

        border-radius: 8px;
    }

}


/* =========================================
   HORIZONTAL LIGHTBOX - DESKTOP GAP FIX
========================================= */

@media (min-width: 768px) {

    .matrix-gallery-modal-container:not(
        .matrix-gallery-direction-vertical
    ) {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: calc(100vh - 40px);
        overflow: hidden;
    }

    .matrix-gallery-modal-container:not(
        .matrix-gallery-direction-vertical
    ) .matrix-gallery-main {
        flex: 0 1 auto;
        width: 100%;
        height: auto;
        min-height: 0;
    }

    .matrix-gallery-modal-container:not(
        .matrix-gallery-direction-vertical
    ) .matrix-gallery-main .swiper-slide {
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .matrix-gallery-modal-container:not(
        .matrix-gallery-direction-vertical
    ) .matrix-gallery-main .swiper-slide img {
        display: block;
        width: auto;
        height: auto;
        max-height: calc(100vh - 180px);
        object-fit: contain;
    }

    .matrix-gallery-modal-container:not(
        .matrix-gallery-direction-vertical
    ) .matrix-gallery-thumbs {
        flex: 0 0 auto;
        width: 100%;
        margin-top: 10px;
    }

}