/* 🚧 WIP 🚧: BEM naming convention and file organization cleanup need to be completed for these styles */
.cpap__product-carousel {
  margin: 120px 0 60px;
  overflow: hidden;

  @media (max-width: 992px) {
    margin: 60px 0 60px;
  }

  .cpap__product-carousel__header-container {
    text-align: center;
    max-width: 770px;
    margin: 0 auto;
    margin-bottom: 24px;
  }

  .cpap__product-carousel__header-title {
    color: var(--cpap-primary-soft-black);
  }

  .cpap__product-carousel__container {
    overflow: hidden;
  }

  .price-row {
    * {
      font-size: 14px !important;
      line-height: 17px !important;
      color: var(--cpap-primary-soft-black);
    }
    .price__sale {
      .price-item {
        font: var(--cpap-typography-font-s-bold);
      }
    }
  }

  .cpap__product-carousel__item {
    padding: 0 18px;
    .cpap__product-carousel__item-container {
      display: block;
      border-radius: 16px;
      transition: background 0.2s;
      padding: 50px 24px 24px 24px;
      @media (max-width: 768px) {
        padding: 50px 16px 31px 16px;
      }
      &:hover {
        @media (min-width: 768.5px) {
          box-shadow: 0px -4px 66px rgba(0, 0, 0, 0.08);

          .cpap__product-carousel__image-container {
            .cpap__product-carousel__image {
              animation: cpap-slide-up 4s infinite 1s;
            }
          }
          .cpap__product-carousel__content {
            .cpap__product-carousel__buy-button-container {
              .product-form__submit {
                opacity: 1;
                visibility: visible;
              }
            }
          }
        }
      }
      &:active {
        box-shadow: 0px -4px 66px rgba(0, 0, 0, 0.08);

        .cpap__product-carousel__image-container {
          .cpap__product-carousel__image {
            animation: cpap-slide-up 4s infinite 1s;
          }
        }
        .cpap__product-carousel__content {
          .cpap__product-carousel__buy-button-container {
            .product-form__submit {
              opacity: 1;
              visibility: visible;
            }
          }
        }
      }
      .cpap__product-carousel__image-container {
        max-width: 233px;
        margin: 0 auto;
        margin-bottom: 20px;
        @media (max-width: 768px) {
          margin-bottom: 30px;
        }
        .cpap__product-carousel__image {
          background-repeat: no-repeat;
          background-position: center;
          background-size: cover;
          padding-top: calc((174 / 233) * 100%);
          transition: all 0.5s;
          mix-blend-mode: multiply;
        }
      }
      .cpap__product-carousel__vendor {
        font: var(--cpap-typography-font-s-bold);
        color: var(--cpap-text-text-gray);
        margin-bottom: 8px;
      }
      .cpap__product-carousel__content {
        .cpap__product-carousel__vendor {
          font: var(--cpap-typography-font-s-bold);
          color: var(--cpap-text-text-gray);
          margin-bottom: 8px;
        }
        p {
          font: var(--cpap-typography-font-s-bold);
          color: var(--cpap-primary-soft-black);
          margin-bottom: 8px;
        }
        .price-box {
          span,
          .price {
            font: var(--cpap-typography-font-s-bold);
          }
          * {
            font-size: 14px !important;
            line-height: 17px !important;
          }
        }
        .cpap__product-carousel__buy-button-container {
          margin-top: 16px;
          @media (max-width: 768px) {
            display: none !important;
          }
          .product-form__submit {
            background: none;
            opacity: 0;
            visibility: hidden;
            color: var(--cpap-primary-soft-black);
            text-align: center;
            width: 100%;
            &:hover {
              @media (min-width: 768.5px) {
                background: var(--cpap-overlay-utility-orange);
              }
            }
            &:active {
              background: var(--cpap-overlay-utility-orange);
            }
            span {
              display: block;
            }
          }
        }
      }
    }
  }

  &.cpap__product-carousel--gray-background {
    background: var(--cpap-primary-beige);
    margin: 0;
    padding: 120px 0 60px;
    @media (max-width: 992px) {
      padding: 60px 0 60px;
    }
    .cpap__product-carousel__item {
      .cpap__product-carousel__item-container {
        @media (max-width: 768px) {
          background: var(--cpap-primary-white);
        }

        .cpap__product-carousel__image-container {
          background-color: var(--cpap-primary-beige);
          background-repeat: no-repeat;
          background-position: center;
          background-size: cover;

          .cpap__product-carousel__image {
            @media (max-width: 768px) {
              mix-blend-mode: normal;
              background-color: var(--cpap-primary-white);
            }
          }
        }

        &:hover {
          @media (min-width: 768.5px) {
            background: var(--cpap-primary-white);

            .cpap__product-carousel__image-container {
              background: var(--cpap-primary-white);
            }
          }
        }

        &:active {
          background: var(--cpap-primary-white);

          .cpap__product-carousel__image-container {
            background: var(--cpap-primary-white);
          }
        }
      }
    }
  }
  .cpap__product-carousel__carousel {
    margin: 0 -16px;
    position: relative;
    &.is-active {
      overflow: initial;
      .cpap__product-carousel__item {
        opacity: 0 !important;
        &.swiper-slide-next {
          opacity: 1 !important;
          & + .cpap__product-carousel__item {
            opacity: 1 !important;
            & + .cpap__product-carousel__item {
              opacity: 1 !important;
            }
          }
        }
      }
    }
    @media (max-width: 768px) {
      margin: 0 -28px;
      padding-right: 77px;
      overflow: initial;
      padding-bottom: 26px;
      padding-left: 20px;
    }
    .cpap__product-carousel__item {
      padding: 0 16px;

      @media (max-width: 768px) {
        padding: 0 8px;
      }
      /* 👇 The following is a Swiper.js  overrides and therefore can't utilize the BEM naming convention */
      &.swiper-slide-active {
        opacity: 1 !important;
      }
      &.swiper-slide-next {
        opacity: 1 !important;
        & + .cpap__product-carousel__item {
          opacity: 1 !important;
          & + .cpap__product-carousel__item {
            opacity: 1 !important;
          }
        }
      }
      &.swiper-slide-prev {
        @media (max-width: 768px) {
          transform: translate(-10px, 0);
        }
      }
      .cpap__product-carousel__item-container {
        height: 100%;

        .price__sale {
          margin-bottom: 0;
        }
      }
    }
    .swiper-button-prev,
    .swiper-button-next {
      transform: translate(0, -50%);
      opacity: 0;
      @media (max-width: 768px) {
        display: none !important;
      }
    }
    .swiper-button-prev {
      left: 0;
    }
    .swiper-button-next {
      right: 0;
    }
    .swiper-pagination {
      display: none !important;
      @media (max-width: 768px) {
        display: flex !important;
      }
      @media (max-width: 374px) {
        max-width: calc(100vw - 40px);
      }
    }
    &:hover {
      @media (min-width: 768.5px) {
        .swiper-button-prev,
        .swiper-button-next {
          opacity: 1;
        }
      }
    }
    &:active {
      .swiper-button-prev,
      .swiper-button-next {
        opacity: 1;
      }
    }
  }
}
