/* =========================================================
   GALLERY LIGHTBOX
   ========================================================= */

/* ── Trigger buttons ─────────────────────────────────── */

.lightbox-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  position: relative;
  overflow: hidden;
  border-radius: inherit;
}

.lightbox-trigger img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.lightbox-trigger:hover img,
.lightbox-trigger:focus-visible img {
  transform: scale(1.04);
  filter: brightness(0.88);
}

.lightbox-trigger:focus-visible {
  outline: 2px solid var(--color-violet-soft, #a78bfa);
  outline-offset: 3px;
  border-radius: 4px;
}

.lightbox-trigger__hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 1rem;
  background: linear-gradient(to top, rgba(10, 7, 20, 0.85), transparent);
  color: rgba(240, 236, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.lightbox-trigger:hover .lightbox-trigger__hint,
.lightbox-trigger:focus-visible .lightbox-trigger__hint {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-trigger img,
  .lightbox-trigger__hint {
    transition: none;
  }
}

/* ── Overlay ─────────────────────────────────────────── */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9800;
  background: rgba(4, 2, 12, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

.lightbox-overlay--visible {
  opacity: 1;
  pointer-events: all;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-overlay {
    transition: none;
  }
  .lightbox-overlay__img {
    animation: none !important;
  }
}

/* ── Stage (image area) ──────────────────────────────── */

.lightbox-overlay__stage {
  position: relative;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay__img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 64px rgba(0, 0, 0, 0.8);
  animation: lightbox-img-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes lightbox-img-in {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Controls ────────────────────────────────────────── */

.lightbox-overlay__controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lightbox-overlay__btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(14, 10, 30, 0.8);
  border: 1px solid rgba(127, 58, 247, 0.3);
  border-radius: 50%;
  color: var(--color-foreground, #f0ecff);
  cursor: pointer;
  pointer-events: all;
  transition: background var(--transition, 0.2s ease), border-color var(--transition, 0.2s ease), transform var(--transition, 0.2s ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox-overlay__btn:hover {
  background: rgba(127, 58, 247, 0.35);
  border-color: rgba(127, 58, 247, 0.7);
}

.lightbox-overlay__btn:focus-visible {
  outline: 2px solid var(--color-violet-soft, #a78bfa);
  outline-offset: 3px;
  border-radius: 50%;
}

.lightbox-overlay__btn--close {
  top: -0.75rem;
  right: -0.75rem;
}

.lightbox-overlay__btn--prev {
  top: 50%;
  left: -1.375rem;
  transform: translateY(-50%);
}

.lightbox-overlay__btn--next {
  top: 50%;
  right: -1.375rem;
  transform: translateY(-50%);
}

.lightbox-overlay__btn--prev:hover,
.lightbox-overlay__btn--next:hover {
  transform: translateY(-50%) scale(1.08);
}

.lightbox-overlay__btn--close:hover {
  transform: rotate(90deg);
}

.lightbox-overlay__btn--hidden {
  opacity: 0.2;
  pointer-events: none;
}

.lightbox-overlay__btn svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Caption ─────────────────────────────────────────── */

.lightbox-overlay__caption {
  position: absolute;
  bottom: -2.25rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(168, 158, 192, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Counter ─────────────────────────────────────────── */

.lightbox-overlay__counter {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: rgba(168, 158, 192, 0.7);
  font-weight: 600;
  letter-spacing: 0.06em;
  background: rgba(10, 7, 20, 0.7);
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
}

/* ── Gallery item cursor ─────────────────────────────── */

.gallery-grid__item {
  cursor: zoom-in;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-overlay__btn,
  .lightbox-overlay__btn--prev:hover,
  .lightbox-overlay__btn--next:hover,
  .lightbox-overlay__btn--close:hover {
    transition: none;
    transform: none;
  }
  .lightbox-overlay__btn--prev,
  .lightbox-overlay__btn--next {
    transform: translateY(-50%);
  }
}
