/* For the lightbox when you click on feature/article images.
   Only used inside articles. */
html {
    --gbox-bg: #0a0a0aed;
}

body.lightbox-open {
	height: 100%;
	width: 100%;
	overflow: hidden;
}

#gbox {
    position: fixed;
    left: 0;
    top: 0;
    display: grid;
    height: 100vh;
    height: -webkit-fill-available; /* safari */
    width: 100vw;
    background-color: var(--gbox-bg);
    grid-template-rows: 1fr 100px;
    grid-template-columns: 1fr;
    overscroll-behavior: none;
    z-index: 1234567899; /* obnoxiously high value to sit on top of ads with obnoxiously high values */
}
#gbox>* {
    /* ??? */
    min-width: 0;
    min-height: 0;
}

#gbox:after { /* prevent visible hole on displays with undersized viewport height */
    content: "";
    position: absolute;
    bottom: -120px;
    background-color: var(--gbox-bg);
    height: 120px;
    width: 100%;
}
#gbox.single {
    grid-template-rows: 1fr;
    nav>button:not([aria-label="close"]) {
        display:none;
    }
}
.single #gbox_list_cont {
    display: none;
    content-visibility: hidden;
}
#gbox.single nav>button:not([aria-label="close"]) {
    display: none;
}

#gbox_main {
    grid-column: 1/2;
    grid-row: 1/2;
    overflow-y: clip;
    position: relative;
    cursor: zoom-out;
}

#gbox_main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#gbox .nav-arrow {
    background-image: url('/wp-content/themes/KbooOS2/img/icon/arrow.svg');
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center;
    max-height: 100px;
}

#gbox .nav-arrow:not(:first-of-type) {
    transform: rotate(180deg);
}

#gbox_list_cont {
    grid-column: 1/2;
    grid-row: 2/3;
    display: grid;
    grid-template-columns: 50px auto 50px;
    grid-template-rows: 1fr;
    width: 100%;
    overflow-x: scroll;
    background-color: #111111aa;
}

#gbox_list_cont nav {
    grid-area: 1/1/2/2;
    text-align: center;
    width: 100%;
    height: 100%;
    line-height: 100px;
    font-size: 32px;
    cursor: pointer;
    user-select: none;
    
}

#gbox_list_cont nav:last-of-type {
    grid-area: 1/3/2/4;
}

#gbox_list {
    overflow-x: scroll;
    grid-area: 1/2/2/3;
    scroll-behavior: smooth;
    touch-action: manipulation;
}
#gbox_list>div{
    display: flex;
}

#gbox_list img {
    width: 100px;
    max-height: 100px;
    object-fit: contain;
    filter: brightness(0.5);
    transition: filter .25s;
    &:not(.active) {
        cursor: pointer;
    }
    &.active, &:hover {
        filter: brightness(1);
    }
    margin: 0 4px;
    &:first-of-type {
        margin-left: auto;
    }
    &:last-of-type {
        margin-right: auto;
    }
}

#gbox button {
    /* this only applies to the close button perhaps rename? */
    text-shadow: 2px 2px 5px black;
    position: absolute;
    z-index: 205;
    background: none;
    font-size: 48px;
    height: 75px;
    width: 75px;
    border: none;
    opacity: .8;
    cursor: pointer;
    color: #fff;
    font-weight: 800;
}

#gbox button:hover {
    opacity: 1;
}
#gbox button[aria-label="close"] {
    top: 10px;
    right: 10px;
}
@media screen and (min-width: 480px) { /* bp-mobile */
    #gbox {
        font-size: 150%;
    }
}

#gbox_caption {
    position: absolute;
    bottom: 20px;
    text-align: center;
    margin: auto;
    width: 60%;
    left: 20%;
}

#gbox_caption span {
    background-color: #000000aa;
    text-shadow: 0 0 3px black;
    padding: 2px 10px;
    line-height: 1.3;
    display: inline-block;
    color: white;
    word-break: break-word;
}
#gbox_caption span:empty {
    display: none;
}

#gbox_loader {
    display: none;
    grid-area: 1/1/2/2;
}

#gbox.loading #gbox_loader {
    display: block;
}
#gbox.loading #gbox_main img,
#gbox.loading #gbox_caption {
    display: none;
}

/* make zoom cursor on all eligible images */
[data-kbpop], img[class*="wp-image"], picture.k-image, picture.k-image img, img.k-image {
    cursor: zoom-in;
}
.featured-image-container.has-fi-source::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 10px;
    background-color: rgba(0,0,0,.25);
    height: 40px;
    background-image: url('/wp-content/themes/KbooOS2/img/icon/info_outline.svg');
    background-size: 70%;
    background-position: center;
    background-repeat: no-repeat;
    width: 40px;
    border-radius: 50%;
    opacity: .8;
    transition: opacity;
    cursor: zoom-in;
    pointer-events: none;
}