/* =========================================================
   HPM PRODUCT GALLERY + IMAGE VIEWER
   Loaded AFTER hpm-product-viewer.css on products.php.

   - Main image + gallery images share one auto-sliding gallery
     (same behaviour as the home banner: arrows, dots, swipe).
   - Images are always shown in full (object-fit: contain), never cropped.
   - Before / After images are a small, compact extra row.
   - Lightbox: whole image visible, zoom buttons, pinch, drag.
   ========================================================= */

.hpm-modal-media {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0 0 20px;
}

/* ---------------------- Gallery slider ---------------------- */
.hpm-gallery {
  position: relative;
  width: 100%;
  outline: none;
}

.hpm-gallery__viewport {
  position: relative;
  overflow: hidden;
  border: 1px solid #e3e8ee;
  border-radius: 12px;
  background: #f3f5f8;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.hpm-gallery__track {
  display: flex;
  width: 100%;
  transition: transform .55s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}

.hpm-gallery__slide {
  flex: 0 0 100%;
  min-width: 100%;
  display: block;
  height: clamp(250px, 52vh, 480px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  appearance: none;
  -webkit-appearance: none;
}

.hpm-gallery__slide img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  object-fit: contain;
  object-position: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  pointer-events: none;
}

.hpm-gallery__slide.is-broken {
  background: #eef1f4 url("../images/hpm-favicon.svg") center / 56px no-repeat;
}

.hpm-gallery__slide.is-broken img {
  visibility: hidden;
}

/* Arrows */
.hpm-gallery__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  color: #fff;
  background: rgba(32, 43, 54, .86);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.hpm-gallery__nav i {
  font-size: 15px;
  line-height: 1;
}

.hpm-gallery__prev { left: 12px; }
.hpm-gallery__next { right: 12px; }

.hpm-gallery__nav:hover,
.hpm-gallery__nav:focus-visible {
  background: #ff5a00;
  border-color: #ff5a00;
  transform: translateY(-50%) scale(1.06);
}

/* Dots */
.hpm-gallery__dots {
  position: absolute;
  right: 0;
  bottom: 10px;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
}

.hpm-gallery__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 1.5px solid #ff5a00;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  cursor: pointer;
  pointer-events: auto;
  transition: width .25s ease, background .25s ease;
}

.hpm-gallery__dot.is-active {
  width: 22px;
  border-radius: 6px;
  background: #ff5a00;
}

/* Thumbnails */
.hpm-gallery__thumbs {
  display: flex;
  gap: 9px;
  margin-top: 11px;
  padding: 2px 1px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.hpm-gallery__thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 62px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f3f5f8;
  opacity: .75;
  cursor: pointer;
  transition: opacity .2s ease, border-color .2s ease;
}

.hpm-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

.hpm-gallery__thumb:hover,
.hpm-gallery__thumb.is-active {
  opacity: 1;
}

.hpm-gallery__thumb.is-active {
  border-color: #ff5a00;
}

/* ---------------------- Before / After (compact) ---------------------- */
.hpm-before-after-box {
  margin-top: 16px;
  padding: 12px 14px 14px;
  border: 1px solid #e3e8ee;
  border-radius: 12px;
  background: #fafbfc;
}

.hpm-before-after-box h3 {
  margin: 0 0 10px;
  color: #202b36;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.hpm-before-after-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hpm-ba-item {
  position: relative;
  width: 132px;
  height: 92px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d9e0e8;
  border-radius: 9px;
  background: #eef1f4;
  cursor: zoom-in;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.hpm-ba-item:hover,
.hpm-ba-item:focus-visible {
  border-color: #ff5a00;
  box-shadow: 0 4px 14px rgba(255, 90, 0, .18);
  outline: none;
}

.hpm-ba-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hpm-ba-tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  line-height: 1.6;
  background: #202b36;
}

.hpm-ba-tag--after {
  background: #ff5a00;
}

/* ---------------------- Lightbox ---------------------- */
body.hpm-lightbox-open { overflow: hidden; }

.hpm-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background: #050a11;
}

