/* Gallery Masonry Grid Styles */
.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: 200px;
  gap: 1rem;
  padding: 0;
}

/* Base gallery item */
.gallery-item {
  position: relative;
  cursor: pointer;
  border: none;
  padding: 0;
  background: transparent;
}

/* Different sizes for dynamic layout */
.gallery-item-small {
  grid-row: span 1;
  grid-column: span 1;
}

.gallery-item-medium {
  grid-row: span 2;
  grid-column: span 1;
}

.gallery-item-large {
  grid-row: span 2;
  grid-column: span 1;
}

.gallery-item-wide {
  grid-row: span 1;
  grid-column: span 1;
}

/* Responsive adjustments */
@media (min-width: 640px) {
  .gallery-masonry {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 768px) {
  .gallery-masonry {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .gallery-item-wide {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .gallery-masonry {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }

  .gallery-item-large {
    grid-row: span 2;
    grid-column: span 2;
  }

  .gallery-item-wide {
    grid-column: span 2;
    grid-row: span 1;
  }
}

@media (min-width: 1280px) {
  .gallery-masonry {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Ensure images maintain aspect ratio and fill container */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Hover effects */
.gallery-item:hover {
  z-index: 10;
}

/* Animation improvements */
.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item:focus {
  outline: none;
}

.gallery-item:focus-visible {
  outline: 4px solid rgba(220, 38, 38, 0.5);
  outline-offset: 2px;
}
