/**
 * "Recently viewed" section chrome only -- the cards themselves come from
 * journal3/recommended_products.tpl and keep the theme's own styling.
 *
 * No brand colour is declared here on purpose: journal3 never defines
 * --j3-primary-color, so a var() fallback would paint every tenant alike.
 */

.recently-viewed-section {
  margin: 32px 0 8px;
  clear: both;
}

.recently-viewed-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.recently-viewed-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  white-space: nowrap;
}

.recently-viewed-header-line {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}

/* Keep the section clear of the mobile sticky add-to-cart bar, which is
   fixed to the bottom of the viewport on product pages. */
.matjrah-sticky-atc ~ .recently-viewed-section {
  margin-bottom: 24px;
}

@media (max-width: 767px) {
  .recently-viewed-section {
    margin-top: 24px;
  }

  .recently-viewed-title {
    font-size: 16px;
  }
}

/* Native scrolling keeps the rail useful without a carousel dependency. */
.discovery-products.main-products,
.discovery-section .discovery-products.main-products {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 2px 0 12px;
  margin: 0;
}
.discovery-products.main-products > .product-layout,
.discovery-section .discovery-products.main-products > .product-layout {
  flex: 0 0 calc((100% - 64px) / 5);
  width: calc((100% - 64px) / 5);
  min-width: 160px;
  padding: 0;
  margin: 0;
  scroll-snap-align: start;
}
.discovery-products:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.discovery-products .product-thumb { height: 100%; }
@media (max-width: 767px) {
  .discovery-products.main-products,
  .discovery-section .discovery-products.main-products { gap: 12px; }
  .discovery-products.main-products > .product-layout,
  .discovery-section .discovery-products.main-products > .product-layout {
    flex-basis: 44%;
    width: 44%;
    min-width: 140px;
  }
}

.discovery-section .discovery-navigation { display: flex; gap: 6px; }
.discovery-section .discovery-navigation[hidden] { display: none; }
.discovery-section .discovery-navigation button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 1px solid currentColor;
  border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
}
.discovery-section .discovery-navigation button:disabled { opacity: .3; cursor: default; }
.discovery-section .discovery-navigation button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
html[dir="rtl"] .discovery-navigation svg { transform: rotate(180deg); }
