/**
 * ==========================
 * JLC PDP CUSTOM GALLERY
 * ==========================
 */

body.single-product {
  --jlc-gallery-dark: #231f20;
  --jlc-gallery-primary: #ff5f00;
  --jlc-gallery-primary-hover: #e65500;
  --jlc-gallery-muted: #746f71;
  --jlc-gallery-border: #ece6e2;
  --jlc-gallery-bg: #f8f6f4;
  --jlc-gallery-white: #ffffff;
  --jlc-gallery-overlay: rgba(18, 16, 17, 0.82);

  --jlc-gallery-radius-main: 26px;
  --jlc-gallery-radius-thumb: 14px;

  --jlc-gallery-shadow: 0 18px 46px rgba(35, 31, 32, 0.09);

  --jlc-gallery-control-shadow: 0 10px 26px rgba(35, 31, 32, 0.16);
}

/**
 * ==========================
 * ROOT
 * ==========================
 */

body.single-product .jlc-pdp-custom-gallery {
  position: relative;
  width: 100%;
  min-width: 0;
}

/**
 * ==========================
 * SLIDER
 * ==========================
 */

body.single-product .jlc-pdp-gallery-slider {
  width: 100%;
  min-width: 0;
}

body.single-product .jlc-pdp-gallery-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--jlc-gallery-radius-main);
  background: var(--jlc-gallery-bg);
  box-shadow: var(--jlc-gallery-shadow);
}

body.single-product .jlc-pdp-gallery-track {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/**
 * Slides
 */
body.single-product .jlc-pdp-gallery-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

body.single-product .jlc-pdp-gallery-slide.is-active {
  pointer-events: auto;
}

/**
 * Image button
 */
body.single-product .jlc-pdp-gallery-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

/**
 * Main image
 */
body.single-product .jlc-pdp-gallery-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: var(--jlc-gallery-radius-main);
  transition:
    transform 0.55s ease,
    opacity 0.35s ease;
}

body.single-product .jlc-pdp-gallery-open:hover .jlc-pdp-gallery-image {
  transform: scale(1.025);
}

/**
 * ==========================
 * MAIN NAVIGATION
 * ==========================
 */

body.single-product .jlc-pdp-gallery-navigation,
body.single-product .jlc-pdp-gallery-expand {
  position: absolute;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--jlc-gallery-dark);
  box-shadow: var(--jlc-gallery-control-shadow);
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition:
    transform 0.25s ease,
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    opacity 0.25s ease;
}

body.single-product .jlc-pdp-gallery-navigation:hover,
body.single-product .jlc-pdp-gallery-expand:hover {
  transform: translateY(-2px);
  background: var(--jlc-gallery-primary-hover);
  border-color: var(--jlc-gallery-primary-hover);
  color: var(--jlc-gallery-white);
}

body.single-product .jlc-pdp-gallery-navigation svg,
body.single-product .jlc-pdp-gallery-expand svg {
  width: 21px;
  height: 21px;
}

/**
 * Previous / next
 */
body.single-product .jlc-pdp-gallery-navigation {
  top: 50%;
  transform: translateY(-50%);
}

body.single-product .jlc-pdp-gallery-navigation:hover {
  transform: translateY(calc(-50% - 2px));
}

body.single-product .jlc-pdp-gallery-navigation--prev {
  left: 18px;
}

body.single-product .jlc-pdp-gallery-navigation--next {
  right: 18px;
}

/**
 * Expand
 */
body.single-product .jlc-pdp-gallery-expand {
  top: 18px;
  right: 18px;
}

/**
 * ==========================
 * COUNTER
 * ==========================
 */

