.product-media-preview .modal__content {
  --modal-animation-name: animation-fade-in;

  position: fixed;
  inset-block: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
}

.product-media-preview[open]::before {
  background-color: transparent;
}

.product-media-preview__controls {
  position: absolute;
  inset-block: auto 24px;
  inset-inline-start: 50%;
  z-index: 6;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
}

.product-media-preview__control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  line-height: 1;
  border-style: solid;
  border-width: 1px;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgb(var(--color-shadow), 0.12);
}

.product-media-preview__close {
  width: 60px;
  height: 60px;
}

.product-media-preview__control .icon {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.product-media-preview__close .icon {
  width: 18px;
  height: 18px;
}

.product-media-preview__arrow[name="previous"] .icon {
  transform: rotate(90deg);
}

.product-media-preview__arrow[name="next"] .icon {
  transform: rotate(-90deg);
}

.product-media-preview__control:focus-visible,
.product-media-preview__zoom-control:focus-visible {
  outline: 2px solid rgb(var(--color-button-background));
  outline-offset: 3px;
}

.product-media-preview__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.product-media-preview__content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: row;
  gap: 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-x pinch-zoom;
}

.product-media-preview__content::-webkit-scrollbar {
  display: none;
}

.product-media-preview__media {
  position: relative;
  display: flex;
  flex: 0 0 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px clamp(16px, 4vw, 72px);
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.product-media-preview__media::-webkit-scrollbar {
  display: none;
}

.product-media-preview__zoom-control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  cursor: default;
  touch-action: pan-x pinch-zoom;
  transition: transform 0.25s ease;
  transform-origin: center;
}

.product-media-preview__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  cursor: zoom-in;
  object-fit: contain;
}

.product-media-preview__media theme-video-media,
.product-media-preview__media .theme-video-media {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
}

.product-media-preview__media .theme-video-media {
  aspect-ratio: var(--aspect-ratio, 16 / 9);
  object-fit: contain;
}

.product-media-preview__media.zoom-in {
  overflow: auto;
}

.product-media-preview__media.zoom-in .product-media-preview__zoom-control {
  cursor: default;
  touch-action: pan-x pan-y pinch-zoom;
  transform: scale(1.8);
}

.product-media-preview__media.zoom-in .product-media-preview__image {
  max-height: unset;
  margin-block-start: var(--offset-y, 0);
  margin-inline-start: var(--offset-x, 0);
  cursor: zoom-out;
}

@media (max-width: 959px) {
  .product-media-preview__controls {
    inset-block-end: 16px;
    gap: 10px;
  }

  .product-media-preview__control {
    width: 44px;
    height: 44px;
  }

  .product-media-preview__close {
    width: 50px;
    height: 50px;
  }

  .product-media-preview__media {
    padding: 8px;
  }
}

body:has([data-has-password-tip]) .product-media-preview__controls {
  inset-block-end: 88px;
}

@media (prefers-reduced-motion: reduce) {
  .product-media-preview__zoom-control {
    transition: none;
  }
}
