/* public/garages/photo-lightbox.css */
/**
 * photo-lightbox.css — Styles for the shared full-screen photo viewer.
 *
 * The lightbox is intentionally theme-independent. Full-screen photo
 * viewers are always dark, on every platform and in every theme, because
 * the dark surface is what makes the photograph readable. This file does
 * not reference --gd-* variables and does not respond to data-theme.
 *
 * Class hierarchy produced by photo-lightbox.js:
 *   .gd-lightbox             — the fixed full-screen overlay (backdrop)
 *   .gd-lightbox__close      — the circular close button, top-right
 *   .gd-lightbox__image      — the photograph
 *   .gd-lightbox__error      — plain-text fallback when the image fails
 */

/* ─── Root overlay (backdrop) ─────────────────────────────────────────── */

.gd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 4500;                     /* above details overlay (3000), below chat lightbox (5000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;                   /* clicks on the backdrop close the lightbox */
  animation: gd-lightbox-fade-in 0.15s ease-out both;
  -webkit-tap-highlight-color: transparent;
}

@keyframes gd-lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Image ───────────────────────────────────────────────────────────── */

.gd-lightbox__image {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  cursor: default;                   /* the image itself is not a close target */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  background: #111827;               /* subtle backing so transparent PNGs are visible */
}

/* ─── Close button ────────────────────────────────────────────────────── */

.gd-lightbox__close {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: calc(22px + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.15s ease-out, transform 0.15s ease-out;
  z-index: 1;                        /* above the image */
}

.gd-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.gd-lightbox__close:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.32);
}

.gd-lightbox__close:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

/* ─── Error fallback ──────────────────────────────────────────────────── */

.gd-lightbox__error {
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  padding: 24px;
  max-width: 320px;
}

/* ─── Reduced motion ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .gd-lightbox {
    animation: none;
  }
  .gd-lightbox__close {
    transition: none;
  }
  .gd-lightbox__close:active {
    transform: none;
  }
}

/* ─── Small viewports ─────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .gd-lightbox {
    padding: 12px;
  }
  .gd-lightbox__image {
    max-width: 96vw;
    max-height: 82vh;
  }
  .gd-lightbox__close {
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
}