/* ─── Apex Lightbox ────────────────────────────────────────────────── */
.apex-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
.apex-lightbox.is-open {
  display: flex;
}

.apex-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.apex-lightbox__frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(92vw, 640px);
  max-height: 90dvh;
  z-index: 1;
}

/* Gallery mode only (multi-image albums, e.g. shop/gallery-category.html) —
   a larger frame than the default product-photo lightbox above, which is
   deliberately kept untouched for existing product-page callers that never
   set this modifier class. */
.apex-lightbox--gallery .apex-lightbox__frame {
  max-width: min(94vw, 1100px);
}

.apex-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 90dvh;
  width: auto;
  height: auto;
  border-radius: 0.75rem;
  object-fit: contain;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  opacity: 1;
  transition: opacity 0.18s ease;
}
.apex-lightbox__img.is-switching {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .apex-lightbox__img {
    transition: none;
  }
}

.apex-lightbox__close {
  position: absolute;
  top: -0.625rem;
  right: -0.625rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #111827;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, color 0.15s;
  z-index: 2;
  flex-shrink: 0;
}
.apex-lightbox__close:hover {
  background: var(--accent, #7a1528);
  color: #fff;
}

/* Prevent body scroll while lightbox is open */
.apex-lightbox-open {
  overflow: hidden;
}

/* ── Album navigation (prev/next/counter) — hidden by default, shown only
   when APEX_LIGHTBOX.open() is given more than one image (see js/lightbox.js).
   Product-page single-image opens never show these. ──────────────────── */
.apex-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: background 0.15s, color 0.15s;
  z-index: 2;
}
.apex-lightbox__nav:hover {
  background: var(--accent, #7a1528);
  color: #fff;
}
.apex-lightbox__nav--prev {
  left: -0.5rem;
}
.apex-lightbox__nav--next {
  right: -0.5rem;
}
@media (max-width: 640px) {
  .apex-lightbox__nav {
    width: 2.35rem;
    height: 2.35rem;
  }
  .apex-lightbox__nav--prev {
    left: 0.35rem;
  }
  .apex-lightbox__nav--next {
    right: 0.35rem;
  }
}
.apex-lightbox__nav[hidden],
.apex-lightbox__counter[hidden] {
  display: none;
}

.apex-lightbox__counter {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  z-index: 2;
  white-space: nowrap;
}

/* Local SEO caption / "Shop this item" link — optional, per-image (see
   data/gallery.json's caption/shopUrl/shopLabel fields, wired through
   js/gallery.js -> js/lightbox.js). Overlays the bottom of the image
   itself as a gradient bar, same "dark scrim, white text" treatment as
   the counter pill above, so it never collides with the counter (which
   stays positioned below the frame). Hidden by default/[hidden] — every
   image without this metadata renders exactly as before. */
.apex-lightbox__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem 1rem 0.85rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  border-radius: 0 0 0.75rem 0.75rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}
.apex-lightbox__caption[hidden] {
  display: none;
}
.apex-lightbox__caption-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #fff;
  max-width: 34rem;
}
.apex-lightbox__caption-text[hidden] {
  display: none;
}
.apex-lightbox__shop-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent, #7a1528);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.apex-lightbox__shop-link:hover {
  background: var(--accent-dark, #5c0f1e);
}
.apex-lightbox__shop-link[hidden] {
  display: none;
}

/* Zoom cursor hint on product card images */
img.bouquet-set__photo,
img[data-lightbox] {
  cursor: zoom-in;
}

/* Deter the normal browser save/share/context-menu experience on the
   enlarged image too, when opened from a source that opted in via
   data-lightbox-protect (Gallery/Colour Chart — see js/lightbox.js,
   js/protect-images.js). Scoped to the --protected modifier only, so every
   other lightbox use (product-page photos) is completely unaffected. */
.apex-lightbox--protected .apex-lightbox__img {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
