/* lightbox.css - BDL Product Image Lightbox */

/* ── Clickable images ── */
.product-hero__image img {
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.product-hero__image img:hover {
  opacity: 0.92;
}

/* ── Gallery layout: stacked native-ratio images in the media column ── */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  max-width: none;
}

.product-gallery img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
  background: var(--bg-page, var(--color-bg));
}

.product-gallery img:hover {
  opacity: 0.92;
}

/* Hide placeholder images */
.product-gallery img[src^="data:"] {
  display: none;
}

/* Hide gallery entirely if only placeholders */
.product-gallery:empty,
.product-gallery:not(:has(img:not([src^="data:"]))) {
  display: none;
}

/* ── Lightbox overlay ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: oklch(0.06 0 0 / 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

/* Image container */
.lightbox__img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 2px;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.lightbox.is-open .lightbox__img {
  opacity: 1;
  transform: scale(1);
}

/* Close button */
.lightbox__close {
  position: absolute;
  top: var(--space-6, 1.5rem);
  right: var(--space-6, 1.5rem);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: oklch(0.95 0 0 / 0.8);
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s ease;
  padding: 0;
}

.lightbox__close:hover {
  color: oklch(1 0 0);
}

.lightbox__close svg {
  width: 28px;
  height: 28px;
}

/* Navigation arrows */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(0.15 0 0 / 0.5);
  border: 1px solid oklch(1 0 0 / 0.1);
  border-radius: 50%;
  color: oklch(0.95 0 0 / 0.8);
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease, color 0.2s ease;
  padding: 0;
}

.lightbox__nav:hover {
  background: oklch(0.2 0 0 / 0.7);
  color: oklch(1 0 0);
}

.lightbox__nav--prev {
  left: var(--space-6, 1.5rem);
}

.lightbox__nav--next {
  right: var(--space-6, 1.5rem);
}

.lightbox__nav svg {
  width: 22px;
  height: 22px;
}

/* Counter (e.g., "2 / 5") */
.lightbox__counter {
  position: absolute;
  bottom: var(--space-6, 1.5rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body, 'Jost', sans-serif);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: oklch(0.8 0 0 / 0.7);
  z-index: 10;
}

/* Hide nav arrows when only 1 image */
.lightbox[data-total="1"] .lightbox__nav,
.lightbox[data-total="1"] .lightbox__counter {
  display: none;
}

/* ── Mobile ── */
@media (max-width: 767px) {
  .lightbox__nav {
    width: 44px;
    height: 44px;
  }

  .lightbox__nav--prev {
    left: var(--space-3, 0.75rem);
  }

  .lightbox__nav--next {
    right: var(--space-3, 0.75rem);
  }

  .lightbox__close {
    top: var(--space-4, 1rem);
    right: var(--space-4, 1rem);
  }

  .lightbox__img {
    max-width: 96vw;
    max-height: 85vh;
  }
}
