@import url("/vendor/pdfjs/pdf_viewer.css");

.pdf-reader {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  order: 2;
  width: 100%;
  height: 75vh;
  min-height: 360px;
  overflow: hidden;
  background: #e9edf2;
  border: 1px solid #dce1e7;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgb(15 23 42 / 5%);
}

.pdf-toolbar {
  --toolbar-unit: min(1px, 0.105cqi);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: calc(12 * var(--toolbar-unit));
  flex-shrink: 0;
  padding: calc(10 * var(--toolbar-unit)) calc(14 * var(--toolbar-unit));
  border-bottom: 1px solid #dce1e7;
  background: #fff;
  color: #334155;
  font: 500 calc(14 * var(--toolbar-unit))/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pdf-toolbar button,
.pdf-toolbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(8 * var(--toolbar-unit));
  min-height: calc(40 * var(--toolbar-unit));
  padding: 0 calc(12 * var(--toolbar-unit));
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.pdf-toolbar button:hover,
.pdf-toolbar a:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.pdf-toolbar button:active,
.pdf-toolbar a:active {
  background: #e2e8f0;
}

.pdf-toolbar button:focus-visible,
.pdf-toolbar a:focus-visible,
.pdf-search input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.pdf-search {
  display: flex;
  align-items: center;
  gap: calc(4 * var(--toolbar-unit));
  min-width: 0;
  max-width: 100%;
}

.pdf-search input {
  width: calc(160 * var(--toolbar-unit));
  min-width: 0;
  min-height: calc(40 * var(--toolbar-unit));
  padding: 0 calc(10 * var(--toolbar-unit));
  border: 1px solid #dce1e7;
  border-radius: 7px;
  background: #f8fafc;
  color: inherit;
  font: inherit;
}

.pdf-toolbar .pdf-fullscreen {
  border-color: #dce1e7;
}

.pdf-fullscreen::before {
  content: "";
  width: calc(16 * var(--toolbar-unit));
  height: calc(16 * var(--toolbar-unit));
  flex-shrink: 0;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.pdf-zoom {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid #dce1e7;
  border-radius: 7px;
  background: #f8fafc;
}

.pdf-zoom button {
  width: calc(40 * var(--toolbar-unit));
  padding: 0;
  font-size: calc(22 * var(--toolbar-unit));
  font-weight: 400;
}

.pdf-zoom button + button {
  border-left-color: #dce1e7;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.pdf-toolbar a {
  margin-left: auto;
  color: #475569;
}

.pdf-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.pdf-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  scrollbar-color: #a8b2bf transparent;
  scrollbar-width: thin;
}

.pdf-reader .pdfViewer {
  padding: 16px 0;
}

/* PDF.js sizes pages by their content; the site's border-box reset would
   shrink the canvas relative to its text and annotation layers. */
.pdf-reader .pdfViewer .page {
  box-sizing: content-box;
}

.pdf-reader .annotationLayer .linkAnnotation:not(.hasBorder) > a:hover {
  opacity: 1;
  background-color: rgb(135 206 250 / 0.3);
  box-shadow: none;
}

.pdf-reader .annotationLayer .linkAnnotation.hasBorder:hover {
  background-color: rgb(135 206 250 / 0.3);
}

.pdf-scroll.preparing {
  opacity: 0;
  pointer-events: none;
}

.pdf-reader.expanded {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100%;
  z-index: 10000;
  border: 0;
  border-radius: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}

.pdf-reader:fullscreen {
  height: 100%;
  width: 100%;
}

.pdf-status {
  font-size: 14px;
  color: #9f1239;
}

.pdf-status:empty {
  display: none;
}

@media (max-width: 480px) {
  .pdf-reader .pdfViewer {
    padding: 8px 0;
  }
}
