/* ============================================
   GALLERY — horizontal scroll-snap strip
   + lightbox overlay
   ============================================ */

/* ── Strip ── */
.v8-gallery {
  display: flex;
  gap: var(--s-3);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--container-pad);
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--s-4);
  scrollbar-width: thin;
  scrollbar-color: var(--c-border-dark) transparent;
}

.v8-gallery-item {
  flex: 0 0 82%;
  scroll-snap-align: start;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}

.v8-gallery-item img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

/* Caption gradient overlay */
.v8-gcap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--c-white);
  padding: var(--s-6) var(--s-3) var(--s-2);
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  line-height: 1.4;
  pointer-events: none;
}

/* Expand button on each photo */
.v8-gal-expand {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.32);
  color: var(--c-white);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--ease), background var(--ease);
  z-index: 2;
}

.v8-gallery-item:hover .v8-gal-expand {
  opacity: 1;
}

.v8-gal-expand:hover {
  background: rgba(255,255,255,0.35);
}

/* ── Progress segments (created by JS) ── */
.v8-gal-segs {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.v8-gal-seg {
  position: relative;
  flex: 1;
  max-width: 56px;
  height: 44px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.v8-gal-seg::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: var(--c-gray-light);
  border-radius: 2px;
}

.v8-gal-seg__fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  width: 0%;
  background: var(--c-blue);
  border-radius: 2px;
}

.v8-gal-seg:hover::before { background: var(--c-border-dark); }

.v8-gal-seg.is-active .v8-gal-seg__fill {
  animation: v8-seg-fill 5s linear forwards;
}

.v8-gal-seg.is-done .v8-gal-seg__fill { width: 100%; }

@keyframes v8-seg-fill {
  from { width: 0%; }
  to   { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .v8-gal-seg.is-active .v8-gal-seg__fill {
    animation: none;
    width: 100%;
  }
}

/* ── Navigation arrows ── */
.v8-gal-nav {
  display: none; /* shown on desktop via v11-overrides */
}

.v8-gal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-md);
  font-size: 32px;
  line-height: 1;
  color: var(--c-text-primary);
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), transform var(--ease);
}

.v8-gal-arrow:hover {
  background: var(--c-white);
  transform: translateY(-50%) scale(1.08);
}

.v8-gal-arrow--prev { left: var(--s-6); }
.v8-gal-arrow--next { right: var(--s-6); }

.v8-gal-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ── Gallery section: anchor for absolute arrows ── */
.v8-gallery-sec {
  position: relative;
}

/* ── Gallery section: strip sits outside .section padding ── */
.v8 .v8-gallery-sec.section {
  padding-top: 0 !important;
  padding-bottom: var(--s-6);
  margin-top: var(--s-16);
}

/* ── Desktop: cinematic full-bleed strip ── */
@media (min-width: 768px) {
  .v8-gallery { gap: var(--s-4); }
  .v8-gallery-item { flex-basis: 420px; }
}

@media (max-width: 767px) {
  .v8-gal-arrow { display: none; }
}

@media (min-width: 1024px) {
  .v8-gallery-sec {
    overflow-x: clip;
  }

  .v8-gallery {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    height: 460px;
    gap: 6px;
    padding-bottom: 0;
    scroll-snap-type: none;
    scrollbar-width: none;
    cursor: grab;
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  }

  .v8-gallery.is-dragging { cursor: grabbing; }

  .v8-gallery-item {
    flex: 0 0 320px;
    height: 100%;
    border-radius: 0;
    transition: flex-basis 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
  }

  .v8-gallery-item:hover { flex-basis: 580px; }

  .v8-gallery-item img {
    height: 100%;
    aspect-ratio: auto;
    filter: saturate(0.85);
    transition: filter 0.4s ease;
  }

  .v8-gallery-item:hover img {
    transform: none;
    filter: saturate(1.08);
  }

  .v8-gallery-item .v8-gcap {
    font-size: var(--text-sm);
    padding: var(--s-10) var(--s-4) var(--s-3);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s ease;
  }

  .v8-gallery-item:hover .v8-gcap {
    opacity: 1;
    transform: none;
  }

  .v8-gal-nav { display: block; }
}
