/* ═══════════════════════════════════════════════════════════════════
   La Valette Boutique — fullscreen image lightbox
   Reuses existing design tokens. Zero copy changes.
   ═══════════════════════════════════════════════════════════════════ */

.lbx-root {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: none;                       /* toggled to flex when active */
  align-items: center;
  justify-content: center;
  background: rgba(14, 14, 14, 0);     /* fade-in target: 0.94 */
  transition: background 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  -webkit-tap-highlight-color: transparent;
}
.lbx-root.lbx-active   { display: flex; }
.lbx-root.lbx-visible  { background: rgba(14, 14, 14, 0.94); }

/* Scroll lock is applied via JS (overflow:hidden + touchmove prevention).
   No CSS body positioning — see lightbox.js scrollLock. */

/* ─── STAGE (viewport) ─────────────────────────────────────────── */
.lbx-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;                      /* mobile viewport aware */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ─── IMAGE ────────────────────────────────────────────────────── */
.lbx-image-wrap {
  position: relative;
  max-width: min(92vw, 1600px);
  max-height: calc(100dvh - 140px);    /* leaves room for caption + chrome */
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.985);              /* subtle scale-in */
  opacity: 0;
  transition: transform 480ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 320ms ease-out;
}
.lbx-root.lbx-visible .lbx-image-wrap {
  transform: scale(1);
  opacity: 1;
}
.lbx-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), 0 4px 20px rgba(0, 0, 0, 0.25);
  background: #111;
  /* When swapping between images we fade with a short transition */
  opacity: 1;
  transition: opacity 220ms ease;
}
.lbx-image.lbx-swapping { opacity: 0.35; }

/* ─── LOADING STATE (thin dash of light) ───────────────────────── */
.lbx-loader {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background: rgba(255,255,255,0.4);
  opacity: 0;
  transition: opacity 220ms ease;
}
.lbx-loader.lbx-show { opacity: 1; animation: lbxPulse 1.2s ease-in-out infinite; }
@keyframes lbxPulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.9; }
}

/* ─── CAPTION ──────────────────────────────────────────────────── */
.lbx-caption {
  position: absolute;
  left: 50%;
  bottom: max(env(safe-area-inset-bottom, 0), 24px);
  transform: translateX(-50%);
  max-width: min(80vw, 720px);
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font, 'Manrope', sans-serif);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 320ms ease 100ms;
}
.lbx-root.lbx-visible .lbx-caption { opacity: 1; }
.lbx-caption-title {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

/* ─── COUNTER (top-centre, ultra-minimal) ──────────────────────── */
.lbx-counter {
  position: absolute;
  top: max(env(safe-area-inset-top, 0), 24px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font, 'Manrope', sans-serif);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity 320ms ease 100ms;
}
.lbx-root.lbx-visible .lbx-counter { opacity: 1; }

/* ─── CHROME BUTTONS (close, prev, next) ───────────────────────── */
.lbx-btn {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  cursor: pointer;
  transition: background 240ms ease, transform 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 320ms ease 100ms;
  opacity: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lbx-root.lbx-visible .lbx-btn { opacity: 1; }
.lbx-btn:hover { background: rgba(255, 255, 255, 0.16); }
.lbx-btn:active { transform: scale(0.94); }
.lbx-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}
.lbx-btn svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  pointer-events: none;
}
.lbx-btn:disabled { opacity: 0.3; cursor: default; }
.lbx-root.lbx-visible .lbx-btn:disabled { opacity: 0.3; }

.lbx-close {
  top: max(env(safe-area-inset-top, 0), 20px);
  right: max(env(safe-area-inset-right, 0), 20px);
}
.lbx-prev {
  top: 50%;
  left: max(env(safe-area-inset-left, 0), 20px);
  transform: translateY(-50%);
}
.lbx-next {
  top: 50%;
  right: max(env(safe-area-inset-right, 0), 20px);
  transform: translateY(-50%);
}
.lbx-prev:active, .lbx-next:active { transform: translateY(-50%) scale(0.94); }

/* ─── MOBILE ADJUSTMENTS ───────────────────────────────────────── */
@media (max-width: 640px) {
  .lbx-image-wrap {
    max-width: 100vw;
    max-height: calc(100dvh - 160px);
  }
  .lbx-btn { width: 42px; height: 42px; }
  .lbx-btn svg { width: 18px; height: 18px; }
  .lbx-prev, .lbx-next {
    top: auto;
    bottom: max(env(safe-area-inset-bottom, 0), 80px);
    transform: none;
  }
  .lbx-prev { left: 20px; }
  .lbx-next { right: 20px; }
  .lbx-prev:active, .lbx-next:active { transform: scale(0.94); }
  .lbx-caption {
    font-size: 11px;
    max-width: 90vw;
    bottom: max(env(safe-area-inset-bottom, 0), 20px);
  }
  .lbx-counter { top: 16px; font-size: 9px; }
}

/* ─── STAY CARD — role="button" on a <div> ──────────────────────
   The card is a <div class="stay-card" role="button"> so we keep the
   original layout and hover CSS intact, and merely add a focus-visible
   outline for keyboard users. All existing .stay-card hover animations
   (transform, border-color, image scale, link underline) apply unchanged.
   The nested "View accommodation" <a> element retains its native link
   behaviour so the internal SEO link is preserved. */
.stay-card[role="button"] {
  cursor: pointer;
}
.stay-card[role="button"]:focus-visible {
  outline: 2px solid var(--sage, #8B8E70);
  outline-offset: 4px;
  border-radius: var(--r-md, 4px);
}
/* The nested SEO link still needs its own focus indicator */
.stay-card .stay-link:focus-visible {
  outline: 2px solid var(--sage, #8B8E70);
  outline-offset: 3px;
}

/* ─── REDUCED MOTION ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .lbx-root,
  .lbx-image-wrap,
  .lbx-caption,
  .lbx-counter,
  .lbx-btn,
  .lbx-image { transition: none !important; }
  .lbx-loader { animation: none; }
}
