/**
 * Modern classic/interior gallery.
 *
 * The List Category Posts `indexnews` template now renders a native scrolling
 * carousel. Slide geometry is independent of image load timing, which avoids
 * the blank spaces and inconsistent mobile heights produced by Owl autoWidth.
 */

.kupetz-classic-gallery-block {
    margin-bottom: 2rem;
    margin-left: calc(50% - 50vw);
    max-width: 100vw;
    overflow: hidden;
    width: 100vw;
}

.kupetz-classic-gallery-block__inner {
    width: 100%;
}

.gallery-title {
    margin-bottom: 3rem;
    text-align: center;
}

/*
 * Interior section headings still use the historical global h1/h2 ornaments.
 * Reserve a little more inline space on this page so the 47px sprite wings can
 * never overlap English or Russian title glyphs at intermediate widths.
 */
.kupetz-page--interior h1,
.kupetz-page--interior h2 {
    padding-left: 76px;
    padding-right: 76px;
}

@media only screen and (max-width:575px) {
    .kupetz-page--interior h1,
    .kupetz-page--interior h2 {
        padding-left: 62px;
        padding-right: 62px;
    }
}

.kupetz-classic-gallery {
    --kupetz-gallery-gap: 10px;
    --kupetz-gallery-slide-height: 300px;
    --kupetz-gallery-slide-width: 300px;
    position: relative;
    width: 100%;
}

.kupetz-classic-gallery-block {
    margin-bottom: 2rem;
    min-width: 0;
}

.kupetz-classic-gallery-block__inner {
    min-width: 0;
}

.kupetz-classic-gallery__viewport {
    cursor: grab;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-behavior: auto;
    width: 100%;
}

.kupetz-classic-gallery__viewport::-webkit-scrollbar {
    display: none;
}

.kupetz-classic-gallery__viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.kupetz-classic-gallery__track {
    display: flex;
    gap: var(--kupetz-gallery-gap);
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    width: max-content;
}


.kupetz-classic-gallery__slide {
    flex: 0 0 var(--kupetz-gallery-slide-width);
    height: var(--kupetz-gallery-slide-height);
    margin: 0;
    overflow: hidden;
    position: relative;
}

.kupetz-classic-gallery__open {
    -webkit-user-drag: none;
    color: inherit;
    display: block;
    height: 100%;
    position: relative;
    text-decoration: none;
    user-select: none;
    width: 100%;
}

.kupetz-classic-gallery__image {
    -webkit-user-drag: none;
    display: block;
    height: 100%;
    max-width: none;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    width: 100%;
}

.kupetz-classic-gallery__overlay {
    border: 1px solid var(--kupetz-color-white);
    bottom: 9px;
    color: var(--kupetz-color-white);
    font-family: var(--kupetz-font-serif);
    left: 9px;
    opacity: 1;
    position: absolute;
    right: 9px;
    top: 9px;
    transition: opacity .3s ease-in-out;
    z-index: 2;
}

