.custom-product-grid {
  display: block;
  padding-top: clamp(var(--padding-top-mobile), 4vw, var(--padding-top-desktop));
  padding-bottom: clamp(var(--padding-bottom-mobile), 4vw, var(--padding-bottom-desktop));
  position: relative;

  &.is-loading {
    pointer-events: none;

    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(255, 255, 255, 0.8);
      z-index: 10;
    }

    &::after {
      content: "";
      position: absolute;
      top: 20%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 3rem;
      height: 3rem;
      border: 3px solid #f3f3f3;
      border-top: 3px solid #000;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      z-index: 11;
    }
  }

  &.full-width-row {
    & > .columns {
      padding: 0;
    }

    .custom-product-grid__title,
    .custom-product-grid__header,
    .custom-product-grid__description,
    .custom-product-grid__coupon_desktop,
    .custom-product-grid__coupon_mobile,
    .custom-product-grid__coupon_disclaimer {
      padding-left: clamp(1.25rem, 2vw, 1.875rem);
      padding-right: clamp(1.25rem, 2vw, 1.875rem);
    }
  }
  .custom-product-grid__description-wrapper--top {
    margin-bottom: 0.625rem;
  }
  .custom-product-grid__description-wrapper--bottom {
    margin-top: var(--description-top-margin);
  }

  read-more-text {
    display: block;
    .rte {
      display: inline;
    }

    .rte.is-expanded {
      display: block;
    }

    .rte.is-expanded h1,
    .rte.is-expanded h2,
    .rte.is-expanded h3,
    .rte.is-expanded h4,
    .rte.is-expanded h5,
    .rte.is-expanded h6,
    .rte.is-expanded p,
    .rte.is-expanded div,
    .rte.is-expanded ul,
    .rte.is-expanded ol,
    .rte.is-expanded li,
    .rte.is-expanded blockquote,
    .rte.is-expanded pre,
    .rte.is-expanded table,
    .rte.is-expanded thead,
    .rte.is-expanded tbody,
    .rte.is-expanded tfoot,
    .rte.is-expanded tr,
    .rte.is-expanded th,
    .rte.is-expanded td,
    .rte.is-expanded hr,
    .rte.is-expanded dl,
    .rte.is-expanded dt,
    .rte.is-expanded dd,
    .rte.is-expanded section,
    .rte.is-expanded article,
    .rte.is-expanded aside,
    .rte.is-expanded header,
    .rte.is-expanded footer,
    .rte.is-expanded nav,
    .rte.is-expanded figure,
    .rte.is-expanded figcaption {
      display: block;
    }

    .rte.is-expanded + .custom-product-grid__read-more {
      margin-left: 0px;
    }

    .rte * {
      display: inline;
    }

    .custom-product-grid__read-more {
      text-decoration: underline;
      margin-left: 5px;
    }
  }

  .custom-product-grid__description .row {
    padding: 0;
  }

  .custom-product-grid__description p:last-child {
    margin-bottom: 0;
  }
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.custom-product-grid__title {
  text-align: center;
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 3.25rem;

  @media screen and (min-width: 768px) {
    margin-bottom: 0.5rem;
  }
}

.custom-product-grid__header {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;

  display: flex;
  align-items: center;
  justify-content: space-between;

  @media screen and (min-width: 768px) {
    padding-top: 0;
    padding-bottom: 0;
    border: none;
    justify-content: center;
  }
}

.custom-product-grid__count,
.facets-button {
  margin: 0;
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
}

.facets-button__wrapper {
  flex: 1;
}

.facets-button {
  padding: clamp(0.625rem, 1.5vw, 0.875rem) clamp(1rem, 1.7vw, 1.125rem);
  border: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  height: 40px;
  font-weight: 400;
  width: fit-content;
  margin-left: auto;
}

.custom-product-grid__empty-div {
  display: none;
  @media screen and (min-width: 768px) {
    display: block;
    flex: 1;
  }
}

.facets-button__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: auto;
  color: inherit;
}

.products {
  padding-top: clamp(1.375rem, 2vw, 2.125rem);
  padding-left: 0;
  padding-right: 0;
  column-gap: clamp(0.9rem, 1.5vw, 1.1rem);
  row-gap: clamp(1.875rem, 4vw, 3.125rem);

  display: grid;
  grid-template-columns: repeat(2, 1fr);

  @media screen and (min-width: 768px) {
    grid-template-columns: repeat(3, 1fr);
  }

  @media screen and (min-width: 1069px) {
    grid-template-columns: repeat(var(--desktop-columns), 1fr);
  }
}

