/* =====================================================
   Lightbox Fullscreen Gallery Styles
   ===================================================== */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: var(--z-lightbox);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

.lightbox.active .lightbox-img {
  transform: scale(1);
  opacity: 1;
}

/* Image transition animation */
.lightbox-img.transitioning {
  animation: imageTransition 0.4s ease-out;
}

@keyframes imageTransition {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========== Close Button ========== */
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 3rem;
  font-weight: 300;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.3s ease;
  line-height: 1;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  z-index: 10;
}

.lightbox-close:hover {
  opacity: 1;
  color: var(--primary-red);
  transform: rotate(90deg);
  background: rgba(255, 255, 255, 0.1);
}

/* ========== Navigation Buttons ========== */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-primary);
  font-size: 2rem;
  cursor: pointer;
  padding: 1.2rem 1.5rem;
  transition: all 0.3s ease;
  border-radius: 4px;
  opacity: 0.7;
  z-index: 10;
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

.lightbox-nav:hover {
  background: var(--primary-red);
  color: var(--text-primary);
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.95);
}

/* ========== Counter ========== */
.lightbox-counter {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 2px;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
}

.lightbox-counter span {
  color: var(--primary-red);
  font-weight: 700;
}

/* ========== Caption ========== */
.lightbox-caption {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active .lightbox-caption {
  opacity: 1;
}

.lightbox-caption .caption-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.lightbox-caption .caption-location {
  font-size: 0.95rem;
  color: var(--silver);
}

/* ========== Keyboard Hints ========== */
.lightbox::before {
  content: 'ESC to close • ← → to navigate';
  position: absolute;
  top: 1.5rem;
  left: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active::before {
  opacity: 0.6;
}

/* ========== Image Loading State ========== */
.lightbox-img.loading {
  opacity: 0;
}

.lightbox-img.loaded {
  opacity: 1;
}

/* ========== Swipe Indicator ========== */
.swipe-indicator {
  position: absolute;
  bottom: 8rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active .swipe-indicator {
  opacity: 0.5;
}

.swipe-icon {
  font-size: 1.2rem;
  animation: swipeHint 1.5s ease-in-out infinite;
}

@keyframes swipeHint {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

/* ========== Lightbox Animations ========== */
@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox.active .lightbox-content {
  animation: lightboxZoomIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========== Progress Bar ========== */
.lightbox-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.lightbox-progress-bar {
  height: 100%;
  background: var(--primary-red);
  width: 0;
  transition: width 0.3s ease;
}

/* ========== Zoom Feature ========== */
.lightbox-img.zoomable {
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.lightbox-img.zoomable.zoomed {
  cursor: zoom-out;
  transform: scale(1.5);
}

/* ========== Dark Mode Considerations ========== */
@media (prefers-color-scheme: dark) {
  .lightbox {
    background: rgba(0, 0, 0, 0.97);
  }
}

/* ========== Focus Styles for Accessibility ========== */
.lightbox-close:focus,
.lightbox-nav:focus {
  outline: 2px solid var(--primary-red);
  outline-offset: 3px;
}

/* Hide focus outline for mouse users */
.lightbox-close:focus:not(:focus-visible),
.lightbox-nav:focus:not(:focus-visible) {
  outline: none;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 2px solid var(--primary-red);
  outline-offset: 3px;
}