/* 图片查看器的样式，配套 lightbox.js。

   前台和后台两套页面各引各的主样式表，这一份得两边都挂上，
   所以单独成文件，不塞进 core.css 里。 */

/* 遮罩打开时页面不跟着滚。core.css 里也有同名的一条，后台那边没有，补在这儿 */
body.modal-open { overflow: hidden }

:where(.lightbox button) {
    margin: 0;
    padding: 0;
    border: 0;
    font: inherit;
    color: inherit;
    background: none;
    -webkit-appearance: none;
    appearance: none;
}

:where(.lightbox, .lightbox *, .lightbox *:before, .lightbox *:after) { box-sizing: border-box }
:where(.lightbox img) { display: block; max-width: 100% }

/* 图片查看器：遮罩、轨道、翻页、缩放，DOM 由 lightbox.js 建 */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: grid;
    grid-template-rows: auto 1fr auto;
    touch-action: none;
    overscroll-behavior: contain;
    -webkit-user-select: none;
    user-select: none;
}

.lightbox[hidden] { display: none }

.lightbox:before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(16, 12, 18, .93);
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px);
    opacity: var(--lightbox-dim, 1);
}

.lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    color: rgba(255, 255, 255, .9);
}

.lightbox-count { font: 700 10px Arial, sans-serif; letter-spacing: .16em }
.lightbox-tools { display: flex; gap: 8px }

.lightbox-button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background .2s;
}

.lightbox-button:hover { background: rgba(255, 255, 255, .26) }
.lightbox-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px }

.lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-top: -23px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    transition: background .2s, opacity .2s;
}

.lightbox-nav:hover { background: rgba(255, 255, 255, .26) }
.lightbox-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px }
.lightbox-nav[hidden] { display: none }
.lightbox-nav:disabled { opacity: .25; cursor: default }
.lightbox-nav:disabled:hover { background: rgba(255, 255, 255, .14) }
.lightbox-nav.is-prev { left: 18px }
.lightbox-nav.is-next { right: 18px }

.lightbox-stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.lightbox-track {
    display: flex;
    height: 100%;
    will-change: transform;
}

.lightbox-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 0 14px;
}

.lightbox-frame {
    position: relative;
    width: 100%;
    max-width: min(1400px, 100%);
    max-height: 100%;
    aspect-ratio: var(--lightbox-ratio, 3 / 2);
    border-radius: 14px;
    background: rgba(255, 255, 255, .06);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.lightbox-frame:before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg,
        rgba(255, 255, 255, .04) 30%,
        rgba(255, 255, 255, .13) 50%,
        rgba(255, 255, 255, .04) 70%) 0 0 / 220% 100%;
    animation: lightbox-sheen 1.4s linear infinite;
}

.lightbox-slide.is-ready .lightbox-frame:before,
.lightbox-slide.is-full .lightbox-frame:before { display: none }

.lightbox-slide.is-ready .lightbox-frame,
.lightbox-slide.is-full .lightbox-frame { background: transparent }

.lightbox-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-user-drag: none;
}

.lightbox-full { opacity: 0; transition: opacity .28s ease }
.lightbox-slide.is-full .lightbox-full { opacity: 1 }
.lightbox-slide.is-full .lightbox-preview { visibility: hidden; transition: visibility 0s linear .3s }
.lightbox-slide.is-failed .lightbox-frame { background: rgba(255, 255, 255, .04) }
.lightbox-slide.is-failed .lightbox-frame:before { display: none }

.lightbox-hint {
    position: absolute;
    left: 18px;
    bottom: 17px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: rgba(255, 255, 255, .85);
    font-size: 11px;
    letter-spacing: .04em;
    pointer-events: none;
}

.lightbox-hint[hidden] { display: none }

.lightbox-dot {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lightbox-spin .8s linear infinite;
}

.lightbox-note {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
}

.lightbox-note[hidden] { display: none }

.lightbox-caption {
    margin: 0;
    padding: 12px 20px 20px;
    text-align: center;
    color: rgba(255, 255, 255, .8);
    font-size: 12px;
    line-height: 1.7;
}

.lightbox-caption[hidden] { display: none }
.lightbox.is-zoomed .lightbox-frame { cursor: grab; will-change: transform }
.lightbox.is-dragging .lightbox-frame,
.lightbox.is-swiping .lightbox-frame { cursor: grabbing }

@keyframes lightbox-spin { to { transform: rotate(360deg) } }
@keyframes lightbox-sheen { to { background-position: -220% 0 } }

@media (max-width: 640px) {
    .lightbox-nav { display: none }
    .lightbox-slide { padding: 0 10px }
    .lightbox-caption { padding: 10px 16px 18px }
    .lightbox-hint { left: 14px; top: 76px; bottom: auto }
}

@media (prefers-reduced-motion: reduce) {
    .lightbox-frame:before { animation: none }
    .lightbox-full { transition: none }
}
