/**
 * 关于页面 - 图片轮播样式（About Gallery）
 * 一行 4 个，显示两行，逐列连续滚动循环播放
 * 文件修改时间：2026-09-02
 */

.cen-gallery {
  position: relative;
}

.cen-gallery__viewport {
  overflow: hidden;
  border-radius: 16px;
}

.cen-gallery__track {
  display: flex;
  gap: 16px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* 每一列：上下两张图（一行 4 列 × 两行） */
.cen-gallery__col {
  flex: 0 0 calc((100% - 48px) / 4); /* 4 列，扣除 3 个间距 */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cen-gallery__item {
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #f3f4f6;
}

.cen-gallery__item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.cen-gallery__item:hover img {
  transform: scale(1.05);
}

/* 左右切换按钮 */
.cen-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  color: #1b1b1b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
  z-index: 2;
}

.cen-gallery__nav:hover {
  background: #f97316;
  color: #fff;
}

.cen-gallery__nav svg {
  width: 20px;
  height: 20px;
}

.cen-gallery__nav--prev {
  left: -60px;
}

.cen-gallery__nav--next {
  right: -60px;
}

/* 视口两侧空间不足时，按钮移到轮播下方，避免遮挡图片 */
@media (max-width: 1319px) {
  .cen-gallery__nav {
    top: auto;
    bottom: -60px;
    transform: none;
  }

  .cen-gallery__nav--prev {
    left: 0;
  }

  .cen-gallery__nav--next {
    right: 0;
  }
}

/* 灯箱 */
.cen-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: rgba(0, 0, 0, 0.85);
  padding: 48px;
}

.cen-lightbox[hidden] {
  display: none;
}

.cen-lightbox__img {
  min-width: 0;
  max-width: calc(100vw - 260px); /* 预留两侧按钮与间距，确保图片完全收在灯箱内 */
  max-height: 84vh;
  border-radius: 12px;
  object-fit: contain;
}

@media (max-width: 640px) {
  .cen-lightbox__img {
    max-width: calc(100vw - 120px);
  }
}

.cen-lightbox__close {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease;
}

.cen-lightbox__close:hover {
  background: #f97316;
}

.cen-lightbox__close svg {
  width: 22px;
  height: 22px;
}

.cen-lightbox__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease;
}

.cen-lightbox__nav:hover {
  background: #f97316;
}

.cen-lightbox__nav svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 640px) {
  .cen-lightbox {
    padding: 16px;
    gap: 8px;
  }

  .cen-lightbox__nav {
    width: 38px;
    height: 38px;
  }
}

/* 移动端：一行 2 列 */
@media (max-width: 640px) {
  .cen-gallery__track {
    gap: 12px;
  }

  .cen-gallery__col {
    flex: 0 0 calc((100% - 12px) / 2);
    gap: 12px;
  }
}
