/*
  Modern responsive masonry gallery with CSS Columns
  Features:
  - True masonry layout that adapts to varying image dimensions
  - Responsive column layout for all screen sizes
  - Proper spacing and alignment
  - Smooth hover effects with scale and shadow
  - Aspect ratio preservation (no image distortion)
  - Efficient lazy loading with shimmer effect
  - Smooth fade-in animations
*/

/* --- Modern Masonry Layout using CSS Columns --- */
.gallery {
  column-count: 4;
  column-gap: 1.5rem;
  padding: 0;
  width: 100%;
}

/* Responsive column adjustments */
@media (max-width: 639px) {
  .gallery {
    column-count: 1;
    column-gap: 1rem;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .gallery {
    column-count: 2;
    column-gap: 1.25rem;
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .gallery {
    column-count: 3;
    column-gap: 1.5rem;
  }
}

@media (min-width: 1280px) {
  .gallery {
    column-count: 4;
    column-gap: 1.5rem;
  }
}

/* Gallery item container */
.gallery-item {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: inline-block;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 1.5rem;
}

@media (max-width: 639px) {
  .gallery-item {
    margin-bottom: 1rem;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .gallery-item {
    margin-bottom: 1.25rem;
  }
}

/* Hover effects */
.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 191, 166, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

.gallery-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 43, 91, 0.3) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  pointer-events: none;
  border-radius: 1rem;
}

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

/* Image styling - maintains natural aspect ratio */
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
  border-radius: 1rem;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Reveal animation integration */
.gallery-item.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.gallery-item.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Focus state for accessibility */
.gallery-item:focus {
  outline: 2px solid rgba(0, 191, 166, 0.8);
  outline-offset: 4px;
}

