/**
 * @file
 * Styles for PDF Embed & SEO Optimize viewer.
 */

/* Viewer wrapper */
.pdf-viewer-wrapper {
  position: relative;
  width: 100%;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

/* Toolbar */
.pdf-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #333;
  color: #fff;
  gap: 16px;
}

.pdf-viewer-toolbar-left,
.pdf-viewer-toolbar-center,
.pdf-viewer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.pdf-viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Remove the ~350ms double-tap-to-zoom click delay on iOS; without it fast
     taps on Done/zoom buttons are sometimes swallowed as a zoom gesture. */
  touch-action: manipulation;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.pdf-viewer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.pdf-viewer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Inline SVG toolbar icons inherit the button's text color. */
.pdf-viewer-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

/* Page navigation */
.pdf-viewer-page-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.pdf-viewer-page-input {
  width: 50px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  text-align: center;
  font-size: 14px;
}

.pdf-viewer-page-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Zoom */
.pdf-viewer-zoom-level {
  min-width: 50px;
  text-align: center;
  font-size: 14px;
}

.pdf-viewer-zoom-select {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.pdf-viewer-zoom-select option {
  background: #333;
  color: #fff;
}

/* Canvas container */
.pdf-viewer-container {
  position: relative;
  overflow-x: auto;
  /* Always reserve the vertical scrollbar: with `auto` it appears only after
     the fitted page turns out to be taller than the container, narrowing it
     after the fit was measured — which leaves the page overflowing
     horizontally by the width of the scrollbar. */
  overflow-y: scroll;
  background: #525659;
  /* Keep one-finger panning but hand two-finger pinches to the viewer's own
     zoom (bindPinchZoom). Without this the browser zooms the whole page —
     toolbar included — instead of the document. */
  touch-action: pan-x pan-y;
}

.pdf-viewer-canvas-wrapper {
  display: flex;
  /* Centre with auto margins on the page instead of justify-content: a
     centred flex item wider than the container overflows to both sides and
     the left overflow cannot be scrolled to, so part of a zoomed page is
     unreachable. Auto margins collapse to 0 once the page overflows. */
  justify-content: flex-start;
  padding: 20px;
  min-height: 100%;
}

.pdf-viewer-canvas {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  background: #fff;
}

/* Page wrapper (positions annotation layer over canvas) */
.pdf-viewer-page-wrapper {
  position: relative;
  display: inline-block;
  margin: 0 auto;
}

/* Annotation layer (overlays canvas for AcroForm fields) */
.pdf-viewer-annotation-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  z-index: 3;
}

.pdf-viewer-annotation-layer input,
.pdf-viewer-annotation-layer select,
.pdf-viewer-annotation-layer textarea {
  pointer-events: auto;
}

/* Fallback form field styles */
.pdf-form-field {
  position: absolute;
  background: rgba(194, 218, 255, 0.65);
  border: 1.5px solid rgba(0, 85, 170, 0.55);
  border-radius: 2px;
  font-size: 12px;
  padding: 1px 4px;
  box-sizing: border-box;
  outline: none;
  font-family: sans-serif;
}

.pdf-form-field:focus {
  background: rgba(194, 218, 255, 0.9);
  border-color: #0055aa;
  box-shadow: 0 0 0 2px rgba(0, 85, 170, 0.25);
}

.pdf-form-checkbox,
.pdf-form-radio {
  width: auto !important;
  height: auto !important;
  min-width: 16px;
  min-height: 16px;
  cursor: pointer;
}

.pdf-form-select {
  cursor: pointer;
}

/* PDF.js AnnotationLayer — required for widget elements to render correctly.
   PDF.js creates section/aside children with these classes; without these
   rules the elements are invisible or non-interactive. */
.pdf-viewer-annotation-layer section,
.pdf-viewer-annotation-layer aside {
  position: absolute;
  text-align: initial;
  pointer-events: auto;
}

.pdf-viewer-annotation-layer .textWidgetAnnotation :is(input, textarea),
.pdf-viewer-annotation-layer .choiceWidgetAnnotation select {
  /* Strip native widget chrome — iOS Safari otherwise paints inputs as grey
     rounded pills with a minimum height, which breaks the field alignment as
     soon as the page is zoomed. */
  appearance: none;
  -webkit-appearance: none;
  border-radius: 2px;
  background-color: rgba(0, 54, 255, 0.13);
  border: 1px solid transparent;
  box-sizing: border-box;
  font-size: calc(9px * var(--scale-factor));
  height: 100%;
  margin: 0;
  padding: 0 3px;
  vertical-align: top;
  width: 100%;
}

