.block-product-image__layer-image-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  padding: var(--padding);
  overflow: hidden;
}

.block-product-image__layer-wrapper theme-product-form {
  padding: 15px;
}

.block-product-image__image-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--aspect-ratio);
  overflow: hidden;
  background-color: rgb(243 243 243 / 100%);
  border-radius: var(--border-radius);
}

.block-product-image__image-wrapper > svg {
  width: 100%;
  height: 100%;
}

.block-product-image__image-wrapper > .block-product-image__image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: var(--fit-type);
  transition: 1s;
}

.block-product-image__image-wrapper
  > .block-product-image__image:nth-of-type(1) {
  opacity: 1;
}

.block-product-image__image-wrapper
  > .block-product-image__image:nth-of-type(2) {
  opacity: 0;
}

/* carousel 容器 - 桌面端保持和原来一样叠放 */
.block-product-image__carousel {
  position: absolute;
  inset: 0;
}

.block-product-image__carousel .block-product-image__image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: var(--fit-type);
  transition: 1s;
}

.block-product-image__carousel .block-product-image__carousel-item:nth-child(1) .block-product-image__image {
  opacity: 1;
}

.block-product-image__carousel .block-product-image__carousel-item:nth-child(2) .block-product-image__image {
  opacity: 0;
}

.block-product-image__carousel .block-product-image__carousel-item {
  position: absolute;
  inset: 0;
}

/* 指示器圆点 - 默认隐藏 */
.block-product-image__dots {
  display: none;
}

/* 遮罩层 */
.block-product-image__layer-wrapper {
  position: absolute;
  inset: 0;
}

/* 桌面端 hover 切换 */
@media (min-width: 960px) {
  .block-product-image__layer-image-wrapper.desktop-hover:hover
    .block-product-image__image:nth-of-type(1) {
    opacity: 0;
  }

  .block-product-image__layer-image-wrapper.desktop-hover:hover
    .block-product-image__image:nth-of-type(2) {
    opacity: 1;
  }

  .block-product-image__layer-image-wrapper.desktop-hover:hover
    .block-product-image__carousel .block-product-image__carousel-item:nth-child(1) .block-product-image__image {
    opacity: 0;
  }

  .block-product-image__layer-image-wrapper.desktop-hover:hover
    .block-product-image__carousel .block-product-image__carousel-item:nth-child(2) .block-product-image__image {
    opacity: 1;
  }
}

/* 移动端 carousel 滑动 */
@media (max-width: 959px) {
  .block-product-image__layer-wrapper {
    pointer-events: none;
  }

  .block-product-image__layer-wrapper .block-product-card__layer {
    pointer-events: none;
  }

  .block-product-image__layer-wrapper .block-product-card__layer * {
    pointer-events: auto;
  }

  .block-product-image__carousel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .block-product-image__carousel::-webkit-scrollbar {
    display: none;
  }

  .block-product-image__carousel .block-product-image__carousel-item {
    position: relative;
    min-width: 100%;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .block-product-image__carousel .block-product-image__carousel-item:nth-child(1) .block-product-image__image,
  .block-product-image__carousel .block-product-image__carousel-item:nth-child(2) .block-product-image__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
  }

  .block-product-image__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
  }

  .block-product-image__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.6);
    transition: background-color 0.3s;
  }

  .block-product-image__dot--active {
    background-color: rgba(255, 255, 255, 1);
  }

  .block-product-image__layer-wrapper theme-product-form {
    padding: 10px;
  }
}
