/* ============================================================
   carousel.css —— 积木块：循环轮播图（前景 + 后景）
   ------------------------------------------------------------
   结构：中间一张大图（前景），左右各露出相邻图的一角（后景），
        非当前图缩小 + 降透明度，形成层次；图片统一 object-fit: cover，
        按每张图自己的 focus 值决定显示上/中/下哪一块，绝不变形。
   ============================================================ */

.carousel {
  position: relative;
  user-select: none;
}

.carousel__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 2.95 / 1;
  overflow: hidden;
}

.carousel__track {
  display: flex;
  gap: 14px;
  height: 100%;
  will-change: transform;
}

.carousel__slide {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--c-thumb-bg);
  opacity: 0.48;
  transform: scale(0.93);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease),
    box-shadow 0.45s var(--ease);
  box-shadow: 0 6px 16px rgba(20, 24, 34, 0.1);
}

.carousel__slide.is-active {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 16px 36px rgba(20, 24, 34, 0.2);
  z-index: 2;
}

.carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;         /* 关键：等比裁切，不变形 */
  object-position: 50% 50%;  /* 具体位置由数据的 focus 决定 */
  display: block;
  pointer-events: none;
}

/* —— 左右箭头：贴在视口两侧 —— */
.carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(12, 16, 26, 0.34);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s var(--ease), background-color 0.2s var(--ease);
  backdrop-filter: blur(6px);
  z-index: 4;
}

.carousel:hover .carousel__nav,
.carousel__nav:focus-visible {
  opacity: 1;
}

.carousel__nav:hover {
  background: rgba(12, 16, 26, 0.58);
}

.carousel__nav svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.carousel__nav--prev {
  left: 12px;
}

.carousel__nav--next {
  right: 12px;
}

/* —— 指示点 —— */
.carousel__dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 4;
}

.carousel__dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: width 0.24s var(--ease), background-color 0.24s var(--ease);
}

.carousel__dot.is-active {
  width: 20px;
  background: #fff;
}

.carousel__empty {
  display: grid;
  place-items: center;
  aspect-ratio: 2.95 / 1;
  color: var(--c-text-3);
  font-size: 13px;
  background: var(--c-card);
  border: 1px dashed var(--c-line);
  border-radius: var(--radius-m);
}

@media (max-width: 760px) {
  .carousel__viewport {
    aspect-ratio: 1.9 / 1;
  }

  .carousel__nav {
    display: none;
  }
}
