/* Gallery Lightbox */

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

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #060d20;
  background-image: radial-gradient(
    ellipse at center,
    rgba(0, 23, 71, 0.55),
    rgba(6, 13, 32, 0.98) 80%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
  overscroll-behavior: contain;
}

.lightbox[aria-hidden="false"],
.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-stage {
  position: relative;
  max-width: min(1280px, 100%);
  max-height: 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
}

.lightbox-image-wrap {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: scale(0.97);
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.5s var(--ease-out);
}

.lightbox-image.is-loaded {
  opacity: 1;
  transform: scale(1);
}

/* Loading spinner */
.lightbox-spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.lightbox-spinner::before {
  content: "";
  width: 38px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold, #c9a962);
  border-radius: 50%;
  animation: lightbox-spin 0.8s linear infinite;
}

.lightbox-image.is-loaded ~ .lightbox-spinner {
  display: none;
}

@keyframes lightbox-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Caption + counter */
.lightbox-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  max-width: 90%;
}

.lightbox-caption {
  font-family: var(--font-display, "Cormorant Garamond", serif);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.005em;
  margin: 0;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
  font-family: var(--font-sans, "DM Sans", sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold, #c9a962);
  opacity: 0.9;
}

/* Buttons (close + nav) */
.lightbox-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition:
    background 0.25s var(--ease),
    border-color 0.25s var(--ease),
    color 0.25s var(--ease),
    transform 0.25s var(--ease-out),
    opacity 0.25s var(--ease);
}

.lightbox-btn svg {
  width: 1.3rem;
  height: 1.3rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible {
  background: var(--gold, #c9a962);
  border-color: var(--gold, #c9a962);
  color: var(--navy, #001747);
  transform: scale(1.06);
  outline: none;
}

.lightbox-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.35);
}

.lightbox-btn[disabled] {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.lightbox-close {
  top: 1.2rem;
  right: 1.2rem;
}

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

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

.lightbox-prev:hover,
.lightbox-prev:focus-visible {
  transform: translateY(-50%) scale(1.06);
}

.lightbox-next:hover,
.lightbox-next:focus-visible {
  transform: translateY(-50%) scale(1.06);
}

/* Thumbnails strip (desktop only) */
.lightbox-thumbs {
  display: none;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.lightbox-thumbs::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  width: 52px;
  height: 36px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  border: 1.5px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.55;
  transition:
    opacity 0.25s var(--ease),
    border-color 0.25s var(--ease),
    transform 0.25s var(--ease-out);
}

.lightbox-thumb:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.lightbox-thumb.is-active {
  opacity: 1;
  border-color: var(--gold, #c9a962);
}

@media (min-width: 900px) {
  .lightbox-thumbs {
    display: flex;
  }
}

/* Body scroll lock + hide floating UI while lightbox is open */
body.lightbox-open {
  overflow: hidden;
}

body.lightbox-open .whatsapp-float,
body.lightbox-open .back-to-top,
body.lightbox-open .cookie-bar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .lightbox {
    padding: 0.6rem;
  }
  .lightbox-stage {
    gap: 0.8rem;
  }
  .lightbox-btn {
    width: 2.55rem;
    height: 2.55rem;
  }
  .lightbox-close {
    top: 0.7rem;
    right: 0.7rem;
  }
  .lightbox-prev {
    left: 0.7rem;
  }
  .lightbox-next {
    right: 0.7rem;
  }
  .lightbox-caption {
    font-size: 1rem;
  }
  .lightbox-counter {
    font-size: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox-image,
  .lightbox-btn {
    transition: none;
  }
}
