/**
 * Modern Gallery Grid Styles 
 */

.modern-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-gap: 20px;
  grid-auto-flow: dense;
  margin: 30px 0;
}

/* Make certain items span 2 columns or rows for visual interest */
.modern-gallery-grid .gallery-item:nth-child(4n + 1) {
  grid-column: span 2;
  grid-row: span 1;
}

.modern-gallery-grid .gallery-item:nth-child(8n) {
  grid-column: span 1;
  grid-row: span 2;
}

/* Gallery item styling */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  background-color: #f5f5f5; /* Light background for images that fail to load */
  min-height: 200px;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.gallery-item a {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

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

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

/* Overlay styling */
.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  padding: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
}

/* Fix for Fancybox */
.fancybox__container {
  --fancybox-bg: rgba(24, 24, 27, 0.95);
}

.fancybox__image {
  background-color: white;
}

/* Media queries for responsive layout */
@media (max-width: 768px) {
  .modern-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    grid-gap: 15px;
  }

  .modern-gallery-grid .gallery-item:nth-child(4n + 1),
  .modern-gallery-grid .gallery-item:nth-child(8n) {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 480px) {
  .modern-gallery-grid {
    grid-template-columns: 1fr 1fr;
    grid-gap: 10px;
  }
}
