/* ========== Gallery Main Sections ========== */

.gallery-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  background-color: var(--background-lightcream);
  color: var(--text-darkbrown);
  font-family: 'Poppins', sans-serif;
}

.section-padding {
  margin-bottom: 40px;
}

/* Header Section */
.gallery-header {
  text-align: center;
}

.gallery-header .section-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-saffron);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.gallery-header .section-subtitle {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--secondary-brown);
  max-width: 600px;
  margin: 0 auto;
}

/* Filter Buttons */
.gallery-filters {
  text-align: center;
}

.filter-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.filter-btn {
  background-color: var(--neutral-cream);
  border: 2px solid var(--primary-saffron);
  color: var(--primary-saffron);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 30px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
  user-select: none;
  font-size: 1rem;
  min-width: 140px;
}

.filter-btn:hover,
.filter-btn:focus {
  background-color: var(--primary-saffron);
  color: var(--neutral-cream);
  outline: none;
}

.filter-btn.active,
.filter-btn[aria-pressed="true"] {
  background-color: var(--primary-saffron);
  color: var(--neutral-cream);
  border-color: var(--primary-saffron);
}

/* Gallery Grid */
.gallery-grid .grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* increased min width for bigger images */
  gap: 20px;
  justify-items: center;
}

.gallery-item {
  width: 100%;
  max-width: 320px;  /* Increased max width */
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.gallery-item:hover,
.gallery-item:focus {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(62, 39, 35, 0.3);
  outline: none;
}

.gallery-item img {
  width: 100%;
  height: 240px;  /* Increased height */
  object-fit: cover;
  border-radius: 10px 10px 0 0;
  flex-shrink: 0;
  display: block;
}

.caption {
  padding: 12px 15px;
  font-weight: 600;
  color: var(--secondary-brown);
  background-color: var(--background-lightcream);
  text-align: center;
  font-size: 1rem;
  border-radius: 0 0 10px 10px;
  flex-shrink: 0;
  flex-grow: 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .gallery-item img {
    height: 180px;  /* Adjust for smaller screens */
  }
  .gallery-item {
    max-width: 100%;
  }
}


/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--neutral-cream);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 6px;
  object-fit: contain;
}

.modal-caption {
  margin-top: 12px;
  font-weight: 600;
  color: var(--secondary-brown);
  text-align: center;
  font-size: 1.1rem;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 2rem;
  background: transparent;
  border: none;
  color: var(--primary-saffron);
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
  color: var(--accent-gold);
  outline: none;
}

/* Modal backdrop */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  overflow: auto;
  transition: opacity 0.3s ease;
}

/* Show modal */
.modal.show {
  display: block;
  opacity: 1;
}

/* Modal content box */
.modal-content {
  position: relative;
  margin: 5% auto;
  max-width: 900px;
  background: #fff;
  border-radius: 10px;
  padding: 1rem 2rem 2rem;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  text-align: center;
}

/* Modal image */
#modalImage {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  object-fit: contain;
}

/* Caption text */
.modal-caption {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: #3E2723; /* Dark brown */
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
}

/* Close button */
.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2.5rem;
  font-weight: bold;
  color: #FF6B35; /* Saffron/orange */
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
  color: #FF8C42;
  outline: none;
}

/* Navigation buttons (prev & next) */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: #FF6B35;
  border: none;
  color: #fff;
  font-size: 2rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 5px;
  user-select: none;
  transition: background-color 0.3s ease;
}

.modal-prev {
  left: 10px;
}

.modal-next {
  right: 10px;
}

.modal-nav:hover,
.modal-nav:focus {
  background-color: #FF8C42;
  outline: none;
}

/* For accessibility focus */
.modal-close:focus,
.modal-nav:focus {
  box-shadow: 0 0 5px 2px #FFD700; /* Golden yellow focus ring */
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .gallery-item {
    aspect-ratio: 3 / 2; /* slightly taller on small screens */
    max-width: 100%;
  }
}
