/* 照片燈箱（重新設計，取代舊的 .gallery-dialog 疊層規則）
   版面：上排左側張數、右側工具列（自動輪播／全螢幕／縮圖預覽開關／關閉）；
   中間照片區佔滿剩餘高度，左右各一個切換鈕；下排以分隔線區隔出說明文字與縮圖預覽列。
   照片一律以絕對定位互相疊放，由 JS 做交叉淡入／左右滑入，讀取時上一張不會被清掉，
   因此不會出現閃白或空窗。此檔案最後載入，樣式自成一套，不與舊規則互相覆蓋。 */
.tc-lightbox{position:fixed;inset:0;z-index:2000;display:block;width:100%;max-width:100%;height:100%;max-height:100%;margin:0;padding:0;border:0;background:transparent;color:#fff;overflow:hidden;overscroll-behavior:contain}
.tc-lightbox:not([open]){display:none}
/* 燈箱內容統一包在這個普通 <div> 裡：<dialog> 本身不能送進瀏覽器全螢幕（Chrome 會拒絕），
   這一層可以，而且它是 dialog 的後代、進 top layer 的順序在 dialog 之後，會正常疊在最上層。 */
.tc-lb-shell{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-height:0}
/* 真正進入瀏覽器全螢幕時，畫面上呈現的是 shell。這裡刻意讓它與自己的 ::backdrop 都保持透明，
   遮罩統一交給外層 <dialog> 的 ::backdrop（半透明）處理——這樣不論有沒有真的進入全螢幕，
   看到的都是同一層半透明遮罩、底下的網頁一樣看得見，不會突然變成一片不透明的深色。 */
.tc-lb-shell:fullscreen{width:100%;height:100%;background:transparent}
.tc-lb-shell:fullscreen::backdrop{background:transparent}
/* 遮罩維持半透明，底下的網頁仍看得見（使用者要求），只加一點點模糊讓照片與說明文字好讀。 */
/* 遮罩不用毛玻璃模糊（2026-10-21 使用者反映放大照片仍不順）：backdrop-filter 讓放大、拖曳、換張時每一格都要重算整片模糊，
   實測約一半的畫面被丟掉；拿掉後同樣操作不掉格。原本只模糊 2px、幾乎看不出來，改用稍深一點的遮罩補足。 */
.tc-lightbox::backdrop{background:rgba(6,18,33,.74)}
/* 滿版模式：重點是「照片變大」，不是只把瀏覽器變全螢幕。
   上排工具列與下方說明／縮圖列改為疊在照片上方的浮層（用漸層底讓文字仍讀得清楚），
   照片區因此取得整個畫面高度，左右留白也去掉，照片實際放到最大。
   背後已看不到網頁，底色改成接近不透明，照片對比才夠。 */
/* 滿版時不再另外疊一層底色，沿用一般模式那層半透明遮罩，底下的網頁一樣看得見。 */
.tc-lightbox.is-fullscreen,.tc-lightbox.is-fullscreen .tc-lb-shell{background:transparent}
.tc-lightbox.is-fullscreen .tc-lb-top{position:absolute;inset:0 0 auto;z-index:5;background:linear-gradient(rgba(0,0,0,.5),transparent)}
.tc-lightbox.is-fullscreen .tc-lb-canvas{padding:0}
.tc-lightbox.is-fullscreen .tc-lb-foot{position:absolute;inset:auto 0 0;z-index:5;border-top:0;background:linear-gradient(transparent,rgba(2,9,18,.86))}
.tc-lightbox.is-fullscreen .tc-lb-arrow{background:rgba(9,26,45,.72)}

/* 上排工具列 */
.tc-lb-top{flex:0 0 auto;display:flex;align-items:center;gap:1rem;min-height:50px;padding:.3rem .55rem}
.tc-lb-count{color:#e2edf7;font-size:.86rem;font-weight:800;letter-spacing:.06em;text-shadow:0 1px 3px rgba(0,0,0,.65)}
.tc-lb-count:empty{display:none}
.tc-lb-tools{display:flex;align-items:center;gap:.12rem;margin-left:auto}
.tc-lb-tool{display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:7px;background:transparent;color:#eaf3fb;cursor:pointer;transition:background .18s ease,color .18s ease}
.tc-lb-tool svg{width:20px;height:20px;fill:currentColor}
/* 線條圖示（放大鏡、全螢幕、縮回、關閉）：上一行的 fill 會蓋掉 SVG 的 fill="none"——放大鏡圓圈被塗滿就看不到裡面的 +／−
   （使用者 2026-09-25 反映），全螢幕四角也會變成實心三角形。播放、暫停、縮圖本來就是實心圖示，不受影響。 */
.tc-lb-tool svg[fill="none"]{fill:none}
.tc-lb-tool:hover,.tc-lb-tool:focus-visible{background:rgba(255,255,255,.16);color:#fff}
.tc-lb-tool:focus-visible{outline:2px solid #fff;outline-offset:1px}
/* 縮圖預覽多數情況預設就是開著的，用淡淡的底色表示「目前為開啟」即可；
   自動輪播正在跑是暫時狀態，用品牌紅明確標示，一眼就知道還在輪播中。 */
.tc-lb-tool[aria-pressed="true"]{background:rgba(255,255,255,.2);color:#fff}
.tc-lb-play[aria-pressed="true"]{background:rgba(197,34,47,.9)}
.tc-lb-tool[hidden]{display:none}

/* 照片區：佔滿上下排之間的剩餘高度 */
.tc-lb-stage{position:relative;flex:1 1 auto;min-height:0;width:100%;overflow:hidden}
/* 照片層明確給 z-index：避免任何情況（例如瀏覽器 top layer 的繪製順序變動）下，
   有設 z-index 的工具列、箭頭還看得到，照片本身卻被蓋在底下。 */
.tc-lb-canvas{position:absolute;inset:0;z-index:1;display:grid;place-items:center;padding:.5rem 4.75rem}
.tc-lb-slide{position:absolute;inset:0;width:100%;height:100%;margin:0;object-fit:contain;image-orientation:from-image;backface-visibility:hidden}
/* 墊檔用的列表縮圖：放大後本來就模糊，索性刻意柔化，原圖淡入時的清晰落差看起來才自然。 */
.tc-lb-slide.is-preview{filter:blur(10px)}
.tc-lb-video{max-width:100%;max-height:100%;background:#000}.tc-lb-embed{width:min(100%,1120px);aspect-ratio:16/9;max-height:100%;background:#000;margin:auto}.tc-lb-embed[hidden]{display:none}.tc-lb-embed iframe{display:block;width:100%;height:100%;border:0}
.tc-lb-video[hidden]{display:none}

.tc-lb-spinner{position:absolute;z-index:3;width:46px;height:46px;border:3px solid rgba(255,255,255,.26);border-top-color:#fff;border-radius:50%;animation:tcLbSpin .8s linear infinite}
.tc-lb-spinner[hidden]{display:none}
@keyframes tcLbSpin{to{transform:rotate(360deg)}}

.tc-lb-arrow{position:absolute;z-index:4;top:50%;display:grid;place-items:center;width:52px;height:52px;margin-top:-26px;padding:0;border:1px solid rgba(255,255,255,.42);border-radius:50%;background:rgba(9,26,45,.58);color:#fff;font:400 2.2rem/1 Arial,sans-serif;cursor:pointer;transition:background .2s ease,border-color .2s ease,transform .2s ease}
.tc-lb-arrow:hover,.tc-lb-arrow:focus-visible{background:#c5222f;border-color:#c5222f;transform:scale(1.07)}
.tc-lb-arrow:focus-visible{outline:3px solid #fff;outline-offset:3px}
.tc-lb-arrow[hidden]{display:none}
.tc-lb-prev{left:1.1rem}
.tc-lb-next{right:1.1rem}

/* 下排：分隔線明確區隔出「這裡是說明與預覽區」，並與畫面下緣保留餘裕。 */
.tc-lb-foot{flex:0 0 auto;border-top:1px solid rgba(255,255,255,.24);background:rgba(4,13,24,.5);padding:.6rem .8rem max(.85rem,env(safe-area-inset-bottom))}
.tc-lb-caption{margin:0;color:#eaf3fb;font-size:.95rem;line-height:1.55;max-height:4.7em;overflow:auto}
.tc-lb-caption:empty{display:none}
.tc-lb-foot.has-thumbs .tc-lb-caption{margin-bottom:.55rem}

.tc-lb-thumbs{display:flex;gap:.45rem;overflow-x:auto;overflow-y:hidden;padding-bottom:.15rem;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.45) transparent;overscroll-behavior-x:contain}
.tc-lb-thumbs[hidden]{display:none}
.tc-lb-thumbs::-webkit-scrollbar{height:6px}
.tc-lb-thumbs::-webkit-scrollbar-thumb{border-radius:3px;background:rgba(255,255,255,.4)}
.tc-lb-thumb{flex:0 0 auto;width:92px;height:62px;padding:0;border:2px solid transparent;border-radius:5px;background:rgba(255,255,255,.12);cursor:pointer;opacity:.6;transition:opacity .2s ease,border-color .2s ease,transform .2s ease}
.tc-lb-thumb img{display:block;width:100%;height:100%;border-radius:3px;object-fit:cover}
.tc-lb-thumb:hover,.tc-lb-thumb:focus-visible{opacity:1;transform:translateY(-2px)}
.tc-lb-thumb:focus-visible{outline:3px solid #fff;outline-offset:2px}
.tc-lb-thumb.is-active{opacity:1;border-color:#4da3ff}
/* 縮圖列右上角的梯形頁籤（像資料夾的標籤，2026-10-20 使用者指定）：按了收合縮圖列，底部只剩說明文字那一行；再按展開恢復。不是關閉。
   頁籤要和縮圖列同一個顏色、貼齊不留縫：縮圖列上緣多留 12px 透明的一條給頁籤，縮圖列本身的底色與上緣線從 12px 開始畫，
   上緣線在頁籤底下留空，頁籤用同樣半透明的底色（兩者背後是同一層遮罩，顏色一致），邊線接著縮圖列的上緣線 */
.tc-lb-foot{position:relative}
.tc-lb-thumbrow[hidden]{display:none}
.tc-lb-foot.has-thumbs{border-top:0;padding-top:calc(.6rem + 12px);
  background:linear-gradient(to right,rgba(255,255,255,.24) calc(100% - 1.1rem - 64px),transparent 0 calc(100% - 1.1rem),rgba(255,255,255,.24) 0) 0 11px/100% 1px no-repeat,
    linear-gradient(rgba(4,13,24,.5),rgba(4,13,24,.5)) 0 12px/100% calc(100% - 12px) no-repeat}
.tc-lb-thumbsize{position:absolute;z-index:6;top:0;right:1.1rem;display:grid;place-items:center;width:64px;height:12px;padding:1px 0 0;border:0;color:#eaf3fb;cursor:pointer;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 12' preserveAspectRatio='none'%3E%3Cpath d='M0 12 9 .5h46L64 12z' fill='%23040d18' fill-opacity='.5'/%3E%3Cpath d='M0 12 9 .5h46L64 12' fill='none' stroke='%23fff' stroke-opacity='.24' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0/100% 100% no-repeat}
.tc-lb-thumbsize[hidden]{display:none}
.tc-lb-thumbsize svg{width:14px;height:11px}
.tc-lb-thumbsize:hover,.tc-lb-thumbsize:focus-visible{color:#fff;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 12' preserveAspectRatio='none'%3E%3Cpath d='M0 12 9 .5h46L64 12z' fill='%23c5222f' fill-opacity='.95'/%3E%3Cpath d='M0 12 9 .5h46L64 12' fill='none' stroke='%23fff' stroke-opacity='.24' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E")}
.tc-lb-thumbsize:focus-visible{outline:2px solid #fff;outline-offset:1px}
.tc-lightbox.is-fullscreen .tc-lb-thumbsize:not(:hover):not(:focus-visible){background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 12' preserveAspectRatio='none'%3E%3Cpath d='M0 12 9 .5h46L64 12z' fill='%23020912' fill-opacity='.35'/%3E%3Cpath d='M0 12 9 .5h46L64 12' fill='none' stroke='%23fff' stroke-opacity='.24' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E")}
.tc-lb-foot.is-thumbs-compact{padding-top:calc(.3rem + 12px);padding-bottom:max(.3rem,env(safe-area-inset-bottom))}
.tc-lb-foot.is-thumbs-compact .tc-lb-thumbrow{display:none}
.tc-lb-foot.is-thumbs-compact .tc-lb-caption{margin-bottom:0;max-height:1.55em;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}

/* 放大鏡：點照片放大、拖曳移動（js 在 public-interactions.js 的「放大鏡」段落） */
.tc-lb-canvas{touch-action:none}
.tc-lb-slide{transform-origin:50% 50%;transition:transform .18s ease-out}
.tc-lightbox:not(.is-zoomed) .tc-lb-slide:not(.is-preview){cursor:zoom-in}
.tc-lightbox.is-zoomed .tc-lb-slide{cursor:grab}
/* 燈箱開著時，背後網頁的動畫（標題區的流動底紋、頁尾標誌等）一律暫停、節慶特效的畫布先藏起來（2026-10-20 使用者反映拖曳照片很慢）：
   遮罩是半透明加模糊，背後每動一格，整片模糊就得重算一次，拖曳照片時跟著卡。關閉燈箱後原樣繼續。 */
html.photo-viewer-open body>:not(.tc-lightbox),html.photo-viewer-open body>:not(.tc-lightbox) *,
html.photo-viewer-open body>:not(.tc-lightbox)::before,html.photo-viewer-open body>:not(.tc-lightbox)::after,
html.photo-viewer-open body>:not(.tc-lightbox) *::before,html.photo-viewer-open body>:not(.tc-lightbox) *::after{animation-play-state:paused!important}
html.photo-viewer-open body>:not(.tc-lightbox) canvas{visibility:hidden}
/* 拖曳中把照片放到獨立的繪圖層（will-change）：只是平移，不必每動一下就把幾千像素寬的原圖重畫一次（2026-10-20 使用者反映拖曳很慢）。
   只在拖曳中加：一直掛著的話，放大倍數改變後瀏覽器不會用新倍數重畫，字會糊 */
.tc-lightbox.is-panning .tc-lb-slide{cursor:grabbing;transition:none;will-change:transform}
/* 滾輪連續縮放時不套 0.18 秒的補間：每一格滾輪都重新起跑一段動畫，照片會一直「追不上」滾輪 */
.tc-lightbox.is-wheeling .tc-lb-slide{transition:none}
/* 照片不能被當成圖片拖出去、也不會被選取反白（拖曳放大後的照片時會搶走滑鼠） */
.tc-lb-slide{-webkit-user-drag:none;user-select:none;-webkit-user-select:none}
.tc-lightbox.is-zoomed .tc-lb-arrow{opacity:.6}
.tc-lb-zoomlevel{min-width:3.2em;padding-right:.25rem;color:#e2edf7;font-size:.8rem;font-weight:800;text-align:right;text-shadow:0 1px 3px rgba(0,0,0,.65)}
.tc-lb-zoomlevel:empty{display:none}
.tc-lb-tool:disabled{opacity:.38;cursor:default;background:transparent}

@media(max-width:767.98px){
.tc-lb-top{min-height:44px;padding:.2rem .35rem}
.tc-lb-tool{width:36px;height:36px}
.tc-lb-tool svg{width:18px;height:18px}
.tc-lb-canvas{padding:.35rem .6rem}
.tc-lb-arrow{width:40px;height:40px;margin-top:-20px;font-size:1.65rem}
.tc-lb-prev{left:.5rem}
.tc-lb-next{right:.5rem}
.tc-lb-foot{padding:.5rem .6rem max(.7rem,env(safe-area-inset-bottom))}
.tc-lb-foot.has-thumbs:not(.is-thumbs-compact){padding-top:calc(.5rem + 12px)}
.tc-lb-caption{font-size:.88rem;max-height:3.6em}
.tc-lb-thumb{width:68px;height:48px}
}
@media(prefers-reduced-motion:reduce){.tc-lb-spinner{animation-duration:2.4s}.tc-lb-tool,.tc-lb-arrow,.tc-lb-thumb,.tc-lb-slide{transition:none}}
