$defaultBorderRadius: 8px;

.natural-gallery-js {
    .root {
        transform: scale(1) translateY(0);
        transform-origin: top center;
        opacity: 1;

        &:is(a) {
            border: none;
        }

        &,
        .figure,
        img {
            border-radius: var(--ngjs-figure-radius, $defaultBorderRadius);
            overflow: hidden;
        }

        &,
        .figure {
            left: 0;
            position: relative;
            display: flex;
            flex-direction: column;
            float: left;
            margin: 0;
            transition: 1s background-color;
            border: none;
            background: none;
        }

        &:focus-within,
        &:focus,
        &:hover {
            .title.hover,
            .select-btn {
                transform: translateY(0%);
            }
        }

        &:focus-visible,
        *:focus-visible {
            outline: var(--ngjs-focus-outline, 1px solid orange);
        }

        &.zoomable,
        .zoomable {
            cursor: zoom-in;
        }

        &.activable,
        .activable {
            cursor: pointer;
        }

        &.loaded .image {
            opacity: 1;
        }

        .image.zoomable:hover,
        .image.zoomable:focus,
        &.zoomable:focus .image,
        &.zoomable:hover .image {
            transform: rotate(1deg) scale(1.2);
        }

        .image {
            display: block;
            position: relative;
            margin: 0;
            width: 100%;
            height: 100%;
            z-index: 100;
            opacity: 0;
            transition: 1s ease-out all;
            min-height: 0;
        }

        .select-btn:focus,
        &.selected .select-btn {
            transform: translateY(0%);
            top: 0;
            left: 0;
        }

        .select-btn {
            position: absolute;
            z-index: 991;
            top: 0;
            left: 0;
            padding: 10px;
            width: 36px;
            height: 36px;
            transition: 0.2s ease all;
            transform: translateY(calc(-100% - 15px));
            color: rgba(255, 255, 255, 0.9);
            fill: currentColor;
            cursor: pointer;
            background: rgba(0, 0, 0, 0.6);
            border-top-left-radius: var(--ngjs-figure-radius, $defaultBorderRadius);
            border-bottom-right-radius: 5px;
            border: none;

            .marker {
                position: relative;
                width: 18px;
                height: 18px;
                border-width: 2px;
                border-style: solid;
                border-color: var(--ngjs-marker-border-color, currentColor);
                box-sizing: border-box;
                border-radius: 2px;

                &::before,
                &::after {
                    content: ' ';
                    position: absolute;
                    display: block;
                    background: var(--ngjs-marker-check-color, transparent);
                    width: 2px;
                }

                &::before {
                    left: 5px;
                    top: 5px;
                    height: 7px;
                    transform: rotateZ(-45deg);
                    transform-origin: 0 100%;
                }

                &::after {
                    left: 4px;
                    top: 0px;
                    height: 11px;
                    transform: rotateZ(45deg);
                    transform-origin: 100% 100%;
                }
            }
        }

        &.selected {
            .select-btn {
                color: var(--ngjs-selected-marker-color, orange);

                .marker {
                    background: currentColor;

                    &::before,
                    &::after {
                        background: var(--ngjs-selected-marker-check, black);
                    }
                }
            }
        }

        .title {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 1100;
            text-align: center;
            color: white;
            font-size: 14px;
            line-height: 1.4em;
            font-weight: normal;
            transition: 0.2s ease all;
            overflow: hidden;
            white-space: normal;

            &,
            button,
            a {
                padding: 8px 8px;
            }

            &:not(.link),
            &.link button,
            &.link a {
                background: var(--ngjs-link-bg, rgb(0, 0, 0, 0.7));
                color: var(--ngjs-link-color, white);
            }

            &:not(.link) {
                border-radius: 0 0 var(--ngjs-figure-radius, $defaultBorderRadius)
                    var(--ngjs-figure-radius, $defaultBorderRadius);
            }

            &.link {
                button,
                a {
                    display: block;
                    box-shadow:
                        inset 0 1px 1px rgba(255, 255, 255, 0.25),
                        0 2px 5px rgba(0, 0, 0, 0.5);
                    border-radius: var(--ngjs-link-radius, 4px);
                    border: none;
                    text-decoration: none;
                    cursor: pointer;

                    &:hover {
                        background: var(--ngjs-link-hover-bg, rgb(0, 0, 0));
                        color: var(--ngjs-link-hover-color, white);
                    }
                }
            }

            // Status : Mouse out
            &.hover {
                // + the margin of &[href]
                transform: translateY(calc(100% + 12px));
            }
        }
    }
}
