/* 3D Glass Photo Lens Gallery */

.gallery-section {
  background: #0a0a0a;
  min-height: 100vh;
  padding: 8rem 2rem 4rem;
}

.gallery-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.gallery-header {
  text-align: center;
  margin-bottom: 4rem;
}

.gallery-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  color: #fff;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #fff 0%, #999 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gallery-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  letter-spacing: 0.05em;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
  padding: 2rem 0;
}

/* Gallery Item */
.gallery-item {
  position: relative;
  aspect-ratio: 4 / 5;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover {
  transform: translateY(-8px);
}

/* Canvas Container */
.canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Gallery Item Overlay */
.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Loading State */
.gallery-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

.gallery-item.loaded::before {
  display: none;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Entrance Animations */
.gallery-item {
  opacity: 0;
  transform: translateY(40px);
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .gallery-section {
    padding: 6rem 1rem 3rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .gallery-header {
    margin-bottom: 2rem;
  }

  .gallery-item-overlay {
    padding: 1.5rem;
  }

  .gallery-item-title {
    font-size: 1rem;
  }
}

/* Gallery Modal Lightbox */
.gallery-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-modal.active {
  display: flex;
  opacity: 1;
}

.gallery-modal-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg) scale(1.1);
}

.gallery-modal-content {
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.modal-canvas-container {
  flex: 1;
  width: 100%;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.gallery-modal-info {
  text-align: center;
  padding: 1rem;
}

.modal-title {
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-instructions {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin: 0;
  letter-spacing: 0.05em;
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .gallery-item-overlay,
  .gallery-modal,
  .gallery-modal-close {
    transition: none;
    animation: none;
  }

  .gallery-item {
    opacity: 1;
    transform: none;
  }

  .gallery-item::before {
    animation: none;
  }
}

/* Responsive Modal */
@media (max-width: 768px) {
  .gallery-modal-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .gallery-modal-content {
    width: 95%;
    height: 85vh;
    gap: 1rem;
  }

  .modal-title {
    font-size: 1.5rem;
  }

  .modal-instructions {
    font-size: 0.8rem;
  }
}
