/* 文章图片灯箱 —— 纯 CSS，无依赖。
   挂载点：custom/functions.php 在文章页/独立页页脚输出本文件与 lightbox.js。 */

/* 正文图片给一个「可点开」的光标暗示 */
.markdown-body img { cursor: zoom-in; }

.jlb {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: none;
    opacity: 0;
    transition: opacity .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.jlb--open { display: block; }
.jlb--visible { opacity: 1; }

html.jlb-lock,
body.jlb-lock { overflow: hidden !important; }

.jlb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 11, 18, .94);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.jlb__figure {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 64px 72px;
    box-sizing: border-box;
    pointer-events: none;
}

.jlb__img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .55);
    cursor: zoom-in;
    pointer-events: auto;
    transform-origin: var(--jlb-ox, 50%) var(--jlb-oy, 50%);
    transform: scale(1);
    transition: transform .22s ease;
    will-change: transform;
    -webkit-user-select: none;
    user-select: none;
}

.jlb__img--zoom {
    cursor: zoom-out;
    transform: scale(2.2);
    border-radius: 0;
    box-shadow: none;
}

.jlb__bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 64px;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, .82);
    text-align: center;
    pointer-events: none;
}

.jlb__count {
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
    color: rgba(255, 255, 255, .95);
}

.jlb__count:empty { display: none; }

.jlb__caption {
    max-width: 720px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .7;
}

.jlb__caption:empty { display: none; }

.jlb__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-family: -apple-system, "Segoe UI", "HarmonyOS Sans", "PingFang SC", sans-serif;
    font-size: 26px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.jlb__btn:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .34); }
.jlb__btn:active { transform: scale(.96); }
.jlb__btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .8); outline-offset: 2px; }

.jlb__close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 24px;
}

.jlb__nav {
    top: 50%;
    width: 46px;
    height: 46px;
    margin-top: -23px;
    padding-bottom: 4px;
    font-size: 30px;
}

.jlb__nav--prev { left: 16px; }
.jlb__nav--next { right: 16px; }

/* 只有一张图时，翻页按钮与计数都不出现 */
.jlb--single .jlb__nav { display: none; }

@media (max-width: 640px) {
    .jlb__figure { padding: 52px 8px 76px; }
    .jlb__nav { width: 38px; height: 38px; margin-top: -19px; font-size: 24px; }
    .jlb__nav--prev { left: 6px; }
    .jlb__nav--next { right: 6px; }
    .jlb__close { top: 10px; right: 10px; width: 34px; height: 34px; }
    .jlb__bar { padding: 0 12px; font-size: 12px; }
    .jlb__img--zoom { transform: scale(2.6); }
}

@media (prefers-reduced-motion: reduce) {
    .jlb,
    .jlb__img,
    .jlb__btn { transition: none !important; }
}

@media print {
    .jlb { display: none !important; }
}