.kupetz-classic-gallery__overlay::before {
    background: rgba(0,0,0,.15);
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.kupetz-classic-gallery__overlay-inner {
    left: 50%;
    padding: 20px;
    position: absolute;
    text-align: center;
    top: 50%;
    transform: translate(-50%,-50%);
    width: 100%;
}

.kupetz-classic-gallery__caption {
    color: var(--kupetz-color-white);
    font-size: 1.5em;
    line-height: 1;
    text-align: center;
}

.kupetz-classic-gallery__caption::before,
.kupetz-classic-gallery__caption::after {
    background-image: url(../../../images/sprite.png);
    background-repeat: no-repeat;
    content: "";
    display: block;
    height: 21px;
    margin-left: auto;
    margin-right: auto;
    width: 146px;
}

.kupetz-classic-gallery__caption::before {
    background-position: -174px 0;
    margin-bottom: .8rem;
}

.kupetz-classic-gallery__caption::after {
    background-position: -174px -21px;
    margin-top: 1.2rem;
}

@media only screen and (min-width:992px) {
    .kupetz-classic-gallery__overlay {
        opacity: 0;
    }

    .kupetz-classic-gallery__open:hover .kupetz-classic-gallery__overlay,
    .kupetz-classic-gallery__open:focus-visible .kupetz-classic-gallery__overlay {
        opacity: 1;
    }

    .kupetz-classic-gallery__caption {
        font-size: 1.1rem;
    }
}

@media only screen and (max-width:991px) {
    .kupetz-classic-gallery {
        --kupetz-gallery-slide-height: 250px;
    }
}

@media only screen and (max-width:575px) {
    .kupetz-classic-gallery {
        --kupetz-gallery-slide-height: 220px;
    }

    /* Keep a visible slice of the next image as an affordance that the row can swipe. */
    .kupetz-classic-gallery.has-mobile-peek .kupetz-classic-gallery__viewport {
        padding-right: 0;
    }

    .kupetz-classic-gallery__overlay-inner {
        padding: 14px;
    }

    .kupetz-classic-gallery__caption {
        font-size: .95em;
        line-height: 1.15;
    }

    .kupetz-classic-gallery__caption::before,
    .kupetz-classic-gallery__caption::after {
        transform: scale(.82);
    }
}

/* Dependency-free gallery lightbox. */
.kupetz-gallery-lightbox {
    background: transparent;
    border: 0;
    height: 100%;
    margin: auto;
    max-height: 100%;
    max-width: 100%;
    padding: 0;
    width: 100%;
}

.kupetz-gallery-lightbox::backdrop {
    background: rgba(0,0,0,.88);
}

.kupetz-gallery-lightbox__panel {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(44px, 5vw) minmax(0, 1fr) minmax(44px, 5vw);
    height: 100%;
    margin: 0 auto;
    max-width: 1500px;
    padding: clamp(3rem, 6vw, 5rem) 0 2rem;
    position: relative;
    width: min(96vw, 1500px);
}

.kupetz-gallery-lightbox__figure {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    justify-content: center;
    margin: 0;
    min-height: 0;
    min-width: 0;
}

.kupetz-gallery-lightbox__image {
    display: block;
    max-height: calc(100dvh - 8rem);
    max-width: 100%;
    object-fit: contain;
}

.kupetz-gallery-lightbox__caption {
    color: #fff;
    font-family: var(--kupetz-font-serif);
    font-size: 1rem;
    margin: 0;
    text-align: center;
}

.kupetz-gallery-lightbox__close,
.kupetz-gallery-lightbox__nav {
    appearance: none;
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.6);
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.kupetz-gallery-lightbox__close {
    border-radius: 50%;
    font-size: 2rem;
    height: 44px;
    line-height: 1;
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 44px;
    z-index: 2;
}

.kupetz-gallery-lightbox__nav {
    align-self: center;
    border-radius: 50%;
    font-size: clamp(2rem, 4vw, 3.5rem);
    height: 52px;
    line-height: 1;
    width: 52px;
}

.kupetz-gallery-lightbox__nav--prev {
    justify-self: start;
}

.kupetz-gallery-lightbox__nav--next {
    justify-self: end;
}

.kupetz-gallery-lightbox__close:hover,
.kupetz-gallery-lightbox__close:focus-visible,
.kupetz-gallery-lightbox__nav:hover,
.kupetz-gallery-lightbox__nav:focus-visible {
    background: rgba(186,146,73,.75);
    outline: 0;
}

@media only screen and (max-width:575px) {
    .kupetz-gallery-lightbox__panel {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        width: 100vw;
    }

    .kupetz-gallery-lightbox__nav {
        height: 40px;
        width: 40px;
    }
}

/* Historical 3D-tour embed retained for database-owned content. */
.tour3d {
    height: 400px;
    overflow: hidden;
}

.tour3d iframe {
    height: 555px;
    left: -20%;
    position: relative;
    top: -20%;
    width: 140%;
}

@media (prefers-reduced-motion: reduce) {
    .kupetz-classic-gallery__overlay {
        transition-duration: .01ms;
    }
}

.kupetz-classic-gallery__image {
    -webkit-user-drag: none;
    user-select: none;
}
