/* ------- gallery ------- */
/* a big picture on top and a row of thumbnails underneath that scrolls sideways.
   click a thumbnail to show it in the big one */
.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery-wrap {
  width: min(100%, 36rem);
}

.gallery-wrap .stage {
  aspect-ratio: 16 / 10;     /* change this if your pictures are a different shape */
  overflow: hidden;
  border-radius: 1.5rem;
  view-transition-name: var(--vt);
}

.gallery-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
}

/* the edges of the strip fade to black on whichever sides there's more to scroll to.
   the script adds fade-left / fade-right; change 3rem to make the fade wider or narrower */
@property --fl { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fr { syntax: "<length>"; inherits: false; initial-value: 0px; }

.gallery.strip {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  transition: --fl 0.2s, --fr 0.2s;
  display: flex;
  gap: 0.4rem;
  margin-top: 0;
  padding-bottom: 0.6rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--Light) var(--Dark);
}

.strip-area {
  position: relative;
  margin-top: 0.4rem;
}

/* round scroll buttons, shown only on sides that can still scroll */
.strip-btn {
  position: absolute;
  top: calc((100% - 0.6rem) / 2);   /* middle of the thumbnails, not the scrollbar */
  transform: translateY(-50%);
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--Light);
  cursor: pointer;
}

.strip-btn[hidden] { display: none; }
.strip-btn-left  { left: 0.4rem; }
.strip-btn-right { right: 0.4rem; }

.strip-btn:hover,
.strip-btn:focus-visible {
  background-color: var(--Text);
}

.strip-btn:focus-visible {
  outline: 2px solid var(--Light);
  outline-offset: 2px;
}

.strip-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: var(--Bckd);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.strip-btn:hover svg,
.strip-btn:focus-visible svg {
  stroke: var(--Light);
}

.gallery.strip.fade-left  { --fl: 3rem; }
.gallery.strip.fade-right { --fr: 3rem; }

/* each thumbnail is a bit under a fifth of the width, so there's always a
   half-cut one poking out at the edge when there's more to scroll to */
.gallery.strip > li {
  flex: 0 0 calc((100% - 5 * 0.4rem) / 5.5);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 0.75rem;
  cursor: pointer;
}

/* frame around the current thumbnail (and the one you've tabbed to) */
.gallery.strip > li.active,
.gallery.strip > li:focus-visible {
  outline: 3px solid var(--Light);
  outline-offset: -3px;
}

/* swap animation: a quick fade of the big picture. set to 0.01s to basically turn it off */
::view-transition-group(*) {
  animation-duration: 0.2s;
  animation-timing-function: ease-out;
}
