﻿


.lightbox-gallery {
    display: flex;
    flex-direction: column;

    /* Setup all main vars + fallbacks */
    --lbg-selector-size: 2rem;
    --lbg-selector-size-mobile: 2rem;
    --lbg-selector-padding: .5em;
    --lbg-button-bg: var(--clr-card);
    --lbg-button-highlight: white;
    --lbg-button-bg-highlight: var(--clr-card-border);
    --lbg-button-category: rgba(15,15,15,1.0);

    --lbg-content-direction: row;
    --lbg-media-strip-visibility: flex;
    --lbg-meta-data-basis: 25%;

    --lbg-dot-strip-size: .5rem;
    --lbg-dot-strip-color: var(--clr-card-border);
    --lbg-dot-strip-color-highlight: var(--clr-highlight);

    --lbg-transition-duration: 150ms ease;
    scrollbar-width: none;

    height: 100dvh;
    max-height: 100dvh;
}

.lightbox-gallery__main {
    padding-block: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1em;
    flex: 1;
}

.lightbox-gallery__header {
    display: flex;
    align-items: center;
    gap: 1em;
}

.lightbox-gallery__content-flow {
    display: flex;
    flex-direction: column;
    gap: 1em;
    flex: 1;
    min-height: 0; /* flex items default to min-height: auto (content's intrinsic height), which would block .media-info below from ever being compressed enough to scroll internally */
}

.lightbox-gallery__player-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    flex: 0;
}

