/* 投影片播放器（slides.html） — 獨立於主站 gallery 樣式，沿用 style.css 的色彩變數與字體 */

html.slides-html, body.slides-body {
  height: 100%;
  overflow: hidden;
  background: #000;
}

.player-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: #000;
  color: #f2f2f2;
}

/* 頂列：返回 + 片名 + 頁碼 + 全螢幕 */
.player-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  z-index: 5;
}

.player-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  color: #f2f2f2;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid #3a3a3a;
  border-radius: var(--radius);
  white-space: nowrap;
}

.player-back:hover, .player-back:focus-visible { background: #f2f2f2; color: #000; }

.player-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.player-counter {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: #ccc;
  min-width: 3.6em;
  text-align: center;
}

.player-btn {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #3a3a3a;
  border-radius: var(--radius);
  color: #f2f2f2;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 10px;
}

.player-btn:hover, .player-btn:focus-visible { background: #f2f2f2; color: #000; outline: none; }

/* 舞台：撐滿剩餘空間，16:9 內容用 object-fit:contain 自動信箱化，適應直/橫向 */
.stage-area {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #000;
}

.slide-swiper, .slide-swiper .swiper-wrapper {
  width: 100%;
  height: 100%;
}

.slide-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.slide-swiper .swiper-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* 左右點擊翻頁區（桌機用，觸控直接靠 Swiper 滑動） */
.stage-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 64px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 2.2rem;
  cursor: pointer;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.stage-nav:hover, .stage-nav:focus-visible { background: rgba(255,255,255,0.08); outline: none; }
.stage-nav.prev { left: 0; justify-content: flex-start; padding-left: 8px; }
.stage-nav.next { right: 0; justify-content: flex-end; padding-right: 8px; }

@media (max-width: 640px) {
  .stage-nav { display: none; } /* 手機用滑動即可，避免誤觸 */
}

/* 縮圖列 */
.thumb-strip {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  background: #111;
  border-top: 1px solid #2a2a2a;
  -webkit-overflow-scrolling: touch;
}

.thumb-strip img {
  height: 52px;
  width: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 2px;
  border: 2px solid transparent;
  opacity: 0.55;
  cursor: pointer;
  flex: 0 0 auto;
}

.thumb-strip img.active {
  opacity: 1;
  border-color: #f2f2f2;
}

@media (max-width: 480px) {
  .thumb-strip { padding: 6px 8px; gap: 4px; }
  .thumb-strip img { height: 40px; }
  .player-title { display: none; } /* 窄螢幕優先留給返回鍵與頁碼 */
}

/* 全螢幕 / 沉浸模式 fallback（iOS Safari 不支援任意元素 Fullscreen API 時使用） */
body.immersive-fallback .player-topbar,
body.immersive-fallback .thumb-strip {
  display: none;
}

body.immersive-fallback .stage-area {
  position: fixed;
  inset: 0;
  z-index: 999;
}

.player-page:fullscreen .stage-area,
.player-page:-webkit-full-screen .stage-area {
  background: #000;
}

/* 找不到 deck 時的錯誤訊息 */
.player-error {
  color: #f2f2f2;
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

.player-error a { color: #9a9a9a; }
