section {
        padding-top: 1em;
        padding-bottom: 2em;
}

#gallery-list > a{
        font-size: 1.5em;
        padding-top: 0.5em;
        padding-bottom: 0.5em;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  justify-content: center;
  height: 100vh;
  align-items: center;
}
.gallery img {
  flex: 1 1 auto;
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  cursor: pointer;
}
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
}
.overlay img {
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 5px;
}
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 30px;
  cursor: pointer;
  color: white;
}
.prev {
  left: 20px;
}
.next {
  right: 20px;
}
.close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 30px;
  cursor: pointer;
}

#gallery-container {
  max-width: 100%;
}

#gallery-header {
  display: flex;
  justify-content: center;
  align-items: center;
  height: auto;
  padding-top: 5rem;
}

#gallery-title {
  text-align: center;
  font-size: 3em;
  max-width: 100vw;
  text-wrap: auto;
}

#gallery-images {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(25em, 1fr)
  ); /* Ensures responsive sizing */
  gap: 0.5em;
  justify-content: center;
  align-items: center; /* Vertically aligns items */
}

#gallery-images img {
  width: 100%;
  height: auto;
  object-fit: contain; /* Ensures the whole image is visible */
  border-radius: 8px;
  display: block;
  margin: auto; /* Centers the image inside its grid cell */
  transition: transform 0.2s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

#gallery-images img:hover {
  transform: scale(1.03);
}

#back-button {
  position: fixed;
  top: 5em; /* Adds slight padding from the top */
  left: 0.7em; /* Adds slight padding from the left */
  z-index: 100; /* Ensures it stays above other elements */
}

/* Overlay */
#gallery-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
}

#overlay-img {
  max-width: 90vw; /* Limit to 90% of the viewport width */
  max-height: 90vh; /* Limit to 90% of the viewport height */
  object-fit: contain; /* Preserve the aspect ratio */
  border-radius: 8px;
}

/* Navigation Buttons */
#prev-btn,
#next-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  cursor: pointer;
  color: white;
  padding: 15px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
}

#prev-btn {
  left: 20px;
}

#next-btn {
  right: 20px;
}

#prev-btn:hover,
#next-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}


@media screen and (max-width: 736px) {
        #gallery-title {
          font-size: 1.5em;
        }
      }