/* ============================================================
   Casa Tequila Prime — Photo Lightbox (reusable)
   Pairs with assets/js/photo-lightbox.js. Self-contained: does not
   touch style.css. Uses only existing design tokens (colors, fonts,
   easing) — no new tokens added.

   TO REMOVE: see the header comment in photo-lightbox.js.
   ============================================================ */

body.photo-lightbox-open { overflow: hidden; }

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.photo-lightbox[hidden] { display: none; }

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8,8,6,.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .35s var(--ease-out);
}
.photo-lightbox.is-open .photo-lightbox-backdrop { opacity: 1; }

.photo-lightbox-figure {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: scale(.97);
  transition: opacity .35s var(--ease-out), transform .35s var(--ease-out);
}
.photo-lightbox.is-open .photo-lightbox-figure { opacity: 1; transform: scale(1); }

/* width/height auto + object-fit:contain is the whole fix for "full
   image, original proportions, no stretch or crop" — the browser
   sizes the image from its own intrinsic ratio, never a forced box. */
.photo-lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}

.photo-lightbox-caption {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  text-align: center;
}
.photo-lightbox-caption:empty { display: none; }

.photo-lightbox-close,
.photo-lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  z-index: 2;
  width: 40px;
  height: 40px;
  color: var(--ivory);
  background: rgba(8,8,6,.5);
  border: 1px solid rgba(245,240,232,.25);
  border-radius: 50%;
  transition: color .3s ease, border-color .3s ease, transform .3s ease;
}
.photo-lightbox-close:hover, .photo-lightbox-close:focus-visible,
.photo-lightbox-nav:hover, .photo-lightbox-nav:focus-visible {
  color: var(--gold); border-color: var(--gold);
}
.photo-lightbox-close { top: 20px; right: 20px; }
.photo-lightbox-close:hover, .photo-lightbox-close:focus-visible { transform: rotate(90deg); }
.photo-lightbox-close svg { width: 16px; height: 16px; }

.photo-lightbox-nav svg { width: 18px; height: 18px; }
.photo-lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.photo-lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }
.photo-lightbox-prev:hover, .photo-lightbox-prev:focus-visible { transform: translateY(-50%) translateX(-3px); }
.photo-lightbox-next:hover, .photo-lightbox-next:focus-visible { transform: translateY(-50%) translateX(3px); }
.photo-lightbox-nav[hidden] { display: none; }

@media (max-width: 600px) {
  .photo-lightbox { padding: 14px; }
  .photo-lightbox-close { top: 10px; right: 10px; width: 36px; height: 36px; }
  .photo-lightbox-close svg { width: 14px; height: 14px; }
  .photo-lightbox-prev { left: 6px; }
  .photo-lightbox-next { right: 6px; }
  .photo-lightbox-nav { width: 36px; height: 36px; }
  .photo-lightbox-img { max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); }
}

/* --- Interactive affordance on the existing photo containers ----- */
/* No cursor:pointer here on purpose — .gallery-full-item and
   .fmi-card-img already run the sitewide custom cursor (cursor:none +
   a dot/ring in main.js's initCursor()); see the hoverTargets entry
   added there, which enlarges the ring on hover same as any other
   clickable card. Native pointer would fight that, not reinforce it. */
.photo-lightbox-trigger { outline-offset: 2px; }
.photo-lightbox-trigger:focus-visible { outline: 2px solid var(--gold); }

.photo-lightbox-cue {
  position: absolute;
  z-index: 2;
  bottom: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,8,6,.55);
  border: 1px solid rgba(245,240,232,.3);
  border-radius: 50%;
  color: var(--ivory);
  opacity: 0;
  transform: scale(.85);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.photo-lightbox-cue svg { width: 14px; height: 14px; }
.photo-lightbox-trigger:hover .photo-lightbox-cue,
.photo-lightbox-trigger:focus-visible .photo-lightbox-cue { opacity: 1; transform: scale(1); }

/* Touch has no hover state to reveal the cue, so it shows at a
   reduced-but-visible baseline opacity always — the same "this photo
   is interactive" signal, just always-on instead of hover-triggered. */
@media (hover: none), (pointer: coarse) {
  .photo-lightbox-cue { opacity: .85; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .photo-lightbox-backdrop,
  .photo-lightbox-figure,
  .photo-lightbox-cue { transition: opacity .01s linear; }
  .photo-lightbox-figure { transform: none; }
}
