.certificate-viewer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(52vw, 920px);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: #213b33;
  background: #f7f4ec;
  box-shadow: -22px 0 70px rgb(24 53 45 / 24%);
}

.certificate-viewer::backdrop {
  background: rgb(20 39 34 / 42%);
  backdrop-filter: blur(2px);
}

.certificate-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  animation: certificate-viewer-in 0.24s ease-out;
}

.certificate-viewer__bar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px 12px 24px;
  border-bottom: 1px solid rgb(83 107 67 / 14%);
}

.certificate-viewer__bar h2 {
  margin: 0;
  font: 600 clamp(15px, 1.2vw, 19px)/1.3 var(--second-family, Arial, sans-serif);
}

.certificate-viewer__close {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #536b43;
  font: 300 31px/1 Arial, sans-serif;
  cursor: pointer;
}

.certificate-viewer__close:hover,
.certificate-viewer__close:focus-visible {
  background: #445736;
}

.certificate-viewer__stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 22px;
}

.certificate-viewer__stage::before {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #60705d;
  content: "Загрузка документа…";
  font: 600 16px/1.3 var(--second-family, Arial, sans-serif);
}

.certificate-viewer__stage[data-ready="true"]::before {
  display: none;
}

.certificate-viewer__stage img {
  display: block;
  opacity: 0;
  transform-origin: center;
  box-shadow: 0 14px 40px rgb(41 53 36 / 14%);
  transition: opacity 0.15s ease;
}

.certificate-viewer__stage[data-ready="true"] img {
  opacity: 1;
}

@keyframes certificate-viewer-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 820px) {
  .certificate-viewer {
    width: 100vw;
  }

  .certificate-viewer__stage {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .certificate-viewer[open] {
    animation: none;
  }
}