.pdf-viewer-annotation-layer .textWidgetAnnotation textarea {
  resize: none;
}

.pdf-viewer-annotation-layer .textWidgetAnnotation :is(input, textarea):focus,
.pdf-viewer-annotation-layer .choiceWidgetAnnotation select:focus {
  background-color: rgba(0, 54, 255, 0.2);
  border-color: rgba(0, 54, 255, 0.4);
  outline: none;
}

/* Checkboxes & radios.
   The PDF canvas already draws the field box for these (it is static page
   content, which ENABLE_FORMS does not strip), so the HTML control must NOT
   draw its own box — otherwise you get two overlapping squares. Keep the input
   transparent and borderless (it just provides the hit area) and overlay only
   the checkmark / dot so a single, clean box shows. */
.pdf-viewer-annotation-layer .buttonWidgetAnnotation.checkBox input,
.pdf-viewer-annotation-layer .buttonWidgetAnnotation.radioButton input {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  /* Fill the widget box exactly. Absolute positioning (the parent section is
     already position:absolute) avoids the in-flow vertical offset caused by an
     inherited line-height taller than the tiny field box, which otherwise
     pushes the checkmark below centre. */
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: none;
}

/* Checkmark: a centered SVG that scales with the box and is always perfectly
   centred (an asymmetric rotated-border tick centres unreliably on small boxes). */
.pdf-viewer-annotation-layer .buttonWidgetAnnotation.checkBox input:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%230036ff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 85% 85%;
}

/* Radio dot. */
.pdf-viewer-annotation-layer .buttonWidgetAnnotation.radioButton input:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: #0036ff;
  transform: translate(-50%, -50%);
}

.pdf-viewer-annotation-layer .buttonWidgetAnnotation.checkBox input:focus,
.pdf-viewer-annotation-layer .buttonWidgetAnnotation.radioButton input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 54, 255, 0.25);
}

.pdf-viewer-annotation-layer .linkAnnotation > a,
.pdf-viewer-annotation-layer .buttonWidgetAnnotation.pushButton > a {
  position: absolute;
  font-size: 1em;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Form toolbar */
.pdf-viewer-form-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: #2b5797;
  color: #fff;
  font-size: 13px;
}

.pdf-viewer-form-toolbar-label {
  font-weight: 600;
  margin-right: auto;
}

.pdf-viewer-form-toolbar .pdf-viewer-btn {
  width: auto;
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  white-space: nowrap;
}

.pdf-viewer-form-toolbar .pdf-viewer-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Loading state */
.pdf-viewer-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(82, 86, 89, 0.9);
  color: #fff;
  z-index: 10;
}

.pdf-viewer-loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pdf-spin 1s linear infinite;
}

@keyframes pdf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error state */
.pdf-viewer-error {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(82, 86, 89, 0.9);
  color: #ff6b6b;
  z-index: 10;
}

/* Search panel */
.pdf-viewer-search-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #444;
  border-bottom: 1px solid #555;
}

.pdf-viewer-search-input {
  flex: 1;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
}

