/*
  This CSS is structured to correctly display the images in rows
  while keeping them centered on the page.
*/

/* 1. Global Container Centering */
.gallery-container {
  max-width: 1200px;
  margin: 0 auto; /* This centers the container on the page */
  padding: 20px;
  font-family: Arial, sans-serif;
}

/* 2. Titles and Sections */
.page-title {
  text-align: center;
  font-size: 2.5em;
  color: #333;
  margin-bottom: 40px;
  border-bottom: 2px solid #ccc;
  padding-bottom: 15px;
}

.gallery-section {
  margin-bottom: 40px;
}

.section-title {
  text-align: center;
  font-size: 1.8em;
  color: #555;
  margin-bottom: 20px;
}

/* 3. The Gallery Grid Layout */
/* We will make the grid itself a centered block, allowing images to form rows */
.gallery-grid {
  display: grid;
  gap: 20px;

  /* Create responsive columns that form rows */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));

  /* Crucial for centering the entire grid block */
  justify-content: center;
}

/* 4. Gallery Item Styling */
/* This ensures the images fill their grid cells */
.gallery-item-link {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item-link:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.gallery-image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

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

/* 5. Mobile Responsiveness */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }
}

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

  .gallery-grid {
    /* On mobile, we still want a single column, but keep it centered */
    grid-template-columns: 1fr;
    gap: 30px;
    justify-items: center; /* Centers the image within its single column */
  }
}
