.product-gallery-tools[hidden],
.product-gallery-dialog:not([open]) {
  display: none;
}

.product-gallery-enhanced .largephoto {
  display: none;
}

.product-gallery-enhanced .mainphoto,
.product-gallery-stage {
  touch-action: pan-y pinch-zoom;
}

.productgallery.product-gallery-enhanced .mainphoto {
  max-height: min(82vh, 56rem);
}

.product-gallery-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  margin-top: .75rem;
}

.product-gallery-steppers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
}

.product-gallery-tools button,
.product-gallery-dialog button {
  display: inline-grid;
  min-block-size: 2.75rem;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: .35rem;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.product-gallery-steppers button,
.product-gallery-close {
  inline-size: 2.75rem;
  padding: .25rem;
}

.product-gallery-tools button:hover,
.product-gallery-dialog button:hover {
  background: color-mix(in srgb, currentColor 9%, transparent);
}

.product-gallery-tools button:disabled,
.product-gallery-dialog button:disabled {
  opacity: .45;
  cursor: default;
}

.product-gallery-tools button:focus-visible,
.product-gallery-dialog button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.product-gallery-position {
  min-inline-size: 4ch;
  text-align: center;
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}

.product-gallery-tools .product-gallery-open {
  display: inline-flex;
  gap: .4rem;
  align-items: center;
  padding: .5rem .75rem;
  font-size: .85rem;
  font-weight: 700;
}

.product-gallery-enhanced .thumbs a[aria-current="true"],
.product-gallery-filmstrip a[aria-current="true"] {
  outline: 2px solid var(--ink, currentColor);
  outline-offset: -2px;
}

.product-gallery-dialog[open] {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(.55rem, 2vmin, 1rem);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100%;
  margin: 0;
  overflow: auto;
  padding: max(.75rem, env(safe-area-inset-top)) clamp(.75rem, 3.5vw, 2.5rem) max(.75rem, env(safe-area-inset-bottom));
  border: 0;
  background: #181615;
  color: #fffaf5;
}

.product-gallery-dialog::backdrop {
  background: #181615;
}

.product-gallery-dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.product-gallery-dialog-heading h2 {
  margin: 0;
  font-size: clamp(.95rem, 2.5vw, 1.4rem);
  line-height: 1.3;
}

.product-gallery-dialog-heading .product-gallery-close {
  flex: none;
  font-size: 1.5rem;
  line-height: 1;
}

.product-gallery-stage {
  display: grid;
  min-height: 0;
  min-width: 0;
  place-items: center;
}

.productgallery .product-gallery-stage img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: auto;
  border: 0;
  object-fit: contain;
}

.product-gallery-dialog-footer {
  display: grid;
  gap: .65rem;
  min-width: 0;
  justify-items: center;
}

.product-gallery-filmstrip {
  display: flex;
  width: min(100%, 52rem);
  gap: .4rem;
  overflow-x: auto;
  padding-block: .2rem .35rem;
  color-scheme: dark;
}

.product-gallery-filmstrip a {
  flex: 0 0 clamp(2.65rem, 7vw, 3.6rem);
}

.productgallery .product-gallery-filmstrip img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.product-gallery-filmstrip a[aria-current="true"],
.product-gallery-filmstrip a:focus-visible {
  outline-color: #fffaf5;
}

.product-gallery-filmstrip a:focus-visible {
  outline: 2px solid #fffaf5;
  outline-offset: -2px;
}
