/* Existing styles */
.gallery-item {
  margin-bottom: 30px;
  transition: all 0.3s ease;
}

.gallery-item img {
  width: 100%;
  height: 300px; /* Set a fixed height for uniformity */
  object-fit: cover; /* Ensures the image covers the area without distortion */
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-caption {
  padding: 10px;
  background-color: #f8f9fa;
  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;
}

.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-links a {
  color: white;
  font-size: 24px;
  margin: 0 10px;
}

.filters-container {
  margin-bottom: 30px;
}

.filter-item {
  cursor: pointer;
  padding: 8px 15px;
  margin: 0 5px;
  border-radius: 30px;
  display: inline-block;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.filter-item.active {
  background: #0d6efd;
  color: white;
}

#gallery-hero {
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url('/assets/img/hero-bg.webp');
  background-size: cover;
  color: white;
  padding: 80px 0;
  margin-bottom: 50px;
}

/* IMPROVED EXPANDED IMAGE STYLES */
#expandedImage {
  display: none;
  position: fixed;
  /* Top position changed from 10% to 50% */
  top: 50%;
  left: 50%;
  /* Transform modified to center both vertically and horizontally */
  transform: translate(-50%, -50%);
  z-index: 1050;
  background: #fff;
  padding: 10px;
  border: 1px solid #000000;
  /* Changed from 80% to 95% */
  max-width: 95%;
  /* Added max-height */
  max-height: 90vh;
  /* Added for better positioning */
  box-sizing: border-box;
  /* Added for mobile display */
  width: 95%;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

#expandedImage img {
  max-width: 100%;
  height: auto;
  /* Added max-height */
  max-height: 85vh;
  /* Added to ensure image is fully visible */
  object-fit: contain;
  /* Improved display */
  display: block;
  margin: 0 auto;
}

#closeExpanded {
  position: absolute;
  top: -10px;
  right: 5px;
  background: none;
  border: none;
  font-size: 40px;
  cursor: pointer;
  color: #333;
  /* Added to make tap target larger on mobile */
  padding: 10px;
  /* Added for better visibility */
  text-shadow: 0 0 5px #fff;
  z-index: 1060;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
  .filter-item {
    padding: 6px 12px;
    margin: 0 3px 6px;
    font-size: 14px;
  }
  
  .gallery-item img {
    height: 200px; /* Smaller height on mobile */
  }
  
  #expandedImage {
    padding: 5px;
    max-width: 98%;
    width: 98%;
    /* Ensure it covers most of the screen on mobile */
    top: 50%;
    transform: translate(-50%, -50%);
  }
  
  #expandedImage img {
    max-height: 80vh;
  }
  
  #closeExpanded {
    font-size: 36px;
    top: -5px;
    right: 0;
    /* Larger tap target on mobile */
    padding: 8px 12px;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 896px) and (orientation: landscape) {
  #expandedImage {
    max-height: 85vh;
    padding: 5px;
  }
  
  #expandedImage img {
    max-height: 75vh;
  }
  
  .gallery-item img {
    height: 150px; /* Smaller thumbnails in landscape */
  }
}