/**
 * 크게 보기(라이트박스) — /js/lightbox.js 가 만드는 창. 갤러리 섹션·이미지 게시판·게시글 본문이 같이 쓴다.
 * 창은 어떤 페이지 위에서도 같은 모양이다(사이트 색을 따르지 않는 어두운 바탕).
 */
.klb {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: grid;
    place-items: center;
    padding: 64px 72px 24px;
    background: rgba(8, 8, 10, 0.94);
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.klb[hidden] { display: none; }
.klb.is-open { opacity: 1; }
.klb--still { transition: none; }

.klb-stage {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 100%;
    max-height: 100%;
    /* 두 손가락 확대는 브라우저에 맡기고, 한 손가락 밀기는 스크립트가 받는다. */
    touch-action: pinch-zoom;
}
.klb-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    min-height: 120px;
}
.klb-img {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 144px);
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.2s ease;
}
.klb.is-loading .klb-img { opacity: 0; }
.klb--still .klb-img { transition: none; }

.klb-spinner {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: klb-spin 0.9s linear infinite;
}
.klb.is-loading .klb-spinner { opacity: 1; }
@keyframes klb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .klb-spinner { animation-duration: 2.4s; }
}

.klb-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px 14px;
    max-width: min(720px, calc(100vw - 48px));
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    color: rgba(255, 255, 255, 0.92);
}
.klb-caption[hidden] { display: none; }
.klb-caption-link {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.klb-caption-link[hidden] { display: none; }

.klb-counter {
    position: absolute;
    top: 18px;
    left: 20px;
    margin: 0;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.8);
}
.klb-counter[hidden] { display: none; }

.klb-btn {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.klb-btn:hover { background: rgba(255, 255, 255, 0.26); }
.klb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.klb-btn[hidden] { display: none; }
.klb-close { top: 10px; right: 12px; }
.klb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.klb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* 휴대폰: 사진을 화면 폭 가득, 넘기기 단추는 아래로 */
@media (max-width: 640px) {
    .klb { padding: 60px 0 84px; }
    .klb-img {
        max-width: 100vw;
        max-height: calc(100vh - 190px);
        max-height: calc(100dvh - 190px);
        border-radius: 0;
    }
    .klb-prev, .klb-next { top: auto; bottom: 16px; transform: none; }
    .klb-prev { left: calc(50% - 60px); }
    .klb-next { right: calc(50% - 60px); }
    .klb-caption { padding: 0 16px; font-size: 14px; }
}

/* 본문 이미지 중 누르면 커지는 것 */
[data-lightbox-images] img[data-lightbox-ready] { cursor: zoom-in; }
a[data-lightbox] { cursor: zoom-in; }
