.photo-viewer {
  /* Кнопки-стрелки стоят поверх кадра: без этого быстрое нажатие выделяло
     разметку просмотрщика, как будто пользователь сделал двойной клик. */
  -webkit-user-select: none;
  user-select: none;
}

.photo-viewer .photo-viewer-heading {
  -webkit-user-select: text;
  user-select: text;
}

.photo-viewer-stage {
  position: relative;
}

.photo-viewer .photo-viewer-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  padding: 0;
  border-radius: 50%;
  aspect-ratio: 1;
}

.photo-viewer-heading [data-photo-title] {
  margin: 0;
  color: #fff;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.photo-viewer-heading [data-photo-description] {
  margin-top: 4px;
  color: #c2c7cf;
  font-size: 12px;
}
.photo-viewer [data-photo-zoom]:disabled {
  opacity: .5;
  cursor: default;
}

.photo-viewer [data-photo-main][hidden],
.photo-viewer [data-photo-description][hidden],
.photo-viewer [data-photo-status][hidden],
.photo-viewer [data-photo-loading-icon][hidden],
.photo-viewer button[data-photo-retry][hidden] {
  display: none;
}

.photo-viewer-status {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 16px 20px;
  border-radius: 8px;
  background: rgba(16, 20, 26, .9);
  color: #fff;
  text-align: center;
  transform: translate(-50%, -50%);
}

.photo-viewer-status p {
  margin: 0;
  max-width: 28em;
  font-size: 14px;
  line-height: 1.5;
}

.photo-viewer [data-photo-loading-icon] {
  display: block;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, .25);
  border-top-color: #a9cfff;
  border-radius: 50%;
  animation: photo-viewer-loading 1s linear infinite;
}

.photo-viewer-stage.has-photo-preview .photo-viewer-status {
  top: auto;
  bottom: 12px;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  transform: translateX(-50%);
}

.photo-viewer-stage.is-error [data-photo-loading-icon] {
  display: none;
}

.photo-viewer button[data-photo-retry] {
  background: #f4f7fb;
  color: #101820;
}

.photo-viewer button[data-photo-retry]:hover {
  background: #dcecff;
}

.photo-viewer button[data-photo-retry]:focus-visible {
  outline: 3px solid #77b4ff;
  outline-offset: 3px;
}

@keyframes photo-viewer-loading {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .photo-viewer [data-photo-loading-icon] {
    animation: none;
  }
}
