.document-preview {
  width: min(94vw, 1120px);
  max-width: 1120px;
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(100, 20, 43, .16);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(22, 5, 13, .34);
}

.document-preview::backdrop {
  background: rgba(17, 5, 10, .78);
  backdrop-filter: blur(3px);
}

.document-preview__header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px 14px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.document-preview__header h2 {
  margin: 0;
  color: var(--wine-900);
  font-family: inherit;
  font-size: 1.06rem;
  letter-spacing: .01em;
}

.document-preview__close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #dfd2d6;
  border-radius: 50%;
  background: #fff;
  color: var(--wine-900);
  font-size: 1.55rem;
  line-height: 1;
}

.document-preview__close:hover,
.document-preview__close:focus-visible {
  border-color: var(--wine-800);
  background: var(--wine-800);
  color: #fff;
}

.document-preview__body {
  display: grid;
  min-height: min(68vh, 720px);
  max-height: calc(92vh - 128px);
  place-items: center;
  padding: 20px;
  overflow: auto;
  background: #f4f0ed;
}

.document-preview__body iframe {
  display: block;
  width: min(100%, 1040px);
  height: min(70vh, 760px);
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.document-preview__image {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 170px);
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 12px 34px rgba(30, 12, 18, .16);
}

.document-preview__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.document-preview__open[hidden] {
  display: none;
}

.pdf-cover {
  position: relative;
  overflow: hidden;
  min-height: 310px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f6f1ed, #e8dfe1);
  cursor: pointer;
}

.pdf-cover::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 54%, rgba(25, 6, 14, .76));
  content: "";
  pointer-events: none;
}

.pdf-cover::before {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--wine-800);
  color: #fff;
  content: "PDF";
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: 0 6px 16px rgba(58, 9, 25, .22);
}

.pdf-cover iframe {
  display: block;
  width: 100%;
  height: 390px;
  border: 0;
  background: #fff;
  pointer-events: none;
}

.pdf-cover__label {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

.pdf-cover__label::before {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 50%;
  content: "↗";
  font-size: 1rem;
}

.pdf-cover:hover,
.pdf-cover:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: -3px;
}

.pdf-cover:hover iframe,
.pdf-cover:focus-visible iframe {
  transform: scale(1.012);
}

.pdf-cover iframe {
  transition: transform .35s ease;
}

@media (max-width: 640px) {
  .document-preview {
    width: calc(100vw - 20px);
    border-radius: 14px;
  }

  .document-preview__header {
    min-height: 58px;
    padding: 10px 12px 10px 16px;
  }

  .document-preview__header h2 {
    font-size: .95rem;
  }

  .document-preview__body {
    min-height: 55vh;
    padding: 10px;
  }

  .document-preview__body iframe {
    min-height: 60vh;
  }

  .pdf-cover {
    min-height: 250px;
  }

  .pdf-cover iframe {
    height: 310px;
  }

  .document-preview__footer {
    padding: 10px 12px;
  }
}
