/* ---------------------------------------------------------------
   RARE SIGHT — product image zoom

   A single reusable viewer for every garment shot on the site: the
   collection grid and the homepage spotlight both open into this.
   Same overlay language as chat/promo — scrim + centred panel,
   opacity/visibility transition (never the `hidden` attribute + rAF,
   which silently breaks in a backgrounded tab).
   --------------------------------------------------------------- */

.lightbox { position: fixed; inset: 0; z-index: 4500; }
.lightbox[hidden] { display: none; }

.lightbox__scrim {
  position: absolute; inset: 0;
  background: rgba(10, 10, 10, 0.88);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.lightbox.is-on .lightbox__scrim { opacity: 1; }

.lightbox__panel {
  position: absolute;
  top: 50%; left: 50%;
  width: min(90vw, 760px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);

  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}
.lightbox.is-on .lightbox__panel {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s;
}

.lightbox__close {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 1;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: #ffffff;
  border: 1px solid #eaeaea;
  border-radius: 50%;
  font-size: 20px; line-height: 1;
  color: #111111;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.lightbox__close:hover { background: #f4f4f4; }
.lightbox__close:focus-visible { outline: 2px solid #000000; outline-offset: 2px; }

/* --- viewport ------------------------------------------------------------
   overflow:auto + margin:auto centring (not flex align/justify-center,
   which clips zoomed content instead of letting it scroll into view).
   -------------------------------------------------------------------- */

.lightbox__viewport {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: 3 / 4;
  max-height: 74vh;
  overflow: auto;
  background: #f6f6f6;
  scrollbar-width: thin;
}

.lightbox__img {
  display: block;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  cursor: zoom-in;
  touch-action: pan-x pan-y;
  -webkit-user-drag: none;
  user-select: none;
}
.lightbox__img.is-zoomed {
  max-width: none;
  max-height: none;
  width: 1400px;
  height: auto;
  cursor: grab;
}
.lightbox__img.is-zoomed.is-dragging { cursor: grabbing; }

/* --- foot: hint + front/back toggle --------------------------------------- */

.lightbox__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid #eeeeee;
}

.lightbox__hint {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: #8a8a8a;
}

.lightbox__thumbs { display: flex; gap: 6px; }
.lightbox__thumb {
  padding: 5px 12px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #767676;
  cursor: pointer;
}
.lightbox__thumb:hover { border-color: #000000; color: #111111; }
.lightbox__thumb.is-current { background: #000000; border-color: #000000; color: #ffffff; }

@media (max-width: 460px) {
  .lightbox__panel { width: calc(100vw - 20px); }
  .lightbox__foot { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__scrim, .lightbox__panel { transition: none; }
  .lightbox__img { transition: none; }
}
