/* Hero slideshow (spec/04-design/hero.md "Slideshow"): the page photo as a slow cross-fade of several photos.
   Linked only by pages whose front matter has `hero_slide:` lines (FI Talkoot), after site.css.
   Without JS only photo 1 shows (the others are display:none, so the browser never fetches them). */

.hero__slides {
  position: absolute;
  z-index: -2;
  inset: 0;
  overflow: hidden;
}

.hero__slides .hero__img { z-index: 0; }

/* Hidden photos are not rendered: lazy images that are display:none are not fetched until their turn. */
.hero__slide {
  display: none;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.hero__slide.is-loading { display: block; opacity: 0; z-index: 0; }
.hero__slide.is-prev { display: block; opacity: 1; z-index: 1; }
.hero__slide.is-current { display: block; opacity: 1; z-index: 2; }

/* Pause/Play: bottom right of the 960px nav frame, level with the title (title left, button right).
   Shown only once hero-slides.js runs (it is the only thing the button controls). */
.hero__controls {
  display: none;
  position: absolute;
  z-index: 1;
  right: max(30px, calc((100% - var(--w-nav)) / 2 + 14px));
  bottom: clamp(36px, 6vw, 64px);
}

.hero--slides.is-ready .hero__controls { display: block; }

.hero__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 18px 0 14px;
  border: 1.5px solid rgba(237, 218, 203, 0.85);
  border-radius: 999px;
  /* Dark enough over the brightest photo pixels: cream text ≥ 6:1 (hero.md). */
  background: rgba(34, 22, 12, 0.78);
  color: var(--cream);
  font: 700 0.9375rem/1 var(--font);
  cursor: pointer;
}

.hero__toggle:hover { background: rgba(34, 22, 12, 0.94); border-color: var(--cream); }

.hero__icon { flex: none; }

/* One icon per state: Pause while it rotates, Play once stopped (the label swaps with it). */
.hero__icon--play { display: none; }
.hero--slides.is-paused .hero__icon--play { display: block; }
.hero--slides.is-paused .hero__icon--pause { display: none; }

/* Phones: the title runs nearly the full width, so the button sits in its own row under it. */
@media (max-width: 599.98px) {
  .hero--slides.is-ready { padding-bottom: 76px; }
  .hero__controls { right: 30px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__slide { transition: none; }
}

@media print {
  .hero__slides,
  .hero__controls { display: none !important; }
}
