/* /css/gallery.css
 *
 * Cinematic Gallery & Lightbox - HUD Edition.
 * Features: Horizontal edge-fading, refractive hover states, and atmospheric lightbox reveals.
 */

#gallery {
  padding-block: var(--space-8);
  overflow: hidden; /* Contains the edge masks */
}

/* 1. CAROUSEL: Immersive Edge-Fading */
.carousel-container {
  position: relative;
  margin-top: 3rem;
  /* Cinematic Fade Mask: Images emerge from the dark */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    black 10%,
    black 90%,
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    black 10%,
    black 90%,
    transparent
  );
}

.carousel-track {
  display: flex;
  gap: 1.5rem;
  padding-block: 2rem; /* Vertical breathing room for hover lift */
  padding-inline: 10vw; /* Keeps the first/last items within the mask "sweet spot" */

  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* 2. GALLERY ITEM: Refractive Depth */
.gallery-item {
  flex: 0 0 auto;
  width: min(450px, 85vw);
  scroll-snap-align: center;
  perspective: 1000px;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;

  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-darker);
  box-shadow: var(--card-shadow);

  cursor: pointer;
  /* Luxury Easing for smooth cinematic motion */
  transition: 
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.4s ease,
    border-color 0.4s ease,
    box-shadow 0.6s ease;
  will-change: transform, filter;
}

/* Hover: Scale + Contrast + Glow */
.gallery-item img:hover {
  transform: translateY(-12px) scale(1.03) rotateX(2deg);
  filter: brightness(1.1) contrast(1.1);
  border-color: rgba(21, 122, 110, 0.4);
  box-shadow: 
    0 30px 60px -15px rgba(0, 0, 0, 0.8),
    0 0 20px -5px var(--accent-glow);
}

/* 3. CONTROLS: High-Tech HUD Style */
.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;

  width: 56px;
  height: 56px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 18px;
  border: 1px solid rgba(185, 208, 220, 0.1);
  background: rgba(19, 20, 22, 0.4);
  color: var(--text-bright);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.carousel-control:hover {
  background: rgba(21, 122, 110, 0.15);
  border-color: var(--accent-primary);
  color: #fff;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px rgba(21, 122, 110, 0.3);
}

.carousel-control.prev { left: 2rem; }
.carousel-control.next { right: 2rem; }

@media (max-width: 860px) {
  .carousel-control { display: none; }
  .carousel-container { -webkit-mask-image: none; mask-image: none; }
  .carousel-track { padding-inline: 1.5rem; }
}

/* 4. LIGHTBOX: Atmospheric Reveal */
.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(10, 11, 13, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  
  z-index: 1000;
  padding: 2rem;
  
  /* Initial State for Animation */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  width: min(1200px, 100%);
  max-height: 85vh;
  object-fit: contain;

  border-radius: var(--radius-xl);
  border: 1px solid rgba(185, 208, 220, 0.1);
  box-shadow: 0 50px 100px rgba(0, 0, 0, 0.9);

  /* Cinematic Entrance Animation */
  transform: scale(0.9) translateY(20px);
  filter: blur(10px);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
}

.lightbox.active .lightbox-content {
  transform: scale(1) translateY(0);
  filter: blur(0);
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;

  transition: all 0.3s ease;
}

.lightbox-close:hover {
  background: rgba(21, 122, 110, 0.2);
  border-color: var(--accent-primary);
  transform: rotate(90deg);
}