/* Slideshow (snippets/slideshow.php): a stage shaped like the first image, dots below. */
.slideshow {
  position: relative;
  float: left;
  width: 100%;
}

.slideshow-track {
  display: flex;
  aspect-ratio: var(--slideshow-ratio, 4 / 3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.slideshow-track::-webkit-scrollbar {
  display: none;
}

.slideshow-track:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.slideshow-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.slideshow-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slideshow-controls {
  display: contents;
}

.slideshow-controls[hidden] {
  display: none;
}

.slideshow button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.slideshow-prev,
.slideshow-next {
  position: absolute;
  /* centred on the stage: (100% - dot row and its margin) / 2 */
  top: calc(50% - (1.5rem + var(--space-sm)) / 2);
  translate: 0 -50%;
  width: 2.75rem;
  height: 2.75rem;
  /* light disc: the black chevron stays visible on dark and light photos */
  border-radius: 50%;
  opacity: 0.75;
  transition: opacity 0.3s;
}

.slideshow .slideshow-prev,
.slideshow .slideshow-next {
  background-color: rgba(255, 255, 255, 0.7);
}

.slideshow .slideshow-prev {
  left: var(--space-xs);
  background-image: url(../images/left-chevron.png);
  background-repeat: no-repeat;
  background-position: center;
}

.slideshow .slideshow-next {
  right: var(--space-xs);
  background-image: url(../images/right-chevron.png);
  background-repeat: no-repeat;
  background-position: center;
}

.slideshow-prev:disabled,
.slideshow-next:disabled {
  opacity: 0.1;
  cursor: default;
}

.slideshow-fullscreen {
  position: absolute;
  top: 0;
  right: 0;
  width: 2.75rem;
  height: 2.75rem;
  color: #fff;
  font-size: 1.25rem;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
  opacity: 0.75;
  transition: opacity 0.3s;
}

/* With a mouse, arrows and the fullscreen button show while hovering, as before. */
@media (hover: hover) {
  .slideshow:not(:hover) .slideshow-prev:not(:focus-visible),
  .slideshow:not(:hover) .slideshow-next:not(:focus-visible),
  .slideshow:not(:hover) .slideshow-fullscreen:not(:focus-visible) {
    opacity: 0;
  }
}

.slideshow-prev:hover:not(:disabled),
.slideshow-next:hover:not(:disabled),
.slideshow-fullscreen:hover {
  opacity: 1;
}

.slideshow button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: -3px;
  border-radius: 50%;
}

.slideshow-dots {
  display: flex;
  justify-content: center;
  height: 1.5rem;
  margin-top: var(--space-sm);
}

.slideshow-dot {
  width: 1.5rem;
  height: 1.5rem;
}

.slideshow-dot::before {
  content: "";
  display: block;
  box-sizing: border-box;
  width: 0.75rem;
  height: 0.75rem;
  margin: auto;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 2px #eeeff1;
  transition: box-shadow 0.3s ease-out;
}

.slideshow-dot[aria-current="true"]::before {
  background: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* Fullscreen: fills the window above the fixed header (z-index 99999). */
.slideshow.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: #000;
}

.slideshow.is-fullscreen .slideshow-track {
  flex: 1;
  aspect-ratio: auto;
}

/* black chevrons, white on the black backdrop */
.slideshow.is-fullscreen .slideshow-prev,
.slideshow.is-fullscreen .slideshow-next {
  filter: invert(1);
}

html.slideshow-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .slideshow-prev,
  .slideshow-next,
  .slideshow-fullscreen,
  .slideshow-dot::before {
    transition: none;
  }
}
