/**
 * The PDF viewer (Bv_Pdf).
 *
 * Rendered with the image; bv-pdf.js adds .bv-pdf--viewer when the browser's own viewer
 * takes over. The widget writes its colours and sizes through {{WRAPPER}}, which beats
 * everything here.
 */

.bv-pdf {
  --bv-pdf-height: 800px;
  /* What the viewer's own toolbar takes off the top, added to an A4 height */
  --bv-pdf-toolbar: 56px;
  box-sizing: border-box;
}

.bv-pdf *,
.bv-pdf *::before,
.bv-pdf *::after {
  box-sizing: border-box;
}

.bv-pdf [hidden] {
  display: none !important;
}

.bv-pdf .bv-pdf-frame {
  display: block;
  width: 100%;
  height: var(--bv-pdf-height);
  border: 0;
}

.bv-pdf.bv-pdf--uten-verktoylinje {
  --bv-pdf-toolbar: 0px;
}

/*
 * A4: the height follows the width, so a page fitted to the width (view=FitH) fits in
 * whole. aspect-ratio cannot add the toolbar on top, so where container units work the
 * height is worked out from the width of the viewer instead.
 */
.bv-pdf.bv-pdf--a4 .bv-pdf-frame {
  height: auto;
  aspect-ratio: 210 / 297;
}

.bv-pdf.bv-pdf--a4-liggende .bv-pdf-frame {
  height: auto;
  aspect-ratio: 297 / 210;
}

@supports (height: 1cqi) {
  .bv-pdf.bv-pdf--a4 .bv-pdf-viewer,
  .bv-pdf.bv-pdf--a4-liggende .bv-pdf-viewer {
    container-type: inline-size;
  }

  .bv-pdf.bv-pdf--a4 .bv-pdf-frame {
    aspect-ratio: auto;
    height: calc(100cqi * 297 / 210 + var(--bv-pdf-toolbar));
  }

  .bv-pdf.bv-pdf--a4-liggende .bv-pdf-frame {
    aspect-ratio: auto;
    height: calc(100cqi * 210 / 297 + var(--bv-pdf-toolbar));
  }
}

/* ---------------------------------------------------------------------
 * The image, without a viewer
 * ------------------------------------------------------------------ */

/*
 * The image takes the space the viewer would have had: A4, or the fixed height -- without
 * the toolbar, which an image does not have. The image fits inside it, or fills it when the
 * widget says so; what it leaves is the background.
 */
.bv-pdf .bv-pdf-cover {
  position: relative;
  display: block;
  overflow: hidden;
  height: var(--bv-pdf-height);
  background: #f3f3f3;
  color: inherit;
  text-decoration: none;
}

.bv-pdf.bv-pdf--a4 .bv-pdf-cover {
  height: auto;
  aspect-ratio: 210 / 297;
}

.bv-pdf.bv-pdf--a4-liggende .bv-pdf-cover {
  height: auto;
  aspect-ratio: 297 / 210;
}

.bv-pdf .bv-pdf-cover .bv-pdf-image {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: contain;
}

.bv-pdf .bv-pdf-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  padding: 24px;
  text-align: center;
}

.bv-pdf .bv-pdf-icon {
  width: 56px;
  height: 56px;
  color: #c62828;
}

.bv-pdf .bv-pdf-label {
  margin-top: -6px;
  color: #c62828;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Not every theme has the class */
.bv-pdf .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.bv-pdf .bv-pdf-name {
  font-weight: 600;
  word-break: break-word;
}

/* ---------------------------------------------------------------------
 * The buttons
 * ------------------------------------------------------------------ */

.bv-pdf .bv-pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* «Kun uten viewer»: the viewer has buttons of its own */
.bv-pdf.bv-pdf--knapper-fallback.bv-pdf--viewer .bv-pdf-actions {
  display: none;
}

.bv-pdf .bv-pdf-actions .bv-pdf-button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 3px;
  background: #000;
  color: #fff;
  line-height: 1.2;
  text-decoration: none;
}

.bv-pdf .bv-pdf-actions .bv-pdf-button:hover,
.bv-pdf .bv-pdf-actions .bv-pdf-button:focus-visible {
  opacity: 0.85;
}

.bv-pdf-tom {
  padding: 24px;
  border: 1px dashed #c3c4c7;
  text-align: center;
}