body.single-product .jlc-pdp-gallery-counter {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 58px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(35, 31, 32, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/**
 * ==========================
 * THUMBNAILS
 * ==========================
 */

body.single-product .jlc-pdp-gallery-thumbnails {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

body.single-product .jlc-pdp-gallery-thumbnails::-webkit-scrollbar {
  display: none;
}

body.single-product .jlc-pdp-gallery-thumbnail {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: var(--jlc-gallery-radius-thumb);
  background: var(--jlc-gallery-bg);
  opacity: 0.62;
  cursor: pointer;
  scroll-snap-align: start;
  transition:
    opacity 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

body.single-product .jlc-pdp-gallery-thumbnail:hover {
  opacity: 1;
  transform: translateY(-2px);
}

body.single-product .jlc-pdp-gallery-thumbnail.is-active {
  opacity: 1;
  border-color: var(--jlc-gallery-primary);
  box-shadow: 0 8px 20px rgba(255, 95, 0, 0.15);
}

body.single-product .jlc-pdp-gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/**
 * ==========================
 * GALLERY STACKING FIX
 * ==========================
 */

/**
 * La pista queda en una capa inferior.
 */
body.single-product .jlc-pdp-gallery-track {
  position: relative;
  z-index: 1;
}

/**
 * Las diapositivas permanecen dentro de la capa de la pista.
 */
body.single-product .jlc-pdp-gallery-slide {
  z-index: 1;
}

body.single-product .jlc-pdp-gallery-slide.is-active {
  z-index: 2;
}

/**
 * El botón que abre el lightbox solo ocupa la capa de la imagen.
 */
body.single-product .jlc-pdp-gallery-open {
  position: relative;
  z-index: 1;
}

/**
 * La imagen no captura eventos directamente.
 */
body.single-product .jlc-pdp-gallery-image {
  pointer-events: none;
}

/**
 * Todos los controles deben quedar por encima de la imagen.
 */
body.single-product .jlc-pdp-gallery-navigation,
body.single-product .jlc-pdp-gallery-expand,
body.single-product .jlc-pdp-gallery-counter {
  z-index: 20;
}

/**
 * Las flechas reciben siempre el clic.
 */
body.single-product .jlc-pdp-gallery-navigation,
body.single-product .jlc-pdp-gallery-expand {
  pointer-events: auto;
  cursor: pointer;
}

/**
 * ==========================
 * SINGLE IMAGE
 * ==========================
 */

body.single-product .jlc-pdp-gallery-slider--single .jlc-pdp-gallery-counter,
body.single-product .jlc-pdp-gallery-slider--single .jlc-pdp-gallery-navigation,
body.single-product
  .jlc-pdp-gallery-slider--single
  .jlc-pdp-gallery-thumbnails {
  display: none;
}

/**
 * ==========================
 * PLACEHOLDER
 * ==========================
 */

body.single-product .jlc-pdp-gallery-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 40px;
  border: 1px solid var(--jlc-gallery-border);
  border-radius: var(--jlc-gallery-radius-main);
  background: linear-gradient(145deg, #fbfaf9 0%, #f3efec 100%);
  color: var(--jlc-gallery-muted);
  text-align: center;
  box-shadow: var(--jlc-gallery-shadow);
}

body.single-product .jlc-pdp-gallery-placeholder__image {
  display: block;
  width: min(58%, 320px);
  height: auto;
  object-fit: contain;
  opacity: 0.4;
  filter: grayscale(1);
}

body.single-product .jlc-pdp-gallery-placeholder__icon {
  width: 74px;
  height: 74px;
  color: #aaa2a5;
}

body.single-product .jlc-pdp-gallery-placeholder__text {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--jlc-gallery-muted);
}

/**
 * ==========================
 * LIGHTBOX
 * ==========================
 */

body.single-product .jlc-pdp-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

body.single-product .jlc-pdp-gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/**
 * Backdrop
 */
body.single-product .jlc-pdp-gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: var(--jlc-gallery-overlay);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/**
 * Dialog
 */
body.single-product .jlc-pdp-gallery-lightbox__dialog {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(1180px, 96vw);
  height: min(880px, 92vh);
  overflow: hidden;
  border-radius: 22px;
  background: var(--jlc-gallery-white);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

/**
 * Header
 */
body.single-product .jlc-pdp-gallery-lightbox__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex: 0 0 auto;
  padding: 18px 22px;
  border-bottom: 1px solid var(--jlc-gallery-border);
  background: var(--jlc-gallery-white);
}

body.single-product .jlc-pdp-gallery-lightbox__title {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--jlc-gallery-dark);
}

/**
 * Close
 */
body.single-product .jlc-pdp-gallery-lightbox__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--jlc-gallery-border);
  border-radius: 50%;
  background: var(--jlc-gallery-white);
  color: var(--jlc-gallery-dark);
  cursor: pointer;
  transition:
    transform 0.3s ease,
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

body.single-product .jlc-pdp-gallery-lightbox__close:hover {
  transform: rotate(90deg);
  background: var(--jlc-gallery-primary-hover);
  border-color: var(--jlc-gallery-primary-hover);
  color: var(--jlc-gallery-white);
}

body.single-product .jlc-pdp-gallery-lightbox__close svg {
  width: 22px;
  height: 22px;
}

/**
 * Content
 */
body.single-product .jlc-pdp-gallery-lightbox__content {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(145deg, #faf9f8 0%, #f3efec 100%);
}

/**
 * Lightbox slides
 */
body.single-product .jlc-pdp-gallery-lightbox__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 28px 80px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

body.single-product .jlc-pdp-gallery-lightbox__slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  z-index: 2;
}

body.single-product .jlc-pdp-gallery-lightbox__slide img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  transition: transform 0.3s ease;
}

