/* Pacexports PDF Viewer. Self-contained: works in any theme. */

.pacex-pdfv {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0c1830;
  color: #fff;
  font-family: inherit;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.pacex-pdfv[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.pacex-pdfv::backdrop {
  background: #0c1830;
}

html.pacex-pdfv-open {
  overflow: hidden;
}

.pacex-pdfv__bar {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  padding: 10px clamp(12px, 3vw, 28px);
  background: #142544;
  border-bottom: 1px solid rgba(228, 234, 245, 0.2);
}

.pacex-pdfv__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font: inherit; /* a theme's display face for h2 is too loud for a toolbar */
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pacex-pdfv__pages {
  flex: none;
  margin: 0;
  color: #c9d5ea;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.pacex-pdfv__tools {
  display: flex;
  flex: none;
  gap: 6px;
}

.pacex-pdfv__tools button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(228, 234, 245, 0.4);
  border-radius: 3px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.pacex-pdfv__tools button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.pacex-pdfv__tools button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pacex-pdfv__tools button:focus-visible,
.pacex-pdfv__scroll:focus-visible {
  outline: 3px solid #8eb75f;
  outline-offset: 2px;
}

.pacex-pdfv__tools .pacex-pdfv__close {
  border-color: #8eb75f;
  background: #8eb75f;
  color: #142544;
}

.pacex-pdfv__tools .pacex-pdfv__close:hover {
  background: #76a047;
}

.pacex-pdfv__scroll {
  overflow: auto;
  padding: clamp(12px, 3vw, 32px);
  overscroll-behavior: contain;
}

.pacex-pdfv__status {
  max-width: 46ch;
  margin: 18vh auto 0;
  color: #c9d5ea;
  font-size: 1.0625rem;
  line-height: 1.5;
  text-align: center;
}

/* --pdfv-zoom scales the sheet; at 1 a page fits the width, up to a comfortable reading size */
.pacex-pdfv__sheet {
  display: grid;
  gap: clamp(10px, 2vw, 20px);
  width: calc(min(100%, 980px) * var(--pdfv-zoom, 1));
  margin-inline: auto;
}

.pacex-pdfv__page {
  width: 100%;
  overflow: hidden;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.7);
}

.pacex-pdfv__page canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none; /* nothing to right-click, drag or long-press */
}

@media (max-width: 560px) {
  .pacex-pdfv__bar {
    flex-wrap: wrap;
  }

  .pacex-pdfv__title {
    flex-basis: 100%;
  }

  .pacex-pdfv__pages {
    flex: 1;
  }
}

/* Printing while the viewer is open prints nothing. */
@media print {
  html.pacex-pdfv-open body > *,
  .pacex-pdfv {
    display: none !important;
  }
}

/* The default button, for the shortcode in any theme. */
.pacex-pdfv-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
