/* 通用图片大图弹窗 — common/_image_lightbox.twig + web-image-lightbox.js */

.web-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: rgba(0, 0, 0, 0.96);
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
}

.web-image-lightbox.is-single .web-image-lightbox-stage {
    flex: 1;
    min-height: 0;
}

.web-image-lightbox.is-multi .web-image-lightbox-stage {
    flex: 0 0 85vh;
    max-height: 85vh;
    min-height: 0;
}

.web-image-lightbox.is-multi .web-image-lightbox-gallery {
    flex: 0 0 15vh;
    max-height: 15vh;
}

.web-image-lightbox-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.5rem;
    pointer-events: none;
}

.web-image-lightbox-toolbar > * {
    pointer-events: auto;
}

.web-image-lightbox-counter {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.web-image-lightbox-close {
    border: none;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.web-image-lightbox-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 0.25rem;
}

.web-image-lightbox-viewport {
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    user-select: none;
}

.web-image-lightbox-swiper {
    width: 100%;
    height: 100%;
}

.web-image-lightbox-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.web-image-lightbox-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

.web-image-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.web-image-lightbox-nav.prev { left: 0.5rem; }
.web-image-lightbox-nav.next { right: 0.5rem; }

.web-image-lightbox.is-single .web-image-lightbox-nav,
.web-image-lightbox.is-single .web-image-lightbox-counter {
    display: none;
}

.web-image-lightbox-gallery {
    display: flex;
    align-items: center;
    min-height: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
}

.web-image-lightbox-gallery-track {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.web-image-lightbox-gallery-track::-webkit-scrollbar {
    height: 4px;
}

.web-image-lightbox-gallery-track::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
}

.web-image-lightbox-thumb {
    flex: 0 0 auto;
    width: clamp(3rem, 12vh, 4.5rem);
    height: clamp(3rem, 11vh, 4rem);
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.35rem;
    overflow: hidden;
    background: transparent;
    opacity: 0.55;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.web-image-lightbox-thumb.active,
.web-image-lightbox-thumb:hover {
    border-color: #fff;
    opacity: 1;
}

.web-image-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

body.web-image-lightbox-open {
    overflow: hidden;
}

[data-image-lightbox] {
    cursor: zoom-in;
}
