@use 'lg-variables' as *;
@use 'lg-mixins' as *;

.lg-container {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
        Arial, 'Noto Sans', 'Liberation Sans', sans-serif, 'Apple Color Emoji',
        'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
// default theme
// A square button that centres its arrow on both axes, and whose own
// centre sits on the vertical middle of the gallery.
.lg-next,
.lg-prev {
    align-items: center;
    background-color: $lg-next-prev-bg;
    border-radius: $lg-border-radius-base;
    color: $lg-next-prev-color;
    cursor: pointer;
    display: flex;
    font-size: 22px;
    height: 42px;
    justify-content: center;
    margin-top: -21px;
    padding: 0;
    position: absolute;
    top: 50%;
    width: 42px;
    z-index: $zindex-controls;
    outline: none;
    border: none;

    &.disabled {
        opacity: 0 !important;
        cursor: default;
    }

    &:hover:not(.disabled) {
        color: $lg-next-prev-hover-color;
    }
    .lg-single-item & {
        display: none;
    }
}

.lg-next {
    right: 20px;
}

.lg-prev {
    left: 20px;
}

@include keyframes(lg-right-end) {
    0% {
        left: 0;
    }

    50% {
        left: -30px;
    }

    100% {
        left: 0;
    }
}

@include keyframes(lg-left-end) {
    0% {
        left: 0;
    }

    50% {
        left: 30px;
    }

    100% {
        left: 0;
    }
}

.lg-outer {
    &.lg-right-end {
        .lg-object {
            @include animation(lg-right-end 0.3s);
            position: relative;
        }
    }

    &.lg-left-end {
        .lg-object {
            @include animation(lg-left-end 0.3s);
            position: relative;
        }
    }
}

// lg toolbar
.lg-toolbar {
    z-index: $zindex-toolbar;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    .lg-media-overlap & {
        background-image: $lg-toolbar-bg;
    }

    .lg-icon {
        color: $lg-toolbar-icon-color;
        cursor: pointer;
        float: right;
        font-size: 24px;
        height: 47px;
        line-height: 27px;
        padding: 10px 0;
        text-align: center;
        width: 50px;
        text-decoration: none !important;
        outline: medium none;
        will-change: color;
        @include transition(color 0.2s linear);
        background: none;
        border: none;
        box-shadow: none;
        &.lg-icon-18 {
            font-size: 18px;
        }
        &:hover {
            color: $lg-toolbar-icon-hover-color;
        }
    }

    .lg-close {
    }
    .lg-maximize {
        font-size: 22px;
    }

    .lg-download {
    }

    // Buttons that do not fit on the row move into the More options menu;
    // the More button itself stays hidden until something has moved.
    .lg-icon[data-lg-overflow],
    .lg-more[hidden] {
        display: none;
    }
}

// Toolbar overflow menu: the buttons that did not fit, with their labels.
.lg-toolbar-menu {
    position: absolute;
    top: 50px;
    right: 8px;
    z-index: $zindex-toolbar + 1;
    min-width: 200px;
    max-width: calc(100% - 16px);
    margin: 0;
    padding: 6px 0;
    border-radius: 6px;
    background-color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    text-align: left;

    .lg-toolbar-menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-height: 44px;
        padding: 8px 16px;
        border: 0;
        background: none;
        color: #333;
        font: inherit;
        font-size: 14px;
        line-height: 1.2;
        text-align: inherit;
        cursor: pointer;

        &:hover,
        &:focus-visible {
            background-color: rgba(0, 0, 0, 0.07);
            outline: none;
        }
    }

    .lg-toolbar-menu-icon {
        display: inline-flex;
        flex: none;
        width: 20px;
        height: 20px;

        .lg-ci,
        svg {
            display: inline-flex;
            width: 100%;
            height: 100%;
        }
    }
}

// lightGallery title
.lg-sub-html {
    color: $lg-sub-html-color;
    font-size: 16px;
    padding: 10px 40px;
    text-align: center;
    z-index: $zindex-subhtml;
    opacity: 0;
    @include transition(opacity 0.2s ease-out 0s);

    h4 {
        margin: 0;
        font-size: 13px;
        font-weight: bold;
    }

    p {
        font-size: 12px;
        margin: 5px 0 0;
    }
    a {
        color: inherit;
        &:hover {
            text-decoration: underline;
        }
    }
    .lg-media-overlap & {
        background-image: $lg-sub-html-bg;
    }
    .lg-item & {
        position: absolute;
        bottom: 0;
        right: 0;
        left: 0;
    }
}

.lg-error-msg {
    font-size: 14px;
    color: #999;
}

// lg image counter
.lg-counter {
    color: $lg-icon-color;
    display: inline-block;
    font-size: $lg-counter-font-size;
    padding-left: 20px;
    padding-top: 12px;
    height: 47px;
    vertical-align: middle;
}

.lg-closing {
    .lg-toolbar,
    .lg-prev,
    .lg-next,
    .lg-sub-html {
        opacity: 0;
        @include transitionCustom(
            transform 0.08s cubic-bezier(0, 0, 0.25, 1) 0s,
            opacity 0.08s cubic-bezier(0, 0, 0.25, 1) 0s,
            color 0.08s linear
        );
    }
}

// Starting effect
body:not(.lg-from-hash) {
    .lg-outer {
        &.lg-start-zoom {
            .lg-item:not(.lg-zoomable) {
                .lg-img-wrap,
                .lg-video-cont,
                .lg-media-cont {
                    opacity: 0;
                    @include transform(scale3d(0.5, 0.5, 0.5));
                    will-change: transform, opacity;
                    @include transitionCustom(
                        transform 250ms cubic-bezier(0, 0, 0.25, 1) 0s,
                        opacity 250ms cubic-bezier(0, 0, 0.25, 1) !important
                    );
                }
                &.lg-complete {
                    .lg-img-wrap,
                    .lg-video-cont,
                    .lg-media-cont {
                        opacity: 1;
                        @include transform(scale3d(1, 1, 1));
                    }
                }
            }
        }
    }
}

.lg-icon {
    &:focus-visible {
        color: #fff;
        border-radius: 3px;
        outline: 1px dashed rgba(255, 255, 255, 0.6);
    }
}
.lg-toolbar {
    .lg-icon {
        &:focus-visible {
            border-radius: 8px;
            outline-offset: -5px;
        }
    }
}
