/* =========================================================================
   Shared "single-row + arrow" product carousel.
   Used by Best Sellers, Featured Products, Trending Products and
   Recently Added Products — all four share this exact layout/behaviour.

   Layout: a CSS grid with grid-auto-flow:column and a single row, so
   items lay out left-to-right in one line. The row scrolls horizontally;
   the right arrow advances by one "page" (one viewport width) at a time,
   revealing more columns that were already rendered but off-screen — no
   extra loading needed. Homepage-only component (see the auto_render()
   is_front_page() checks in each section class).
   ========================================================================= */

.fmke-pcarousel { margin: 32px 0; }

.fmke-pcarousel__head { margin: 0 0 16px; }
.fmke-pcarousel__title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: #1F3D2C;
  margin: 0;
}

.fmke-pcarousel__viewport { position: relative; }

.fmke-pcarousel__track.products {
  display: grid !important;
  grid-template-columns: none !important; /* cancel out fmke-jumia-style's global
    ul.products{grid-template-columns:repeat(4,1fr)} rule — that plugin's CSS
    loads sitewide and otherwise silently wins on this specific property,
    since nothing here contested it before. Auto-flow + grid-auto-columns
    below is what actually drives this carousel's sizing. */
  grid-auto-flow: column;
  grid-template-rows: repeat(1, 1fr); /* homepage carousels: single row, scroll for more */
  grid-auto-columns: calc((100% - 3 * 16px) / 4); /* 4 columns visible on desktop */
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 2px 2px 8px;
  margin: 0 !important;
  list-style: none;
  scrollbar-width: none;
}
.fmke-pcarousel__track.products::-webkit-scrollbar { display: none; }
.fmke-pcarousel__track.products li.product {
  scroll-snap-align: start;
  margin: 0 !important;
  width: auto !important;
}

.fmke-pcarousel__arrow {
  position: absolute;
  top: 50%;
  margin-top: -19px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--fmke-border, #F0E4D8);
  background: #fff;
  color: var(--fmke-dark, #1F3D2C);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.1);
  transition: opacity .15s ease, background .15s ease, color .15s ease;
  z-index: 5;
}
.fmke-pcarousel__arrow:hover {
  background: var(--fmke-primary, #FF6A00);
  color: #fff;
  border-color: var(--fmke-primary, #FF6A00);
}
.fmke-pcarousel__arrow--prev { left: -19px; }
.fmke-pcarousel__arrow--next { right: -19px; }
.fmke-pcarousel__arrow[hidden] { display: none; }

/* Responsive: fewer visible columns as the viewport narrows, single row throughout. */
@media (max-width: 1200px) {
  .fmke-pcarousel__track.products { grid-auto-columns: calc((100% - 2 * 16px) / 3); }
}
@media (max-width: 900px) {
  .fmke-pcarousel__track.products { grid-auto-columns: calc((100% - 1 * 14px) / 2); gap: 14px; }
  .fmke-pcarousel__arrow { width: 32px; height: 32px; margin-top: -16px; }
  .fmke-pcarousel__arrow--prev { left: -10px; }
  .fmke-pcarousel__arrow--next { right: -10px; }
}
@media (max-width: 480px) {
  /* One column per "page" on very small screens, peeking the next card
     slightly so it's clear there's more to scroll to. */
  .fmke-pcarousel__track.products { grid-auto-columns: calc(100% - 34px); }
  .fmke-pcarousel__title { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .fmke-pcarousel__track.products { scroll-behavior: auto; }
}
