/* Root Section */
.gallery-section {
  padding: 8rem 4rem;
  background-color: #f9fafb;
  max-width: 1440px;
  margin: 0 auto;
}

.gallery-section .section-title {
  font-size: 2.5rem;
  text-align: center;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.gallery-section .section-subtitle {
  font-size: 1.125rem;
  color: #555;
  text-align: center;
  margin-bottom: 3rem;
}

/* Masonry Grid Layout */
.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

/* Individual Gallery Card */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.15);
}

/* Image Styling */
.gallery-item img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

/* Caption Overlay */
.gallery-item .caption {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 1rem 1.25rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent 80%);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

.gallery-item:hover .caption {
  opacity: 1;
}

/* Responsive Tweaks */
@media screen and (max-width: 768px) {
  .gallery-section {
    padding: 5rem 1.5rem;
  }

  .gallery-section .section-title {
    font-size: 2rem;
  }

  .gallery-section .section-subtitle {
    font-size: 1rem;
  }

  .gallery-item img {
    height: 200px;
  }

  .gallery-item .caption {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
  }
}
