/* Listing gallery. Deliberately unopinionated about colour — it inherits the
   theme. Only layout, sizing and the things that affect Core Web Vitals. */

.ss-gallery {
  --ss-gallery-radius: 4px;
  --ss-gallery-gap: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: var(--ss-gallery-gap);
}

/* ---------- hero ---------- */

.ss-gallery__main .splide__slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ss-gallery__link {
  display: block;
  width: 100%;
  line-height: 0;
}

.ss-gallery__link img {
  width: 100%;
  height: auto;
  /* width/height attributes are on every img, so the browser reserves the right
     box before the file arrives. No aspect-ratio needed and no layout shift as
     55 photos stream in. */
  max-height: min(72vh, 800px);
  object-fit: contain;
  border-radius: var(--ss-gallery-radius);
  background: rgba(0, 0, 0, 0.04);
}

.ss-gallery__arrow {
  background: rgba(0, 0, 0, 0.55);
  opacity: 1;
}
.ss-gallery__arrow svg { fill: #fff; }
.ss-gallery__arrow:hover:not(:disabled) { background: rgba(0, 0, 0, 0.75); }
.ss-gallery__arrow:disabled { opacity: 0.35; }

/* ---------- thumbnail strip ---------- */

.ss-gallery__thumbs .splide__slide {
  opacity: 0.55;
  transition: opacity 0.15s ease;
  cursor: pointer;
  border-radius: 2px;
  overflow: hidden;
}
.ss-gallery__thumbs .splide__slide:hover { opacity: 0.85; }

.ss-gallery__thumbs .splide__slide.is-active {
  opacity: 1;
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.ss-gallery__thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;   /* uniform strip; the hero shows the true aspect */
  display: block;
}

/* ---------- caption ---------- */

.ss-gallery__count {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ---------- accessibility ---------- */

.ss-gallery :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ss-gallery .splide__track,
  .ss-gallery__thumbs .splide__slide {
    transition: none !important;
  }
}
