/* ZRM Product Carousel — CSS scroll-snap */

.zrm-product-carousel {
  position: relative;
  max-width: 100%;
  width: 100%;
  --carousel-visible: var(--carousel-visible-desktop, 3);
}

@media (max-width: 1024px) {
  .zrm-product-carousel {
    --carousel-visible: var(--carousel-visible-tablet, 2);
  }
}

@media (max-width: 768px) {
  .zrm-product-carousel {
    --carousel-visible: var(--carousel-visible-mobile, 1.5);
  }
}

/* Track: horizontal scroll with snap */
.zrm-product-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(
    (100% - (var(--carousel-visible, 3) - 1) * var(--carousel-gap, 24px)) /
    var(--carousel-visible, 3)
  );
  gap: var(--carousel-gap, 24px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.zrm-product-carousel__track::-webkit-scrollbar {
  display: none;
}

/* Card */
.zrm-product-carousel__card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Image container */
.zrm-product-carousel__image {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--card-image-bg, rgba(0, 0, 0, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: solid;
  border-width: 0;
  border-color: transparent;
  isolation: isolate;
}

.zrm-product-carousel__image::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('/wp-content/themes/bricks-child/assets/img/karlsberg_paper_texture.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: multiply;
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

.zrm-product-carousel__image img {
  position: relative;
  z-index: 2;
  max-width: 140px;
  max-height: 264px;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.zrm-product-carousel__placeholder {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.02) 100%);
}

/* Text body */
.zrm-product-carousel__body {
  padding: 1.25rem 0.5rem 1rem;
  background: var(--card-content-bg, transparent);
  border-style: solid;
  border-width: 0;
  border-color: transparent;
}

.zrm-product-carousel__title {
  margin: 0 0 0.5rem;
  font-size: var(--card-title-font-size, 1rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  color: var(--card-title-color, inherit);
}

.zrm-product-carousel__desc {
  margin: 0;
  font-size: var(--card-desc-font-size, 0.875rem);
  line-height: 1.4;
  color: var(--card-desc-color, inherit);
}

/* Navigation arrows */
.zrm-product-carousel__nav {
  position: absolute;
  top: -64px;
  width: 39px;
  height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nav-bg-normal, none);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--nav-arrow-color, inherit);
  transition: background 0.2s, color 0.2s;
  z-index: 2;
  padding: 0;
}

.zrm-product-carousel__nav svg {
  width: 15px;
  height: 15px;
}

.zrm-product-carousel__nav:hover {
  background: var(--nav-bg-hover, var(--nav-bg-normal, none));
  color: var(--nav-arrow-color-hover, var(--nav-arrow-color, inherit));
}

.zrm-product-carousel__nav--prev {
  right: 51px;
}

.zrm-product-carousel__nav--next {
  right: 0;
}

/* When inside a constrained container, overlap arrows */
@media (max-width: 1200px) {
  .zrm-product-carousel__nav--prev {
    right: 51px;
  }
  .zrm-product-carousel__nav--next {
    right: 0;
  }
}

/* Hide arrows when all cards fit in view (no scroll needed) */
.zrm-product-carousel--no-scroll .zrm-product-carousel__nav {
  display: none;
}

/* Pagination bars — horizontal line style, mobile only */
.zrm-product-carousel__dots {
  display: none; /* Hidden on desktop/tablet */
}

@media (max-width: 768px) {
  .zrm-product-carousel__nav {
    display: none;
  }

  .zrm-product-carousel__dots {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
    padding: 1rem 0 0;
    margin: 0;
    list-style: none;
    border: none;
    background: none;
  }

  .zrm-product-carousel__dot {
    flex: 1;
    min-width: 0;
    height: 4px;
    padding: 0;
    border: none;
    border-radius: 2px;
    background: #b8b8b8;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
  }

  .zrm-product-carousel__dot:hover {
    background: #999;
  }

  .zrm-product-carousel__dot--active {
    background: var(--color-primary-300, #752E15);
  }
}
