/* ============================================================================
   Lightbox Styles - Full-screen Image Viewer
   ============================================================================

   Provides immersive full-screen viewing experience for gallery artwork.

   Features:
   - Full-screen modal overlay with backdrop blur
   - Responsive image display (max 70vh height)
   - Navigation controls (previous/next, keyboard, touch)
   - Metadata display (title, description, counter)
   - Loading states and animations
   - Focus trap for accessibility
   - Smooth transitions and GPU-accelerated animations

   Dependencies: main.css (CSS variables)
   ========================================================================= */

/* ============================================================================
   Container & Overlay
   ========================================================================= */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000; /* Above header (z-index: 100) */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal) ease-in-out;
  background: transparent;
}

/* Hidden state */
.lightbox[hidden],
.lightbox[aria-hidden="true"] {
  display: none;
}

/* Visible state */
.lightbox[aria-hidden="false"] {
  display: flex;
  opacity: 1;
}

/* Semi-transparent overlay with backdrop blur */
.lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 25, 41, 0.95); /* Dark blue with 95% opacity */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer; /* Clicking overlay closes lightbox */
}

/* ============================================================================
   Content Container
   ========================================================================= */

.lightbox__content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: lightboxFadeIn var(--transition-normal) ease-out;
  pointer-events: auto;
}

/* ============================================================================
   Close Button
   ========================================================================= */

.lightbox__close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: var(--color-text-primary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

.lightbox__close:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============================================================================
   Navigation Buttons
   ========================================================================= */

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: transparent;
  font-size: 36px;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  z-index: 10;
  user-select: none;
  padding: 0;
  overflow: hidden;
}

.lightbox__nav::after {
  content: '';
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-text-primary);
  font-size: 32px;
  line-height: 1;
}

.lightbox__nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.1);
}

.lightbox__nav:focus {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.lightbox__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lightbox__nav--prev {
  left: var(--spacing-lg);
}

.lightbox__nav--prev::after {
  content: '‹';
  left: 48%;
}

.lightbox__nav--next {
  right: var(--spacing-lg);
}

.lightbox__nav--next::after {
  content: '›';
  left: 52%;
}

/* ============================================================================
   Image Container
   ========================================================================= */

.lightbox__image-container {
  position: relative;
  width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-md);
}

.lightbox__picture {
  display: block;
  max-width: 100%;
  max-height: 70vh;
}

.lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  width: auto;
  object-fit: contain;
  animation: imageScaleIn var(--transition-slow) ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

/* ============================================================================
   Loading Spinner
   ========================================================================= */

.lightbox__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  opacity: 1;
  transition: opacity var(--transition-fast) ease;
}

.lightbox__loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.lightbox__spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================================================
   Metadata Panel
   ========================================================================= */

.lightbox__metadata {
  text-align: center;
  max-width: 800px;
  padding: 0 var(--spacing-md);
}

.lightbox__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-xs) 0;
}

.lightbox__description {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-sm) 0;
  line-height: 1.6;
}

.lightbox__info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
}

.lightbox__counter {
  display: none; /* Counter hidden per user request */
}

/* ============================================================================
   Animations
   ========================================================================= */

@keyframes lightboxFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes imageScaleIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* ============================================================================
   Responsive Breakpoints
   ========================================================================= */

/* Mobile (<768px) */
@media (max-width: 767px) {
  .lightbox__content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .lightbox__image-container {
    max-height: 60vh;
  }

  .lightbox__picture,
  .lightbox__image {
    max-height: 60vh;
  }

  .lightbox__close {
    width: 40px;
    height: 40px;
    font-size: 20px;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
  }

  .lightbox__nav {
    width: 50px;
    height: 50px;
    font-size: 28px;
    line-height: 50px;
  }

  .lightbox__nav--prev {
    left: var(--spacing-sm);
  }

  .lightbox__nav--next {
    right: var(--spacing-sm);
  }

  .lightbox__title {
    font-size: 1.25rem;
  }

  .lightbox__description {
    font-size: 0.875rem;
  }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .lightbox__image-container {
    max-height: 65vh;
  }

  .lightbox__picture,
  .lightbox__image {
    max-height: 65vh;
  }

  .lightbox__nav {
    width: 55px;
    height: 55px;
    font-size: 32px;
    line-height: 55px;
  }
}

/* ============================================================================
   Accessibility
   ========================================================================= */

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox__content,
  .lightbox__image,
  .lightbox__close,
  .lightbox__nav,
  .lightbox__loading {
    animation: none;
    transition: none;
  }

  .lightbox__spinner {
    animation: none;
    border-top-color: transparent;
    border-right-color: var(--color-accent);
  }

  .lightbox__close:hover {
    transform: none;
  }

  .lightbox__nav:hover:not(:disabled) {
    transform: translateY(-50%);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lightbox__close,
  .lightbox__nav {
    border-width: 3px;
  }

  .lightbox__close:focus,
  .lightbox__nav:focus {
    outline-width: 4px;
  }
}
