/* ==========================================================================
   Polaris - 纯净沉浸画册视觉系统 (Pure Editorial Dark System)
   ========================================================================== */
:root {
  --bg-deep: #07080b;
  --bg-dock: rgba(14, 18, 27, 0.88);
  --bg-card: rgba(22, 28, 40, 0.6);
  --border-dock: rgba(255, 255, 255, 0.11);
  --border-glow: rgba(244, 114, 182, 0.4);
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-sub: #64748b;
  --accent: #f472b6;
  --dock-h: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "SF Pro Display", "PingFang SC", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* 画廊视图下允许顺畅上下滚动 */
html.view-gallery, body.view-gallery {
  overflow-y: auto !important;
  height: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   主视口与阅读器模式（保持普通自然光标）
   ========================================================================== */
.main-viewport {
  width: 100%;
  height: 100%;
  position: relative;
}

.view-section {
  width: 100%;
  height: 100%;
}

.section-reader {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: default !important; /* 保持系统默认普通箭头光标，不改变样式 */
}

/* 主写真展示画框：占满整屏，仅为底部悬浮 Dock 留出呼吸空间 */
.photo-frame {
  width: 100%;
  height: 100%;
  padding-top: 12px;
  padding-bottom: calc(var(--dock-h) + 24px + var(--safe-bottom));
  padding-left: 12px;
  padding-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  pointer-events: auto;
  cursor: default !important;
}

.photo-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 16px 48px -6px rgba(0, 0, 0, 0.85);
  transition: opacity 0.16s ease, transform 0.18s var(--ease-spring);
  will-change: transform, opacity;
  pointer-events: none; /* 让点击穿透至父级区域统一处理坐标判定，手感一致 */
}

/* ==========================================================================
   统一底部极简微胶囊控制条 (Dock)
   排布：[列表]  [画廊 (图标+文字)]  [页数 / 总页数]  [=====○=====]
   ========================================================================== */
.bottom-dock {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-dock);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-dock);
  border-radius: 9999px;
  padding: 5px 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75);
  width: min(94vw, 480px);
  height: var(--dock-h);
  box-sizing: border-box;
  cursor: default;
}

/* 1. 画廊按钮（仅图标 + "画廊"二字） */
.dock-btn-gallery {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-dock);
  border-radius: 9999px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.dock-btn-gallery:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

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

.dock-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* 2. 画廊与进度栏之间的页数显示 (如 1 / 137) */
.dock-page-counter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.8rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 2px;
}

.dock-page-counter #curPage {
  color: var(--text-main);
  font-weight: 600;
}

.dock-page-counter .sep {
  opacity: 0.35;
  margin: 0 2px;
}

/* 3. 列表按钮（返回写真集列表；左右翻页小箭头已下线，翻页交给中线点击 / 拖拽 / 滑动 / 滑块 / 键盘） */
.dock-btn-list {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-dock);
  border-radius: 9999px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.dock-btn-list:hover {
  background: rgba(244, 114, 182, 0.16);
  border-color: var(--border-glow);
  color: #ffffff;
}

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

/* 4. 进度条滑块 */
.dock-slider-box {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 54px;
  height: 100%;
}

.dock-slider-box input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}

.dock-slider-box input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.7);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.dock-slider-box input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* ==========================================================================
   画廊模式 (Gallery View) - 手机端 2 列纯净排布
   ========================================================================== */
.section-gallery {
  width: 100%;
  min-height: 100%;
  padding-top: 20px;
  padding-bottom: 80px;
  box-sizing: border-box;
}

.gallery-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

/* PC 端多列，手机端 2 列 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  width: 100%;
}

/* 画廊卡片：纯净无遮挡写真，序号独立放在图片底部细条内 */
.gallery-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-dock);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), border-color 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.75);
}

/* 跨页全景卡片：横跨 2 列，默认黄金 3:2 宽幅全景展示 */
.gallery-card.card-spread {
  grid-column: span 2;
}

.gallery-card.card-spread .card-media {
  aspect-ratio: 3 / 2;
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s var(--ease-spring);
}

.gallery-card:hover .card-media img {
  transform: scale(1.04);
}

/* 序号独立在图片下方，绝不遮盖任何像素 */
.card-info {
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.45);
  border-top: 1px solid var(--border-dock);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-page-text {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-weight: 500;
}

.card-click-tip {
  font-size: 0.68rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-card:hover .card-click-tip {
  opacity: 1;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   移动端专业优化
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --dock-h: 42px;
  }

  /* 手机端底部浮动 Dock 适配 (含安全区) */
  .bottom-dock {
    bottom: calc(12px + var(--safe-bottom));
    width: calc(100% - 20px);
    gap: 8px;
    padding: 4px 8px;
  }

  .dock-btn-gallery {
    height: 30px;
    padding: 0 8px;
    font-size: 0.78rem;
    gap: 4px;
  }

  .dock-page-counter {
    font-size: 0.75rem;
    padding: 0 1px;
  }

  .dock-btn-list {
    height: 30px;
    padding: 0 8px;
    font-size: 0.78rem;
    gap: 4px;
  }

  /* 手机端写真画框上下微调 (含安全区) */
  .photo-frame {
    padding-top: 8px;
    padding-bottom: calc(var(--dock-h) + 16px + var(--safe-bottom));
    padding-left: 6px;
    padding-right: 6px;
  }

  /* 手机端画廊：标准 2 列流体瀑布流，间距 8px */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .gallery-wrapper {
    padding: 0 8px;
  }

  .section-gallery {
    padding-top: 12px;
    padding-bottom: calc(70px + var(--safe-bottom));
  }

  .card-info {
    padding: 4px 6px;
  }

  .card-page-text {
    font-size: 0.66rem;
  }
}