.pdf-viewer-search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.pdf-viewer-search-results {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

/* Progress bar */
.pdf-viewer-progress-bar {
  height: 3px;
  background: rgba(0, 0, 0, 0.2);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.pdf-viewer-progress-fill {
  height: 100%;
  background: #4CAF50;
  transition: width 0.3s;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .pdf-viewer-toolbar {
    flex-wrap: wrap;
    padding: 8px;
  }

  .pdf-viewer-toolbar-center {
    order: -1;
    width: 100%;
    justify-content: center;
    margin-bottom: 8px;
  }

  .pdf-viewer-zoom-select {
    display: none;
  }

  .pdf-viewer-canvas-wrapper {
    padding: 10px;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

/* Off-screen container holding every page rasterised for printing.
   Only revealed inside the print media query.

   It is parked off-screen at its natural size rather than collapsed to 0x0 with
   `visibility: hidden`: WebKit skips decoding images inside a zero-sized hidden
   box, and window.print() does not wait for a decode, so those pages reached
   the print sheet as empty grey placeholders. Laid out off-screen they decode
   like any other image. `fixed` keeps the negative offset from ever producing a
   scrollbar. */
.pdf-print-container {
  position: fixed;
  top: 0;
  left: 0;
  /* Shifted out by exactly its own width, so it clears the viewport whatever
     the page size is — a fixed offset such as -200vw does not, because the
     container is as wide as a rasterised page. */
  transform: translateX(-100%);
  width: auto;
  height: auto;
  pointer-events: none;
}

@media print {
  /* Respect each page's own size and orientation. */
  @page {
    margin: 0;
    size: auto;
  }

  /* iOS WebKit blank-page fix (validated by the iOS print spike): host Drupal
     themes commonly set `html, body { height: 100% }`, which box-locks the
     static-flow print container to a single viewport — iOS Safari then prints a
     BLANK page (desktop browsers are lenient). Reset the height/overflow/position
     constraints so the body expands to the full stacked-image content height.
     Scoped to the active-print state so it only applies while printing. */
  html.pdf-print-active,
  body.pdf-print-active {
    height: auto !important;
    min-height: 0 !important;
    width: auto !important;
    overflow: visible !important;
    position: static !important;
  }

  /* When a print is in progress, hide everything except the active viewer's
     print container. The .pdf-print-current marker scopes the reveal to the
     viewer that initiated the print, so multiple viewers on one page never
     print each other's pages. */
  body.pdf-print-active > *:not(.pdf-print-current) {
    display: none !important;
  }

  .pdf-print-container.pdf-print-current {
    position: static;
    left: auto;
    transform: none;
    width: auto;
    height: auto;
    overflow: visible;
    visibility: visible;
  }

  .pdf-print-page {
    display: block;
    /* The only sizing rule, and it must stay a percentage. A rasterised A4 page
       and an A4 sheet share the same 1.414 aspect ratio, so at full width there
       is no slack for the paper margins and the header/footer band, and every
       page spills onto a second sheet. Absolute clamps cannot buy that slack
       back: iOS Safari scales the whole print layout by
       (paper width / layout viewport width), so `in` is not a physical inch
       there, and `vh` is the screen viewport rather than the page box. A
       percentage is relative to the page box in every engine and rides that
       uniform scale unchanged. 90% leaves roughly 5% headroom over the
       tightest case measured (Letter with margins and headers on). This is the
       fallback for A4-and-shorter aspects; setPrintPageImage overrides it with
       a smaller inline percentage for source pages taller than A4 (US Legal),
       whose height would otherwise overflow the sheet. */
    width: 90%;
    height: auto;
    margin: 0 auto;
    page-break-inside: avoid;
    break-inside: avoid;
    /* One PDF page per sheet. Safe only because the width above guarantees the
       image fits: GWS-4521 removed this rule when images overflowed, because
       the forced break then landed after the spilled remainder and produced a
       blank between every page. */
    page-break-after: always;
    break-after: page;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .pdf-print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

/* Landscape paper inverts the page box: usable height falls from roughly 134%
   of its width to roughly 63%, so the width above overflows the sheet by
   nearly 2x. Combined with `page-break-after: always` the forced break then
   lands after the spilled remainder and puts a blank sheet between every page
   — the exact regression GWS-4521 fixed. Recomputing against the landscape box
   keeps the same slack the portrait rule has. `!important` because the inline
   width set by setPrintPageImage would otherwise win, and the custom property
   carries the source page's aspect from that same function. */
@media print and (orientation: landscape) {
  .pdf-print-page {
    width: min(90%, calc(63% / var(--pdf-print-aspect, 1.414))) !important;
  }
}

/* -------------------------------------------------------------------------
 * Sign / draw tool (pdf.js Ink annotation editor)
 * ---------------------------------------------------------------------- */

/* Active state for the toolbar Sign button while draw mode is on. */
.pdf-viewer-sign.is-active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Floating "Done drawing" bar. Fixed to the viewport so it stays reachable even
   when the draw tool has consumed one-finger scrolling and the toolbar has been
   scrolled or zoomed off-screen. Toggled via the [hidden] attribute in JS. */
.pdf-viewer-sign-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  background: #333;
  color: #fff;
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.pdf-viewer-sign-bar[hidden] {
  display: none;
}

.pdf-viewer-sign-bar-label {
  font-size: 14px;
  line-height: 1.2;
}

/* The Done button needs to read as a clear, tappable affordance — override the
   icon-only toolbar button sizing. */
.pdf-viewer-sign-bar .pdf-viewer-sign-done {
  width: auto;
  height: auto;
  gap: 6px;
  padding: 8px 16px;
  background: #4CAF50;
  border-color: #4CAF50;
  border-radius: 20px;
  font-size: 14px;
  white-space: nowrap;
}

.pdf-viewer-sign-bar .pdf-viewer-sign-done:hover {
  background: #43a047;
  border-color: #43a047;
}

@media (max-width: 768px) {
  .pdf-viewer-sign-bar-label {
    display: none;
  }

  .pdf-viewer-sign-bar {
    padding: 6px;
  }
}

/* Editor layer overlays the canvas, above the annotation (form) layer. It is
 * inert until the Sign tool is toggled on, so form fields and links stay
 * clickable in normal viewing. */
.pdf-viewer-editor-layer {
  position: absolute;
  top: 0;
  left: 0;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  /* pdf.js positions editors relative to a layer scaled by --scale-factor. */
  font-size: calc(100px * var(--scale-factor, 1));
  transform-origin: 0 0;
}

/* Critical for touch devices (iOS Safari): without touch-action: none the
 * browser claims the drag for scrolling/pinch-zoom and the stroke never
 * reaches the canvas. Also suppress the iOS text-selection callout. */
.pdf-viewer-signing .pdf-viewer-editor-layer,
.pdf-viewer-signing .annotationEditorLayer,
.annotationEditorLayer.inkEditing,
.annotationEditorLayer .inkEditor,
.annotationEditorLayer .inkEditorCanvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.pdf-viewer-signing .pdf-viewer-editor-layer {
  pointer-events: auto;
}

/* pdf.js disables its own layer when not in an editing mode. */
.annotationEditorLayer.disabled {
  pointer-events: none;
}

/* Crosshair while the Ink (draw) tool is active. */
.annotationEditorLayer.inkEditing {
  cursor: crosshair;
}

/* Each Ink editor is an absolutely-positioned box; its canvas fills it. */
.annotationEditorLayer .inkEditor {
  position: absolute;
  width: 100%;
  height: 100%;
  background: transparent;
  transform-origin: 0 0;
}

.annotationEditorLayer .inkEditor .inkEditorCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Selection, drag and resize affordances for drawn ink (ported from pdf.js
   web/annotation_editor_layer_builder.css). Without these the editors exist
   but have no visible outline, move cursor or resize handles, so they are hard
   to pick up and move. */
.pdf-viewer-editor-layer,
.annotationEditorLayer {
  --outline-width: 2px;
  --outline-color: #0036ff;
  --focus-outline: solid var(--outline-width) var(--outline-color);
  --hover-outline: dashed var(--outline-width) var(--outline-color);
  --resizer-size: 8px;
  --resizer-shift: calc(0px - var(--outline-width) - var(--resizer-size) / 2 - var(--outline-width) / 2);
  --resizer-color: #fff;
}

/* A committed editor is draggable — show the move cursor on hover. */
.annotationEditorLayer .inkEditor[draggable="true"],
.annotationEditorLayer .freeTextEditor[draggable="true"],
.annotationEditorLayer .stampEditor[draggable="true"] {
  cursor: move;
}

/* Dashed outline on hover so the user can see what is grabbable. */
.annotationEditorLayer .inkEditor:hover:not(.selectedEditor),
.annotationEditorLayer .freeTextEditor:hover:not(.selectedEditor),
.annotationEditorLayer .stampEditor:hover:not(.selectedEditor) {
  outline: var(--hover-outline);
}

/* Solid outline on the currently selected editor. */
.annotationEditorLayer .selectedEditor {
  outline: var(--focus-outline);
}

.annotationEditorLayer .inkEditor,
.annotationEditorLayer .freeTextEditor,
.annotationEditorLayer .stampEditor {
  border-radius: 3px;
}

/* Resize handles (8 around the selected editor). */
.annotationEditorLayer .resizers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.annotationEditorLayer .resizers.hidden {
  display: none;
}

.annotationEditorLayer .resizer {
  position: absolute;
  width: var(--resizer-size);
  height: var(--resizer-size);
  border: var(--focus-outline);
  border-radius: 50%;
  background: var(--resizer-color);
}

.annotationEditorLayer .resizer.topLeft {
  top: var(--resizer-shift);
  left: var(--resizer-shift);
  cursor: nw-resize;
}

.annotationEditorLayer .resizer.topMiddle {
  top: var(--resizer-shift);
  left: calc(50% + var(--resizer-shift));
  cursor: n-resize;
}

.annotationEditorLayer .resizer.topRight {
  top: var(--resizer-shift);
  right: var(--resizer-shift);
  cursor: ne-resize;
}

.annotationEditorLayer .resizer.middleRight {
  top: calc(50% + var(--resizer-shift));
  right: var(--resizer-shift);
  cursor: e-resize;
}

.annotationEditorLayer .resizer.bottomRight {
  bottom: var(--resizer-shift);
  right: var(--resizer-shift);
  cursor: se-resize;
}

.annotationEditorLayer .resizer.bottomMiddle {
  bottom: var(--resizer-shift);
  left: calc(50% + var(--resizer-shift));
  cursor: s-resize;
}

.annotationEditorLayer .resizer.bottomLeft {
  bottom: var(--resizer-shift);
  left: var(--resizer-shift);
  cursor: sw-resize;
}

.annotationEditorLayer .resizer.middleLeft {
  top: calc(50% + var(--resizer-shift));
  left: var(--resizer-shift);
  cursor: w-resize;
}

.annotationEditorLayer.resizingTopLeft {
  cursor: nw-resize;
}

.annotationEditorLayer.resizingTopMiddle {
  cursor: n-resize;
}

.annotationEditorLayer.resizingTopRight {
  cursor: ne-resize;
}

.annotationEditorLayer.resizingMiddleRight {
  cursor: e-resize;
}

.annotationEditorLayer.resizingBottomRight {
  cursor: se-resize;
}

.annotationEditorLayer.resizingBottomMiddle {
  cursor: s-resize;
}

.annotationEditorLayer.resizingBottomLeft {
  cursor: sw-resize;
}

.annotationEditorLayer.resizingMiddleLeft {
  cursor: w-resize;
}

/* ==========================================================================
   Link layer (internal + external link annotations)
   ========================================================================== */

/* Overlays the canvas, like the form annotation layer, and is positioned by
   pdf.js via the --scale-factor custom property so it stays aligned at every
   zoom level. Sits below the form layer (z-index 3) so form fields keep
   priority where they overlap. */
.pdf-viewer-link-layer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  /* Empty regions of the layer must not eat clicks; only the link anchors
     themselves are interactive. */
  pointer-events: none;
}

.pdf-viewer-link-layer section {
  position: absolute;
  text-align: initial;
  pointer-events: auto;
}

.pdf-viewer-link-layer .linkAnnotation > a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 1em;
  pointer-events: auto;
}

/* Visible focus ring for keyboard users tabbing through links (WCAG 2.2 AA). */
.pdf-viewer-link-layer .linkAnnotation > a:focus-visible {
  outline: 2px solid #0036ff;
  outline-offset: 1px;
}

/* While drawing, links must not steal pointer events from the ink tool. */
.pdf-viewer-signing .pdf-viewer-link-layer {
  pointer-events: none;
}

/* ==========================================================================
   Sections / outline panel
   ========================================================================== */

/* Drawer overlaying the left edge of the scroll container. Positioned as an
   overlay (not a flex column) so it does not change container.clientWidth,
   which the page-fit / page-width zoom maths reads. */
.pdf-viewer-outline {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 260px;
  max-width: 80%;
  height: 100%;
  overflow-y: auto;
  background: #f4f5f7;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  padding: 12px 8px;
  color: #1a1a1a;
}

.pdf-viewer-outline[hidden] {
  display: none;
}

.pdf-viewer-outline-heading {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px 8px;
  color: #333;
}

.pdf-viewer-outline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nested levels get a small indent and a guide line. */
.pdf-viewer-outline-list .pdf-viewer-outline-list {
  margin-left: 12px;
  padding-left: 4px;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
}

.pdf-viewer-outline-item {
  margin: 0;
}

.pdf-viewer-outline-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.3;
  color: #1a1a1a;
  cursor: pointer;
}

.pdf-viewer-outline-link:hover {
  background: rgba(0, 54, 255, 0.08);
}

/* WCAG 2.2 AA visible focus indicator. */
.pdf-viewer-outline-link:focus-visible {
  outline: 2px solid #0036ff;
  outline-offset: 1px;
}

.pdf-viewer-outline-link.is-active {
  background: rgba(0, 54, 255, 0.14);
  font-weight: 600;
}

/* Active state on the toolbar toggle when the drawer is open. */
.pdf-viewer-outline-open .pdf-viewer-outline-toggle {
  background: rgba(0, 0, 0, 0.08);
}

/* Dark theme adjustments. */
.pdf-viewer-theme-dark .pdf-viewer-outline {
  background: #2a2d31;
  color: #f0f0f0;
  border-right-color: rgba(255, 255, 255, 0.15);
}

.pdf-viewer-theme-dark .pdf-viewer-outline-heading,
.pdf-viewer-theme-dark .pdf-viewer-outline-link {
  color: #f0f0f0;
}

.pdf-viewer-theme-dark .pdf-viewer-outline-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.pdf-viewer-theme-dark .pdf-viewer-outline-link.is-active {
  background: rgba(120, 160, 255, 0.28);
}

@media (max-width: 768px) {
  .pdf-viewer-outline {
    width: 220px;
  }
}
