/* ============================================================
   Gallery CSS — Three.js 主页 HTML Overlay 样式
   只负责 canvas 之上的 UI 层，不再有 CSS 3D 相关代码
   ============================================================ */

/* ─────────────────────────────────────────────
   CSS 变量
───────────────────────────────────────────── */
:root {
  --accent: #ff6b9d;
  --accent-light: #ffb3c6;
  --accent-pale: rgba(255, 107, 157, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-blur: blur(16px);
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --shadow-glow: 0 0 30px rgba(255, 107, 157, 0.25);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────
   全局重置
───────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'PingFang SC',
               'Microsoft YaHei', sans-serif;
  background: #0d0816;
  color: var(--text-primary);
  user-select: none;
  -webkit-user-select: none;
}

/* ─────────────────────────────────────────────
   Three.js Canvas（全屏底层）
───────────────────────────────────────────── */
#gallery-canvas {
  position: fixed;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  touch-action: none;
}

/* ─────────────────────────────────────────────
   Loading 屏幕
───────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff8ec 0%, #ffe9d6 45%, #ffd9e0 100%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 太阳 SVG 加载动画（呼应"阳光明媚"） */
.loading-sun {
  width: 78px;
  height: 78px;
  margin-bottom: 28px;
  animation: sunSpin 9s linear infinite, sunPulse 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(255, 181, 71, 0.55));
}

@keyframes sunSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes sunPulse {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(255, 181, 71, 0.45)); }
  50%      { filter: drop-shadow(0 0 26px rgba(255, 181, 71, 0.75)); }
}


#loading-screen .loading-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #4a3a2a;
  margin-bottom: 6px;
  font-family: 'Dancing Script', cursive;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

#loading-screen .loading-subtitle {
  font-size: 0.82rem;
  color: #8a7460;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

#loading-screen .progress-track {
  width: 200px;
  height: 3px;
  background: rgba(120, 80, 60, 0.12);
  border-radius: 99px;
  overflow: hidden;
}

#loading-screen #progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffb547, var(--accent));
  border-radius: 99px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(255, 181, 71, 0.6);
}

#loading-screen #progress-text {
  margin-top: 10px;
  font-size: 0.75rem;
  color: #8a7460;
  letter-spacing: 0.06em;
}


/* ─────────────────────────────────────────────
   右上角操作按钮
───────────────────────────────────────────── */
#top-actions {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  gap: 10px;
  animation: slideInRight 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.5s;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(32px) scale(0.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.action-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.action-btn:hover {
  background: var(--accent-pale);
  border-color: var(--accent);
  color: var(--accent-light);
  transform: scale(1.1);
  box-shadow: 0 0 18px rgba(255, 107, 157, 0.3);
}

.action-btn:active {
  transform: scale(0.95);
}

/* ─────────────────────────────────────────────
   导航按钮（左上角紧凑图标条，不遮挡照片）
───────────────────────────────────────────── */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-32px) scale(0.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

#bottom-nav {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 200;
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: slideInLeft 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.6s;
  opacity: 0.55;
  transition: opacity 0.25s ease;
}
#bottom-nav:hover { opacity: 1; }

.nav-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.nav-btn .nav-icon {
  font-size: 1rem;
  line-height: 1;
}

/* 隐藏文字标签（标签作为 title 出现在 hover tooltip） */
.nav-btn > span:not(.nav-icon) {
  display: none;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--accent-light);
  background: var(--accent-pale);
}

.nav-btn.active {
  box-shadow: inset 0 0 0 1px rgba(255, 107, 157, 0.4);
}

/* ─────────────────────────────────────────────
   照片详情面板
───────────────────────────────────────────── */
#photo-detail-panel {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#photo-detail-panel.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* 背景遮罩 */
.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 18, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 内容容器 */
.detail-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: detailIn 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

#photo-detail-panel.active .detail-content {
  animation: detailIn 0.45s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes detailIn {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* 大图 */
#detail-img {
  max-width: min(80vw, 640px);
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 0 60px rgba(255, 107, 157, 0.15);
  display: block;
}

/* 操作栏（关闭 + 左右切换） */
.detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.detail-btn:hover {
  background: var(--accent-pale);
  border-color: var(--accent);
  color: var(--accent-light);
  transform: scale(1.1);
}

#detail-close {
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
}

/* ─────────────────────────────────────────────
   提示文字（中央漂浮）
───────────────────────────────────────────── */
#hint-text {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  pointer-events: none;
  opacity: 0;
  animation: hintFade 6s ease-in-out 3.5s forwards;
  white-space: nowrap;
}

