/* Image Optimization and Gallery Styles */

/* Lazy Loading */
.lazy {
  opacity: 0;
  transition: opacity 0.3s;
}

.lazy.loaded {
  opacity: 1;
}

/* Image loading placeholder */
.lazy:not(.loaded) {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

/* Gallery Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.image-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
}

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

.modal-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);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.modal-nav {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.modal-prev,
.modal-next {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 1.5rem;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.modal-prev:hover,
.modal-next:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.modal-caption {
  margin-top: 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  max-width: 600px;
}

/* Enhanced Gallery Images */
.photo-item img,
.gallery-image {
  transition: all 0.3s ease;
  cursor: pointer;
}

.photo-item:hover img,
.gallery-image:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* Performance optimizations */
@media (max-width: 768px) {
  .modal-content {
    padding: 1rem;
  }
  
  .modal-image {
    max-width: 95%;
    max-height: 75%;
  }
  
  .modal-close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  
  .modal-nav {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* WebP Support */
.webp-support .photo-item img[data-webp] {
  content: attr(data-webp);
}
