/* ============================================================
   PishPish.cn — 相册轮播 (Photo Carousel)
   主题：绿松石·丝路 — 使用 theme.css 变量
   
   特性：
   - 中间 slide 完全可见，左右相邻 slide 淡化预览
   - 触摸滑动 + 鼠标拖拽 + 箭头 + 圆点指示器
   - 响应式适配（Mobile-first）
   - 复用现有 openLightbox() 函数
   ============================================================ */

/* ─── 轮播容器 ─── */
.photo-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: grab;
  background: var(--color-dark-card, #1A1A2E);
  border-radius: var(--radius-md, 12px);
}

.photo-carousel:active,
.photo-carousel.is-dragging {
  cursor: grabbing;
}

/* ─── 轨道 ─── */
.carousel-track {
  display: flex;
  align-items: center;
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
}

.carousel-track.no-transition {
  transition: none;
}

/* ─── 单张幻灯片 ─── */
.carousel-slide {
  flex: 0 0 70%;
  max-width: 70%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl, 32px) var(--spacing-md, 16px);
  transition: opacity 0.45s ease, filter 0.45s ease;
}

/* 主图（中间激活态） */
.carousel-slide.active {
  opacity: 1;
  filter: none;
  z-index: 2;
}

.carousel-slide.active img {
  transform: scale(1);
}

/* 左侧预览 */
.carousel-slide.prev {
  opacity: 0.38;
  z-index: 1;
}

.carousel-slide.prev img {
  filter: blur(3px);
  transform: scale(0.9);
}

/* 右侧预览 */
.carousel-slide.next {
  opacity: 0.38;
  z-index: 1;
}

.carousel-slide.next img {
  filter: blur(3px);
  transform: scale(0.9);
}

/* ─── 幻灯片内图片 ─── */
.carousel-slide img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  border-radius: var(--radius-sm, 8px);
  transition: transform 0.45s ease, filter 0.45s ease;
  pointer-events: none; /* 防止拖拽触发图片默认行为 */
}

.carousel-slide.active img {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* ─── 说明文字 ─── */
.carousel-caption {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--spacing-sm, 8px) var(--spacing-lg, 24px);
  background: rgba(26, 26, 46, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-on-dark, #FFFFFF);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  border-radius: var(--radius-sm, 8px);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-slide.active .carousel-caption {
  opacity: 1;
}

/* ─── 放大按钮 ─── */
.carousel-expand {
  position: absolute;
  top: 36px;
  right: 36px;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
  opacity: 0;
  font-family: var(--font-body);
}

.carousel-slide.active .carousel-expand {
  opacity: 1;
}

.carousel-expand:hover {
  background: rgba(26, 26, 46, 0.8);
  transform: scale(1.08);
}

/* ─── 导航箭头 ─── */
.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
  opacity: 0.8;
  font-family: var(--font-heading, 'Playfair Display', serif);
}

.carousel-prev { left: 20px; }
.carousel-next { right: 20px; }

.carousel-prev:hover,
.carousel-next:hover {
  background: rgba(255, 255, 255, 0.22);
  opacity: 1;
  transform: translateY(-50%) scale(1.06);
}

.carousel-prev:active,
.carousel-next:active {
  transform: translateY(-50%) scale(0.96);
}

/* 仅一张图时隐藏控件 */
.photo-carousel.single .carousel-prev,
.photo-carousel.single .carousel-next,
.photo-carousel.single .carousel-dots {
  display: none;
}

/* ─── 圆点指示器 ─── */
.carousel-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 10px;
  padding: 6px 16px;
  background: rgba(26, 26, 46, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 20px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.65);
  transform: scale(1.15);
}

.carousel-dot.active {
  background: var(--color-accent, #C9A96E);
  transform: scale(1.2);
}

/* ─── 响应式：平板（768px ~ 991px） ─── */
@media (max-width: 991px) {
  .carousel-slide {
    flex: 0 0 80%;
    max-width: 80%;
    padding: var(--spacing-md, 16px) var(--spacing-sm, 8px);
  }

  .carousel-slide img {
    max-height: 50vh;
  }

  .carousel-prev,
  .carousel-next {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
  }

  .carousel-prev { left: 12px; }
  .carousel-next { right: 12px; }

  .carousel-expand {
    top: 20px;
    right: 20px;
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .carousel-dots {
    bottom: 14px;
    gap: 8px;
  }

  .carousel-dot {
    width: 9px;
    height: 9px;
  }
}

/* ─── 响应式：手机（< 768px） ─── */
@media (max-width: 767px) {
  .carousel-slide {
    flex: 0 0 90%;
    max-width: 90%;
    padding: var(--spacing-sm, 8px) var(--spacing-xs, 4px);
  }

  .carousel-slide img {
    max-height: 42vh;
    border-radius: 4px;
  }

  .carousel-slide.active img {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  }

  .carousel-prev,
  .carousel-next {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .carousel-prev { left: 8px; }
  .carousel-next { right: 8px; }

  .carousel-caption {
    bottom: 28px;
    font-size: 0.75rem;
    padding: 6px 16px;
  }

  .carousel-expand {
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .carousel-dots {
    bottom: 10px;
    gap: 7px;
    padding: 4px 12px;
  }

  .carousel-dot {
    width: 8px;
    height: 8px;
  }
}
