/**
 * StImageViewer — 前台全螢幕圖片檢視 lightbox
 * Editorial Civic 設計：深墨 backdrop / 紙白圓 X / 金色 hover
 */

/* ===== 區域變數（editorial token）===== */
:root {
  --st-iv-backdrop:           rgba(26, 21, 48, 0.92);
  --st-iv-toolbar-bg:         rgba(26, 21, 48, 0.88);
  --st-iv-toolbar-border:     rgba(200, 164, 92, 0.35);
  --st-iv-toolbar-color:      var(--paper, #F8F4ED);
  --st-iv-toolbar-color-hover: var(--gold-soft, #E8D7A8);
  --st-iv-close-bg:           var(--paper, #F8F4ED);
  --st-iv-close-color:        var(--ink-deep, #1A1530);
  --st-iv-close-bg-hover:     var(--gold-soft, #E8D7A8);
  --st-iv-close-border:       rgba(200, 164, 92, 0.6);
  --st-iv-radius:             999px;
  --st-iv-z:                  11000;
  --st-iv-ease:               var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  --st-iv-transition:         transform 0.2s var(--st-iv-ease), opacity 0.2s var(--st-iv-ease);
}

/* ===== 主容器 ===== */
.st-imageviewer {
  position: fixed;
  inset: 0;
  z-index: var(--st-iv-z);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--st-iv-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--st-iv-ease);
  user-select: none;
}

.st-imageviewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ===== 圖片舞台 ===== */
.st-imageviewer__stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}

.st-imageviewer__stage.is-panning {
  cursor: grabbing;
}

.st-imageviewer__img {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  transform: scale(1) translate(0, 0);
  transform-origin: center center;
  transition: var(--st-iv-transition);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  background: var(--paper, #F8F4ED);
  border: 1px solid rgba(200, 164, 92, 0.25);
}

.st-imageviewer__img.is-panning {
  transition: none;
}

/* ===== 右上角圓 X 按鈕 ===== */
.st-imageviewer__close {
  position: absolute;
  top: clamp(14px, 2.2vw, 32px);
  right: clamp(14px, 2.2vw, 32px);
  width: 48px;
  height: 48px;
  border: 1px solid var(--st-iv-close-border);
  border-radius: var(--st-iv-radius);
  background: var(--st-iv-close-bg);
  color: var(--st-iv-close-color);
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s var(--st-iv-ease),
              background 0.18s var(--st-iv-ease),
              color 0.18s var(--st-iv-ease);
}

.st-imageviewer__close:hover,
.st-imageviewer__close:focus {
  background: var(--st-iv-close-bg-hover);
  color: var(--st-iv-close-color);
  transform: scale(1.08);
  outline: none;
}

.st-imageviewer__close:active {
  transform: scale(0.96);
}

/* ===== 底部 zoom 工具列 ===== */
.st-imageviewer__toolbar {
  position: absolute;
  bottom: clamp(18px, 3vw, 36px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--st-iv-toolbar-bg);
  border: 1px solid var(--st-iv-toolbar-border);
  border-radius: var(--st-iv-radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.st-imageviewer__btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--st-iv-toolbar-color);
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--st-iv-radius);
  transition: background 0.18s var(--st-iv-ease),
              color 0.18s var(--st-iv-ease);
}

.st-imageviewer__btn:hover,
.st-imageviewer__btn:focus {
  background: rgba(200, 164, 92, 0.18);
  color: var(--st-iv-toolbar-color-hover);
  outline: none;
}

.st-imageviewer__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.st-imageviewer__scale {
  min-width: 60px;
  text-align: center;
  color: var(--st-iv-toolbar-color);
  font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0 6px;
}

/* ===== 可放大的 img 提示游標 ===== */
.st-imageviewer-target {
  cursor: zoom-in;
}

/* ===== RWD ===== */
@media (max-width: 575.98px) {
  .st-imageviewer__close { width: 42px; height: 42px; font-size: 20px; }
  .st-imageviewer__btn { width: 36px; height: 36px; font-size: 20px; }
  .st-imageviewer__scale { min-width: 50px; font-size: 12px; }
  .st-imageviewer__img { max-width: 96vw; max-height: 80vh; }
}
