/* ============================================
   通用图片灯箱（与模板无关）—— assets/css/lightbox.css
   配套 JS：assets/js/lightbox.js
   ============================================ */

/* 打开灯箱时锁定页面滚动 */
html.ilb-lock {
    overflow: hidden;
}

/* 正文图片：可点击提示 + 轻量悬停反馈（类名 is-zoomable 由 JS 打在正文图片上） */
img.is-zoomable {
    cursor: zoom-in;
    transition: box-shadow 0.25s ease, filter 0.25s ease;
}
img.is-zoomable:hover {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    filter: brightness(0.97);
}

/* 遮罩层：暗色半透明全屏 */
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 14, 13, 0.94);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    -webkit-tap-highlight-color: transparent;
}
.img-lightbox.open {
    opacity: 1;
    visibility: visible;
}

/* 图片舞台（图 + 图注） */
.ilb-stage {
    margin: 0;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transform: scale(0.94);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
    pointer-events: none;
}
.img-lightbox.open .ilb-stage {
    transform: scale(1);
}
.ilb-stage .ilb-img,
.ilb-stage .ilb-caption {
    pointer-events: auto;
}

/* 大图本体 */
.ilb-img {
    max-width: 92vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
    user-select: none;
    -webkit-user-drag: none;
}
.ilb-img.is-loaded {
    opacity: 1;
}

/* 图注 */
.ilb-caption {
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.6;
    max-width: 80vw;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* 底部计数 n / total */
.ilb-counter {
    position: absolute;
    bottom: max(22px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 12px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

/* 左右切换 / 关闭 按钮 */
.ilb-nav,
.ilb-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    user-select: none;
}
.ilb-nav:hover,
.ilb-close:hover {
    background: rgba(255, 255, 255, 0.28);
}
.ilb-prev {
    left: max(18px, env(safe-area-inset-left));
    top: 50%;
    transform: translateY(-50%);
}
.ilb-next {
    right: max(18px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
}
.ilb-close {
    top: max(18px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    font-size: 24px;
}
.ilb-prev:hover,
.ilb-next:hover {
    transform: translateY(-50%) scale(1.06);
}
.ilb-close:hover {
    transform: scale(1.06);
}
.ilb-nav:active { transform: translateY(-50%) scale(0.96); }
.ilb-close:active { transform: scale(0.96); }

/* 移动端适配 */
@media (max-width: 640px) {
    .ilb-img {
        max-width: 94vw;
        max-height: 76vh;
    }
    .ilb-nav,
    .ilb-close {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
    .ilb-close {
        font-size: 20px;
    }
    .ilb-caption {
        font-size: 12px;
        max-width: 88vw;
    }
}
