/**
 * Lightbox CSS - Full-screen image viewer with pinch-to-zoom
 * Vanilla CSS, no dependencies
 * Updated to use consistent border radius design tokens
 */

/* Design tokens imported from main.css */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

/* Lightbox overlay - hidden by default */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox.visible {
  opacity: 1;
}

/* Close button - top right - keep circular */
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%; /* Circular button */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: all 0.2s ease;
  color: white;
  font-size: 24px;
  line-height: 1;
  padding: 0;
  backdrop-filter: blur(10px);
}

.lightbox__close:hover,
.lightbox__close:focus {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
  outline: none;
}

.lightbox__close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Image container - handles touch/zoom */
.lightbox__container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none; /* Disable browser zoom gestures */
  user-select: none;
}

/* The actual image - soft rounded corners */
.lightbox__image {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: grab;
  transition: opacity 0.3s ease;
  transform-origin: center center;
  will-change: transform;
  border-radius: var(--radius-md); /* Soft rounded corners */
}

.lightbox__image.loading {
  opacity: 0;
}

.lightbox__image.loaded {
  opacity: 1;
}

.lightbox__image.zoomed {
  cursor: grab;
}

.lightbox__image.dragging {
  cursor: grabbing;
}

/* Loading spinner */
.lightbox__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 18px;
  display: none;
  align-items: center;
  gap: 12px;
}

.lightbox__loading.active {
  display: flex;
}

.lightbox__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%; /* Circular spinner */
  animation: spin 0.8s linear infinite;
}

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

/* Navigation arrows - keep circular */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%; /* Circular buttons */
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: all 0.2s ease;
  color: white;
  font-size: 20px;
  backdrop-filter: blur(10px);
}

.lightbox__nav:hover,
.lightbox__nav:focus {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-50%) scale(1.1);
  outline: none;
}

.lightbox__nav.active {
  display: flex;
}

.lightbox__nav--prev {
  left: 20px;
}

.lightbox__nav--next {
  right: 20px;
}

/* Caption/title - soft rounded */
.lightbox__caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: var(--radius-md); /* Soft rounded corners */
  text-align: center;
  font-size: 16px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

/* Zoom indicator - soft rounded */
.lightbox__zoom-hint {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: var(--radius-sm); /* Small rounded corners */
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.lightbox__zoom-hint.visible {
  opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .lightbox__close {
    top: 10px;
    right: 10px;
  }
  
  .lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .lightbox__nav--prev {
    left: 10px;
  }
  
  .lightbox__nav--next {
    right: 10px;
  }
  
  .lightbox__caption {
    font-size: 14px;
    padding: 10px 20px;
    bottom: 10px;
  }
  
  .lightbox__image {
    max-width: 95vw;
    max-height: 95vh;
  }
}

/* Accessibility - hide scrollbar when lightbox open */
body.lightbox-open {
  overflow: hidden;
  touch-action: none;
}

/* Focus trap styling */
.lightbox:focus {
  outline: none;
}
