/* Gallery-specific styles */
.gallery-header {
  padding: 8rem 2rem 4rem;
  text-align: center;
  background: #fafafa;
}

.gallery-header h1 {
  font-family: "Playfair Display", serif;
  font-size: 3.5rem;
  font-weight: 400;
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.gallery-header p {
  font-size: 1.2rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
}

/* Filter Controls */
.filter-container {
  padding: 2rem 1rem;
  text-align: center;
  background: white;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 60px; /* Below navbar */
  z-index: 100;
}

.filter-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: 800px;
  margin: 0 auto;
}

.filter-btn {
  padding: 0.9rem 1.5rem;
  background: transparent;
  border: 2px solid #ddd;
  color: #666;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  min-height: 44px; /* Touch-friendly */
  border-radius: 4px;
}

.filter-btn:hover {
  border-color: #1a1a1a;
  color: #1a1a1a;
}

.filter-btn:active {
  transform: scale(0.97);
}

.filter-btn.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: white;
}

/* Gallery Container - Clean Grid Layout */
.gallery-container {
  padding: 4rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  width: 100%;
}

/* Gallery Item */
.gallery-item {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  height: 300px;
}

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

/* Image styling - Fixed aspect ratio for consistency */
.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
  .masonry-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }

  .gallery-item {
    height: 280px;
  }
}

@media (max-width: 768px) {
  .gallery-container {
    padding: 2rem 1rem;
  }

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

  .gallery-item {
    height: 280px;
    width: 100%;
    margin: 0 auto;
    border-radius: 6px;
  }

  .gallery-header {
    padding: 7rem 1rem 2rem;
  }

  .gallery-header h1 {
    font-size: 2.2rem;
  }

  .gallery-header p {
    font-size: 1rem;
  }

  .filter-container {
    padding: 1rem 0.5rem;
    top: 56px;
  }

  .filter-buttons {
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  .filter-buttons::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .filter-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Smoother mobile scrolling */
  .gallery-container {
    -webkit-overflow-scrolling: touch;
  }

  /* Reduce hover effects on mobile for better performance */
  .gallery-item:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  .gallery-item:hover img {
    transform: none;
  }
}

@media (max-width: 480px) {
  .gallery-container {
    padding: 2rem 0.5rem;
  }

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

  .gallery-item {
    height: 220px;
  }
}

/* Hide/show for filtering */
.gallery-item.hide {
  display: none;
}

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

.lightbox.active {
  display: flex;
  opacity: 1;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  margin: auto;
}

.lightbox.active {
  touch-action: none;
}

.lightbox img {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  will-change: transform;
  transform-origin: center center;
}

.lightbox-close {
  position: fixed; /* Changed from absolute */
  top: 20px; /* Changed from -40px */
  right: 20px; /* Changed from 0 */
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5); /* Added background for better visibility */
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  z-index: 2001;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  font-size: 2rem;
  padding: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
  z-index: 2001;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
  left: -80px;
}

.lightbox-next {
  right: -80px;
}

/* Mobile lightbox adjustments */
@media (max-width: 768px) {
  .lightbox-close {
    top: 12px;
    right: 12px;
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
  }

  .lightbox-nav {
    font-size: 1.8rem;
    padding: 0;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .lightbox-content {
    max-width: 95vw;
    max-height: 85vh;
  }

  .lightbox img {
    max-height: 80vh;
  }
}

/* Swipe hint for mobile */
@media (max-width: 768px) {
  .lightbox::after {
    content: "Swipe to navigate";
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: fadeOut 3s forwards;
    animation-delay: 2s;
    pointer-events: none;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

/* Loading animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth gallery item animations */
.gallery-item {
  animation: fadeInUp 0.6s ease forwards;
}