body.single-product .jlc-pdp-gallery-lightbox__slide img.is-zoomed {
  transform: scale(1.65);
  cursor: zoom-out;
}

/**
 * Lightbox navigation
 */
body.single-product .jlc-pdp-gallery-lightbox__navigation {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--jlc-gallery-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--jlc-gallery-dark);
  box-shadow: var(--jlc-gallery-control-shadow);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    transform 0.25s ease,
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

body.single-product .jlc-pdp-gallery-lightbox__navigation:hover {
  transform: translateY(calc(-50% - 2px));
  background: var(--jlc-gallery-primary-hover);
  border-color: var(--jlc-gallery-primary-hover);
  color: var(--jlc-gallery-white);
}

body.single-product .jlc-pdp-gallery-lightbox__navigation--prev {
  left: 22px;
}

body.single-product .jlc-pdp-gallery-lightbox__navigation--next {
  right: 22px;
}

body.single-product .jlc-pdp-gallery-lightbox__navigation svg {
  width: 22px;
  height: 22px;
}

/**
 * Footer
 */
body.single-product .jlc-pdp-gallery-lightbox__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 10px 20px;
  border-top: 1px solid var(--jlc-gallery-border);
  background: var(--jlc-gallery-white);
  font-size: 13px;
  font-weight: 700;
  color: var(--jlc-gallery-dark);
}

/**
 * ==========================
 * DESKTOP ZOOM
 * ==========================
 */

body.single-product .jlc-pdp-custom-gallery {
  position: relative;
}

/**
 * Panel lateral
 */
body.single-product .jlc-pdp-gallery-zoom-panel {
  position: absolute;

  top: 0;
  left: calc(100% + 28px);

  width: min(520px, 38vw);
  aspect-ratio: 1 / 1;

  overflow: hidden;

  border: 1px solid rgba(35, 31, 32, 0.08);
  border-radius: 24px;

  background: #ffffff;

  box-shadow: 0 26px 70px rgba(35, 31, 32, 0.16);

  opacity: 0;
  visibility: hidden;

  transform: translateX(12px);

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s ease;

  pointer-events: none;

  z-index: 40;
}

body.single-product .jlc-pdp-gallery-zoom-panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/**
 * Imagen ampliada
 */
body.single-product .jlc-pdp-gallery-zoom-panel__image {
  width: 100%;
  height: 100%;

  background-repeat: no-repeat;
  background-color: #ffffff;

  cursor: zoom-in;
}

/**
 * Lente
 */
body.single-product .jlc-pdp-gallery-zoom-lens {
  position: absolute;

  left: 0;
  top: 0;

  display: block;

  width: 140px;
  height: 140px;

  border-radius: 16px;

  background: rgba(255, 255, 255, 0.18);

  border: 1px solid rgba(255, 255, 255, 0.85);

  backdrop-filter: blur(2px);

  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);

  opacity: 0;

  transform: translate3d(0, 0, 0);

  transition: opacity 0.15s ease;

  pointer-events: none;

  z-index: 25;
}

body.single-product .jlc-pdp-gallery-zoom-lens.is-active {
  opacity: 1;
}

/**
 * Cursor
 */
body.single-product .jlc-pdp-gallery--zoom-active .jlc-pdp-gallery-image {
  cursor: crosshair;
}

/**
 * Evita que el panel salga de la pantalla
 * cuando la columna es estrecha.
 */
