@import '../../mixins';

:root,
page {
  --pp-swipe-paddingLeft: 0;
  --pp-swipe-paddingRight: 0;
  --pp-swipe-radius: 0;

  --pp-swipe-overflow: none;
  --pp-swipe-width: 80%;
  --pp-swipe-item-opacity: 1;

  --pp-swipe-item-transform: scale(0.85);
  --pp-swipe-item-gutter: 20%;
  --pp-swipe-item-margin: 20rpx;

  --pp-swipe-margin: 60rpx;

  --pp-swipe-position-bottom: 0;

  --pp-swipe-dot-color: var(--pp-color-white);
  --pp-swipe-dot-active-color: var(--pp-swipe-dot-color);
  --pp-swipe-dot-size: 12rpx;
  --pp-swipe-dot-gutter: 20rpx;
  --pp-swipe-position-top: var(--pp-swipe-dot-gutter);
  --pp-swipe-min-height: 416rpx;

  --pp-swipe-padding-top: 0rpx;
  --pp-swipe-padding-bottom: 0rpx;

  --pp-swipe-background-color: transparent;
}

.swipe-wrap {
  position: relative;
  width: 100%;
  min-height: var(--pp-swipe-min-height);
  box-sizing: content-box;
  padding-bottom: var(--pp-swipe-position-bottom);

  &.swipe-hidden {
    .swiper {
      left: 0;
      right: 0;
      margin: auto;
      width: var(--pp-swipe-width);
      height: calc(100% + var(--pp-swipe-position-bottom) - 2rpx);
      box-shadow: var(--pp-swipe-box-shadow);
      border-radius: var(--pp-swipe-radius);
      overflow: hidden;
      -webkit-backface-visibility: hidden;
      -webkit-transform: translate3d(0, 0, 0);
      background-color: var(--pp-swipe-background-color);
      .swipe-item {
        .item-image-box {
          padding-top: 0;
          padding-bottom: 0;
        }
        .swipe-content {
          position: relative;
          width: 100%;
          height: 100%;
          margin: 0;
          box-shadow: none;
          border-radius: initial;
          overflow: initial;
        }
      }
    }
  }

  .swiper {
    position: absolute;
    width: 100%;
    overflow: var(--pp-swipe-overflow);
    box-sizing: content-box;

    .swipe-item {
      overflow: visible;
      position: relative;
      box-sizing: content-box;
      height: 100%;
      z-index: 22;

      .item-image-box {
        width: 100%;
        height: 100%;
        padding-top: var(--pp-swipe-padding-top);
        padding-bottom: var(--pp-swipe-padding-bottom);
        box-sizing: border-box;
      }

      .swipe-content {
        width: 100%;
        height: 100%;
        padding-bottom: var(--pp-swipe-position-bottom);
        box-sizing: border-box;
        transition: all 0.5s ease-out;
        will-change: transform;
        box-shadow: var(--pp-swipe-box-shadow);
        border-radius: var(--pp-swipe-radius);
        overflow: hidden;

        &-goods {
          display: flex;
          justify-items: center;
          align-items: center;
          height: auto;
          border-radius: var(--pp-swipe-radius);
          box-shadow: var(--pp-swipe-box-shadow);
          overflow: hidden;
        }
      }

      .image {
        width: 100%;
        height: 100%;
      }

      .goods {
        display: block;
        width: 100%;
      }

      .goods-box {
        width: 100%;
        height: 100%;
      }
    }

    &-theme-1 {
      width: 100% !important;
      height: 100%;

      .swipe-item {
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    &-theme-2 {
      height: 100%;
    }

    &-theme-3 {
      height: 100%;

      .swipe-item {
        .swipe-content {
          opacity: var(--pp-swipe-item-opacity);
          transform-origin: 50%;
          transform: scale(0.85) translateX(calc(var(--pp-swipe-item-gutter) * 1.6));
          margin: 0 auto;
        }

        &.active {
          z-index: 99;

          .swipe-content {
            transform: scale(1);
          }
        }

        &.active + .swipe-item {
          .swipe-content {
            transform: scale(0.85)
              translateX(calc(var(--pp-swipe-item-gutter) * -1.6));
          }
        }
      }
    }
  }
}
