/* =========================================================
   IMAGE GALLERY MODAL
   ========================================================= */

.image-gallery-modal {
    position: fixed;
    z-index: 1000;

    inset: 0;

    display: none;
}


.image-gallery-modal.is-open {
    display: block;
}


.image-gallery-modal__backdrop {
    position: absolute;

    inset: 0;

    background: rgba(10, 14, 12, 0.92);

    backdrop-filter: blur(4px);
}


.image-gallery-modal__dialog {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    padding: 44px 86px;
}


/* =========================================================
   FIGURE
   ========================================================= */

.image-gallery-modal__figure {
    display: flex;
    flex-direction: column;

    width: min(1200px, 100%);
    max-height: 100%;

    margin: 0;
}


.image-gallery-modal__image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 1;

    min-height: 0;
}


.image-gallery-modal__image {
    display: block;

    max-width: 100%;
    max-height: calc(100vh - 180px);

    width: auto;
    height: auto;

    object-fit: contain;

    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}


/* =========================================================
   CAPTION
   ========================================================= */

.image-gallery-modal__caption {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 22px;

    margin-top: 18px;

    color: rgba(255, 255, 255, 0.9);

    font-size: 0.95rem;
    line-height: 1.55;
}


.image-gallery-modal__counter {
    color: rgba(255, 255, 255, 0.55);

    white-space: nowrap;
}


.image-gallery-modal__caption-text {
    max-width: 900px;
}


/* =========================================================
   CONTROLS
   ========================================================= */

.image-gallery-modal__close,
.image-gallery-modal__nav {
    appearance: none;

    border: 0;
    padding: 0;

    background: transparent;

    color: rgba(255, 255, 255, 0.86);

    cursor: pointer;

    transition:
        color 160ms ease,
        transform 160ms ease,
        opacity 160ms ease;
}


.image-gallery-modal__close:hover,
.image-gallery-modal__nav:hover {
    color: #ffffff;
}


.image-gallery-modal__close {
    position: absolute;
    z-index: 4;

    top: 20px;
    right: 28px;

    width: 44px;
    height: 44px;

    font-size: 2.2rem;
    font-weight: 300;
    line-height: 1;
}


.image-gallery-modal__nav {
    position: absolute;
    z-index: 4;

    top: 50%;

    width: 54px;
    height: 80px;

    transform: translateY(-50%);

    font-size: 4rem;
    font-family: serif;
    font-weight: 300;
    line-height: 1;
}


.image-gallery-modal__nav:hover {
    transform: translateY(-50%) scale(1.05);
}


.image-gallery-modal__nav--prev {
    left: 20px;
}


.image-gallery-modal__nav--next {
    right: 20px;
}


/* =========================================================
   BODY LOCK
   ========================================================= */

body.gallery-modal-open {
    overflow: hidden;
}


/* =========================================================
   GALLERY TRIGGER
   ========================================================= */

[data-gallery-trigger] {
    position: relative;

    cursor: zoom-in;
}


.gallery-trigger-label {
    position: absolute;

    right: 18px;
    bottom: 18px;

    display: inline-flex;
    align-items: center;

    padding: 9px 14px;

    background: rgba(20, 31, 26, 0.78);
    color: #ffffff;

    font-size: 0.78rem;
    letter-spacing: 0.04em;

    pointer-events: none;

    backdrop-filter: blur(3px);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 800px) {

    .image-gallery-modal__dialog {
        padding: 62px 18px 24px;
    }


    .image-gallery-modal__image {
        max-height: calc(100vh - 190px);
    }


    .image-gallery-modal__caption {
        grid-template-columns: 1fr;
        gap: 5px;

        margin-top: 14px;

        font-size: 0.88rem;
    }


    .image-gallery-modal__nav {
        top: auto;
        bottom: 82px;

        width: 48px;
        height: 54px;

        transform: none;

        background: rgba(10, 14, 12, 0.52);

        font-size: 3rem;
    }


    .image-gallery-modal__nav:hover {
        transform: none;
    }


    .image-gallery-modal__nav--prev {
        left: 18px;
    }


    .image-gallery-modal__nav--next {
        right: 18px;
    }


    .image-gallery-modal__close {
        top: 10px;
        right: 12px;
    }


    .gallery-trigger-label {
        right: 12px;
        bottom: 12px;

        padding: 7px 10px;

        font-size: 0.72rem;
    }

}