.photo-gallery {
  --gallery-height: clamp(260px, 32vw, 480px);
  min-width: 0;
  width: 100%;
}

.photo-gallery .gallery-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

.photo-gallery:not([data-gallery-ready]) .gallery-controls {
  display: none;
}

.photo-gallery [data-gallery-status] {
  margin-right: 8px;
  color: var(--muted, currentColor);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.photo-gallery .gallery-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line, #b9d2bd55);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.photo-gallery .gallery-controls button svg {
  width: 20px;
  height: 20px;
}

.photo-gallery [data-gallery-prev] svg { transform: rotate(180deg); }

.photo-gallery .gallery-controls button:disabled {
  opacity: .3;
  cursor: default;
}

@media (hover: hover) {
  .photo-gallery .gallery-controls button:not(:disabled):hover {
    border-color: currentColor;
    background: #b9d2bd1a;
  }
}

.photo-gallery .gallery-track[data-gallery-track] {
  position: relative;
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  width: 100%;
  min-width: 0;
  padding: 4px 0 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  /* Lenis contains both axes on marked tracks; vertical gestures belong to the page. */
  overscroll-behavior-y: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line, #b9d2bd55) transparent;
}

.photo-gallery .gallery-track::-webkit-scrollbar {
  height: 5px;
}

.photo-gallery .gallery-track::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background: var(--line, #b9d2bd55);
}

.photo-gallery .gallery-track .gallery-slide {
  flex: 0 0 auto;
  width: min(calc(var(--gallery-height) * var(--photo-ratio, 1.5)), 86%);
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
}

.photo-gallery .gallery-slide > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--gallery-height);
  border-radius: 16px;
}

.photo-gallery .gallery-slide > a > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 16px;
  object-fit: contain;
}

.photo-gallery .gallery-track .gallery-slide figcaption {
  margin-top: 14px;
  padding-top: 0;
  color: var(--muted, currentColor);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.photo-gallery .gallery-slide figcaption span { display: block; }

.veil .restoration-gallery { margin-top: 60px; }
.veil .restoration-gallery > h3 { margin-bottom: 16px; }

.photo-gallery .gallery-track:focus-visible,
.photo-gallery .gallery-controls button:focus-visible,
.photo-gallery .gallery-slide > a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .photo-gallery { --gallery-height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  .photo-gallery .gallery-controls button { transition: none; }
  .photo-gallery .gallery-track { scroll-behavior: auto; }
}
