/* Reusable image lightbox — a full-screen <dialog> that shows one image at a
   time with prev/next navigation, dots, and a caption. Theme-neutral (dark
   scrim, light controls) so it can drop onto any product page. Pair with
   /lightbox.js, which builds the markup and exposes window.Lightbox. */
/* Fill the visual viewport via inset:0 rather than 100vw/100vh — the vw/vh
   units include the scrollbar gutter, which pushed the top-right close button
   under the scrollbar and clipped it. inset:0 sizes to the viewport minus
   scrollbars, so the controls stay fully on-screen. */
.lightbox {
  position: fixed; inset: 0;
  width: auto; height: auto;
  margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden;
  color: #fff;
}
.lightbox::backdrop { background: rgba(6, 8, 12, 0.86); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox[open] { animation: lb-fade 160ms ease; }
@keyframes lb-fade { from { opacity: 0; } }

/* Viewport is a two-row grid: the image fills the top, the caption + dots sit
   below. Empty space (and the figure padding) closes on click — see lightbox.js. */
.lb-viewport { position: relative; width: 100%; height: 100%; display: grid; grid-template-rows: 1fr auto; }
.lb-figure {
  margin: 0; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 4vw, 3.5rem);
}
/* Only max-* is set, so the image never upscales past its natural size — it just
   shrinks to fit on smaller viewports. */
.lb-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 6px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  background: #0b0d12; transition: opacity 140ms ease;
}
.lb-img.is-loading { opacity: 0.3; }

.lb-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  padding: 0 1.5rem 1.4rem;
}
.lb-caption {
  margin: 0; text-align: center; max-width: 60ch;
  font: 500 0.85rem/1.45 system-ui, -apple-system, sans-serif;
  color: rgba(255, 255, 255, 0.82); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Round, translucent controls — close (top-right) and prev/next (centered sides). */
.lb-btn {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; padding: 0;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(18, 21, 28, 0.6); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: background 140ms ease, border-color 140ms ease;
}
.lb-btn:hover { background: rgba(40, 44, 54, 0.85); border-color: rgba(255, 255, 255, 0.4); }
.lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-btn svg { width: 1.3rem; height: 1.3rem; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: clamp(0.5rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb-next { right: clamp(0.5rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }

/* A single-image set hides the per-image affordances. */
.lightbox.is-single .lb-prev,
.lightbox.is-single .lb-next,
.lightbox.is-single .lb-dots { display: none; }

.lb-dots { display: flex; justify-content: center; gap: 0.45rem; }
.lb-dot {
  width: 0.5rem; height: 0.5rem; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4); background: transparent; cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.lb-dot:hover { border-color: rgba(255, 255, 255, 0.75); }
.lb-dot.is-active { background: #fff; border-color: #fff; }
.lb-dot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Screen-reader-only live region announcing position. */
.lb-live { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

@media (prefers-reduced-motion: reduce) {
  .lightbox[open] { animation: none; }
  .lb-img { transition: none; }
}
