/* =========================================================
   GALLERY GRID
========================================================= */

.gallery-trigger {
    display: block;
    cursor: zoom-in;
    text-decoration: none;
}

.gallery_image {
    position: relative;
    overflow: hidden;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 48px;
    border-bottom-left-radius: 16px;
    background: #111;
}

.gallery_img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;

    transition:
        transform .7s cubic-bezier(.16, 1, .3, 1),
        filter .4s ease,
        opacity .4s ease;
}

.gallery-trigger:hover .gallery_img {
    transform: scale(1.06);
    filter: brightness(.92);
}

/* =========================================================
   DIALOG
========================================================= */

.gallery_dialog {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;

    border: 0;
    padding: 0;
    margin: 0;

    background: transparent;
    overflow: hidden;
}

.gallery_dialog::backdrop {
    background: rgba(0, 0, 0, .88);
    backdrop-filter: blur(10px);

    animation:
        galleryFade .35s ease;
}

.gallery_dialog_inner {
    position: relative;

    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 2rem;

    animation:
        galleryZoom .35s cubic-bezier(.16, 1, .3, 1);
}

/* =========================================================
   IMAGE
========================================================= */

.gallery_image_wrap {
    position: relative;

    max-width: min(1400px, 92vw);
    max-height: 90vh;

    overflow: hidden;

    border-radius: 16px;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, .45);
}

.gallery_dialog img {
    display: block;

    width: 100%;
    height: 100%;

    max-width: 100%;
    max-height: 90vh;

    object-fit: contain;

    background: #111;

    opacity: 0;
    transform: scale(.985);

    transition:
        opacity .25s ease,
        transform .25s ease;
}

.gallery_dialog img.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* =========================================================
   BUTTONS
========================================================= */

.gallery_close,
.gallery_nav {
    position: absolute;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    line-height: 1;

    border: 0;
    border-radius: 999px;

    background: rgba(255, 255, 255, .12);

    backdrop-filter: blur(10px);

    color: #fff;

    cursor: pointer;

    transition:
        background .25s ease,
        transform .25s ease,
        opacity .25s ease;

    z-index: 20;
}

/* =========================================================
   CLOSE BUTTON
========================================================= */

.gallery_close {
    top: 30px;
    right: 30px;

    width: 56px;
    height: 56px;
}

.gallery_close:hover {
    background: rgba(255, 255, 255, .2);
    transform: scale(1.06);
}

/* =========================================================
   NAV BUTTONS
========================================================= */

.gallery_nav {
    top: 50%;
    transform: translateY(-50%);

    width: 64px;
    height: 64px;
}

.gallery_nav:hover {
    background: rgba(255, 255, 255, .2);
    transform:
        translateY(-50%) scale(1.06);
}

.gallery_prev {
    left: 30px;
}

.gallery_next {
    right: 30px;
}

/* =========================================================
   SVG ICONS
========================================================= */

.gallery_close svg,
.gallery_nav svg {
    width: 28px;
    height: 28px;

    stroke: currentColor;
    stroke-width: 2;

    fill: none;

    stroke-linecap: round;
    stroke-linejoin: round;

    flex-shrink: 0;

    transition:
        transform .25s ease,
        opacity .25s ease;
}

.gallery_nav svg {
    width: 34px;
    height: 34px;
}

.gallery_nav:hover svg {
    transform: scale(1.08);
}

.gallery_close:hover svg {
    transform: rotate(90deg);
}

/* =========================================================
   BODY LOCK
========================================================= */

body.gallery-open {
    overflow: hidden;
    touch-action: none;
}

/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes galleryFade {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }

}

@keyframes galleryZoom {

    from {
        opacity: 0;
        transform: scale(.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }

}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 991px) {

    .gallery_dialog_inner {
        padding: 1rem;
    }

    .gallery_image_wrap {
        max-width: 100%;
        border-radius: 24px;
    }

    .gallery_nav {
        width: 52px;
        height: 52px;
    }

    .gallery_nav svg {
        width: 28px;
        height: 28px;
    }

    .gallery_prev {
        left: 12px;
    }

    .gallery_next {
        right: 12px;
    }

    .gallery_close {
        top: 12px;
        right: 12px;

        width: 50px;
        height: 50px;
    }

    .gallery_close svg {
        width: 24px;
        height: 24px;
    }

}

@media (max-width: 575px) {

    .gallery_dialog_inner {
        padding:
            1rem 0.5rem;
    }

    .gallery_image_wrap {
        border-radius: 18px;
    }

    .gallery_nav {
        width: 46px;
        height: 46px;
    }

    .gallery_nav svg {
        width: 24px;
        height: 24px;
    }

    .gallery_close {
        width: 44px;
        height: 44px;
    }

}