/* General Reset */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #666;
  color: #000;
}

/* Layout Table Styling */
.main-wrapper {
  width: 860px;
  margin: auto;
  border-collapse: collapse;
  background-color: #fff;
}

/* Page Content */
.content {
  background-color: #fff;
  padding: 20px;
}

.content h1, .content h2 {
  text-align: center;
  margin: 10px 0;
}

.disclaimer {
  font-size: 0.9em;
  padding: 10px;
  color: #444;
}


/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 100%;
  margin: 20px auto;
}

.gallery-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  text-align: center;
  overflow: hidden;
}

.gallery-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.gallery-card h3,
.gallery-card p {
  margin: 10px;
}

/* Modal */
#modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  overflow-y: auto;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.modal-wrapper {
  width: 90%;
  max-width: 1000px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#modal .close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

.modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-image {
  background: white;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.modal-image img {
  width: 100%;
  border-radius: 5px;
}

.modal-image h4 {
  margin: 10px 0 5px;
}

.modal-image p {
  font-size: 0.9em;
  color: #333;
}

/* Modal Navigation */
.modal-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.modal-nav button {
  padding: 10px 20px;
  font-size: 1rem;
  background: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/* Carousel Thumbnails */
#carousel {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding: 10px;
  margin-top: 20px;
  border-top: 1px solid #666;
  justify-content: center;
}

#carousel img {
  height: 60px;
  border: 2px solid white;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: 0.2s;
}

#carousel img.active {
  border: 2px solid yellow;
  opacity: 1;
}

#carousel img:hover {
  opacity: 1;
}

/* Responsive: Mobile Adjustments */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .gallery-card img {
    height: auto;
  }

  .gallery-card h3,
  .gallery-card p {
    text-align: center;
    font-size: 1em;
  }

  .modal-wrapper {
    width: 100%;
    padding: 0 10px;
  }

  .modal-image {
    border-radius: 0;
    padding: 0;
  }

  .modal-image img {
    width: 100%;
    border-radius: 0;
  }

  .modal-nav {
    flex-direction: column;
    gap: 10px;
  }

  .modal-nav button {
    width: 90%;
  }

  #carousel {
    justify-content: flex-start;
    padding: 5px;
  }

  #carousel img {
    height: 50px;
    flex-shrink: 0;
  }

  #modal .close {
    font-size: 26px;
    top: 15px;
    right: 20px;
  }
  * Make modal image use more of the screen height */
  .modal-wrapper {
    width: 100%;
    padding: 0;
    max-width: none;
  }

  .modal-image {
    border-radius: 0;
    padding: 0;
    width: 100%;
    max-width: none;
    height: auto;
    background: transparent;
  }

  .modal-image img {
    width: 100%;
    height: auto;
    object-fit: contain; /* prevent cropping */
    border-radius: 0;
  }

  /* Adjust modal nav buttons for full-width */
  .modal-nav {
    flex-direction: row;
    gap: 10px;
    width: 100%;
    justify-content: center;
  }

  .modal-nav button {
    flex: 1;
    max-width: 150px;
  }

  /* Make carousel thumbnails scrollable below image */
  #carousel {
    justify-content: flex-start;
    padding: 5px;
    overflow-x: auto;
    max-width: 100%;
  }

  #carousel img {
    height: 60px;
    flex-shrink: 0;
  }
}

