/* PIPPER: horizontal banner strip using images from the Shoptet carousel.
   CSS-only: native horizontal scrolling, no autoplay/arrows/pagination.
   Scoped to the homepage carousel; does not affect other banners.
   Keep this file after the template's styles. */

body.in-index #carousel {
  --pipper-banner-gap: 10px;
  --pipper-banner-width: 300px;
  width: 100%;
  max-width: 100%;
}

body.in-index #carousel > .carousel-inner {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: var(--pipper-banner-gap);
  width: 100%;
  height: auto !important;
  /* Shoptet writes an inline min-height using the full carousel width.
     Portrait cards are narrower, so that reserved height must be cleared. */
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 10px 0 30px 14px;
  box-sizing: border-box;
  scroll-padding-inline: 14px;
  align-items: flex-start;
}

/* Override every native slide state, including during Shoptet autoplay. */
body.in-index #carousel > .carousel-inner > .item {
  display: block !important;
  position: relative !important;
  inset: auto !important;
  float: none !important;
  flex: 0 0 var(--pipper-banner-width) !important;
  width: var(--pipper-banner-width) !important;
  max-width: none !important;
  margin: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  transition: none !important;
  scroll-snap-align: start;
}

body.in-index #carousel > .carousel-inner > .item > a {
  display: block;
  width: 100%;
}

/* Preserve the complete uploaded image, including any text inside it. */
body.in-index #carousel > .carousel-inner > .item img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

/* Native controls refer to the original single-slide carousel. */
body.in-index #carousel > .carousel-control,
body.in-index #carousel > .carousel-indicators {
  display: none !important;
}

/* A single uploaded banner keeps its existing full-width presentation. */
body.in-index #carousel > .carousel-inner > .item:only-child {
  flex-basis: 100% !important;
  width: 100% !important;
}

@media (max-width: 767px) {
  body.in-index #carousel {
    --pipper-banner-gap: 10px;
    --pipper-banner-width: min(300px, 82vw);
  }
}

body.in-index #carousel > .carousel-inner > .item img {
  transition: transform 220ms ease, box-shadow 220ms ease;
}

@media (hover: hover) and (pointer: fine) {
  body.in-index #carousel > .carousel-inner > .item:hover img {
    transform: translateY(-6px);
    box-shadow: 0 14px 22px -10px rgb(25 18 65 / 28%);
  }
}

body.in-index #carousel > .carousel-inner > .item:focus-within img {
  transform: translateY(-6px);
  box-shadow: 0 14px 22px -10px rgb(25 18 65 / 28%);
}

@media (prefers-reduced-motion: reduce) {
  body.in-index #carousel > .carousel-inner > .item img {
    transition: none;
  }
  body.in-index #carousel > .carousel-inner > .item:hover img,
  body.in-index #carousel > .carousel-inner > .item:focus-within img {
    transform: none;
  }
}

/* Show a half-card at the right edge at every responsive size.
   Use the carousel's width, not the browser width. */
body.in-index #carousel {
  container-type: inline-size;
  container-name: pipper-banners;
  --pipper-banner-gap: 10px;
}
body.in-index #carousel > .carousel-inner {
  --pipper-banner-width: calc((100% - 10px) / 1.5);
}
@container pipper-banners (min-width: 600px) {
  body.in-index #carousel > .carousel-inner {
    --pipper-banner-width: calc((100% - 20px) / 2.5);
  }
}
@container pipper-banners (min-width: 900px) {
  body.in-index #carousel > .carousel-inner {
    --pipper-banner-width: calc((100% - 30px) / 3.5);
  }
}
@container pipper-banners (min-width: 1200px) {
  body.in-index #carousel > .carousel-inner {
    --pipper-banner-width: calc((100% - 40px) / 4.5);
  }
}

/* Mobile: fixed-header spacing is already supplied by the sticky header
   through body padding. Remove the template's duplicate 60px reservation. */
@media (max-width: 767px) {
  body.in-index > .overall-wrapper {
    padding-top: 0 !important;
  }
}
