/* --- MODERN 3D CAROUSEL LAYOUT --- */
.carousel-viewport {
  position: relative;
  width: 100%;
  height: 550px; /* Adjusted to account for reflections */
  perspective: 1200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0px;
}

.carousel-container {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item {
  position: absolute;
  width: 300px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  background: #000;
  
  /* The Reflection Effect */
  -webkit-box-reflect: below 10px linear-gradient(transparent, transparent 60%, rgba(255, 255, 255, 0.2));
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* State Styling via JS */
.gallery-item.far-left { transform: translateX(-450px) rotateY(55deg) scale(0.6); opacity: 0.3; z-index: 1; filter: blur(8px); }
.gallery-item.left { transform: translateX(-250px) rotateY(25deg) scale(0.8); opacity: 0.6; z-index: 2; filter: blur(4px); }
.gallery-item.active { transform: translateX(0) rotateY(0) scale(1.15); opacity: 1; z-index: 10; box-shadow: 0 30px 60px 5px rgba(0,0,0,0.98); }
.gallery-item.right { transform: translateX(250px) rotateY(-25deg) scale(0.8); opacity: 0.6; z-index: 2; filter: blur(4px); }
.gallery-item.far-right { transform: translateX(450px) rotateY(-55deg) scale(0.6); opacity: 0.3; z-index: 1; filter: blur(8px); }
.gallery-item.hidden { transform: translateX(250px) rotateY(-90deg) scale(0); opacity: 0; pointer-events: none; }

/* Navigation Buttons */
.carousel-control {
  position: absolute;
  top: 45%;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  border: 1px solid rgba(255, 207, 68, 0.3);
  padding: 7px 18px 8px 18px;
  font-size: 24px;
  cursor: pointer;
  z-index: 100;
  border-radius: 50%;
  transition: all 0.3s ease;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.carousel-control:hover { background: rgba(33, 22, 11, 0.8); color: #FFCC44; transform: scale(1.25); }
.carousel-control.prev { left: 20px; }
.carousel-control.next { right: 20px; }

/* Mobile Adjustments */
@media (max-width: 768px) {
  .carousel-viewport { height: 400px; }
  .gallery-item { width: 200px; }
  .gallery-item.far-left, .gallery-item.far-right { display: none; }
  .gallery-item.left { transform: translateX(-120px) scale(0.7); }
  .gallery-item.right { transform: translateX(120px) scale(0.7); }
}

/* --- MOBILE-FRIENDLY LIGHTBOX WITH TRANSITIONS --- */
.local-lightbox {
  display: flex; /* Keep as flex to maintain centering */
  position: fixed;
  z-index: 10000;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  /* Transition Properties */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* State when open */
.local-lightbox.visible {
  opacity: 1;
  z-index: 10000;
  visibility: visible;
  pointer-events: auto;

  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;

  background: transparent;
  /* background: /* linear-gradient(180deg, rgba(90,90,90,0.1), rgba(11,11,11,0.1)); */
  /* box-shadow: 0px 3px 10px 1px rgba(0,0,0,0.9); */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-backdrop-filter: blur(25px) saturate(120%) contrast(100%);
  backdrop-filter: blur(25px) saturate(120%) contrast(100%);
/*   border: 1px #000000 solid; */
  border-radius: 12px;
 
  min-height: 100%;
  max-height: 100%;
  min-width: 100%;
  max-width: 100%;

  margin-left: 0;
  margin-bottom: 0;
  margin-right: 0;
  margin-top: 0;

  padding-top: 0px;
  padding-bottom: 5px;
  padding-right: 0px;
  padding-left: 0px;

}

.local-lightbox img {
  object-fit: scale-down;
  z-index: 10000;
  
  /* Initial state for the image (smaller) */
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Image zooms to full size when parent is visible */
.local-lightbox.visible img {
  transform: scale(1.0);
  z-index: 10000;
  /* object-fit: scale-down; */

  margin: 0px;
  padding: 0px;

  max-height: 100%;
  max-width: 100%;

  /* background: linear-gradient(180deg, rgba(133,133,133,0.6), rgba(33,33,33,0.8)); */
  box-shadow: 0px 3px 16px 1px rgba(0,0,0,0.9); /*,  
  inset 0px 0px 10px 5px rgba(220,220,220,0.1); */

  border: 1px #000000 solid; 
  background-size: cover;
  border-radius: 12px;
}


.local-close { 
  position: fixed; 
  z-index: 10002;
  top: 2px; 
  right: 10px;
  text-shadow: 0px 0px 6px rgba(225,5,5,0.9);
  font-size: 42px; 
  line-height: 1;
  color: #DDDDDD; 
  cursor: pointer; 
  filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.8)); 
  transition: transform 0.2s ease;
}

.local-close:hover {
  transform: scale(1.2);
  color: var(--nav-link-hover);
}

#local-caption {
  z-index: 20002;
  color: var(--text-color);
  text-align: center;
  font-size: 1.1rem;
  font-family: var(--venue-only-font, sans-serif);
  /* Subtle fade in for text */
  opacity: 0;
  transition: opacity 0.5s ease 0.2s; 
}

.local-lightbox.visible #local-caption {
  position: fixed;
  bottom: 15px;
  z-index: 20002;
  color: #FFFFFF;
  text-align: center;
  font-size: 1.1rem;
  font-family: var(--venue-only-font, sans-serif);

  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  border: 1px solid rgba(255, 207, 68, 0.9);
  box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.9);
  padding: 5px 15px 5px 15px;
  border-radius: 8px;

  opacity: 1;
}


/* --- GALLERY LOADER STYLES --- */
.gallery-loader {
  position: absolute;
  inset: 0;
  background: #0b0b0b; /* Matches your dark theme */
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

/* Class to trigger the graceful exit */
.gallery-loader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
  width: 250px;
}

.loader-progress-container {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin: 15px 0;
  border-radius: 4px;
  overflow: hidden;
}

.loader-progress-bar {
  width: 0%;
  height: 100%;
  background: #FFCC44;
  box-shadow: 0 0 10px rgba(255, 204, 68, 0.5);
  transition: width 0.4s ease;
}

#loader-text {
  font-family: 'El Messiri', serif;
  color: #FFCC44;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Simple Spinner */
.loader-spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 204, 68, 0.1);
  border-top: 2px solid #FFCC44;
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* --- End Loader --- */