/*
 * /gallery/ slideshow. Source: design/…/Gallery.dc.html.
 * Without JS the photos stack. With JS, an inline script in the template
 * adds .is-ready before the first paint (no layout shift) and the
 * slideshow layout below takes over; gallery.js wires up the controls.
 * Values come from the theme's tokens.css.
 */

.rv-gallery {
  padding: 0 var(--gutter);
}

.rv-gallery__slides {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 24px 0 0;
  list-style: none;
}

.rv-gallery__img {
  display: block;
  width: 100%;
  height: auto;
}

.rv-gallery__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  max-width: 100%;
  background: radial-gradient(ellipse at 50% 40%, var(--bg-glow), var(--bg-deep) 75%);
  color: var(--text-ghost);
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

/* ---- Slideshow (JS) ----------------------------------------------- */

/* The stage fills the screen below the sticky header, minus the bar.
   gallery.js publishes the header's height as --rv-header-h. */
.rv-gallery.is-ready .rv-gallery__slides {
  position: relative;
  height: max(280px, calc(100svh - var(--rv-header-h, 77px) - 94px));
  cursor: pointer;
}

.rv-gallery.is-ready .rv-gallery__slide {
  position: absolute;
  inset: 24px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.rv-gallery.is-ready .rv-gallery__slide.is-current {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.35s ease;
}

.rv-gallery.is-ready .rv-gallery__img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.rv-gallery.is-ready .rv-gallery__frame {
  height: 100%;
}

/* ---- Counter, progress, controls ---------------------------------- */

.rv-gallery__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 28px;
}

.rv-gallery__bar[hidden] {
  display: none;
}

/* In slideshow mode the bar keeps its place before gallery.js shows it,
   so the footer never moves. */
.rv-gallery.is-ready .rv-gallery__bar[hidden] {
  display: flex;
  visibility: hidden;
}

.rv-gallery__count {
  min-width: 90px;
  margin: 0;
  color: var(--text-faint);
  font-size: var(--fs-small);
  font-weight: var(--fw-light);
  letter-spacing: var(--track-label);
}

.rv-gallery__current {
  color: var(--gold);
}

.rv-gallery__progress {
  position: relative;
  flex: 1;
  max-width: 420px;
  height: 1px;
  background: var(--rule);
}

.rv-gallery__progress span {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--progress, 0%);
  height: 1px;
  background: var(--gold);
  transition: width 0.35s ease;
}

.rv-gallery__buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  min-width: 90px;
}

.rv-gallery__btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--hairline-outline);
  border-radius: 0;
  background: none;
  color: var(--gold);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.rv-gallery__btn:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

@media (prefers-reduced-motion: reduce) {

  .rv-gallery.is-ready .rv-gallery__slide,
  .rv-gallery.is-ready .rv-gallery__slide.is-current,
  .rv-gallery__progress span,
  .rv-gallery__btn {
    transition: none;
  }
}
