/* ============================================================
 * 轮播图 (加入尺寸自适应)
 *
 * 自适应用法（在自己的容器或主题 CSS 里覆盖这几个变量即可）：
 *
 *   .slider { --slider-ratio: 21 / 9; }        // 改宽高比
 *   .sidebar .slider { --slider-ratio: 4 / 3; } // 侧边栏更高一点
 *   .slider { --slider-max-height: 300px; }     // 限高
 *
 * 原理：宽度始终 100% 跟着容器；高度由 aspect-ratio 推算，
 *       再用 min-height / max-height 夹住上下限。
 *       图片用 object-fit: cover 填充，永远不会被拉伸变形，
 *       比例变化只会改变"裁掉多少"，不会改变形状。
 
 底部标题（胶囊） 隐藏了
 * ============================================================ */

.slider {
  /* ---- 可调变量 ---- */
  --slider-ratio: 16 / 9;          /* 宽高比，原版 1200×450 即 8:3 */
  --slider-min-height: 160px;     /* 高度下限：极窄容器时兜底 */
  --slider-max-height: 450px;     /* 高度上限：超宽屏时不再变高 */

  position: relative;
  width: 100%;
  height: 450px;                  /* 不支持 aspect-ratio 的旧浏览器兜底：退回原版固定 450px */
  overflow: hidden;
  border-radius:12px;
}

/* 现代浏览器：高度 = 宽度 ÷ 比例，并夹在 [min, max] 之间 */
@supports (aspect-ratio: 1 / 1) {
  .slider {
    height: auto;
    aspect-ratio: var(--slider-ratio);
    min-height: var(--slider-min-height);
    max-height: var(--slider-max-height);
  }
}

/* 断点：屏幕越窄，比例越高（避免横幅被压成一条） */
@media (max-width: 1024px) {
  .slider {
    --slider-ratio: 16 / 9;
    --slider-max-height: 380px;
  }
}

@media (max-width: 640px) {
  .slider {
    --slider-ratio: 3 / 2;
    --slider-max-height: 300px;
    --slider-min-height: 150px;
  }
}

.slide-track {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ---------- 单张幻灯片：淡入淡出 ---------- */
.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.slide.hidden {
  pointer-events: none;
}

.slide img {
  display: block;          /* 去掉 inline 图片的基线间隙 */
  width: 100%;
  height: 100%;
  object-fit: cover;       /* 关键：等比缩放后裁剪填充，绝不拉伸变形 */
  object-position: center; /* 裁剪重心，可改成 top / bottom 保留画面重点 */
  position: relative;
  z-index: 1;
}

/* ---------- 悬停时的暗色蒙层 ---------- */
.slide::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  opacity: 0;
  z-index: 2;
  transition: opacity 0.3s;
}

.slide:hover::before {
  opacity: 1;
}

/* ---------- 底部标题（胶囊） ---------- */
.description {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  padding: 4px 10px;
  background: rgb(255, 255, 255, 0.5);
  border: 1px solid rgb(255 255 255 / 50%);
  backdrop-filter: blur(10px);
  border-radius: 80px;
  color: #0d1a4e;
  z-index: 2;
  white-space: nowrap;
  transition: opacity 0.3s ease;
  display: none;
}

.slide:hover .description {
  opacity: 0;
}

/* ---------- 触摸按钮（悬停时出现） ---------- */
.many-button {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.many-button button {
  background-color: rgb(255, 255, 255, 0.21);
  color: white;
  font-size: 13px;
  border: 1px solid rgb(255 255 255 / 50%);
  backdrop-filter: blur(12px);
  padding: 5px 15px;
  border-radius: 50px;
  cursor: pointer;
  display: none;
  z-index: 3;
  transition: background-color 0.3s;
}

.slide:hover button {
  display: block;
}

.many-button button:hover {
  background-color: #52525224;
  backdrop-filter: blur(5px);
}

/* ---------- 左右箭头（悬停时滑入） ---------- */
.slider .arrow {
  position: absolute;
  top: 50%;
  user-select: none;
  transform: translateY(-50%);
  background-color: rgb(207 207 207 / 50%);
  border: 1px solid rgb(255 255 255 / 50%);
  color: white;
  padding: 15px 10px;
  cursor: pointer;
  z-index: 50;
  border-radius: 8px;
  width: 30px;
  text-align: center;
  backdrop-filter: blur(12px);
}

.arrow.left {
  left: -30px;
  transition: left 0.3s ease;
}

.arrow.right {
  right: -30px;
  transition: right 0.3s ease;
}

.slider:hover .arrow.left {
  left: 10px;
}

.slider:hover .arrow.right {
  right: 10px;
}

/* ---------- 指示点 ---------- */
.slider-indicators {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
}

.slider-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: rgba(153, 153, 153, 0.7);
  border-radius: 50%;
  margin: 0 3px;
  cursor: pointer;
  transition: background-color 0.3s ease, width 0.3s ease, height 0.3s ease;
  backdrop-filter: blur(5px);
}

.slider-indicator.active {
  width: 15px;
  height: 7px;
  border-radius: 100px;
  background-color: rgb(70, 103, 240);
  backdrop-filter: blur(5px);
}
