@keyframes carousel-progress {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(0);
  }
}
.carousel-wrapper {
  width: 100%;
  overflow: hidden;
}
.carousel {
  width: 100%;
}
.carousel .button {
  word-break: break-word;
  white-space: normal;
}
.carousel .carousel__track {
  overflow-y: hidden;
  width: 100%;
  height: var(--desktop-height);
}

/* 桌面端使用宽高比时 */
.carousel .carousel__track[style*="--desktop-aspect-ratio"] {
  height: auto;
  aspect-ratio: var(--desktop-aspect-ratio);
}
.carousel__item {
  width: 100%;
  flex-shrink: 0;
}
.carousel__image {
  position: relative;
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  background-color: lightgray;
  background-position: 50% 50%;
  background-size: cover;
  background-repeat: no-repeat;
}
.carousel__image--mobile,
.carousel__image--desktop {
  position: relative;
  z-index: 1;
}
.carousel__image--mobile img,
.carousel__image--mobile svg,
.carousel__image--desktop img,
.carousel__image--desktop svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.carousel__image--mobile {
  display: none;
}
.carousel__image--desktop {
  display: block;
  width: 100%;
  height: 100%;
}
.carousel__image-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background-color: rgb(var(--color-image-background));
  overflow: hidden;
}
.carousel__image-mask {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-color: rgba(
    0,
    0,
    0,
    calc(var(--slideshow-image-mask-opacity) / 100)
  );
  transform: translate(-50%, -50%);
}
.carousel__group {
  position: relative;
  z-index: 3;
  width: auto;
  max-width: min(700px, calc(100% - 40px));
  height: auto;
  display: flex;
  align-self: flex-start;
  flex-shrink: 0;
}
.carousel__group > h2 {
  text-shadow: 0px 2px 2px rgba(0, 0, 0, 0.23);
  width: auto;
  height: auto;
}
.carousel__pager {
  position: absolute;
  inset-block-end: 0;
  inset-inline-start: 50%;
  z-index: 3;
  display: flex;
  gap: 6px;
  align-items: center;
  transform: translate(-50%, 0);
}
.carousel__pager--dots {
  inset-block-end: 20px;
}
.carousel__pager--dot {
  display: block;
  width: 6px;
  height: 6px;
  padding: 0;
  cursor: pointer;
  background-color: #fff;
  border: 0;
  border-radius: 50%;
  opacity: 0.4;
  transition: opacity, width, height, 0.3s;
}
.carousel__pager--dot.is-active {
  width: 10px;
  height: 10px;
  opacity: 1;
}
.carousel__pager--progresses {
  gap: 10px;
}
.carousel__pager--progress {
  display: block;
  width: 120px;
  height: 6px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background-color: rgb(255 255 255 / 50%);
  border: 0;
}
.carousel__pager--progress.is-active {
  opacity: 1;
}
.carousel__pager--progress.is-active .carousel__pager--progress-inner {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #fff;
  animation: carousel-progress var(--slideshow-speed, 0s) linear forwards;
}
.carousel__pager--progress.is-active .carousel__pager--progress-inner-static {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #fff;
}
.carousel__pager--arrows {
  inset-block-end: 0;
  inset-inline: auto 40px;
  width: fit-content;
  transform: translateY(50%);
}
.carousel__pager--arrow {
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  background-color: #fff;
  filter: drop-shadow(0 4px 10px rgb(0 0 0 / 15%));
  border: 0;
  border-radius: 50%;
}
.carousel__pager--arrow[name="previous"] {
  transform: rotate(90deg);
}
.carousel__pager--arrow[name="next"] {
  transform: rotate(-90deg);
}
.carousel__image-text-mask {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  display: block;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
}
.carousel__image-text-mask-deep {
  background: radial-gradient(
    77.64% 77.64% at 50% 50%,
    rgb(0 0 0 / 30%) 59.64%,
    rgb(0 0 0 / 0%) 100%
  );
  filter: blur(120px);
  border-radius: 50%;
}
.carousel__image-text-mask-light {
  background: radial-gradient(
    77.64% 77.64% at 50% 50%,
    rgb(255 255 255 / 30%) 59.64%,
    rgb(255 255 255 / 0%) 100%
  );
  filter: blur(120px);
  border-radius: 50%;
}

@media (max-width: 959px) {
  .carousel .carousel__track {
    height: var(--mobile-height);
    aspect-ratio: var(--mobile-aspect-ratio, 9/16);
    max-width: 100%;
  }
  
  .carousel .carousel__track[style*="--mobile-aspect-ratio"] {
    height: auto;
  }
  
  .carousel__image {
    height: 100%;
  }
  
  .carousel__image--mobile {
    display: block;
    height: 100%;
  }

  .carousel__image--desktop {
    display: none;
  }
  
  .carousel__group {
    width: auto;
    max-width: calc(100% - 32px);
    height: auto;
  }
  
  .carousel__group > h2 {
    width: 100%;
    height: auto;
  }
  
  .carousel__pager--progress {
    width: 60px;
  }

  .carousel__pager--arrows {
    inset-inline: auto 20px;
  }

  .carousel__pager--arrow {
    width: 32px;
    height: 32px;
  }

  .carousel__pager--arrow svg {
    width: 10px;
    height: 10px;
  }
}
