/* Basic Reset & Body Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;

}

.header {
    text-align: center;
}

h2 {
  color: #333;
  margin-bottom: 10px;
}

p {
  color: #666;
  margin-bottom: 20px;
}

/* --- Scrollable Gallery Thumbnails --- */
.gallery-row {
  /* This is the key for horizontal scrolling */
  overflow-x: auto;
  white-space: nowrap; /* Prevents thumbnails from wrapping */
  padding: 15px 0; /* Vertical padding around the scrollable area */
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-radius: 8px;
  margin: 0 20px; /* Margins for the gallery container */

  /* Optional: Hide scrollbar for a cleaner look */
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for Webkit (Chrome, Safari) */
.gallery-row::-webkit-scrollbar {
  display: none;
}

.gallery-column {
  display: inline-block; /* Aligns columns horizontally */
  width: 200px; /* Fixed width for each thumbnail container */
  max-width: 45vw; /* Responsive: max 45% of viewport width on smaller screens */
  margin: 0 10px; /* Spacing between thumbnails */
  vertical-align: top; /* Align items to the top */
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}

.gallery-column:hover {
  transform: translateY(-5px); /* Simple hover effect */
}

.gallery-column img {
  width: 100%; /* Image fills its column */
  height: 120px; /* Fixed height for uniformity */
  object-fit: cover; /* Crops image to fit without distortion */
  border-radius: 5px;
  opacity: 0.9;
  transition: opacity 0.2s ease-in-out;
}

.gallery-column img:hover {
  opacity: 1;
}

.gallery-column .caption {
  margin-top: 8px;
  font-size: 0.85em;
  color: #555;
  white-space: normal; /* Allow caption text to wrap */
}

/* --- Expanded Image Modal (JavaScript controlled) --- */
.expanded-container {
  /* Fixed position to cover the entire screen */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9); /* Dark overlay */
  z-index: 1000; /* Ensures it's on top */

  /* Flexbox for perfect centering of the image */
  display: flex; /* Set to 'flex' by JS when open, 'none' when closed */
  justify-content: center;
  align-items: center;

  /* Initially hidden by default */
  display: none; /* Will be toggled by JavaScript */
}

.expanded-container img {
  max-width: 90%; /* Responsive: max 90% of modal width */
  max-height: 90vh; /* Responsive: max 90% of viewport height */
  object-fit: contain; /* Ensures entire image is visible, adds letterboxing if needed */
  display: block; /* Remove extra space below image */
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.expanded-container .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 40px;
  text-decoration: none; /* Remove underline from link */
  cursor: pointer;
  z-index: 1001; /* Ensure close button is above the image */
  padding: 5px 10px;
  background-color: rgba(0,0,0,0.5);
  border-radius: 5px;
  line-height: 1; /* Adjust line height for better centering of X */
}

.expanded-container .close-btn:hover {
  background-color: rgba(0,0,0,0.8);
}

.expanded-container .image-text {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%); /* Center text horizontally */
  color: white;
  font-size: 1.2em;
  background-color: rgba(0,0,0,0.6);
  padding: 8px 15px;
  border-radius: 5px;
  white-space: normal; /* Allow text to wrap */
}

/* --- Navigation Arrows within the Modal --- */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3em;
  color: white;
  cursor: pointer;
  padding: 10px;
  background-color: rgba(0,0,0,0.3);
  border-radius: 50%;
  user-select: none; /* Prevent text selection */
  z-index: 1001; /* Above image */
  transition: background-color 0.2s ease;
}

.nav-arrow:hover {
  background-color: rgba(0,0,0,0.6);
}

.nav-arrow.left {
  left: 20px;
}

.nav-arrow.right {
  right: 20px;
}

/* Media Queries for responsiveness */
@media (max-width: 768px) {
  .gallery-column {
    width: 40vw; /* Larger thumbnails on smaller screens */
    height: 120px;
  }
}

@media (max-width: 480px) {
  .gallery-column {
    width: 60vw; /* Even larger thumbnails on very small screens */
    height: 100px;
  }
  .gallery-column img {
    height: 100px;
  }
  .expanded-container .close-btn {
    font-size: 30px;
    top: 10px;
    right: 10px;
  }
  .expanded-container .image-text {
    font-size: 1em;
    bottom: 10px;
  }
  .nav-arrow {
    font-size: 2em;
    padding: 5px;
    left: 10px;
    right: 10px;
  }
}