/* ライトボックス：オーバーレイ */
#okamura-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    gap: 16px;
    animation: okamura-lb-fadein 0.2s ease;
}

#okamura-lightbox-overlay.is-active {
    display: flex;
}

/* スクロール防止 */
body.okamura-lightbox-open {
    overflow: hidden;
}

/* 画像コンテナ：常に 80vw × 80vh を確保 */
#okamura-lightbox-container {
    position: relative;
    width: 80vw;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 拡大画像：コンテナいっぱいに contain で収める */
#okamura-lightbox-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* 閉じるボタン：画面右上に固定配置 */
#okamura-lightbox-close {
    position: fixed;
    top: 5%;
    right: 5%;
    width: 50px;
    height: 50px;
    padding: 0;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    color: #333;
    transition: background 0.15s ease, color 0.15s ease;
    z-index: 100000;
}

#okamura-lightbox-close:hover,
#okamura-lightbox-close:focus {
    background: #fff;
    color: #000;
    outline: none;
}

/* 前へ / 次へ ボタン */
#okamura-lightbox-prev,
#okamura-lightbox-next {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

#okamura-lightbox-prev:hover,
#okamura-lightbox-prev:focus,
#okamura-lightbox-next:hover,
#okamura-lightbox-next:focus {
    background: rgba(255, 255, 255, 0.35);
    border-color: #fff;
    outline: none;
}

/* スマートフォン：画像を上、ボタンを下に横並びで配置 */
@media (max-width: 600px) {
    #okamura-lightbox-overlay {
        flex-direction: row;
        flex-wrap: wrap;
        align-content: center;
        justify-content: center;
        gap: 12px;
        padding: 16px;
    }

    /* コンテナを先頭行に全幅で表示・デスクトップの固定サイズをリセット */
    #okamura-lightbox-container {
        order: -1;
        flex: 0 0 100%;
        width: 100%;
        height: auto;
    }

    #okamura-lightbox-img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 65vh;
    }

    /* 前へ・次へボタンを横並びで画像の下に中央配置 */
    #okamura-lightbox-prev,
    #okamura-lightbox-next {
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}

/* フェードインアニメーション */
@keyframes okamura-lb-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ライトボックス対象の画像にホバーエフェクト */
/* Gutenberg */
figure[data-lightbox="true"] img,
/* クラシックエディター */
img.okamura-lightbox {
    cursor: zoom-in;
    transition: opacity 0.2s ease;
}

figure[data-lightbox="true"] img:hover,
img.okamura-lightbox:hover {
    opacity: 0.85;
}

/* 管理画面：注入したチェックボックスのスタイル */
.okamura-lightbox-setting {
    margin-bottom: 10px !important;
}

.okamura-lightbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    font-weight: normal !important;
}
