/* ============================================================
   Homepage Gallery — Hero + Thumbnail Strip slider
   Distinct from card-based sliders (sports, blog) on the same page.
   ============================================================ */

.gallery-section {
  padding: 90px 0;
  background: var(--color-dark);
  color: #fff;
  position: relative;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* Subtle ambient glow behind the hero */
.gallery-section::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 60%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    closest-side,
    rgba(254, 107, 0, 0.15),
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

.gallery-section > .container {
  position: relative;
  z-index: 1;
}

/* Loading state — fade in once JS init succeeds */
.gallery-section.is-slider-loading {
  opacity: 0;
  pointer-events: none;
  min-height: 620px;
}
.gallery-section.is-slider-loading > .container {
  visibility: hidden;
}

/* ============================================================
   Header
   ============================================================ */
.gallery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.gallery-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1.5px solid var(--color-primary, #fe6b00);
  color: var(--color-primary, #fe6b00);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
  white-space: nowrap;
}
.gallery-link:hover {
  background: var(--color-primary, #fe6b00);
  color: #fff;
  transform: translateX(2px);
}

/* ============================================================
   Stage — hero viewport + thumbnail strip
   ============================================================ */
.gallery-stage {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* HERO — all slides stacked, JS toggles `is-active` for crossfade */
.gallery-stage__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8; /* Slimmer, more balanced ratio for desktop */
  max-height: 500px; /* Prevents the image from being too tall on large screens */
  border-radius: 18px;
  overflow: hidden;
  background: #0f1421;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.gallery-hero-slide {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.55s ease;
  pointer-events: none;
  overflow: hidden;
}
.gallery-hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.gallery-hero-slide.is-active .card-cover__img {
  /* Snappier Ken-Burns to match shorter rotation interval */
  transform: scale(1.05);
  transition: transform 4s ease-out;
}

.gallery-hero-slide .card-cover__img {
  width: 100%;
  height: 100%;
  /* object-fit: cover; */
  display: block;
  transform: scale(1);
  transition: transform 0s;
}

/* Soft vignette on every slide so caption stays legible regardless of photo */
.gallery-hero-slide::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 45%;
  background: linear-gradient(
    to top,
    rgba(15, 20, 33, 0.78) 0%,
    transparent 100%
  );
  pointer-events: none;
}

.gallery-hero-slide__caption {
  position: absolute;
  left: 24px;
  bottom: 24px;
  max-width: calc(100% - 48px);
  padding: 10px 16px;
  background: rgba(15, 20, 33, 0.78);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  letter-spacing: 0.02em;
}

/* Progress bar (auto-rotation indicator) — pinned to bottom of hero */
.gallery-stage__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 3;
}
.gallery-stage__progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--color-primary, #fe6b00);
  box-shadow: 0 0 12px rgba(254, 107, 0, 0.6);
  transition: width 0.1s linear;
}

/* Hero side nav arrows — always visible, subtle until hover */
.gallery-stage__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 20, 33, 0.62);
  backdrop-filter: blur(10px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
  opacity: 0.85;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.gallery-stage__hero:hover .gallery-stage__nav,
.gallery-stage__hero:focus-within .gallery-stage__nav {
  opacity: 1;
}
.gallery-stage__nav:hover {
  background: var(--color-primary, #fe6b00);
  transform: translateY(-50%) scale(1.08);
}
.gallery-stage__nav:active {
  transform: translateY(-50%) scale(0.96);
}
.gallery-stage__nav:focus-visible {
  outline: 2px solid var(--color-primary, #fe6b00);
  outline-offset: 3px;
  opacity: 1;
}
.gallery-stage__nav--prev {
  left: 18px;
}
.gallery-stage__nav--next {
  right: 18px;
}

/* ============================================================
   Thumbnail strip
   ============================================================ */
.gallery-stage__strip-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gallery-stage__counter {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.gallery-stage__counter strong {
  color: #fff;
  font-weight: 700;
}

.gallery-stage__strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.gallery-stage__strip::-webkit-scrollbar {
  height: 6px;
}
.gallery-stage__strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}
.gallery-stage__strip::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}

.gallery-thumb {
  flex: 0 0 104px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #0f1421;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.06);
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.5;
  filter: saturate(0.85);
  transition:
    opacity 0.2s ease,
    transform 0.4s ease,
    filter 0.2s ease;
}
.gallery-thumb:hover {
  transform: translateY(-3px);
}
.gallery-thumb:hover img {
  opacity: 0.85;
  filter: saturate(1);
}

.gallery-thumb.is-active {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2.5px var(--color-primary, #fe6b00),
    0 10px 24px rgba(254, 107, 0, 0.45);
}
.gallery-thumb.is-active img {
  opacity: 1;
  filter: saturate(1);
  transform: scale(1.05);
}
/* Tiny dot indicator on the active thumb */
.gallery-thumb.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary, #fe6b00);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(254, 107, 0, 0.9);
}
.gallery-thumb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2.5px var(--color-primary, #fe6b00);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991px) {
  .gallery-section {
    padding: 70px 0;
  }
  .gallery-stage__hero {
    aspect-ratio: 16 / 9;
    border-radius: 14px;
  }
  .gallery-stage__nav {
    width: 44px;
    height: 44px;
    opacity: 1;
  }
  .gallery-stage__nav--prev {
    left: 12px;
  }
  .gallery-stage__nav--next {
    right: 12px;
  }
}

@media (max-width: 640px) {
  .gallery-section {
    padding: 55px 0;
  }
  .gallery-head {
    margin-bottom: 28px;
  }
  .gallery-link {
    font-size: 0.78rem;
    padding: 10px 16px;
  }
  .gallery-stage {
    gap: 16px;
  }
  .gallery-stage__hero {
    aspect-ratio: 16 / 10;
    border-radius: 12px;
  }
  .gallery-hero-slide__caption {
    left: 12px;
    bottom: 12px;
    padding: 8px 12px;
    font-size: 0.78rem;
  }
  .gallery-stage__nav {
    width: 38px;
    height: 38px;
  }
  .gallery-stage__nav--prev {
    left: 8px;
  }
  .gallery-stage__nav--next {
    right: 8px;
  }
  .gallery-stage__strip-wrap {
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .gallery-stage__counter {
    text-align: center;
  }
  .gallery-stage__strip {
    gap: 8px;
  }
  .gallery-thumb {
    flex: 0 0 72px;
    height: 50px;
    border-radius: 6px;
  }
}
