/* Shared light artwork viewer, extracted from the homepage gallery. */
html.is-gallery-open { overflow: hidden; }
.preview-gallery [hidden] { display: none !important; }
.preview-gallery[data-input] :is(a, button, [tabindex="0"]):focus-visible {
  outline: none;
}
.preview-gallery[data-input="keyboard"] a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.preview-gallery[open] {
  --gallery-edge-y: max(16px, env(safe-area-inset-top), env(safe-area-inset-bottom));
  --gallery-edge-x: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --gallery-control-size: 44px;
  --gallery-gap: 10px;
  --gallery-hover-shadow: 0 1px 3px rgb(0 0 0 / 5%), 0 3px 8px -3px rgb(0 0 0 / 6%);

  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--gallery-edge-y) var(--gallery-edge-x);
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  background: transparent;
  color: var(--preview-text, var(--color-black));
}

.preview-gallery::backdrop {
  background: rgb(247 247 247 / 76%);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  opacity: 0;
  transition: opacity 170ms ease;
}

.preview-gallery.is-visible::backdrop {
  opacity: 1;
  transition-duration: 240ms;
}

@media (prefers-reduced-motion: reduce) {
  .preview-gallery::backdrop, .preview-gallery.is-visible::backdrop { transition-duration: 100ms; }
}

@starting-style {
  .preview-gallery.is-visible::backdrop { opacity: 0; }
}

.preview-gallery__panel {
  --gallery-fit-height: calc(100dvh - 2 * (var(--gallery-edge-y) + var(--gallery-control-size) + var(--gallery-gap)) - 19px);

  display: grid;
  flex: none;
  width: min(100%, clamp(152px, calc(var(--gallery-fit-height) * var(--gallery-ratio, 1)), 1320px));
  gap: var(--gallery-gap);
  margin: auto;
}

.preview-gallery__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: var(--gallery-control-size);
}

.preview-gallery__header h2 { margin: 0; font-weight: 400; font-size: clamp(1rem, 2.3vw, 1.3125rem); line-height: 1.25; }

.preview-gallery__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: var(--gallery-ratio, 1);
}

.preview-gallery__media > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: contain;
}

.preview-gallery:not([data-gallery-ready]) [data-gallery-active],
.preview-gallery.is-morphing [data-gallery-active] { opacity: 0; }

.preview-gallery__transition {
  position: fixed;
  z-index: 1;
  max-width: none;
  border-radius: 4px;
  object-fit: contain;
  pointer-events: none;
}

.preview-gallery__transition[hidden] { display: none; }

.preview-gallery__media a { padding: 10px; color: var(--preview-accent, var(--color-blue)); }

.preview-gallery__control, .preview-gallery__thumbnails button {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--gallery-control-size);
  height: var(--gallery-control-size);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--preview-text, var(--color-black));
  cursor: pointer;
}

.preview-gallery__control { border-radius: 50%; }
.preview-gallery[data-input="keyboard"] .preview-gallery__control:focus-visible {
  background: var(--preview-text, var(--color-black));
  color: var(--color-white, #fff);
}

.preview-gallery__control span { display: grid; place-items: center; width: 20px; height: 20px; }

.preview-gallery__control span::before, .preview-gallery__control span::after {
  content: "";
  grid-area: 1 / 1;
  width: 20px;
  height: 1px;
  background: currentColor;
  transform: rotate(45deg);
}

.preview-gallery__control span::after { transform: rotate(-45deg); }

.preview-gallery__thumbnails {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  padding-block: 3px 16px;
}
.preview-gallery__thumbnails button {
  position: relative;
  width: max(24px, calc(var(--gallery-control-size) * var(--thumbnail-ratio, 1)));
  height: var(--gallery-control-size);
  border-radius: 4px;
}
.preview-gallery__thumbnails img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: inherit;
  object-fit: contain;
  opacity: .65;
}
.preview-gallery__thumbnails button[aria-current="true"] img { opacity: 1; }
.preview-gallery__thumbnails button[aria-current="true"]::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: calc(50% - 2px);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.preview-gallery[data-input="keyboard"] .preview-gallery__thumbnails button:focus-visible::before {
  content: "";
  position: absolute;
  inset: auto 0 -13px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}

@media (forced-colors: active) {
  .preview-gallery[data-input="keyboard"] :is(a, button, [tabindex="0"]):focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 3px;
  }
  .preview-gallery[data-input="keyboard"] .preview-gallery__control:focus-visible {
    background: Highlight;
    color: HighlightText;
  }
  .preview-gallery__thumbnails img { opacity: 1; }
}

@media (hover: hover) and (pointer: fine) {
  .preview-gallery__thumbnails button:hover img {
    opacity: 1;
    box-shadow: var(--gallery-hover-shadow);
  }
  .preview-gallery__control:hover {
    background: rgb(255 255 255 / 36%);
    box-shadow: var(--gallery-hover-shadow);
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .preview-gallery__control span { transition: transform 180ms cubic-bezier(0.25, 0.6, 0.35, 1); }
  .preview-gallery__control:hover span { transform: rotate(90deg); }
}

