* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000;
}

/* Readable by crawlers and screen readers, invisible on the page. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#gallery.has-error::after {
  content: "Could not load the gallery.";
  display: block;
  padding: 4rem 1rem;
  color: #555;
  font: 1rem/1.5 system-ui, sans-serif;
  text-align: center;
}

.slide {
  position: relative;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  overflow: hidden;

  /* No transform on entry: the panels form one continuous vertical image, so
     anything that moves a panel relative to its neighbour breaks the seam. */
  opacity: 0;
  transition: opacity 0.5s ease;
}

.slide.is-visible {
  opacity: 1;
}

/* Upscaled 20px thumbnail, blurred. Stands in until the real file decodes. */
.placeholder {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(18px);
  transform: scale(1.1);
  transition: opacity 0.5s ease;
}

.slide.is-loaded .placeholder {
  opacity: 0;
}

.slide .media {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.slide.is-loaded .media {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .slide,
  .slide .media,
  .placeholder {
    transition-duration: 0.01ms;
  }
}
