/* Toolszu PDF Embedder & Viewer */
.tzpv {
    --tzpv-bg: #eef1f5;
    --tzpv-bar: #ffffff;
    --tzpv-line: #e2e6ec;
    --tzpv-text: #1f2937;
    --tzpv-sub: #6b7280;
    --tzpv-btn-hover: #f1f4f8;
    --tzpv-input: #f6f7f9;
    --tzpv-page-shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 6px 18px rgba(15, 23, 42, .08);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: var(--tzpv-height, 800px);
    max-height: 100vh;
    margin: 1.5em 0;
    border: 1px solid var(--tzpv-line);
    border-radius: 12px;
    background: var(--tzpv-bg);
    color: var(--tzpv-text);
    font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    container-type: inline-size;
    box-sizing: border-box;
}
.tzpv *, .tzpv *::before, .tzpv *::after { box-sizing: border-box; }
.tzpv-theme-dark {
    --tzpv-bg: #1b1e24;
    --tzpv-bar: #262a31;
    --tzpv-line: #343a43;
    --tzpv-text: #e8eaee;
    --tzpv-sub: #a1a7b1;
    --tzpv-btn-hover: #323741;
    --tzpv-input: #1f2329;
    --tzpv-page-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
    .tzpv-theme-auto {
        --tzpv-bg: #1b1e24;
        --tzpv-bar: #262a31;
        --tzpv-line: #343a43;
        --tzpv-text: #e8eaee;
        --tzpv-sub: #a1a7b1;
        --tzpv-btn-hover: #323741;
        --tzpv-input: #1f2329;
        --tzpv-page-shadow: 0 2px 10px rgba(0, 0, 0, .5);
    }
}

