/* ===========================
   GALLERY SLIDESHOW
   Homepage community photos/videos carousel
=========================== */

/* Section wrapper — same gradient background as fundraisers section */
.gallery-section {
  background: linear-gradient(180deg, #eef4fb 0%, #f0f8f4 50%, #eef4fb 100%);
  padding: 3rem 0;
  position: relative;
  z-index: 1;
}

/* Inner container — centered with max width */
.gallery-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 6%;
}

/* ── Section Header ── */
.gallery-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Eyebrow tag — small green pill above the title */
.gallery-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #e8f4ec;
  color: #2e7d47;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

/* Main section title */
.gallery-title {
  font-size: 2rem;
  font-weight: 900;
  color: #1a3c5e;
  margin-bottom: 0.5rem;
}

/* Subtitle text */
.gallery-sub {
  font-size: 1rem;
  color: #666;
  line-height: 1.5;
  max-width: 520px;   /* tighter width so it wraps nicely */
  margin: 0 auto;

  /* limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

  text-overflow: ellipsis;
}

/* ── Slideshow Container ── */
.gallery-slideshow {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  /* Fixed height matching roughly 2 achievement card rows */
  height: 320px;
  background: #1a3c5e;
  box-shadow:
    0 8px 40px rgba(26, 60, 94, 0.2),
    0 2px 0px #c8daf0,
    0 4px 0px #bdd0ec;
}

/* ── Slides Wrapper ── */
.gallery-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── Individual Slide ── */
.gallery-slide {
  /* Absolute positioning stacks all slides on top of each other */
  position: absolute;
  inset: 0;
  /* Hidden by default — only the .active slide is visible */
  opacity: 0;
  visibility: hidden;
  /* Smooth crossfade transition between slides */
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

/* Active slide — fully visible on top */
.gallery-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

/* ── Slide Media (image or video) ── */
.gallery-slide-media {
  width: 100%;
  height: 100%;
  /* Cover the entire slide area, cropping edges if needed */
  object-fit: cover;
  display: block;
}

/* ── Dark Gradient Overlay ── */
/* Gradient from transparent at top to dark at bottom for text readability */
.gallery-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.25) 40%,
    rgba(0, 0, 0, 0.05) 70%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 3;
}

/* ── Caption Bar ── */
/* Positioned at the bottom of the slide, over the dark gradient */
.gallery-slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 2rem 1.8rem;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

/* Slide title */
.gallery-slide-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  margin: 0;
}

/* Slide date — always LTR since dates are numeric */
.gallery-slide-date {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  direction: ltr;
}

/* ── Navigation Arrows ── */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  /* Semi-transparent white circle */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  /* Slightly hidden until hover on desktop */
  opacity: 0.7;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  opacity: 1;
  transform: translateY(-50%) scale(1.08);
}

/* Left arrow position */
.gallery-nav-prev {
  left: 1rem;
}

/* Right arrow position */
.gallery-nav-next {
  right: 1rem;
}

/* ── Dot Indicators ── */
.gallery-dots {
  position: absolute;
  bottom: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Individual dot */
.gallery-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

/* Active dot — wider pill shape and brighter */
.gallery-dot.active {
  width: 28px;
  border-radius: 5px;
  background: white;
}

.gallery-dot:hover {
  background: rgba(255, 255, 255, 0.7);
}

/* ── Progress Bar ── */
/* Thin line at the very bottom showing auto-play progress */
.gallery-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 6;
}

.gallery-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2e7d47, #4aaa68);
  border-radius: 0 3px 3px 0;
}

/* ── Video Play Button ── */
.gallery-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(46, 125, 71, 0.85);
  backdrop-filter: blur(4px);
  border: 3px solid rgba(255, 255, 255, 0.4);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.gallery-video-play:hover {
  background: rgba(46, 125, 71, 1);
  transform: translate(-50%, -50%) scale(1.1);
  border-color: rgba(255, 255, 255, 0.7);
}

/* ── RTL Support ── */
/* Gallery header text follows the page direction */
[dir="rtl"] .gallery-header {
  direction: rtl;
}

[dir="rtl"] .gallery-eyebrow,
[dir="rtl"] .gallery-title,
[dir="rtl"] .gallery-sub {
  direction: rtl;
  text-align: center;
}

/* Slide title aligns right in RTL */
[dir="rtl"] .gallery-slide-title {
  direction: rtl;
  text-align: right;
}

/* Caption bar reverses — title right, date left */
[dir="rtl"] .gallery-slide-caption {
  flex-direction: row-reverse;
}

/* Swap arrow positions in RTL */
[dir="rtl"] .gallery-nav-prev {
  left: auto;
  right: 1rem;
}

[dir="rtl"] .gallery-nav-next {
  right: auto;
  left: 1rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .gallery-section {
    padding: 3rem 1rem 4rem;
  }

  .gallery-title {
    font-size: 1.6rem;
  }

  .gallery-slideshow {
    border-radius: 18px;
    /* Taller aspect ratio on tablet for better visibility */
    height: 280px;
  }

  .gallery-slide-title {
    font-size: 1.15rem;
  }

  .gallery-slide-caption {
    padding: 1.2rem 1.5rem 1.5rem;
  }

  /* Smaller nav arrows on tablet */
  .gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .gallery-section {
    padding: 2rem 0.9rem 2.5rem;
  }

  .gallery-inner {
    width: 100%;
    max-width: 100%;
  }

  /* Match other mobile sections */
  .gallery-header {
    width: 100%;
    max-width: 100%;
    padding: 0 0.75rem;
    margin: 0 auto 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /* Row 1 */
  .gallery-eyebrow {
    font-size: 0.72rem;
    padding: 0.3rem 0.8rem;
    margin-bottom: 0.65rem;
    white-space: nowrap;
  }

  /* Row 2 */
  .gallery-title {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 0.55rem;
    text-align: center;
    width: 100%;
  }

  /* Row 3 */
  .gallery-sub {
    width: 100%;
    max-width: 260px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #666;
    text-align: center;

    display: block !important;
    overflow: visible !important;
    text-overflow: unset !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
  }

  /* Slideshow same width feel as achievement/contact */
   .gallery-slideshow {
    width: 100%;
    border-radius: 14px;
    height: 240px;
  }

  .gallery-nav {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
  }

  .gallery-nav-prev {
    left: 0.5rem;
  }

  .gallery-nav-next {
    right: 0.5rem;
  }

  .gallery-video-play {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }
}