
/*轮播图核心功能拆解*/
/*上手就能感受到，这个轮播图把常见的交互都塞进去了。下面按模块说说它具体怎么用。*/

/*自动播放与进度条：默认每4.5秒自动切换到下一张，底部进度条会实时显示当前停留进度。鼠标悬停时自动暂停，移开后从暂停位置继续播放。*/

/*手动切换：左右两侧的箭头按钮可以手动切换上一张/下一张，点击底部的指示点能直接跳转到指定幻灯片，所有切换都有平滑的滑动过渡。*/

/*拖拽滑动：在轮播区域按住鼠标或触摸拖动，内容会跟手移动，松开时根据拖动距离和速度决定切到下一张还是回弹。快速滑动也能触发切换。*/

/*键盘控制：点击轮播区域后，可以用方向键左右切换，空格键播放/暂停，Home和End键跳到第一张或最后一张。*/

/*无限循环与淡入淡出：默认开启无限循环，通过首尾克隆实现无缝衔接。把配置里的effect改成'fade'，就能切换成淡入淡出模式。*/

/*优化建议： 您可以在代码开头的DEFAULTS对象里调整自动播放间隔、过渡时长、拖拽灵敏度等核心参数。另外，每张幻灯片目前用的是渐变色背景，您可以替换成自己的图片或视频，只需把.slide-inner里的背景样式改掉即可。*/

/* ============ 容器 ============ */
  .carousel {
    position: relative;
    width: min(550px, 100%);
    border-radius: 20px;
    overflow: hidden;
    background: #14161d;
    /*box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .8),*/
    /*            0 0 0 1px rgba(255, 255, 255, .06);*/
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: grab;
  }
  .carousel.is-dragging { cursor: grabbing; }
  .carousel:focus-visible {
    box-shadow: 0 0 0 3px rgba(79, 140, 255, .9),
                0 30px 70px -20px rgba(0, 0, 0, .8);
  }

  /* ============ 视口 & 轨道 ============ */
  .carousel-viewport {
    overflow: hidden;
    border-radius: inherit;
    touch-action: pan-y;   /* 横滑交给 JS，纵向留给页面滚动 */
  }

  .carousel-track {
    display: flex;
    will-change: transform;
  }

  .carousel-slide {
    flex: 0 0 100%;
    min-width: 100%;
    position: relative;
  }

  /* ============ 幻灯片内容 ============ */
  .slide-inner {
    position: relative;
    aspect-ratio: 18 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /*padding: clamp(22px, 5vw, 56px);*/
    background: linear-gradient(135deg, var(--c1), var(--c2));
    overflow: hidden;
  }
  .slide-inner::after {
    content: "";
    position: absolute;
    width: 62%;
    aspect-ratio: 1;
    right: -16%;
    top: -32%;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    filter: blur(12px);
    pointer-events: none;
  }
  .slide-inner h2 {
    margin: 0 0 10px;
    font-size: clamp(28px, 5vw, 52px);
    line-height: 1.08;
    letter-spacing: -.02em;
    text-shadow: 0 2px 24px rgba(0, 0, 0, .18);
  }
  .slide-inner p {
    margin: 0;
    font-size: clamp(13px, 1.6vw, 17px);
    opacity: .93;
    max-width: 46ch;
    line-height: 1.6;
  }

  /* ============ 淡入淡出模式 ============ */
  .carousel.effect-fade .carousel-track { display: block; position: relative; }
  .carousel.effect-fade .carousel-slide + .carousel-slide {
    position: absolute;
    inset: 0;
  }

  /* ============ 左右箭头 ============ */
  .carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity .3s ease, background .2s ease, transform .2s ease;
  }
  .carousel:hover .carousel-btn,
  .carousel:focus-within .carousel-btn { opacity: 1; }
  .carousel-btn:hover { background: rgba(0, 0, 0, .62); }
  .carousel-btn:active { transform: translateY(-50%) scale(.9); }
  .carousel-btn.prev { left: 14px; }
  .carousel-btn.next { right: 14px; }
  .carousel-btn svg { width: 20px; height: 20px; }

  @media (hover: none) {
    .carousel-btn { opacity: 1; }
  }

  /* ============ 指示点 ============ */
  .carousel-dots {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .carousel-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 99px;
    background: rgba(255, 255, 255, .45);
    cursor: pointer;
    transition: width .35s cubic-bezier(.22,.61,.36,1),
                background .3s ease;
  }
  .carousel-dot:hover { background: rgba(255, 255, 255, .75); }
  .carousel-dot.active {
    width: 26px;
    background: #fff;
  }

  /* ============ 进度条 ============ */
  .carousel-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11;
    height: 3px;
    background: rgba(255, 255, 255, .14);
    pointer-events: none;
  }
  .carousel-progress-bar {
    height: 100%;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: linear-gradient(90deg, #4f8cff, #a855f7);
    will-change: transform;
  }

  .hint {
    margin-top: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, .4);
    text-align: center;
    line-height: 1.8;
  }
  .hint kbd {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .14);
    font-family: inherit;
    font-size: 12px;
  }
  .slide-img{
    margin: 0;
    /*height: 100%;*/
  }
  .slide-img img{
    height: auto;
    width: 500px;
  }