/* ============================================================
   Bright Roots Wellbeing — product carousel
   Horizontal, scroll-snapping carousel for the shop grid.
   3 cards per view on desktop, scaling down to 1 on phones.
   Arrow buttons are injected by /assets/js/carousel.js; without
   JS the track is still swipeable/scrollable.
   ============================================================ */

.brw-carousel {
  position: relative;
  margin-top: 36px;
}

/* -- TRACK -- */
.brw-carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 20px) / 3);
  gap: 20px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 4px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-2) transparent;
}

.brw-carousel-track > * {
  scroll-snap-align: start;
}

/* Slim, on-brand scrollbar (WebKit) */
.brw-carousel-track::-webkit-scrollbar { height: 8px; }
.brw-carousel-track::-webkit-scrollbar-track { background: var(--surface); border-radius: 8px; }
.brw-carousel-track::-webkit-scrollbar-thumb { background: var(--accent-2); border-radius: 8px; }
.brw-carousel-track::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* -- CARDS INSIDE THE CAROUSEL --
   At 3 across the cards are as wide as the standard grid, so they keep the
   default .brw-ebook type; only the artwork framing is carousel-specific.
   Every card shares the same 4:3 image box so the headings line up. */
.brw-carousel .brw-ebook img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Posters are portrait artwork — show them whole rather than cropping */
.brw-carousel .brw-ebook--poster img {
  object-fit: contain;
  background: var(--surface);
  padding: 10px;
}

.brw-carousel .brw-ebook .price { margin: auto 0 14px; }

/* -- ARROW BUTTONS (injected by carousel.js) -- */
.brw-carousel-nav {
  position: absolute;
  top: calc(50% - 10px);
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-size: 24px;
  font-family: var(--font-head);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
  transition: background .2s, color .2s, opacity .2s;
}

.brw-carousel-nav:hover { background: var(--accent); color: #fff; }
.brw-carousel-nav:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.brw-carousel-nav[disabled] { opacity: .3; cursor: default; box-shadow: none; }
.brw-carousel-nav[disabled]:hover { background: #fff; color: var(--accent); }
.brw-carousel-nav[hidden] { display: none; }

.brw-carousel-nav--prev { left: -20px; }
.brw-carousel-nav--next { right: -20px; }

/* Keep the arrows on-screen once the page runs out of side margin */
@media (max-width: 1220px) {
  .brw-carousel-nav--prev { left: 2px; }
  .brw-carousel-nav--next { right: 2px; }
}

/* -- RESPONSIVE COLUMN COUNT -- */
@media (max-width: 900px) {
  .brw-carousel-track { grid-auto-columns: calc((100% - 16px) / 2); gap: 16px; }
}

@media (max-width: 620px) {
  .brw-carousel-track { grid-auto-columns: 88%; gap: 16px; }
  .brw-carousel-nav { width: 38px; height: 38px; font-size: 20px; }
}

/* -- REDUCED MOTION -- */
@media (prefers-reduced-motion: reduce) {
  .brw-carousel-track { scroll-behavior: auto; }
}
