product-recently-viewed {
  display: block;
}

.product-recently-viewed-title.large {
  font-size: calc(var(--title4-font-size) * 1.2);
}

.product-recently-viewed-title.small {
  font-size: calc(var(--title4-font-size) * 0.8);
}

.product-recently-viewed-title.medium {
  font-size: calc(var(--title4-font-size) * 1);
}

@media (min-width: 960px) {
  .slider-product-recently-viewed.no-slider-pc > .slider {
    flex-wrap: wrap;
  }
  .slider-product-recently-viewed.no-slider-pc
    .slider-product-recently-viewed__button {
    display: none;
  }
}

.slider-product-recently-viewed.no-slider-mobile > .slider {
  flex-wrap: wrap;
}

.slider-product-recently-viewed.no-slider-mobile
  .slider-product-recently-viewed__button {
  display: none;
}

@media (max-width: 959px) {
  .slider-product-recently-viewed > .slider.slider--mobile {
    margin-left: calc(var(--page-padding) * -1) !important;
    margin-right: calc(var(--page-padding) * -1) !important;
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
    scroll-padding-left: var(--page-padding);
  }

  .slider-product-recently-viewed > .slider.slider--mobile > .slider__slide {
    width: calc((200vw - var(--page-padding)) / (2 * var(--mobile-cols) + 1));
  }
}

.slider-product-recently-viewed__button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(var(--color-page-background));
  border: 1px solid rgba(var(--color-entry-line));
  cursor: pointer;
  color: rgba(var(--color-text));
}

.slider-product-recently-viewed__button.previous {
  left: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.slider-product-recently-viewed__button.next {
  right: 0;
  transform: translate(50%, -50%) rotate(-90deg);
}

.slider-product-recently-viewed__button:disabled {
  color: rgba(var(--color-text), 0.3);
}

.slider-product-recently-viewed__button:hover:not(:disabled) {
  border-color: rgba(var(--color-text));
}

/* The ipad end responds to the mobile end in vertical screen */

/* @custom-media --tablet (max-width: 959px); */

/* @custom-media --gt-mobile (min-width: 751px); */

/* detectingScreen need to consider the configuration of the tablet */

/* Recently viewed geometry parity with the Shopify reference.
   PDP: a static 5-up row inside a 1450 container (slides 290, cards 260),
   centred 36/400/46 heading. Cart: a 4-up slider inside the 1200 page width
   (slides 300, cards 270) with a left-aligned heading. Both leave 40px under
   the heading. Scoped by data-section-template so the collection page, which
   already matches, is untouched. */
@media screen and (min-width: 960px) {
  product-recently-viewed[data-section-template="product"],
  product-recently-viewed[data-section-template="cart"] {
    padding-left: 15px;
    padding-right: 15px;
  }

  product-recently-viewed[data-section-template="product"] {
    max-width: 1450px;
    /* At viewports under ~1450px the container sits flush against the
       page edge (only the 15px padding above as gutter), but the prev/next
       arrow buttons straddle the slider track edge by 20px (§ button rule
       below: width 40px + translate 50%). That leaves a 5px bleed past the
       viewport edge causing page-level horizontal scroll. Clip it here —
       cards never reach this edge (they end at the padding boundary), so
       only the harmless arrow overhang is trimmed, and only when it would
       otherwise exceed the gutter. */
    overflow-x: clip;
    overflow-y: visible;
  }

  product-recently-viewed[data-section-template="product"] .slider__slide,
  product-recently-viewed[data-section-template="cart"] .slider__slide {
    padding-left: 15px;
    padding-right: 15px;
  }

  product-recently-viewed[data-section-template="product"] .slider,
  product-recently-viewed[data-section-template="cart"] .slider {
    margin-left: -15px;
    margin-right: -15px;
    margin-bottom: 0;
  }
}

product-recently-viewed[data-section-template="product"] .product-recently-viewed-title,
product-recently-viewed[data-section-template="cart"] .product-recently-viewed-title {
  margin-bottom: 40px;
}

@media screen and (min-width: 960px) {
  product-recently-viewed[data-section-template="product"] .product-recently-viewed-title,
  product-recently-viewed[data-section-template="cart"] .product-recently-viewed-title {
    line-height: 46.008px;
  }
}

@media screen and (max-width: 959px) {
  product-recently-viewed[data-section-template="product"] .product-recently-viewed-title,
  product-recently-viewed[data-section-template="cart"] .product-recently-viewed-title {
    font-size: 25px;
    line-height: 34px;
  }
}

product-recently-viewed[data-section-template="cart"] .product-recently-viewed-title {
  text-align: left;
}

/* Nothing viewed yet: the reference shows no strip at all. Collapse the padding
   rather than using display:none - the element loads its content from an
   IntersectionObserver, and a display:none target never intersects. */
product-recently-viewed:not(:has(.slider__slide)) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
