/**
 * DMS Gallery Image Manager
 * Frontend Styles
 */


/*
|--------------------------------------------------------------------------
| Gallery
|--------------------------------------------------------------------------
*/

.dmsgim-gallery {

    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(var(--dmsgim-columns), minmax(0, 1fr));

    gap: var(--dmsgim-gap);

    margin: 0;

    padding: 0;
}


/*
|--------------------------------------------------------------------------
| Gallery Item
|--------------------------------------------------------------------------
*/

.dmsgim-gallery-item {

    position: relative;

    min-width: 0;

    margin: 0;

    padding: 0;

    overflow: hidden;
}


/*
|--------------------------------------------------------------------------
| Image Wrapper
|--------------------------------------------------------------------------
*/

.dmsgim-gallery-image {

    position: relative;

    width: 100%;

    aspect-ratio:
        var(--dmsgim-aspect-ratio);

    overflow: hidden;

    background: #eeeeee;
}


/*
|--------------------------------------------------------------------------
| Lightbox Trigger
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-trigger {

    position: absolute;

    inset: 0;

    display: block;

    width: 100%;

    height: 100%;

    margin: 0;

    padding: 0;

    border: 0;

    border-radius: 0;

    background: transparent;

    cursor: zoom-in;

    overflow: hidden;

    text-align: left;

    font: inherit;
}


/*
|--------------------------------------------------------------------------
| Image
|--------------------------------------------------------------------------
*/

.dmsgim-gallery-image img {

    width: 100%;

    height: 100%;

    display: block;

    object-fit: cover;

    transform: scale(1);

    transition:
        transform 0.55s ease;
}


/*
|--------------------------------------------------------------------------
| Hover Image
|--------------------------------------------------------------------------
*/

.dmsgim-gallery-item:hover
.dmsgim-gallery-image img {

    transform:
        scale(var(--dmsgim-hover-zoom));
}


/*
|--------------------------------------------------------------------------
| Overlay
|--------------------------------------------------------------------------
*/

.dmsgim-gallery-overlay {

    position: absolute;

    inset: 0;

    z-index: 2;

    display: flex;

    align-items: flex-end;

    padding: 32px;

    box-sizing: border-box;

    background:
        color-mix(
            in srgb,
            var(--dmsgim-overlay-color) calc(var(--dmsgim-overlay-opacity) * 100%),
            transparent
        );

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.35s ease,
        visibility 0.35s ease,
        transform 0.35s ease;
}


/*
|--------------------------------------------------------------------------
| Fade Up Animation
|--------------------------------------------------------------------------
*/

.dmsgim-animation-fade-up
.dmsgim-gallery-overlay {

    transform:
        translateY(15px);
}


.dmsgim-animation-fade-up
.dmsgim-gallery-item:hover
.dmsgim-gallery-overlay {

    opacity: 1;

    visibility: visible;

    transform:
        translateY(0);
}


/*
|--------------------------------------------------------------------------
| Fade Animation
|--------------------------------------------------------------------------
*/

.dmsgim-animation-fade
.dmsgim-gallery-overlay {

    transform:
        none;
}


.dmsgim-animation-fade
.dmsgim-gallery-item:hover
.dmsgim-gallery-overlay {

    opacity: 1;

    visibility: visible;

    transform:
        none;
}


/*
|--------------------------------------------------------------------------
| Zoom Animation
|--------------------------------------------------------------------------
*/

.dmsgim-animation-zoom
.dmsgim-gallery-overlay {

    transform:
        scale(0.94);
}


.dmsgim-animation-zoom
.dmsgim-gallery-item:hover
.dmsgim-gallery-overlay {

    opacity: 1;

    visibility: visible;

    transform:
        scale(1);
}


/*
|--------------------------------------------------------------------------
| No Animation
|--------------------------------------------------------------------------
*/

.dmsgim-animation-none
.dmsgim-gallery-overlay {

    transform:
        none;

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease;
}


.dmsgim-animation-none
.dmsgim-gallery-item:hover
.dmsgim-gallery-overlay {

    opacity: 1;

    visibility: visible;

    transform:
        none;
}


/*
|--------------------------------------------------------------------------
| Content
|--------------------------------------------------------------------------
*/

.dmsgim-gallery-content {

    width: 100%;

    color: #ffffff;
}


