/* Basic Reset */
/*body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: #f5f5f5;
}*/

.gallery-container {
  max-width: 1400px;
  margin: 0 auto;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  justify-content: center;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Desktop: Force 3x3 layout */
@media (min-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    grid-auto-rows: 1fr; /* Equal row heights */
  }
}

.gallery-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  cursor: pointer;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.gallery-item img:hover {
  transform: scale(1.05);
}

/* Animation classes for pagination */
.gallery.fade-out {
  opacity: 0;
  transform: translateY(20px);
}

.gallery.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Pagination Buttons */
.pagination {
  margin-top: 20px;
  text-align: center;
}

.pagination button {
  padding: 10px 20px;
  margin: 0 5px;
  font-size: 18px;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  background-color: #3498db;
  color: white;
  transition: background 0.3s;
}

.pagination button:hover {
  background-color: #2980b9;
}

.pagination .disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Popup Styles */
.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
}

.popup img {
  max-width: 90%;
  max-height: 80%;
  margin-bottom: 10px;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

/* Popup Caption */
#caption {
  color: #fff;
  font-size: 20px;
  margin-top: 10px;
  text-align: center;
}

/* Popup Close Button */
#closeBtn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
}

/* Navigation Arrows inside Popup */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 50px;
  color: white;
  padding: 10px;
  cursor: pointer;
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  user-select: none;
  transition: background 0.3s;
}

#prevImgBtn {
  left: 20px;
}

#nextImgBtn {
  right: 20px;
}

.nav-btn:hover {
  background: rgba(0,0,0,0.6);
}

/* Responsive Popup Image */
@media (max-width: 600px) {
  .popup img {
    max-width: 95%;
    max-height: 70%;
  }

  #caption {
    font-size: 16px;
  }

  .nav-btn {
    font-size: 40px;
  }
}