custom-product-card,
.card-product {
  min-width: 0;
  max-width: 100%;
  width: 100%;

  .card-product__title {
    @media screen and (min-width: 1024px) {
      font-size: calc(var(--font-body-scale) * 1.125rem);
    }
  }
  .card-product__vendor {
    @media screen and (min-width: 1024px) {
      font-size: calc(var(--font-body-scale) * 0.75rem);
    }
  }
  .card-product__slider-nav svg {
    @media screen and (min-width: 1024px) {
      width: 0.75rem;
      height: 0.75rem;
    }
  }
  .card-product__slider-nav button {
    @media screen and (min-width: 1024px) {
      width: 3.125rem;
      height: 3.125rem;
    }
  }
  .card-product__price,
  .card-product__compare-price,
  .card-product__colors-text {
    @media screen and (min-width: 1024px) {
      font-size: calc(var(--font-body-scale) * 0.875rem);
    }
  }
  .card-product__colors-text{
    @media screen and (min-width: 1024px) {
      min-height: calc(0.875rem * 1.4);
    }
  }
  .card-product__info .card-product__colors,
  .card-product__title-price-wrapper,
  .card-product__category-link,
  .card-product__color-swatches,
  .card-product__color-names {
    padding-left: clamp(0.75rem, 1.5vw, 0.9375rem);
    padding-right: clamp(0.75rem, 1.5vw, 0.9375rem);
  }
  @media screen and (min-width: 1024px) {
    .card-product__title-price-wrapper {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      flex-direction: row;
      gap: 5px;
    }

    .card-product__price-link {
      margin: 0;
    }
    .card-product__title {
      margin: 0;
    }
    .card-product__price-wrapper {
      flex-wrap: nowrap;
    }

    .card-product__image-wrapper--212-240 {
      aspect-ratio: 354 / 460;
    }

    .card-product__image-wrapper--212-240 .card-product__image {
      object-fit: contain;
    }
  }
}

custom-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: clamp(3.125rem, 4.5vw, 3.75rem);

  &.loading {
    pointer-events: none;
  }
}

.load-more {
  font-size: 1.0625rem;
  font-weight: 500;
  text-decoration: underline;
  line-height: normal;
  opacity: 1;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;

  svg {
    width: 16px;
    height: 16px;
    display: none;
  }

  &:disabled {
    pointer-events: none;
    opacity: 0.6;
  }

  &.loading {
    pointer-events: none;
    opacity: 0.7;

    svg {
      display: block;
      animation: spin-button 1s linear infinite;
    }

    span {
      display: none;
    }
  }

  &.loading::after {
    display: none;
  }

  @media screen and (min-width: 1200px) {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.01em;
  }
}

.load-more:hover {
  opacity: 0.6;
}
.load-more:focus{
  opacity: 1;
}

@keyframes spin-button {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.collection-product-grid {
  .custom-product-grid__header {
    padding-top: 0;
  }

  .custom-product-grid__title {
    text-align: left;
    margin-bottom: clamp(0.625rem, 2.5vw, 1.375rem);
  }

  .custom-product-grid__header {
    justify-content: space-between;
    @media screen and (max-width: 767px) {
      flex-direction: column;
      padding-right: 0 !important;
      padding-left: 0 !important;
      align-items: start;
      border-top: 0;
    }
  }

  .custom-product-grid__sibling-collections {
    overflow-x: auto;
    padding-bottom: 1.25rem;
    width: 100%;
    padding-left: clamp(1.25rem, 2vw, 1.875rem);

    @media screen and (min-width: 768px) {
      padding-bottom: 0;
      padding-left: 0;
    }
  }
  .custom-product-grid__sibling-collections-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    column-gap: 1.875rem;

    flex-wrap: nowrap;
    min-width: 100%;

    @media screen and (min-width: 768px) {
      column-gap: 1.5625rem;
      row-gap: 0.5rem;
      flex-wrap: wrap;
      min-width: auto;
    }
  }

  .custom-product-grid__sibling-collection-item {
    font-size: 1rem;
    line-height: 1.4;
    white-space: nowrap;

    &:last-child {
      padding-right: clamp(1.25rem, 2vw, 1.875rem);
      @media screen and (min-width: 768px) {
        padding-right: 0;
      }
    }
  }

  .custom-product-grid__info-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 1.875rem;

    @media screen and (max-width: 767px) {
      margin-left: 0;
      padding-top: 0.75rem;
      border-top: 1px solid #efefef;
      width: 100%;
      justify-content: space-between;
      padding-left: clamp(1.25rem, 2vw, 1.875rem);
      padding-right: clamp(1.25rem, 2vw, 1.875rem);
    }
  }
}

.custom-product-grid__coupon {
  background: var(--coupon-bg);
  border: 1px solid var(--coupon-border);
  color: var(--coupon-text);
  padding-top: var(--padding-top-mobile);
  padding-bottom: 24px;
  margin-top: calc(var(--padding-top-mobile)*-1);
  @media screen and (min-width: 768px) {
    padding-top: var(--padding-top-desktop);
    margin-top: calc(var(--padding-top-desktop)*-1);
  }
  .custom-product-grid__coupon_desktop {
    display: none;
  }
  @media screen and (min-width: 768px) {
    .custom-product-grid__coupon_desktop {
      display: flex;
      p:first-child {
        line-height: 32px;
      }
      .custom-product-grid__coupon_code {
        margin-left: 12px;
      }
    }
    .custom-product-grid__coupon_mobile {
      display: none;
    }
  }
  .custom-product-grid__coupon_code {
    display: inline-flex;
    border: 1px solid #000000;
    .custom-product-grid__coupon_code_value,
    .custom-product-grid__coupon_code_copy {
      padding: 0 16px;
      height: 32px;
      line-height: 32px;
      font-weight: bold;
      border: none;
    }
    .button svg {
      stroke: #FFFFFF;
    }
    .button:hover svg {
      stroke: #000000;
    }
  }
  .custom-product-grid__coupon_disclaimer {
    .custom-product-grid__coupon_disclaimer_content {
      display: none;
      padding: 10px 0;
    }
  }
  .custom-product-grid__coupon_disclaimer.open {
    .custom-product-grid__coupon_disclaimer_toggle {
      svg {
        transform: rotate(180deg);
      }
    }
    .custom-product-grid__coupon_disclaimer_content {
      display: block;
    }
  }
}