/* pdp-gallery.css — mobile product media strip for the product pages
   (/party-ufo/ and /diy-kit/). Shared between soundglow.dk and soundglow.eu:
   this file MUST stay byte-identical in both docroots.

   By default the strip only appears at the <=900px breakpoint. It renders
   as the first child of .product-info (order:-1 in the mobile flex column),
   so it sits above the eyebrow / product name / price.

   .pdp-gallery--desktop opts a gallery in at all widths: above 900px it
   fills its (fixed-aspect) parent as a one-slide-per-view looping carousel
   with prev/next arrows and overlaid dots (see the block at the bottom).

   Full-bleed is the same negative-margin trick .rev-carousel-wrap uses, with
   the same -1.5rem / -1.25rem / -1rem steps as the page section gutter. */

.pdp-gallery { display: none; }
.pdp-arrow { display: none; }

@media (max-width: 900px) {
  .pdp-gallery {
    display: block;
    order: -1;
    position: relative;
    margin: 0 -1.5rem 1.4rem;
  }

  /* Horizontal snap track. Slides are centre-snapped with symmetric padding so
     the neighbouring slide peeks in on both sides — that peek is the only
     affordance telling a thumb the strip scrolls. */
  .pdp-gallery-track {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    padding: 0 8%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pdp-gallery-track::-webkit-scrollbar { display: none; }
  .pdp-gallery-track:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }

  /* 3:4 to match the product photography format. The gradient is a
     placeholder so posterless webm clips never flash black before decode. */
  .pdp-slide {
    flex: 0 0 84%;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    aspect-ratio: 3 / 4;
    scroll-snap-align: center;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    border: 1px solid rgba(255,255,255,0.10);
    background: linear-gradient(135deg, #1a1530, #0d0b1e);
  }
  .pdp-slide img,
  .pdp-slide video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .pdp-slide:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

  /* The dot row lives back inside the section gutter, so it cancels the
     wrapper's negative margin with matching padding. */
  .pdp-gallery-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .pdp-dot {
    appearance: none;
    width: 7px; height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
  }
  .pdp-dot.is-active { background: var(--purple); transform: scale(1.35); }
  .pdp-dot:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
}

@media (max-width: 550px) {
  .pdp-gallery { margin-left: -1.25rem; margin-right: -1.25rem; }
  .pdp-gallery-dots { padding-left: 1.25rem; padding-right: 1.25rem; }
}

@media (max-width: 380px) {
  .pdp-gallery { margin-left: -1rem; margin-right: -1rem; }
  .pdp-gallery-dots { padding-left: 1rem; padding-right: 1rem; }
}

/* Full-screen tap-to-zoom viewer, injected by pdp-gallery.js. Edge-to-edge
   snap track, one slide per screen; any tap closes it. Sits above the cart
   drawer (9999) and the grain overlay, below the consent banner. */
.pdp-zoom {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(5,4,12,0.97);
  cursor: zoom-out;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.pdp-zoom.is-open { display: block; animation: pdp-zoom-in 0.18s ease-out; }
@keyframes pdp-zoom-in { from { opacity: 0; } to { opacity: 1; } }

.pdp-zoom-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior: contain;
  touch-action: pan-x pinch-zoom;
  scrollbar-width: none;
}
.pdp-zoom-track::-webkit-scrollbar { display: none; }
.pdp-zoom-slide {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdp-zoom-slide img,
.pdp-zoom-slide video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pdp-zoom-count {
  position: absolute;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(5,4,12,0.6);
  color: var(--white);
  font-family: var(--font-b);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  pointer-events: none;
}
.pdp-zoom-count:empty { display: none; }

.pdp-zoom-close {
  position: absolute;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  right: 0.75rem;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(5,4,12,0.6);
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.pdp-zoom-close:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* Freeze the page behind the viewer. */
html.pdp-zoom-lock,
html.pdp-zoom-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .pdp-dot { transition: none; }
  .pdp-zoom.is-open { animation: none; }
}

/* Image groups opted into the full-screen viewer with data-pdp-zoom. */
[data-pdp-zoom] img { cursor: zoom-in; }
[data-pdp-zoom] img:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* ── Desktop carousel (.pdp-gallery--desktop, >900px) ─────────────────
   Fills the parent box (the page gives it the aspect ratio + frame), one
   slide per view. pdp-gallery.js loops it through the same lead/tail
   clones as the mobile strip, so the arrows wrap endlessly. */
@media (min-width: 901px) {
  .pdp-gallery--desktop {
    display: block;
    position: relative;
    z-index: 1;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
  }
  .pdp-gallery--desktop .pdp-gallery-track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .pdp-gallery--desktop .pdp-gallery-track::-webkit-scrollbar { display: none; }
  .pdp-gallery--desktop .pdp-slide {
    flex: 0 0 100%;
    height: 100%;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    border: none;
    font: inherit;
    color: inherit;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    cursor: zoom-in;
    background: linear-gradient(135deg, #1a1530, #0d0b1e);
  }
  .pdp-gallery--desktop .pdp-slide img,
  .pdp-gallery--desktop .pdp-slide video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .pdp-gallery--desktop .pdp-slide:focus-visible { outline: 2px solid var(--purple); outline-offset: -3px; }

  .pdp-gallery--desktop .pdp-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px; height: 44px;
    margin-top: -22px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(5,4,12,0.55);
    color: var(--white);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
  }
  .pdp-gallery--desktop .pdp-arrow svg { width: 20px; height: 20px; }
  .pdp-gallery--desktop .pdp-arrow--prev { left: 0.9rem; }
  .pdp-gallery--desktop .pdp-arrow--next { right: 0.9rem; }
  .pdp-gallery--desktop:hover .pdp-arrow,
  .pdp-gallery--desktop:focus-within .pdp-arrow { opacity: 1; }
  .pdp-gallery--desktop .pdp-arrow:hover { background: rgba(168,85,247,0.55); }
  .pdp-gallery--desktop .pdp-arrow:focus-visible { opacity: 1; outline: 2px solid var(--purple); outline-offset: 2px; }

  .pdp-gallery--desktop .pdp-gallery-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    position: absolute;
    left: 50%;
    bottom: 1rem;
    z-index: 2;
    transform: translateX(-50%);
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(5,4,12,0.45);
  }
  .pdp-gallery--desktop .pdp-dot {
    appearance: none;
    width: 7px; height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
  }
  .pdp-gallery--desktop .pdp-dot.is-active { background: var(--purple); transform: scale(1.35); }
  .pdp-gallery--desktop .pdp-dot:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
}

/* Hover-only arrows can't be found on touch-only large screens (tablets in
   landscape) — keep them visible there. */
@media (min-width: 901px) and (hover: none) {
  .pdp-gallery--desktop .pdp-arrow { opacity: 1; }
}

@media (min-width: 901px) and (prefers-reduced-motion: reduce) {
  .pdp-gallery--desktop .pdp-arrow,
  .pdp-gallery--desktop .pdp-dot { transition: none; }
}
