/**
 * @package     Plg_Content_Empdf
 * @copyright   (C) 2026 Event Manager
 * @license     GNU General Public License version 2 or later
 */

.em-pdf {
    max-width: var(--em-pdf-max-width, 900px);
    margin: 1.5rem auto;
}

.em-pdf,
.em-pdf * {
    box-sizing: border-box;
}

.em-pdf-bar {
    margin: 0 0 0.75rem;
}

.em-pdf-status {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    background: #f4f5f6;
    border-radius: 4px;
}

.em-pdf-failed {
    background: #fdf3e6;
}

.em-pdf-page {
    --scale-factor: 1;
    --total-scale-factor: var(--scale-factor);
    --scale-round-x: 1px;
    --scale-round-y: 1px;

    position: relative;
    width: 100%;
    margin: 0 0 1rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 0 10px 0 #dbdbdb;
    direction: ltr;
}

.em-pdf-page:last-child {
    margin-bottom: 0;
}

.em-pdf-page canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    margin: 0;
}

/* PDF.js's text layer (from its pdf_viewer.css, without the editing and highlighting parts): transparent
   text placed over each word of the drawing, so it can be selected, copied and found. */
.em-pdf .textLayer {
    --min-font-size: 1;
    --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
    --min-font-size-inv: calc(1 / var(--min-font-size));

    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    overflow: clip;
    opacity: 1;
    line-height: 1;
    text-align: initial;
    letter-spacing: normal;
    word-spacing: normal;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    forced-color-adjust: none;
    transform-origin: 0 0;
    caret-color: CanvasText;
    z-index: 0;
}

.em-pdf .textLayer span,
.em-pdf .textLayer br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    -webkit-user-select: text;
    user-select: text;
}

.em-pdf .textLayer > :not(.markedContent),
.em-pdf .textLayer .markedContent span:not(.markedContent) {
    --font-height: 0;
    --scale-x: 1;
    --rotate: 0deg;

    z-index: 1;
    font-size: calc(var(--text-scale-factor) * var(--font-height));
    transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}

.em-pdf .textLayer .markedContent {
    display: contents;
}

.em-pdf .textLayer span[role="img"] {
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.em-pdf .textLayer ::selection {
    background: rgba(0, 0, 255, 0.25);
    color: transparent;
}

.em-pdf .textLayer br::selection {
    background: transparent;
}

.em-pdf .textLayer .endOfContent {
    display: block;
    position: absolute;
    inset: 100% 0 0;
    z-index: 0;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
}

.em-pdf .textLayer.selecting .endOfContent {
    top: 0;
}

/* Only the pages near the screen are drawn, so a printout of the web page would have gaps: print the
   link instead, and visitors print the PDF itself. */
@media print {
    .em-pdf-pages {
        display: none;
    }
}
