/* ==========================================
   Shared Reusable Gallery Component Stylesheet
   ========================================== */

:root {
  /* Fallback color variables in case they are not defined in the host page */
  --gallery-primary: var(--primary-color, #4A0E4E);
  --gallery-primary-dark: var(--primary-dark, #2F0533);
  --gallery-accent: var(--accent-color, #D80073);
  --gallery-bg: var(--bg-warm, #FAF6F0);
  --gallery-text: var(--text-dark, #2C252D);
  --gallery-text-light: var(--text-light, #6E6170);
  --gallery-font: var(--font-main, 'Montserrat', sans-serif);
}

/* --- Inline Gallery Slider Container --- */
.gallery-slider-wrapper {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 20px auto;
  overflow: hidden;
  border-radius: 20px;
  background-color: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color, #EADEC9);
  box-shadow: var(--shadow-md, 0 10px 15px -3px rgba(74, 14, 78, 0.08));
  font-family: var(--gallery-font);
}

/* Aspect ratio box helper to make it responsive */
.gallery-slider-aspect {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* default 16:9 aspect ratio */
}

/* Target element inside aspect ratio box */
.gallery-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
}

.gallery-slides-container {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* --- Gallery Slide Structure --- */
.gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* Professional Blurred Backup Background for portrait/mixed ratio media */
.gallery-slide-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(25px) brightness(0.4);
  transform: scale(1.15); /* prevents white edges */
  z-index: 1;
  opacity: 0.85;
  transition: opacity 0.5s ease;
}

.gallery-media-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 10px;
  cursor: pointer;
}

.gallery-media-item {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-media-wrapper:hover .gallery-media-item {
  transform: scale(1.015);
}

/* --- Inline Video Overlays & Badges --- */
.gallery-video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  background: rgba(74, 14, 78, 0.7); /* Deep Purple */
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 1.8rem;
  z-index: 3;
  pointer-events: none;
  opacity: 0.85;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gallery-media-wrapper:hover .gallery-video-badge {
  opacity: 1;
  background: var(--gallery-accent);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Specific styling for inline looping videos */
.gallery-slide-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  background-color: #000000;
  display: block;
}

/* --- Navigation Controls --- */
.gallery-control-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #FFFFFF;
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
}

.gallery-control-btn:hover {
  background: var(--gallery-accent);
  border-color: var(--gallery-accent);
  color: #FFFFFF;
  transform: translateY(-50%) scale(1.1);
}

.gallery-prev-btn {
  left: 20px;
}

.gallery-next-btn {
  right: 20px;
}

/* --- Slide Indicators / Dots --- */
.gallery-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-dot.active {
  background: var(--gallery-accent);
  width: 24px;
  border-radius: 4px;
}


/* ==========================================
   Fullscreen Lightbox Viewer / Popup Modal
   ========================================== */

.gallery-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 2, 16, 0.85); /* Deep dark background */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--gallery-font);
}

.gallery-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.gallery-lightbox-container {
  position: relative;
  width: 90vw;
  height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Lightbox Media Viewport */
.gallery-lightbox-media-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gallery-lightbox-img,
.gallery-lightbox-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: transparent;
}

.gallery-lightbox.active .gallery-lightbox-img,
.gallery-lightbox.active .gallery-lightbox-video {
  transform: scale(1);
}

/* Embedded YouTube iframe style */
.gallery-lightbox-youtube-iframe {
  width: 100%;
  height: 100%;
  max-width: 90vw;
  max-height: 75vh;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Countdown bar for auto-closing photos */
.gallery-lightbox-countdown {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--gallery-accent);
  width: 0%;
  transition: width 5s linear; /* Default photo duration */
}

/* Close & Navigation UI in Lightbox */
.gallery-lightbox-close-btn {
  position: absolute;
  top: -40px;
  right: 0px;
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 2.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  line-height: 1;
}

.gallery-lightbox-close-btn:hover {
  opacity: 1;
  color: var(--gallery-accent);
  transform: scale(1.1);
}

.gallery-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10010;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.gallery-lightbox-arrow:hover {
  background: var(--gallery-accent);
  border-color: var(--gallery-accent);
  transform: translateY(-50%) scale(1.1);
}

.gallery-lightbox-arrow-left {
  left: -80px;
}

.gallery-lightbox-arrow-right {
  right: -80px;
}

/* Responsive Overrides */
@media (max-width: 1200px) {
  .gallery-lightbox-arrow-left {
    left: 10px;
  }
  .gallery-lightbox-arrow-right {
    right: 10px;
  }
  .gallery-lightbox-close-btn {
    top: 10px;
    right: 20px;
    z-index: 10020;
  }
}

@media (max-width: 768px) {
  .gallery-slider-aspect {
    padding-top: 75%; /* 4:3 ratio for smaller screens */
  }
  .gallery-control-btn {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
  .gallery-prev-btn {
    left: 10px;
  }
  .gallery-next-btn {
    right: 10px;
  }
  .gallery-lightbox-arrow {
    width: 45px;
    height: 45px;
    font-size: 1.4rem;
  }
}
