/* ============================================
   IMAGE GALLERY & LIGHTBOX STYLES
   ============================================ */

/* Gallery Grid Layout */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  background: #f8f9fa;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.1);
}

/* Gallery overlay */
.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(15, 28, 63, 0.8),
    rgba(203, 163, 77, 0.8)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay::before {
  content: '🔍';
  font-size: 2rem;
  margin-right: 0.5rem;
}

/* Masonry Layout */
.gallery-masonry {
  column-count: 3;
  column-gap: 1.5rem;
  padding: 2rem 0;
}

.gallery-masonry .gallery-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
  display: inline-block;
  width: 100%;
}

.gallery-masonry .gallery-item img {
  height: auto;
  min-height: 200px;
}

/* Lightbox Styles */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.lightbox.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 1.1rem;
  max-width: 600px;
}

/* Lightbox Controls */
.lightbox-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox-controls:hover {
  background: rgba(203, 163, 77, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 2rem;
}

.lightbox-next {
  right: 2rem;
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.lightbox-close:hover {
  background: rgba(255, 0, 0, 0.8);
  transform: scale(1.1);
}

/* Lightbox Navigation */
.lightbox-nav {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}

.lightbox-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.lightbox-dot.active {
  background: #CBA34D;
  transform: scale(1.2);
}

/* Image Reveal Animations */
.image-reveal {
  overflow: hidden;
  position: relative;
}

.image-reveal::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: reveal 2s ease-in-out;
  z-index: 1;
}

@keyframes reveal {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Curtain Reveal */
.curtain-reveal {
  position: relative;
  overflow: hidden;
}

.curtain-reveal::before,
.curtain-reveal::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: #0F1C3F;
  z-index: 1;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.curtain-reveal::before {
  left: 0;
  transform: translateX(0);
}

.curtain-reveal::after {
  right: 0;
  transform: translateX(0);
}

.curtain-reveal.revealed::before {
  transform: translateX(-100%);
}

.curtain-reveal.revealed::after {
  transform: translateX(100%);
}

/* Zoom Reveal */
.zoom-reveal {
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-reveal.revealed {
  transform: scale(1);
  opacity: 1;
}

/* Slide Reveal */
.slide-reveal {
  transform: translateX(-50px);
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-reveal.revealed {
  transform: translateX(0);
  opacity: 1;
}

/* Instagram-style Feed */
.instagram-feed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  padding: 2rem 0;
}

.instagram-item {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.instagram-item:hover {
  transform: scale(1.05);
}

.instagram-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.instagram-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.instagram-item:hover .instagram-overlay {
  opacity: 1;
}

.instagram-overlay span {
  color: white;
  font-size: 1.5rem;
}

/* Before/After Slider */
.before-after-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.before-after-slider {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
}

.before-after-slider img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.before-after-slider .after-image {
  clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%);
  transition: clip-path 0.3s ease;
}

.slider-handle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 4px;
  height: 100%;
  background: #CBA34D;
  cursor: ew-resize;
  z-index: 2;
  transform: translateX(-50%);
}

.slider-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: #CBA34D;
  border: 3px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.slider-handle::after {
  content: '⟷';
  position: absolute;
  top: 50%;
  left: 50%;
  color: white;
  font-size: 12px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
  }
  
  .gallery-masonry {
    column-count: 2;
    column-gap: 1rem;
  }
  
  .lightbox-controls {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
  
  .lightbox-prev {
    left: 1rem;
  }
  
  .lightbox-next {
    right: 1rem;
  }
  
  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  
  .instagram-feed {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .gallery-masonry {
    column-count: 1;
  }
  
  .instagram-feed {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Loading States */
.gallery-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  color: #666;
}

.gallery-loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #CBA34D;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 1rem;
}

/* Error States */
.gallery-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #666;
  text-align: center;
}

.gallery-error::before {
  content: '⚠️';
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Accessibility */
.lightbox:focus {
  outline: 2px solid #CBA34D;
  outline-offset: 2px;
}

.gallery-item:focus {
  outline: 2px solid #CBA34D;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gallery-overlay {
    background: rgba(0, 0, 0, 0.9);
  }
  
  .lightbox {
    background: rgba(0, 0, 0, 1);
  }
}
