/*
    Fullscreen image viewer — templates/components/compImageViewer.html.twig
    Doc: doc/features/card-deck.md
*/

.image-viewer {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    color: #fff;
    background-color: #06152d;
    border: 0;

    &::backdrop {
        background: rgba(0, 23, 52, 0.6); /* replaces the gradient of modal.css's dialog::backdrop */
    }
}

/* Inside the dialog, not on it: a `display` on the <dialog> itself would show it while closed */
.image-viewer-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.image-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.6rem;
}

.image-viewer-count {
    font-size: 1.6rem;
    font-weight: 700;
}

.image-viewer-close {
    display: grid;
    place-items: center;
    width: 4.4rem;
    height: 4.4rem;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.14);
    border: 0;
    border-radius: 50%;
}

/* A horizontal scroll-snap strip: touch swipe and trackpad are native, the arrows scroll it */
.image-viewer-track {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;

    &::-webkit-scrollbar {
        display: none;
    }
}

.image-viewer-slide {
    flex: 0 0 100%; /* exactly one track wide: the controller divides the scroll position by it */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 0 1.2rem 2rem;
    scroll-snap-align: start;
    scroll-snap-stop: always; /* one flick = one image, never two */

    & img {
        display: block;
        width: auto;
        max-width: 100%;
        height: auto;
        max-height: calc(100dvh - 17rem); /* the bar above, the caption below */
        border-radius: 1rem;
    }
}

.image-viewer-caption {
    max-width: 60rem;
    font-size: 1.6rem;
    line-height: 1.5;
    text-align: center;
    color: #dfe8f5;
}

.image-viewer-arrow {
    position: absolute;
    z-index: 2;
    top: 50%;
    translate: 0 -50%;
    display: grid;
    place-items: center;
    width: 4.4rem;
    height: 4.4rem;
    color: var(--blue-ocean);
    background-color: rgba(255, 255, 255, 0.94);
    border: 0;
    border-radius: 50%;
    box-shadow: var(--shadow-strong);
    transition: opacity 0.2s ease;

    &:disabled {
        opacity: 0;
        pointer-events: none;
    }
}

.image-viewer-prev {
    left: 1.2rem;
}

.image-viewer-next {
    right: 1.2rem;
}