/* Before the script starts, and without JavaScript */
.tzpv-fallback { margin: auto; padding: 24px; text-align: center; }
.tzpv-fallback-link { font-weight: 600; }
.tzpv-notice { padding: 12px 16px; border: 1px dashed #c3c4c7; border-radius: 8px; color: #50575e; }

/* Toolbar */
.tzpv-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 48px;
    padding: 6px 8px;
    background: var(--tzpv-bar);
    border-bottom: 1px solid var(--tzpv-line);
}
.tzpv-group { display: flex; align-items: center; gap: 2px; }
.tzpv-left { flex: 1 1 0; min-width: 0; }
.tzpv-right { flex: 1 1 0; justify-content: flex-end; }
.tzpv-title { min-width: 0; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tzpv .tzpv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tzpv-text);
    box-shadow: none;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tzpv .tzpv-btn:hover { background: var(--tzpv-btn-hover); color: var(--tzpv-accent, #2563eb); }
.tzpv .tzpv-btn:focus-visible, .tzpv-thumb:focus-visible, .tzpv-scroll:focus-visible { outline: 2px solid var(--tzpv-accent, #2563eb); outline-offset: 1px; }
.tzpv .tzpv-btn[aria-pressed="true"] { background: var(--tzpv-btn-hover); color: var(--tzpv-accent, #2563eb); }
.tzpv .tzpv-btn:disabled { opacity: .35; cursor: default; background: transparent; color: var(--tzpv-text); }
.tzpv .tzpv-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tzpv input.tzpv-page, .tzpv select.tzpv-zoom-select, .tzpv input.tzpv-search-input {
    height: 32px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid var(--tzpv-line);
    border-radius: 7px;
    background: var(--tzpv-input);
    color: var(--tzpv-text);
    font: inherit;
    box-shadow: none;
}
.tzpv input.tzpv-page { width: 3.6ch; min-width: 3ch; text-align: center; }
.tzpv-total { padding: 0 4px; color: var(--tzpv-sub); white-space: nowrap; }
.tzpv select.tzpv-zoom-select { width: auto; max-width: 128px; padding-right: 22px; cursor: pointer; }

/* Search bar */
.tzpv-searchbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding: 6px 8px;
    background: var(--tzpv-bar);
    border-bottom: 1px solid var(--tzpv-line);
}
.tzpv-searchbar[hidden] { display: none; }
.tzpv input.tzpv-search-input { flex: 1; min-width: 0; max-width: 360px; padding: 0 10px; }
.tzpv-search-count { min-width: 70px; padding: 0 6px; color: var(--tzpv-sub); font-size: 13px; white-space: nowrap; }

/* Body */
.tzpv-body { position: relative; display: flex; flex: 1; min-height: 0; }
.tzpv-scroll { position: relative; flex: 1; min-width: 0; overflow: auto; outline: none; -webkit-overflow-scrolling: touch; }
.tzpv-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; width: max-content; min-width: 100%; padding: 20px; }
.tzpv-page-wrap { position: relative; flex-shrink: 0; background: #fff; box-shadow: var(--tzpv-page-shadow); overflow: hidden; }
.tzpv-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.tzpv-links { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tzpv-link { position: absolute; display: block; pointer-events: auto; border-radius: 2px; }
.tzpv-link:hover { background: rgba(37, 99, 235, .12); }

/* Thumbnails */
.tzpv-side { flex: 0 0 168px; padding: 14px 10px; overflow-y: auto; background: var(--tzpv-bar); border-right: 1px solid var(--tzpv-line); }
.tzpv-side[hidden] { display: none; }
.tzpv .tzpv-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    margin: 0 0 12px;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--tzpv-sub);
    font: inherit;
    font-size: 12px;
    box-shadow: none;
    cursor: pointer;
}
.tzpv .tzpv-thumb canvas { display: block; width: 110px; height: auto; background: #fff; box-shadow: var(--tzpv-page-shadow); }
.tzpv .tzpv-thumb:hover { background: var(--tzpv-btn-hover); }
.tzpv .tzpv-thumb.is-current { border-color: var(--tzpv-accent, #2563eb); color: var(--tzpv-text); font-weight: 700; }

/* Loading, error, password */
.tzpv-status { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; color: var(--tzpv-sub); text-align: center; }
.tzpv-spinner { width: 34px; height: 34px; border: 3px solid var(--tzpv-line); border-top-color: var(--tzpv-accent, #2563eb); border-radius: 50%; animation: tzpv-spin .8s linear infinite; }
@keyframes tzpv-spin { to { transform: rotate(360deg); } }
.tzpv-error-box { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 320px; }
.tzpv-error-icon svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.tzpv-error-box p { margin: 0; color: var(--tzpv-text); }
.tzpv a.tzpv-error-link, .tzpv button.tzpv-pass-btn {
    display: inline-block;
    padding: 9px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--tzpv-accent, #2563eb);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.tzpv-pass { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 340px; }
.tzpv-pass p { flex-basis: 100%; margin: 0 0 4px; color: var(--tzpv-text); }
.tzpv-pass input { flex: 1; min-width: 160px; height: 38px; padding: 0 10px; border: 1px solid var(--tzpv-line); border-radius: 8px; background: var(--tzpv-input); color: var(--tzpv-text); font: inherit; }

/* Full screen */
.tzpv:fullscreen { height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
.tzpv.tzpv-fs { position: fixed; inset: 0; z-index: 2147483000; width: 100%; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
html.tzpv-lock, html.tzpv-lock body { overflow: hidden; }
.tzpv-print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }

/* Narrower viewers: the title goes first, then the zoom list; thumbnails float over the pages */
@container (max-width: 720px) {
    .tzpv-title { display: none; }
    .tzpv-left { flex: 0 0 auto; }
    .tzpv-bar { justify-content: space-between; }
}
@container (max-width: 560px) {
    .tzpv-zoom-select { display: none; }
    .tzpv-bar { gap: 2px; padding: 4px; }
    .tzpv-pages { padding: 10px; gap: 10px; }
    .tzpv-side { position: absolute; inset: 0 auto 0 0; z-index: 5; box-shadow: 4px 0 18px rgba(0, 0, 0, .18); }
}
@container (max-width: 440px) {
    .tzpv-hide-sm { display: none !important; }
    .tzpv .tzpv-btn { width: 32px; height: 34px; }
    .tzpv-total { display: none; }
}

/* PDF.js text layer: invisible text on top of each page so it can be selected and searched */
.tzpv .textLayer {
    position: absolute;
    inset: 0;
    z-index: 2;
    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;
    --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));
}
.tzpv .textLayer :is(span, br) {
    position: absolute;
    color: transparent;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    -webkit-user-select: text;
    user-select: text;
}
.tzpv .textLayer > :not(.markedContent),
.tzpv .textLayer .markedContent span:not(.markedContent) {
    z-index: 1;
    --font-height: 0;
    font-size: calc(var(--text-scale-factor) * var(--font-height));
    --scale-x: 1;
    --rotate: 0deg;
    transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}
.tzpv .textLayer .markedContent { display: contents; }
.tzpv .textLayer span[role="img"] { -webkit-user-select: none; user-select: none; cursor: default; }
.tzpv .textLayer ::selection { background: rgba(0, 100, 255, .25); }
.tzpv .textLayer br::selection { background: transparent; }
.tzpv .textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; -webkit-user-select: none; user-select: none; }
/* Search matches sit inside a text piece, so they keep its position and size */
.tzpv .textLayer span.tzpv-hit { position: static; display: inline; transform: none; font-size: inherit; margin: -1px; padding: 1px; border-radius: 3px; background: rgba(250, 204, 21, .5); color: transparent; }
.tzpv .textLayer span.tzpv-hit-current { background: rgba(249, 115, 22, .65); box-shadow: 0 0 0 2px rgba(249, 115, 22, .45); }