.dmsgim-gallery-date {

    margin-bottom: 10px;

    color: var(--dmsgim-date-color, #ffffff);

    font-family: var(--dmsgim-date-font, inherit);

    font-size: var(--dmsgim-date-size, 15px);

    line-height: 1.4;

    font-weight: var(--dmsgim-date-weight, 600);
}


.dmsgim-gallery-title {

    margin-bottom: 12px;

    color: var(--dmsgim-title-color, #ffffff);

    font-family: var(--dmsgim-title-font, inherit);

    font-size: var(--dmsgim-title-size, 23px);

    line-height: 1.35;

    font-weight: var(--dmsgim-title-weight, 700);
}


.dmsgim-gallery-description {

    color: var(--dmsgim-description-color, #ffffff);

    font-family: var(--dmsgim-description-font, inherit);

    font-size: var(--dmsgim-description-size, 15px);

    line-height: 1.65;

    font-weight: var(--dmsgim-description-weight, 400);
}


/*
|--------------------------------------------------------------------------
| LIGHTBOX
|--------------------------------------------------------------------------
*/

#dmsgim-lightbox {

    position: fixed;

    inset: 0;

    z-index: 999999;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 100vw;

    height: 100vh;

    padding: 30px;

    box-sizing: border-box;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}


#dmsgim-lightbox.is-open {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/*
|--------------------------------------------------------------------------
| Backdrop
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-backdrop {

    position: absolute;

    inset: 0;

    background:
        rgba(0, 0, 0, 0.94);

    cursor: zoom-out;
}


/*
|--------------------------------------------------------------------------
| Dialog
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-dialog {

    position: relative;

    z-index: 2;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    width: 100%;

    height: 100%;

    max-width: 1500px;

    max-height: 100%;

    box-sizing: border-box;

    pointer-events: none;
}


/*
|--------------------------------------------------------------------------
| Media
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-media {

    position: relative;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 100%;

    height: calc(100% - 115px);

    min-height: 0;

    box-sizing: border-box;

    pointer-events: auto;

    touch-action: pan-y;
}


.dmsgim-lightbox-image {

    display: block;

    max-width: 100%;

    max-height: 100%;

    width: auto;

    height: auto;

    object-fit: contain;

    user-select: none;

    -webkit-user-drag: none;

    opacity: 1;

    transition:
        opacity 0.2s ease;
}


.dmsgim-lightbox-image.is-loading {

    opacity: 0;
}


/*
|--------------------------------------------------------------------------
| Loader
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-loader {

    position: absolute;

    top: 50%;

    left: 50%;

    z-index: 3;

    width: 42px;

    height: 42px;

    margin:
        -21px
        0
        0
        -21px;

    opacity: 0;

    visibility: hidden;

    transition:
        opacity 0.2s ease;
}


.dmsgim-lightbox-loader.is-visible {

    opacity: 1;

    visibility: visible;
}


.dmsgim-lightbox-loader span {

    display: block;

    width: 100%;

    height: 100%;

    border:
        3px solid
        rgba(255, 255, 255, 0.25);

    border-top-color:
        #ffffff;

    border-radius: 50%;

    animation:
        dmsgim-lightbox-spin
        0.75s linear infinite;
}


@keyframes dmsgim-lightbox-spin {

    to {
        transform: rotate(360deg);
    }

}


/*
|--------------------------------------------------------------------------
| Close Button
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-close {

    position: absolute;

    top: 10px;

    right: 10px;

    z-index: 20;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 48px;

    height: 48px;

    padding: 0;

    border: 0;

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.12);

    color: #ffffff;

    cursor: pointer;

    font-size: 34px;

    line-height: 1;

    pointer-events: auto;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.dmsgim-lightbox-close:hover {

    background:
        rgba(255, 255, 255, 0.25);

    transform:
        scale(1.05);
}


.dmsgim-lightbox-close:focus-visible,
.dmsgim-lightbox-prev:focus-visible,
.dmsgim-lightbox-next:focus-visible {

    outline:
        2px solid #ffffff;

    outline-offset: 3px;
}


/*
|--------------------------------------------------------------------------
| Navigation
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-prev,
.dmsgim-lightbox-next {

    position: absolute;

    top: 50%;

    z-index: 20;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 54px;

    height: 54px;

    margin: -27px 0 0;

    padding: 0;

    border: 0;

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.12);

    color: #ffffff;

    cursor: pointer;

    font-size: 25px;

    line-height: 1;

    pointer-events: auto;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.dmsgim-lightbox-prev {

    left: 12px;
}


.dmsgim-lightbox-next {

    right: 12px;
}


.dmsgim-lightbox-prev:hover,
.dmsgim-lightbox-next:hover {

    background:
        rgba(255, 255, 255, 0.25);
}


.dmsgim-lightbox-prev:hover {

    transform:
        translateX(-2px);
}


.dmsgim-lightbox-next:hover {

    transform:
        translateX(2px);
}


.dmsgim-lightbox-prev.is-hidden,
.dmsgim-lightbox-next.is-hidden {

    display: none;
}


/*
|--------------------------------------------------------------------------
| Lightbox Info
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-info {

    position: relative;

    z-index: 10;

    width: 100%;

    max-width: 1000px;

    min-height: 75px;

    padding:
        10px
        80px
        5px;

    box-sizing: border-box;

    text-align: center;

    color: #ffffff;

    pointer-events: none;
}


.dmsgim-lightbox-date {

    margin-bottom: 5px;

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

    font-size: 13px;

    line-height: 1.4;

    font-weight: 600;
}


.dmsgim-lightbox-title {

    margin-bottom: 5px;

    color: #ffffff;

    font-size: 20px;

    line-height: 1.35;

    font-weight: 700;
}


.dmsgim-lightbox-description {

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

    font-size: 14px;

    line-height: 1.5;
}


.dmsgim-lightbox-date.is-empty,
.dmsgim-lightbox-title.is-empty,
.dmsgim-lightbox-description.is-empty {

    display: none;
}


/*
|--------------------------------------------------------------------------
| Counter
|--------------------------------------------------------------------------
*/

.dmsgim-lightbox-counter {

    position: absolute;

    right: 20px;

    bottom: 22px;

    z-index: 20;

    padding:
        6px
        10px;

    border-radius: 20px;

    background:
        rgba(255, 255, 255, 0.12);

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

    font-size: 12px;

    line-height: 1;

    pointer-events: none;
}


/*
|--------------------------------------------------------------------------
| Tablet
|--------------------------------------------------------------------------
*/

@media (max-width: 1024px) {

    .dmsgim-gallery {

        grid-template-columns:
            repeat(
                var(--dmsgim-tablet-columns),
                minmax(0, 1fr)
            );
    }


    .dmsgim-gallery-overlay {

        padding: 25px;
    }


    .dmsgim-gallery-title {

        font-size: 20px;
    }


    .dmsgim-gallery-description {

        font-size: 14px;

        line-height: 1.55;
    }


    #dmsgim-lightbox {

        padding: 20px;
    }


    .dmsgim-lightbox-prev {

        left: 5px;
    }


    .dmsgim-lightbox-next {

        right: 5px;
    }

}


/*
|--------------------------------------------------------------------------
| Mobile
|--------------------------------------------------------------------------
*/

@media (max-width: 767px) {

    .dmsgim-gallery {

        grid-template-columns:
            repeat(
                var(--dmsgim-mobile-columns),
                minmax(0, 1fr)
            );
    }


    .dmsgim-gallery-overlay {

        padding: 22px;
    }


    .dmsgim-gallery-date {

        font-size: 14px;

        margin-bottom: 8px;
    }


    .dmsgim-gallery-title {

        font-size: 19px;

        line-height: 1.35;

        margin-bottom: 10px;
    }


    .dmsgim-gallery-description {

        font-size: 14px;

        line-height: 1.5;
    }


    /*
    |--------------------------------------------------------------------------
    | Mobile Lightbox
    |--------------------------------------------------------------------------
    */

    #dmsgim-lightbox {

        padding: 10px;
    }


    .dmsgim-lightbox-dialog {

        justify-content: center;
    }


    .dmsgim-lightbox-media {

        height: calc(100% - 100px);

        width: 100%;
    }


    .dmsgim-lightbox-image {

        max-width: 100%;

        max-height: 100%;
    }


    .dmsgim-lightbox-close {

        top: 5px;

        right: 5px;

        width: 44px;

        height: 44px;

        font-size: 30px;
    }


    .dmsgim-lightbox-prev,
    .dmsgim-lightbox-next {

        width: 42px;

        height: 42px;

        margin-top: -21px;

        font-size: 20px;

        background:
            rgba(255, 255, 255, 0.10);
    }


    .dmsgim-lightbox-prev {

        left: 2px;
    }


    .dmsgim-lightbox-next {

        right: 2px;
    }


    .dmsgim-lightbox-info {

        min-height: 70px;

        padding:
            5px
            45px
            0;
    }


    .dmsgim-lightbox-title {

        font-size: 17px;
    }


    .dmsgim-lightbox-description {

        font-size: 13px;
    }


    .dmsgim-lightbox-counter {

        right: 10px;

        bottom: 8px;

        font-size: 11px;
    }

}


/*
|--------------------------------------------------------------------------
| Touch Devices
|--------------------------------------------------------------------------
*/

@media (hover: none) {

    .dmsgim-gallery-overlay {

        opacity: 1;

        visibility: visible;

        transform: none;
    }


    .dmsgim-gallery-image img {

        transform: none;
    }


    .dmsgim-lightbox-prev:hover,
    .dmsgim-lightbox-next:hover {

        transform: none;

        background:
            rgba(255, 255, 255, 0.12);
    }

}


/*
|--------------------------------------------------------------------------
| Reduced Motion
|--------------------------------------------------------------------------
*/

@media (prefers-reduced-motion: reduce) {

    .dmsgim-gallery-image img,
    .dmsgim-gallery-overlay,
    #dmsgim-lightbox,
    .dmsgim-lightbox-image,
    .dmsgim-lightbox-close,
    .dmsgim-lightbox-prev,
    .dmsgim-lightbox-next {

        transition: none !important;
    }


    .dmsgim-lightbox-loader span {

        animation: none;
    }

}