.hpm-image-lightbox .hpm-lightbox-bar {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.hpm-image-lightbox .hpm-lightbox-count {
  min-width: 56px;
  color: rgba(255, 255, 255, .8);
  font-size: 14px;
  font-weight: 600;
}

.hpm-image-lightbox .hpm-lightbox-zoom {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
}

.hpm-image-lightbox .hpm-lightbox-zoom button {
  min-width: 42px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.hpm-image-lightbox .hpm-lightbox-zoom button[data-lb="reset"] {
  font-size: 13px;
  border-right: 1px solid rgba(255, 255, 255, .2);
  border-left: 1px solid rgba(255, 255, 255, .2);
}

.hpm-image-lightbox .hpm-lightbox-zoom button:hover {
  background: #ff5a00;
}

.hpm-image-lightbox .hpm-lightbox-close {
  position: static;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.hpm-image-lightbox .hpm-lightbox-close:hover {
  background: #ff5a00;
  border-color: #ff5a00;
}

.hpm-image-lightbox .hpm-lightbox-stage {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0 0 12px;
  overflow: hidden;
  touch-action: none;
}

/* The image box fills the stage; object-fit keeps the WHOLE picture visible. */
.hpm-image-lightbox .hpm-lightbox-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  object-fit: contain;
  object-position: center;
  background: transparent;
  cursor: zoom-in;
  transform-origin: 0 0;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}

.hpm-image-lightbox .hpm-lightbox-image.is-zoomed { cursor: grab; }
.hpm-image-lightbox .hpm-lightbox-image.is-zoomed:active { cursor: grabbing; }

/* small usage hint that fades away */
.hpm-image-lightbox .hpm-lightbox-hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 3;
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity .4s ease;
}
.hpm-image-lightbox .hpm-lightbox-hint.is-hidden { opacity: 0; }
.hpm-image-lightbox.is-zoomed .hpm-lightbox-arrow { opacity: .35; }

.hpm-image-lightbox .hpm-lightbox-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  color: #fff;
  background: rgba(32, 43, 54, .85);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background .2s ease;
}

.hpm-image-lightbox .hpm-lightbox-arrow:hover { background: #ff5a00; }
.hpm-image-lightbox .hpm-lightbox-prev { left: 14px; }
.hpm-image-lightbox .hpm-lightbox-next { right: 14px; }

/* ---------------------- Responsive ---------------------- */
@media (max-width: 991.98px) {
  .hpm-gallery__slide { height: clamp(230px, 46vh, 400px); }
}

@media (max-width: 767.98px) {
  .hpm-gallery__viewport { border-radius: 10px; }
  .hpm-gallery__slide { height: clamp(200px, 64vw, 330px); }

  .hpm-gallery__nav {
    width: 32px;
    height: 32px;
  }
  .hpm-gallery__nav i { font-size: 12px; }
  .hpm-gallery__prev { left: 7px; }
  .hpm-gallery__next { right: 7px; }

  .hpm-gallery__thumb { width: 68px; height: 50px; }

  .hpm-ba-item { width: 112px; height: 78px; }

  .hpm-image-lightbox .hpm-lightbox-bar { padding: 8px 10px; }
  .hpm-image-lightbox .hpm-lightbox-zoom button { min-width: 38px; height: 36px; }
  .hpm-image-lightbox .hpm-lightbox-close { width: 38px; height: 38px; }
  .hpm-image-lightbox .hpm-lightbox-arrow { width: 38px; height: 38px; }
  .hpm-image-lightbox .hpm-lightbox-prev { left: 8px; }
  .hpm-image-lightbox .hpm-lightbox-next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .hpm-gallery__track { transition: none; }
}

/* Product popup close button: always visible on top of the picture */
.hpm-modal .hpm-modal-close {
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 25, 40, .22);
}
.hpm-modal .hpm-modal-close:hover { background: #ff5a00; color: #fff; }

/* The floating mail / call buttons must not sit on top of an open popup or viewer */
body.hpm-modal-open .hpm-floating-contact-left,
body.hpm-modal-open .hpm-floating-contact-right,
body.hpm-lightbox-open .hpm-floating-contact-left,
body.hpm-lightbox-open .hpm-floating-contact-right,
body.hpm-modal-open .float-text,
body.hpm-modal-open .scrollbar-v,
body.hpm-modal-open .mouse-cursor {
  display: none !important;
}


/* Product pictures that open the zoom viewer */
[data-hpm-zoom] { cursor: zoom-in; }

/* Home "View Details" popup: the picture is clickable to zoom */
.hpm-featured-modal__image[data-hpm-zoom] { position: relative; }
.hpm-featured-modal__image[data-hpm-zoom]::after {
  content: "\f00e";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(21, 33, 48, .78);
  color: #fff;
  font-size: 14px;
  pointer-events: none;
}