.lightbox-gallery__player-content .selector {
    position: absolute;
    width: var(--lbg-selector-size-mobile);
    height: var(--lbg-selector-size-mobile);
    padding: var(--lbg-selector-padding);
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-gallery__player-content .selector.left {
    left: 0rem;
    z-index: 100;
}

.lightbox-gallery__player-content .selector.right {
    right: 0rem;
    z-index: 100;
}

.lightbox-gallery__player-content .player-docker {
    aspect-ratio: 16/9;
    width: 100%;
    background-color: rgba(0,0,0,0.15);
    border-radius: .5em;
    overflow: hidden;
    position: relative;
}

.lightbox-player {
    position: absolute;
    inset: 0;
    display: block;
}

.lightbox-player.image {
}

.lightbox-player img,
.lightbox-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox-player img {
    object-fit: cover;
}

.lightbox-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.lightbox-gallery__media-info {
    display: flex;
    flex-direction: column;
    gap: 1em;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    flex: 1 1 auto; /* was flex-shrink: 0 - that blocked this from ever being compressed small enough for overflow-y to actually scroll instead of just growing */
    flex-basis: var(--lbg-meta-data-basis);
    min-height: 0;
}

.lightbox-gallery__media-info .title {
    font-weight: bold;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.lightbox-gallery__media-info .description {
    flex: 1 0 auto; /* grow to fill leftover space, but never shrink below its full text height - .media-info scrolls instead */
}

.lightbox-gallery__media-info .meta-data {
    display: flex;
    gap: 1em;
    color: #ccc;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    white-space: nowrap;
    padding-block: .5em;
    flex-shrink: 0;
}

/* display: flex above has higher specificity than the browser's default
   [hidden] { display: none } rule, so it would otherwise win and the
   element would stay visible - this reasserts display: none for all four,
   including location/date/separator defensively in case they ever pick up
   their own display rule later. */
.lightbox-gallery__media-info .meta-data[hidden],
.lightbox-gallery__media-info .location[hidden],
.lightbox-gallery__media-info .date[hidden],
.lightbox-gallery__media-info .separator[hidden] {
    display: none;
}

.lightbox-gallery__media-info .categories {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    flex-shrink: 0; /* overflow-x here makes this a scroll container, whose automatic min-size is 0 - without this it's the one child the flex algorithm squishes flat when space runs short */
}

.lightbox-gallery__media-info .categories button {
    border-radius: 2rem;
    background-color: var(--lbg-button-category);
    padding: .5em 1em;
    transition: background-color var(--lbg-transition-duration), color var(--lbg-transition-duration);
}

.lightbox-gallery__media-info .categories button.highlight {
    background-color: var(--clr-highlight);
    color: white;
}

.lightbox-gallery__content-flow .dot-strip {
    display: flex;
    margin-inline: auto;
    gap: .5rem;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.lightbox-gallery__content-flow .dot-strip .dot {
    width: var(--lbg-dot-strip-size);
    height: var(--lbg-dot-strip-size);
    border-radius: 50%;
    background-color: var(--lbg-dot-strip-color);
    transition: background-color var(--lbg-transition-duration);
}

.lightbox-gallery__content-flow .dot-strip .dot.highlight {
    background-color: var(--lbg-dot-strip-color-highlight);
}

.lightbox-gallery__footer {
    display: none;
    align-items: center;
    gap: 1rem;
}

.lightbox-gallery__footer .selector {
    height: calc(var(--lbg-selector-size) * 2);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 3rem;
    position: relative;
}

.lightbox-gallery__footer .selector .image {
    position: absolute;
}

.lightbox-gallery__footer .media-strip {
    display: flex;
    gap: 1rem;
    overflow: auto;
    margin-inline: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.lightbox-gallery__footer .media-strip-item {
    height: 8rem;
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
    position: relative;
    border-color: transparent;
}

.lightbox-gallery__footer .media-strip-item.highlight {
    border-color: var(--clr-highlight);
}

.lightbox-gallery__footer .play-badge {
    position: absolute;
}



/**/
/* Components */
/**/

.lightbox-gallery button.close {
    padding: unset;
    transition: transform var(--lbg-transition-duration), border-color var(--lbg-transition-duration), background-color var(--lbg-transition-duration);
}

.lightbox-gallery button.selector {
    transition: transform var(--lbg-transition-duration), border-color var(--lbg-transition-duration), background-color var(--lbg-transition-duration);
}

.lightbox-gallery button.media-strip-item {
    transition: transform var(--lbg-transition-duration), border-color var(--lbg-transition-duration), background-color var(--lbg-transition-duration);
}

.lightbox-gallery .play-badge {
    position: absolute;
    aspect-ratio: 1/1;
    width: 5rem;
    border-radius: 50%;
    /*    border: .15rem solid var(--clr-highlight);*/
    background-color: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: width var(--lbg-transition-duration);
}

.lightbox-gallery .play-badge > div {
    width: 80%;
    aspect-ratio: 1/1;
    background-image: url(/img/play.svg);
    transition: width var(--lbg-transition-duration);
}



/**/
/* Image classes */
/**/

.image__size-auto {
    width: 100%;
    aspect-ratio: 1/1;
}

.lightbox-gallery .image__arrow-left {
    background-image: url(/modules/lightbox-gallery/img/chevron-left.svg);
}

.lightbox-gallery .image__arrow-right {
    background-image: url(/modules/lightbox-gallery/img/chevron-right.svg);
}

.lightbox-gallery .image__gallery {
    background-image: url(/modules/lightbox-gallery/img/gallery-grid.svg);
}

.lightbox-gallery .image__close {
    background-image: url(/modules/lightbox-gallery/img/close.svg);
}



/**/
/* Modalizer Styling */
/**/

.lightbox-gallery.modalizer-instance {

}



/**/
/* Large Screens */
/**/

@media only screen and (min-width: 750px) {

    .lightbox-gallery {
        height: auto;
    }

    .lightbox-gallery__content-flow {
        flex-direction: var(--lbg-content-direction);
        padding-inline: 1rem;
    }

    .lightbox-gallery__player-content {
        flex: 1 1 100%;
    }

    .lightbox-gallery__media-info {
        flex: 1 1 50%;
    }

    .lightbox-gallery__player-content .selector {
        width: var(--lbg-selector-size);
        height: var(--lbg-selector-size);
    }

    .lightbox-gallery__player-content .selector.left {
        left: -.5rem;
    }

    .lightbox-gallery__player-content .selector.right {
        right: -.5rem;
    }

    .lightbox-gallery__player-content .player-docker {
    }

    .lightbox-gallery__content-flow .dot-strip {
        display: none;
    }

    .lightbox-gallery__footer {
        display: var(--lbg-media-strip-visibility);
        padding-inline: 1rem;
    }

    .lightbox-gallery__header {
        padding-inline: 1rem;
    }

    .lightbox-gallery__media-info {
        padding-inline: 1rem;
    }
}



/**/
/* Mobile */
/**/

@media only screen and (max-width: 750px) {

    .lightbox-gallery {
        width: 100dvw;
    }

    .lightbox-gallery__header {
        padding-inline: 1rem;
    }

    .lightbox-gallery__media-info {
        padding-inline: 1rem;
    }
}



/* Not enough vertical room for the media strip */

@media only screen and (max-height: 500px) {

    .lightbox-gallery__footer {
        display: none;
    }

    .lightbox-gallery {
        height: 100dvh;
        width: 100dvw;
    }
}



/* desktop hover effects */

@media (hover: hover) and (pointer: fine) {

    .lightbox-gallery {
        max-height: 100vh;
    }

    .lightbox-gallery button.selector:hover,
    .lightbox-gallery button.close:hover,
    .lightbox-gallery button:hover {
        color: white;
        background-color: var(--lbg-button-bg-highlight);
        border-color: var(--lbg-button-highlight);
    }
}



/* Phone tap animations */

@media (hover: none) and (pointer: coarse) {

    button:active {
        transform: scale(0.96);
        background-color: var(--lbg-button-bg-highlight);
        border-color: var(--lbg-button-highlight);
    }
}