/* PHOTO STRIP — used on painting pages with more than one photo (see gallery.js) */
.gallery {
  text-align: center;
}

.gallery-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 0.5rem 0 2rem;
}

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

.gallery-track:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

.gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.gallery-slide img {
  display: block;
  width: auto;
  max-width: calc(100% - 4rem);  /* leaves room for the shadow inside the strip */
  max-height: 78vh;
  margin: 0 auto;
  cursor: zoom-in;
  box-shadow: 0 10px 28px rgba(28, 28, 26, 0.12);
}

.gallery-slide video {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100% - 4rem);
  max-height: 78vh;
  margin: 0 auto;
  box-shadow: 0 10px 28px rgba(28, 28, 26, 0.12);
}

.gallery-slide figcaption {
  margin-top: 1rem;
  font-size: 0.8125rem;
  font-weight: 300;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.gallery-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
}

.gallery-bar button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.gallery-bar button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}

.gallery-bar button:disabled {
  opacity: 0.35;
  cursor: default;
}

.gallery-count {
  min-width: 4.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.gallery-thumb {
  padding: 2px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.gallery-thumb img {
  display: block;
  height: 56px;
  width: auto;
}

.gallery-thumb--video {
  position: relative;
}

.gallery-thumb--video::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.gallery-thumb:hover,
.gallery-thumb[aria-current="true"] {
  opacity: 1;
}

.gallery-thumb[aria-current="true"] {
  border-color: var(--accent);
}

/* Full-screen view */
.gallery-dialog {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  background: transparent;
}

.gallery-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-dialog::backdrop {
  background: rgba(28, 28, 26, 0.96);
}

.gallery-dialog img {
  max-width: 94vw;
  max-height: 90vh;
}

.gallery-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

/* Phones: the next photo peeks in at the edge, and swiping replaces the thumbnails */
@media (max-width: 640px) {
  .gallery-track {
    gap: 0.75rem;
  }

  .gallery-slide {
    flex-basis: 86%;
  }

  .gallery-slide img,
  .gallery-slide video {
    max-width: calc(100% - 1rem);
    box-shadow: 0 6px 16px rgba(28, 28, 26, 0.12);
  }

  .gallery-thumbs {
    display: none;
  }
}

/* The arrows and thumbnails need gallery.js; hide them if it hasn't run */
.gallery:not(.is-ready) .gallery-bar,
.gallery:not(.is-ready) .gallery-thumbs {
  display: none;
}
