/* Полноэкранный просмотр медиа и диалоги.
   Часть styles.css; порядок подключения в HTML = порядок каскада, менять нельзя. */

.media-viewer-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  padding: 16px 18px 18px;
}

/* Тулбар прижат к самому изображению (верхняя кромка), а не к краям экрана. */
.media-viewer-topbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.media-viewer-topbar .media-viewer-meta,
.media-viewer-topbar .media-viewer-actions {
  pointer-events: auto;
}

.media-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.media-viewer-meta,
.media-viewer-actions,
.media-viewer-submeta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-viewer-counter,
.media-viewer-badge {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 13, 18, 0.74);
  font-size: 0.74rem;
}

.media-viewer-badge {
  letter-spacing: 0.06em;
}

.media-viewer-actions .ghost-button,
.media-viewer-actions .icon-button {
  min-height: 34px;
  background: rgba(10, 13, 18, 0.74);
}

.media-viewer-stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 70px;
}

.media-viewer-image-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: fit-content;
  max-width: min(90vw, 980px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
}

.media-viewer-image {
  max-width: min(90vw, 980px);
  max-height: calc(100vh - 200px);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  object-fit: contain;
}

.media-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(134, 199, 255, 0.48);
  background: rgba(9, 14, 24, 0.92);
  color: #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

#media-viewer-prev {
  left: 18px;
}

#media-viewer-next {
  right: 18px;
}

.media-viewer-nav:hover {
  border-color: rgba(134, 199, 255, 0.86);
  background: rgba(31, 111, 255, 0.82);
}

:root[data-theme="light"] .media-viewer-nav {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(15, 23, 42, 0.84);
  color: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
}

.media-viewer-nav[hidden] {
  visibility: hidden;
}

.media-viewer-footer {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 13, 18, 0.88), rgba(8, 11, 16, 0.82));
  align-items: start;
}

.media-viewer-caption {
  margin: 0;
  flex: 1;
  min-width: 0;
  max-width: none;
  max-height: 8.8rem;
  overflow: auto;
  padding-right: 10px;
  line-height: 1.55;
  color: var(--text);
}

:root[data-theme="light"] .media-viewer-counter,
:root[data-theme="light"] .media-viewer-badge,
:root[data-theme="light"] .media-viewer-actions .ghost-button,
:root[data-theme="light"] .media-viewer-actions .icon-button,
:root[data-theme="light"] .media-viewer-footer {
  background: #ffffff;
  color: var(--text);
}

:root[data-theme="light"] .media-viewer-footer {
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.14);
}

.media-viewer-submeta {
  flex-wrap: wrap;
  flex: 0 0 auto;
  max-width: 340px;
  justify-content: end;
}

.gallery-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pill {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line);
}

.toast-root {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  z-index: 50;
}