img[data-gallery-photo-pending="true"] {
  visibility: hidden !important;
}

button[aria-label="Открыть фото товара на весь экран"] {
  position: relative;
}

button[aria-label="Предыдущее фото"],
button[aria-label="Следующее фото"] {
  display: grid;
  place-items: center;
  font-size: 0;
  line-height: 0;
}

.galleryLoadingPatchArrowIcon {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[role="dialog"][data-gallery-photo-loading="true"]::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(92vw, 520px, 74vh);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  background: linear-gradient(100deg, #263242 25%, #39495b 42%, #263242 60%);
  background-size: 220% 100%;
  animation: galleryLoadingPatchShimmer 1.35s ease-in-out infinite;
  content: "";
  pointer-events: none;
}

[role="dialog"][data-gallery-photo-loading="true"]::after {
  position: absolute;
  z-index: 3;
  top: calc(50% + min(46vw, 260px));
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  color: #d6dee8;
  content: attr(data-gallery-photo-label);
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

[role="dialog"][data-gallery-photo-loading="true"][data-gallery-photo-error="true"]::before {
  background: #263242;
  animation: none;
}

[role="dialog"][data-gallery-photo-loading="true"] [class*="viewerCounter"] {
  z-index: 3;
}

button[aria-label="Открыть фото товара на весь экран"][data-gallery-photo-loading="true"]::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(72%, 300px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background: linear-gradient(100deg, #e2e8ef 25%, #f8fafc 42%, #e2e8ef 60%);
  background-size: 220% 100%;
  animation: galleryLoadingPatchShimmer 1.35s ease-in-out infinite;
  content: "";
  pointer-events: none;
}

button[aria-label="Открыть фото товара на весь экран"][data-gallery-photo-loading="true"]::after {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 20px;
  left: 0;
  color: #607187;
  content: attr(data-gallery-photo-label);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

button[aria-label="Открыть фото товара на весь экран"][data-gallery-photo-error="true"]::before {
  background: #e2e8ef;
  animation: none;
}

@keyframes galleryLoadingPatchShimmer {
  from { background-position: 100% 0; }
  to { background-position: -120% 0; }
}

@media (max-width: 600px) {
  [role="dialog"][data-gallery-photo-loading="true"]::after {
    top: calc(50% + min(46vw, 180px));
  }
}

@media (prefers-reduced-motion: reduce) {
  [role="dialog"][data-gallery-photo-loading="true"]::before,
  button[aria-label="Открыть фото товара на весь экран"][data-gallery-photo-loading="true"]::before {
    animation: none;
  }
}
