/* ============================================================
 * 卡尼奶主题 · 文章图片灯箱
 * 遮罩弹窗放大预览，作用域限定 .knn-lb-* 前缀，适配深色模式
 * ============================================================ */

/* 可放大图片的手型光标 */
.article-content img.knn-lb-trigger {
    cursor: zoom-in;
}

/* 打开灯箱时锁定页面滚动 */
body.knn-lb-lock {
    overflow: hidden;
}

/* 遮罩层 */
.knn-lb-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    box-sizing: border-box;
}

.knn-lb-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.knn-lb-overlay * {
    box-sizing: border-box;
}

/* 图片舞台 */
.knn-lb-stage {
    max-width: 92vw;
    max-height: 86vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.knn-lb-img {
    max-width: 92vw;
    max-height: 86vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    transform: scale(1);
    transition: transform .2s ease;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}

.knn-lb-overlay.is-dragging .knn-lb-img {
    transition: none;
    cursor: grabbing !important;
}

/* 顶部工具栏 */
.knn-lb-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    z-index: 2;
}

.knn-lb-counter {
    color: rgba(255, 255, 255, .85);
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

.knn-lb-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.knn-lb-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .2s;
}

.knn-lb-tool:hover {
    background: rgba(255, 255, 255, .26);
}

/* 左右切换按钮 */
.knn-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
    transition: background-color .2s;
}

.knn-lb-nav:hover {
    background: rgba(255, 255, 255, .26);
}

.knn-lb-prev {
    left: 20px;
}

.knn-lb-next {
    right: 20px;
}

/* 图片说明 */
.knn-lb-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 18px 22px;
    text-align: center;
    color: rgba(255, 255, 255, .9);
    font-size: 13.5px;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
    pointer-events: none;
}

/* 深色模式：遮罩加深 */
body.dark-mode .knn-lb-overlay {
    background: rgba(0, 0, 0, .92);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .knn-lb-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .knn-lb-prev {
        left: 8px;
    }

    .knn-lb-next {
        right: 8px;
    }

    .knn-lb-tool {
        width: 34px;
        height: 34px;
    }

    .knn-lb-stage,
    .knn-lb-img {
        max-width: 96vw;
    }
}
