/* Responsive Gallery Grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px auto;
  padding: 0 10px;
}

.gallery img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  object-fit: cover;
}

.gallery img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }
}

/* Lightbox overlay */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Lightbox content wrapper */
.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lightbox-content img {
  max-width: 90%;
  max-height: 80vh;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.lightbox-content img.loaded {
  opacity: 1;
}

.lightbox img {
  max-width: 90%;
  max-height: 75%;
  border-radius: 10px;
}

/* Caption styling */
.lightbox-caption {
  color: #fff;
  font-size: 16px;
  margin-top: 12px;
  max-width: 90%;
  line-height: 1.4;
  display: none; /* hidden by default */
}

.lightbox-caption.active {
  display: block; /* only shown if caption exists */
}


/* Close button */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
}

