/*
 * The document viewer, in the site's manner (the alumni pages are the reference):
 * the navy, square buttons, the file's name in bold under a quieter small-capitals
 * line, and the university's arms in the background. There is no bar on top: the
 * browser's PDF viewer and Google's and Microsoft's have toolbars of their own, and a
 * bar above them repeated the name and the buttons. The close button stands above the
 * window's corner (on a phone, in the document's top-left corner, clear of the
 * viewers' own buttons); the strip with the name, «Завантажити» and «Відкрити окремо»
 * is always under the document. The navy is a fixed colour; the paper follows the
 * dark theme.
 *
 * The overlay is always laid out and hidden with visibility, not display:none, so the
 * opacity transition can run: the navy layer fades in and out instead of appearing in
 * a single frame. Visibility flips only after the fade-out, and a hidden overlay takes
 * no clicks or focus.
 */
.ms-pdf-overlay {
    --doc-navy: var(--color-blue-200, #16295b);
    --doc-line: var(--color-blue-030, #4facfe);
    --doc-paper: var(--color-bg-tertiary, #f0f0f0);
    --doc-ease: cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    visibility: hidden; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    padding: 0 32px 32px; box-sizing: border-box;
    /* Deep navy, lit from the top corner in the brand's blue, with a far softer
       light-blue glow in the opposite one. */
    background:
        radial-gradient(ellipse 80% 70% at 12% 0%, rgba(var(--color-blue-100--rgb, 38, 90, 166), 0.28), transparent 70%),
        radial-gradient(ellipse 55% 50% at 100% 100%, rgba(79, 172, 254, 0.16), transparent 65%),
        linear-gradient(165deg, rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.95), rgba(8, 16, 38, 0.97));
    z-index: 99999;
    opacity: 0; transition: opacity 0.25s ease-out, visibility 0s linear 0.25s;
    font-family: "Roboto", sans-serif;
}
.ms-pdf-overlay.is-open { visibility: visible; opacity: 1; transition: opacity 0.25s ease-out, visibility 0s; }
/* The overlay is a <dialog>: its own frame, padding and size limits go, and the
   overlay paints the navy layer itself, so the backdrop stays clear. */
dialog.ms-pdf-overlay { margin: 0; border: 0; max-width: none; max-height: none; color: inherit; overflow: hidden; }
dialog.ms-pdf-overlay::backdrop { background: transparent; }
/* The university's arms, a white silhouette (the theme's departments/bg-gerb.svg, as
   on the department pages), large and faint on the right, partly behind the window.
   The script sets --doc-arms on the first opening on a wide screen, so the file is
   not fetched with every page, nor at all on a phone, where the window hides it. */
.ms-pdf-overlay::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none;
    background: var(--doc-arms, none) right -6vw center / auto min(96vh, 1000px) no-repeat;
    opacity: 0.09;
}

/* The row above the window, as wide as it, with the close button at its end: the
   button's right edge on the window's, 12px above it. Pushed past the edge, it read
   as misplaced against the video's black frame. */
.ms-doc-top { position: relative; display: flex; justify-content: flex-end; align-items: flex-end; flex-shrink: 0; width: 100%; max-width: 1280px; height: 64px; padding-bottom: 12px; box-sizing: border-box; }
.ms-pdf-close {
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    padding: 0; border: 0; background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.92); cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
/* A thin cross on a faint square: easy to find, yet not the boldest thing on the
   screen, as a thick white cross was. */
.ms-pdf-close:hover { color: #fff; background: rgba(255, 255, 255, 0.18); }

.ms-pdf-content {
    position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
    width: 100%; max-width: 1280px;
    background: var(--doc-paper); overflow: hidden;
    /* A hairline frame and a deep, soft shadow lift the window off the navy. */
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 32px 80px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(16px) scale(0.985);
    transition: transform 0.4s var(--doc-ease);
}
.ms-pdf-overlay.is-open .ms-pdf-content { transform: none; }

/* While the document loads, a light-blue stretch runs along the window's top edge. */
.ms-pdf-content.is-loading::after {
    content: ""; position: absolute; top: 0; left: 0; z-index: 3; width: 30%; height: 3px; background: var(--doc-line); pointer-events: none;
    animation: ms-doc-load 1.3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes ms-doc-load { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

#ms-doc-container { position: relative; flex: 1 1 auto; min-height: 0; background: var(--doc-paper); }

/* The strip under the document: the name on the left, the buttons on the right. */
.ms-doc-foot { display: flex; align-items: center; gap: 16px; flex-shrink: 0; padding: 12px 16px 12px 24px; background: var(--color-surface-card, #fff); border-top: 1px solid var(--color-border, #d9d9d9); }
.ms-doc-head { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ms-doc-label { font-size: 12px; line-height: 1.2; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-secondary, #626570); font-variant-numeric: tabular-nums; }
.ms-doc-label:empty { display: none; }
.ms-doc-name { font-size: 16px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text-heading, #16295b); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Buttons: the alumni pair on paper — filled navy for the main one, outline beside it. */
.ms-doc-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ms-doc-btn {
    --btn-fg: #fff; --btn-bg: var(--doc-navy); --btn-line: var(--doc-navy);
    display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px;
    border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--btn-fg);
    font-size: 14px; font-weight: 500; line-height: 1.2; text-decoration: none; white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.ms-doc-btn--ghost { --btn-fg: var(--color-text-heading, #16295b); --btn-bg: transparent; --btn-line: var(--color-text-heading, #16295b); }
.ms-doc-btn:hover, .ms-doc-btn--ghost:hover { --btn-fg: #fff; --btn-bg: var(--color-blue-100, #265aa6); --btn-line: var(--color-blue-100, #265aa6); color: var(--btn-fg); }
.ms-doc-btn:focus-visible, .ms-pdf-close:focus-visible, .ms-doc-zoom:focus-visible { outline: 2px solid var(--doc-line); outline-offset: 2px; }

/* The frame lies over the loading note and stays see-through until it has loaded,
   so the window shows the note instead of standing white. */
.ms-pdf-iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; display: block; transition: opacity 0.2s ease; }
.ms-pdf-iframe.is-loading { opacity: 0; }

/* Notes: a bold heading and a quieter line, as the site's sections speak; while
   loading, only a quiet line. */
.ms-doc-msg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.ms-doc-msg__title { max-width: 26em; font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text-heading, #16295b); }
.ms-doc-msg__hint { max-width: 32em; font-size: 15px; line-height: 1.5; color: var(--color-text-secondary, #626570); }
.ms-doc-msg--quiet .ms-doc-msg__title { font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--color-text-secondary, #626570); }

/* Pages drawn by pdf.js (phones, iPads): one under another on the grey paper,
   scrolled inside the window without moving the page behind. touch-action keeps the
   browser from zooming the whole page: the pinch zooms the document alone. */
.ms-doc-pages { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; padding: 24px 24px 88px; box-sizing: border-box; }
.ms-doc-sheet { position: relative; margin: 0 auto; }
.ms-doc-page { margin-bottom: 16px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06); }
.ms-doc-page:last-child { margin-bottom: 0; }
.ms-doc-page { position: relative; }
.ms-doc-page canvas { display: block; width: 100%; height: auto; }

/* The page's text over its picture (pdf.js's text layer, the rules of its own viewer):
   letters in place but see-through, so they can be selected and searched. */
.ms-doc-page .textLayer { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; overflow: hidden; line-height: 1; text-align: initial; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; }
.ms-doc-page .textLayer > span:not(.markedContent),
.ms-doc-page .textLayer .markedContent > span:not(.markedContent),
.ms-doc-page .textLayer br { position: absolute; color: transparent; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.ms-doc-page .textLayer span.markedContent { top: 0; height: 0; }
.ms-doc-page .textLayer ::selection { background: rgba(var(--color-blue-100--rgb, 38, 90, 166), 0.35); }
.ms-doc-page .textLayer br::selection { background: transparent; }
.ms-doc-page .textLayer .endOfContent { display: block; position: absolute; top: 100%; left: 0; right: 0; bottom: 0; z-index: -1; cursor: default; user-select: none; }
/* Search matches: the brand's light blue, the current one in the deeper blue. */
.ms-doc-page .textLayer .ms-hit { position: static; margin: -1px; padding: 1px; color: transparent; background: rgba(79, 172, 254, 0.4); }
.ms-doc-page .textLayer .ms-hit.is-current { background: rgba(var(--color-blue-100--rgb, 38, 90, 166), 0.55); box-shadow: 0 0 0 1px rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.6); }

/* The page number with zoom beside it: a small translucent navy chip at the bottom,
   the current page in white, the total quieter. It fades out while the document
   rests and comes back on scrolling, touching or pointing at it. */
.ms-doc-tools {
    position: absolute; left: 50%; bottom: 16px; z-index: 2; display: flex; align-items: center; height: 36px; padding: 0 2px;
    transform: translateX(-50%);
    background: rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.72); color: #fff;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    transition: opacity 0.4s ease;
}
.ms-doc-tools.is-idle { opacity: 0; }
.ms-doc-tools:hover, .ms-doc-tools:focus-within { opacity: 1; }
.ms-doc-zoom { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; background: none; color: rgba(255, 255, 255, 0.8); cursor: pointer; transition: color 0.2s ease, background-color 0.2s ease; }
.ms-doc-zoom:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.1); }
.ms-doc-zoom:disabled { opacity: 0.3; cursor: default; }
.ms-doc-count { min-width: 56px; padding: 0 6px; text-align: center; font-size: 12px; line-height: 1; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.55); white-space: nowrap; }
.ms-doc-count__now { font-weight: 600; color: #fff; }
.ms-doc-zoom--find { margin-left: 2px; border-left: 1px solid rgba(255, 255, 255, 0.16); }

/* The search bar: the chip's translucent navy, at the top of the window. */
.ms-doc-find {
    position: absolute; top: 16px; left: 50%; z-index: 3; display: flex; align-items: center; gap: 2px;
    width: min(460px, calc(100% - 32px)); height: 40px; padding: 0 4px 0 0; transform: translateX(-50%);
    background: rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.85); color: #fff;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.ms-doc-find[hidden] { display: none; }
.ms-doc-find__input {
    flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 12px; border: 0; outline: none; background: transparent;
    color: #fff; font: 400 15px/1 "Roboto", sans-serif; -webkit-appearance: none; appearance: none;
}
.ms-doc-find__input::placeholder { color: rgba(255, 255, 255, 0.5); }
.ms-doc-find__input::-webkit-search-cancel-button { display: none; }
.ms-doc-find:focus-within { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), inset 0 -2px 0 var(--doc-line); }
.ms-doc-find__count { flex-shrink: 0; padding: 0 8px; font-size: 12px; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.7); white-space: nowrap; }

/* Plain text in a reading column on the card's paper. */
.ms-doc-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; padding: 32px max(24px, calc((100% - 860px) / 2)); box-sizing: border-box; overflow: auto; overscroll-behavior: contain; white-space: pre-wrap; word-break: break-word; font: 14px/1.6 ui-monospace, Consolas, monospace; color: var(--color-text-primary, #000); background: var(--color-surface-card, #fff); }

/* A video keeps its proportions on black, like any player; the window is sized to
   a 16:9 picture instead of the tall page a document needs. */
.ms-pdf-content.is-video { flex: 0 0 auto; max-width: 1100px; }
.ms-doc-top:has(+ .is-video) { max-width: 1100px; }
.ms-pdf-content.is-video #ms-doc-container { flex: 0 0 auto; aspect-ratio: 16 / 9; max-height: calc(100vh - 200px); background: #000; }
.ms-doc-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Under a video only the buttons: its name and size said nothing the picture does not. */
.ms-pdf-content.is-video .ms-doc-head { display: none; }
.ms-pdf-content.is-video .ms-doc-actions { margin-left: auto; }

/* The site's video player (VideoPlayer in ms-doc-viewer.js): the picture on black, a
   square navy play button while paused, and under the picture a bar on a soft
   dark fade — thin white marks, the seek line in the site's light blue. In play the
   bar and the pointer fade out after a pause in movement. */
.ms-player { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; background: #000; outline: none; }
.ms-player.is-idle { cursor: none; }
.ms-player__big {
    position: absolute; top: 50%; left: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
    display: flex; align-items: center; justify-content: center; padding: 0; border: 0;
    background: rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.85); color: #fff; cursor: pointer;
    transition: opacity 0.2s ease, transform 0.3s var(--doc-ease), background-color 0.2s ease;
}
.ms-player__big:hover { background: var(--color-blue-100, #265aa6); }
.ms-player:not(.is-paused) .ms-player__big { opacity: 0; transform: scale(0.9); pointer-events: none; }
.ms-player__bar {
    position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 2px;
    padding: 40px 8px 8px; background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
    color: #fff; transition: opacity 0.3s ease;
}
.ms-player.is-idle .ms-player__bar { opacity: 0; pointer-events: none; }
.ms-player__btn {
    flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    padding: 0; border: 0; background: none; color: rgba(255, 255, 255, 0.85); cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.ms-player__btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.ms-player__btn:focus-visible, .ms-player__big:focus-visible, .ms-player__seek:focus-visible { outline: 2px solid var(--doc-line); outline-offset: 0; }
.ms-player__speed { width: auto; min-width: 44px; padding: 0 6px; font: 500 13px/1 "Roboto", sans-serif; font-variant-numeric: tabular-nums; }
.ms-player__time { flex-shrink: 0; padding: 0 6px; font-size: 13px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.85); }

/* The seek line: played in light blue, loaded in pale white, the rest faint; a small
   white square to hold, the site's square corners. The theme gives every input a bottom
   border and (search.css, with !important) a bottom padding: on the slider they drew a
   second line under the track and pushed the track off the middle of the bar. */
.ms-player__seek { --played: 0%; --buffered: 0%; flex: 1 1 auto; min-width: 48px; height: 24px; margin: 0 4px; padding: 0 !important; border: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.ms-player__seek::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(to right, var(--doc-line) var(--played), rgba(255, 255, 255, 0.5) var(--played), rgba(255, 255, 255, 0.5) var(--buffered), rgba(255, 255, 255, 0.22) var(--buffered));
}
.ms-player__seek::-moz-range-track {
    height: 4px;
    background: linear-gradient(to right, var(--doc-line) var(--played), rgba(255, 255, 255, 0.5) var(--played), rgba(255, 255, 255, 0.5) var(--buffered), rgba(255, 255, 255, 0.22) var(--buffered));
}
.ms-player__seek::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 0; background: #fff; -webkit-appearance: none; appearance: none; transition: transform 0.15s ease; }
.ms-player__seek::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 0; background: #fff; }
.ms-player__seek:hover::-webkit-slider-thumb, .ms-player__seek:active::-webkit-slider-thumb { transform: scale(1.25); }

/* Full screen: the bar keeps clear of the phone's rounded corners and home line. */
.ms-player.is-full .ms-player__bar { padding: 40px max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }

@media (max-width: 768px) {
    /* On a phone the window is the whole screen; the close button lies in the
       document's top-left corner, the buttons under the document, side by side. */
    .ms-pdf-overlay { height: 100dvh; padding: 0; justify-content: stretch; }
    .ms-doc-top { position: absolute; top: env(safe-area-inset-top, 0px); left: 0; z-index: 3; width: auto; height: auto; padding: 8px; }
    /* Over the document a soft, translucent navy, not a solid block. */
    .ms-pdf-close { width: 40px; height: 40px; margin: 0; color: #fff; background: rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
    .ms-pdf-close:hover { background: rgba(var(--color-blue-200--rgb, 22, 41, 91), 0.9); }
    .ms-pdf-content { max-width: none; box-shadow: none; transform: translateY(24px); }
    .ms-doc-foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
    .ms-doc-head { display: none; }
    .ms-doc-actions { flex: 1 1 auto; }
    .ms-doc-btn { flex: 1 1 0; min-height: 44px; padding: 0 12px; }
    /* The first page and the text start below the close button. */
    .ms-doc-pages { padding: 60px 8px 76px; }
    .ms-doc-page { margin-bottom: 8px; }
    .ms-doc-tools { bottom: 12px; }
    /* On a phone the bar sits beside the close button, in the rest of the top row;
       16px type keeps iOS from zooming the page into the field. */
    .ms-doc-find { top: calc(8px + env(safe-area-inset-top, 0px)); left: 56px; right: 8px; width: auto; height: 40px; transform: none; }
    .ms-doc-find__input { font-size: 16px; }
    .ms-doc-text { padding: 64px 16px 16px; }
    .ms-doc-msg__title { font-size: 18px; }
    /* On a phone a video, like a document, takes the whole screen: the picture in
       the middle on black, as phones' own players show it. */
    .ms-pdf-content.is-video { flex: 1 1 auto; }
    .ms-pdf-content.is-video #ms-doc-container { flex: 1 1 auto; aspect-ratio: auto; max-height: none; }
    /* A narrow screen keeps the bar to what fits: speed goes, the rest stays. */
    .ms-player__speed { display: none; }
    .ms-player__big { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
}

/* The navy layer does not blur the page behind: at its 95% it hardly showed, and
   the blur tripled the graphics card's work on every frame while the document
   scrolled (measured 2026-11-11). */

@media (prefers-reduced-motion: reduce) {
    .ms-pdf-content { transform: none; transition: none; }
    .ms-pdf-content.is-loading::after { animation: none; display: none; }
    .ms-doc-tools { transition: none; }
}
