@layer component {
  theme-carousel {
    position: relative;
    display: block;
  }

  theme-carousel .carousel__track {
    position: relative;
    display: flex;
    flex-wrap: inherit;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* 支持通过 CSS 变量控制高度，默认为 auto */
    height: var(--carousel-height, auto);
    min-height: var(--carousel-min-height, auto);
    max-height: var(--carousel-max-height, none);
  }

  /* 移动端高度控制 */
  @media (max-width: 959px) {
    theme-carousel .carousel__track {
      height: var(--carousel-mobile-height, var(--carousel-height, auto));
      min-height: var(--carousel-mobile-min-height, var(--carousel-min-height, auto));
      max-height: var(--carousel-mobile-max-height, var(--carousel-max-height, none));
    }
  }

  theme-carousel .carousel__track::-webkit-scrollbar {
    display: none;
  }

  theme-carousel .carousel__track > * {
    flex-shrink: 0;
    list-style: none;
    scroll-snap-align: start;
  }
  theme-carousel[data-direction="vertical"] .carousel__track {
    flex-direction: column;
    overflow-x: unset;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
  }
}
