/* ═══════════════════════════════════════════════════════════════════════
   lightbox.css ── 圖片點擊放大（含 caption／source 三層資料）唯一正本
   建立 2026-07-31（su 拍板「plant 與 monitor 一併接上」）

   【canonical 依據】線稿定錨.md:69【硬鎖】
      「放大檢視含三層資料：圖本體＋caption＋source；適用於監督文章圖與未來計劃圖；
        『關於平台』介紹圖明確不走 lightbox（客戶已確認）。無 source 之圖列自動隱藏。」
      客戶需求日 2026-06-18。

   【內容來源】移植自 wireframe.html:220-237（樣式）＋575-582（DOM）＋836-863（行為），
      值照抄；差異＝線稿只顯示灰底佔位文字，本版顯示真實圖片（.lb-img），
      無圖時才退回線稿的文字佔位（.lb-ph）。

   【載入順序】page-chrome.css 之後
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 觸發元素：可放大的圖框 ── */
.zoomable{ position:relative; cursor:zoom-in; }
.zoomable::after{ content:"⤢ 點擊放大"; position:absolute; right:10px; bottom:10px; font-size:12px; color:#fff;
  background:rgba(0,0,0,.55); padding:3px 9px; border-radius:6px; pointer-events:none; opacity:0; transition:opacity .15s; z-index:2; }
.zoomable:hover::after,.zoomable:focus-visible::after{ opacity:1; }
.zoomable:focus-visible{ outline:2px solid var(--c-ink); outline-offset:3px; }
@media (prefers-reduced-motion:reduce){ .zoomable::after{ transition:none; } }

/* ── 放大檢視層 ── */
.lb{ position:fixed; inset:0; background:rgba(0,0,0,.82); display:none; align-items:center; justify-content:center; z-index:9999; padding:5vh 5vw; }
.lb.open{ display:flex; }
.lb .lb-fig{ margin:0; display:flex; flex-direction:column; gap:14px; align-items:center; max-width:90vw; }
/* 真圖：長邊受限於視窗，維持原比例不裁切 */
.lb .lb-img{ display:block; max-width:min(1200px,90vw); max-height:74vh; width:auto; height:auto;
  max-inline-size:min(1200px,90vw); border-radius:14px; background:#1c1c1c; object-fit:contain; }
.lb .lb-img[hidden]{ display:none; }
/* 無圖時的文字佔位（沿用線稿行為，例：尚未提供實際圖片的區塊）*/
.lb .lb-ph{ width:min(960px,90vw); height:min(600px,74vh); border-radius:14px; background:#1c1c1c; color:#ddd;
  display:flex; align-items:center; justify-content:center; font-size:15px; text-align:center; padding:24px; }
.lb .lb-ph[hidden]{ display:none; }
.lb .lb-cap{ max-width:min(1200px,90vw); text-align:center; line-height:1.6; }
.lb .lb-cap-text{ display:block; color:#f2f2f2; font-size:15px; font-weight:600; }
.lb .lb-cap-text:empty{ display:none; }
.lb .lb-src{ display:block; margin-top:4px; color:#a8a8a8; font-size:12px; }
.lb .lb-src:empty{ display:none; }          /* 無 source 之圖列自動隱藏（線稿定錨硬鎖）*/
.lb-close{ position:absolute; top:18px; right:26px; width:44px; height:44px; border:0; background:rgba(255,255,255,.14);
  color:#fff; font-size:26px; line-height:1; border-radius:50%; cursor:pointer; }
.lb-close:hover{ background:rgba(255,255,255,.24); }
.lb-close:focus-visible{ outline:2px solid #fff; outline-offset:2px; }

/* ── 捲動鎖與「零水平位移」補償 ──
   鎖捲＝html 上 overflow:hidden（有 Lenis 時另呼叫 lenis.stop()，其 .lenis-stopped 也會上 overflow:hidden）。
   ⚠ 抽掉捲軸寬會讓整頁水平位移（frontend-pitfalls 既有雷，交接單 notes(1) 第③條同源）。
      對策＝lightbox.js 在鎖捲「之前」量出捲軸寬寫進 --lb-sbw，下列規則只在開啟期間補回來。
      ⚠ 不可改用全域 html{scrollbar-gutter:stable}：那會讓版面永久右縮一個捲軸寬（實測 1920→1905），
        拿永久視覺差異換暫時狀態，代價不對稱（2026-07-31 已試過並回退）。
      macOS 預設 overlay 捲軸量到 --lb-sbw:0px → 本規則組自然無作用，零副作用。
   固定定位元素（header／布幕揭露期間的 footer）不受 body padding 影響，需各自補。 */
html.lb-lock{ overflow:hidden; }
html.lb-lock body{ padding-right:var(--lb-sbw,0px); }
html.lb-lock .site-header{ padding-right:var(--lb-sbw,0px); }
html.lb-lock .site-footer{ padding-right:var(--lb-sbw,0px); }