@keyframes hintFade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  15%  { opacity: 0.7; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 0.7; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ─────────────────────────────────────────────
   响应式 — 移动端
───────────────────────────────────────────── */
@media (max-width: 640px) {
#top-actions {
    top: 12px;
    right: 12px;
  }

  .action-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  #bottom-nav {
    top: 12px;
    left: 12px;
    padding: 4px 6px;
    gap: 6px;
  }

  .nav-btn {
    width: 32px;
    height: 32px;
  }
  .nav-btn .nav-icon {
    font-size: 0.9rem;
  }

  #detail-img {
    max-width: 94vw;
    max-height: 65vh;
  }
}

/* ─────────────────────────────────────────────
   WebGL 不支持时的降级提示
───────────────────────────────────────────── */
#webgl-fallback {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #0d0816;
  color: var(--text-primary);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 40px;
}

#webgl-fallback.show { display: flex; }

#webgl-fallback h2 {
  font-size: 1.3rem;
  color: var(--accent-light);
}

#webgl-fallback p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.6;
}

/* ─────────────────────────────────────────────
   可访问性：减少动画偏好
───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── FX 控制面板 ─── */
#fx-control-panel {
  position: fixed;
  left: 20px; bottom: 24px;
  z-index: 220;
  display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 10px;
}
#fx-control-panel .fx-toggle {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  color: var(--text-primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: var(--transition);
}
#fx-control-panel .fx-toggle:hover {
  background: var(--accent-pale); border-color: var(--accent); color: var(--accent-light);
  transform: rotate(45deg) scale(1.05);
}
#fx-control-panel .fx-panel {
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px 16px; min-width: 250px;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow), 0 12px 40px rgba(0,0,0,0.5);
  transform-origin: bottom left;
  transition: opacity 0.3s, transform 0.3s;
}
#fx-control-panel.collapsed .fx-panel {
  opacity: 0; transform: scale(0.85) translateY(8px); pointer-events: none;
}
.fx-section { display: flex; flex-direction: column; gap: 6px; }
.fx-title { font-size: 0.7rem; color: var(--text-secondary); letter-spacing: 0.06em; }
.fx-title kbd {
  font-size: 0.62rem; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,0.08); margin-left: 4px;
}
.fx-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 9px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: rgba(255,255,255,0.04);
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  min-width: 44px;
}
.fx-btn .fx-ico { font-size: 1.05rem; line-height: 1; }
.fx-btn .fx-lab { font-size: 0.62rem; }
.fx-btn:hover { background: var(--accent-pale); color: var(--text-primary); }
.fx-btn.active {
  background: var(--accent-pale); border-color: var(--accent);
  color: var(--accent-light); box-shadow: 0 0 12px rgba(255,107,157,0.25);
}
.fx-chip {
  padding: 6px 11px; border-radius: 99px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,0.04);
  color: var(--text-secondary); font-size: 0.72rem; cursor: pointer;
  transition: var(--transition);
}
.fx-chip:hover { color: var(--text-primary); border-color: var(--accent); }
.fx-chip.active {
  background: var(--accent-pale); border-color: var(--accent); color: var(--accent-light);
}
@media (max-width: 640px) {
  #fx-control-panel { left: 12px; bottom: 16px; }
  #fx-control-panel .fx-panel { min-width: 0; padding: 10px 12px; }
}

/* ============================================================
   声音系统:音乐按钮态 + 控制面板「声音」分节
   ============================================================ */

/* 音乐按钮:开启时强调色高亮 */
.action-btn.audio-on {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-pale);
}

/* 无素材:降低存在感,提示不可用 */
.action-btn.audio-disabled {
  opacity: 0.4;
}

/* 有素材但未解锁:柔和脉冲,提示"点我出声" */
.action-btn.audio-hint {
  animation: audio-pulse 2s ease-in-out infinite;
}
@keyframes audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,157,0.0); }
  50%      { box-shadow: 0 0 14px 2px rgba(255,107,157,0.45); }
}
@media (prefers-reduced-motion: reduce) {
  .action-btn.audio-hint { animation: none; }
}

/* 面板「声音」分节 */
.fx-volume-row { align-items: center; gap: 8px; }
.fx-vol-ico { font-size: 0.85rem; line-height: 1; }
.fx-volume {
  flex: 1; height: 4px; -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.14); border-radius: 99px; cursor: pointer;
  accent-color: var(--accent);
}
.fx-volume::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px rgba(255,107,157,0.5);
}
.fx-volume::-moz-range-thumb {
  width: 13px; height: 13px; border: none; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px rgba(255,107,157,0.5);
}
.fx-audio-note {
  font-size: 0.6rem; color: var(--text-secondary); opacity: 0.75;
  min-height: 0.7em; line-height: 1.3;
}
.fx-audio-note:empty { display: none; }

/* 无素材:整节灰禁(滑块与开关失效但仍显示提示) */
.fx-section.fx-disabled .fx-chip,
.fx-section.fx-disabled .fx-volume {
  opacity: 0.4; pointer-events: none;
}