@media (max-width: 1500px) {
  body.single-product .jlc-pdp-gallery-zoom-panel {
    width: 420px;
  }
}

@media (max-width: 1350px) {
  body.single-product .jlc-pdp-gallery-zoom-panel {
    width: 360px;
  }
}

/**
 * Tablet y móvil
 */
@media (max-width: 1200px) {
  body.single-product .jlc-pdp-gallery-zoom-panel,
  body.single-product .jlc-pdp-gallery-zoom-lens {
    display: none !important;
  }
}

/**
 * ==========================
 * TABLET
 * ==========================
 */

@media (max-width: 1024px) {
  body.single-product .jlc-pdp-gallery-thumbnail {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
  }

  body.single-product .jlc-pdp-gallery-lightbox {
    padding: 18px;
  }

  body.single-product .jlc-pdp-gallery-lightbox__dialog {
    width: 96vw;
    height: 90vh;
  }

  body.single-product .jlc-pdp-gallery-lightbox__slide {
    padding: 24px 70px;
  }
}

/**
 * ==========================
 * MOBILE
 * ==========================
 */

@media (max-width: 767px) {
  body.single-product .jlc-pdp-gallery-viewport {
    border-radius: 0px;
  }

  body.single-product .jlc-pdp-gallery-image {
    border-radius: 0px;
  }

  body.single-product .jlc-pdp-gallery-thumbnails {
    margin-top: 2px;
    gap: 0px;
  }

  body.single-product .jlc-pdp-gallery-navigation,
  body.single-product .jlc-pdp-gallery-expand {
    width: 35px;
    height: 35px;
  }

  body.single-product .jlc-pdp-gallery-navigation--prev {
    left: 12px;
  }

  body.single-product .jlc-pdp-gallery-navigation--next {
    right: 12px;
  }

  body.single-product .jlc-pdp-gallery-expand {
    top: 12px;
    right: 12px;
  }

  body.single-product .jlc-pdp-gallery-counter {
    right: 12px;
    bottom: 12px;
    height: 25px;
    font-size: 12px;
  }

  body.single-product .jlc-pdp-gallery-thumbnail {
    flex-basis: 68px;
    width: 68px;
    height: 68px;
    border-radius: 11px;
  }

  body.single-product .jlc-pdp-gallery-lightbox {
    padding: 0;
  }

  body.single-product .jlc-pdp-gallery-lightbox__dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  body.single-product .jlc-pdp-gallery-lightbox__header {
    padding: 14px 16px;
  }

  body.single-product .jlc-pdp-gallery-lightbox__title {
    max-width: calc(100% - 64px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
  }

  body.single-product .jlc-pdp-gallery-lightbox__slide {
    padding: 18px 16px 74px;
  }

  body.single-product .jlc-pdp-gallery-lightbox__navigation {
    top: auto;
    bottom: 160px;
    width: 44px;
    height: 44px;
    transform: none;
  }

  body.single-product .jlc-pdp-gallery-lightbox__navigation:hover {
    transform: translateY(-2px);
  }

  body.single-product .jlc-pdp-gallery-lightbox__navigation--prev {
    left: calc(50% - 54px);
  }

  body.single-product .jlc-pdp-gallery-lightbox__navigation--next {
    right: calc(50% - 54px);
  }

  body.single-product .jlc-pdp-gallery-lightbox__footer {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 4;
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    transform: translateX(-50%);
  }
}

/**
 * ==========================
 * ACCESSIBILITY
 * ==========================
 */

@media (prefers-reduced-motion: reduce) {
  body.single-product .jlc-pdp-gallery-slide,
  body.single-product .jlc-pdp-gallery-track,
  body.single-product .jlc-pdp-gallery-image,
  body.single-product .jlc-pdp-gallery-navigation,
  body.single-product .jlc-pdp-gallery-expand,
  body.single-product .jlc-pdp-gallery-thumbnail,
  body.single-product .jlc-pdp-gallery-lightbox,
  body.single-product .jlc-pdp-gallery-lightbox__slide,
  body.single-product .jlc-pdp-gallery-lightbox__close,
  body.single-product .jlc-pdp-gallery-lightbox__navigation,
  body.single-product .jlc-pdp-gallery-lightbox__slide img {
    transition: none;
  }
}
