/* ============================================================
   Lightbox — site-wide image zoom utility
   Markup contract:
     <a href="full.webp" data-lightbox data-caption="optional"
        class="lightbox-trigger">
       <img src="thumb.webp" alt="..." />
     </a>
   ============================================================ */

.lightbox-trigger {
  display: inline-block;
  position: relative;
  cursor: zoom-in;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(255, 255, 255, 0.06);
}

.lightbox-trigger:hover,
.lightbox-trigger:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px -10px rgba(0, 0, 0, 0.7),
              0 0 0 1px rgba(0, 255, 255, 0.4);
  outline: none;
}

.lightbox-trigger img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-trigger:hover img {
  transform: scale(1.02);
}

.lightbox-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.lightbox-trigger .lightbox-hint {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(0, 255, 255, 0.35);
  color: #00ffff;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

/* ===== Overlay ===== */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-stage {
  position: relative;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  transform: scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-overlay.is-open .lightbox-stage {
  transform: scale(1);
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  cursor: zoom-out;
}

.lightbox-caption {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.875rem;
  text-align: center;
  max-width: 60ch;
  line-height: 1.5;
}

.lightbox-close {
  position: fixed;
  top: clamp(0.75rem, 2vw, 1.5rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  z-index: 1;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: rgba(0, 255, 255, 0.15);
  border-color: rgba(0, 255, 255, 0.6);
  transform: rotate(90deg);
  outline: none;
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

/* Body lock when open */
body.lightbox-open {
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lightbox-trigger,
  .lightbox-trigger img,
  .lightbox-overlay,
  .lightbox-stage,
  .lightbox-close {
    transition: none !important;
  }
  .lightbox-trigger:hover img,
  .lightbox-trigger:hover,
  .lightbox-trigger:focus-visible {
    transform: none;
  }
}
