/* PageTurner (Blazor) - flipbook viewer */

@font-face {
    font-family: Avalon;
    src: url("../fonts/Avalon-Medium-webfont.woff2") format("woff2"), url("../fonts/Avalon-Medium-webfont.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: Avalon;
    src: url("../fonts/Avalon-Demi-webfont.woff2") format("woff2"), url("../fonts/Avalon-Demi-webfont.woff") format("woff");
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background-color: #fcfcfc;
    font-family: var(--rz-text-font-family); /* no RadzenLayout here, so set the theme font (Roboto) */
}

.ptb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- layout ---------- */

.ptb-viewer {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.ptb-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 1rem 3.5rem;
    box-sizing: border-box;
}

.ptb-book {
    position: relative;
    width: 100%;
    height: 100%;
}

.ptb-book-inner {
    width: 100%;
    height: 100%;
}

.ptb-hidden {
    visibility: hidden;
}

/* side arrows: gray strips on the outside edges of the book, as tall as the page.
   flipbook.js (syncSideArrows) sets the --ptb-book-* variables; the fallbacks cover the time before it runs */
.ptb-stage .ptb-side.rz-button {
    --ptb-side-width: 1.375rem; /* 22px, the legacy strip width */
    position: absolute;
    top: var(--ptb-book-top, 1rem);
    height: var(--ptb-book-height, calc(100% - 2rem));
    width: var(--ptb-side-width);
    min-width: 0;
    padding: 0;
    z-index: 5;
    background-color: rgba(0, 0, 0, 0.2);
}

.ptb-stage .ptb-side.rz-button:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.ptb-stage .ptb-side.rz-button:active {
    background-color: rgba(0, 0, 0, 0.6);
}

.ptb-side.rz-button .rzi {
    font-size: 1.5rem;
}

.ptb-stage .ptb-side-left.rz-button {
    left: calc(var(--ptb-book-left, 3.5rem) - var(--ptb-side-width));
    border-radius: 0.75rem 0 0 0.75rem;
}

.ptb-stage .ptb-side-right.rz-button {
    right: calc(var(--ptb-book-right, 3.5rem) - var(--ptb-side-width));
    border-radius: 0 0.75rem 0.75rem 0;
}

/* Tips image centered in the empty left-hand page beside the front cover (--ptb-* come from flipbook.js syncSideArrows).
   Hidden until flipbook.js adds ptb-cover-alone to the stage (cover alone, at rest, not zoomed) */
.ptb-stage .ptb-tips {
    display: none;
    position: absolute;
    left: calc(var(--ptb-book-left) + var(--ptb-page-width) / 2);
    top: calc(var(--ptb-book-top) + var(--ptb-book-height) / 2);
    transform: translate(-50%, -50%);
    max-width: calc(var(--ptb-page-width) * 0.8);
    max-height: calc(var(--ptb-book-height) * 0.8);
    border: 1px solid #aaa;
    border-radius: 4px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.ptb-stage.ptb-cover-alone .ptb-tips {
    display: block;
}

/* ---------- pages ---------- */

.ptb-page {
    position: relative;
    overflow: hidden;
    background-color: #fff;
    container-type: inline-size;
}

/* Empty space shown under the curl when turning onto a lone cover */
.ptb-blank-page {
    background-color: #fcfcfc;
    box-shadow: 0 0 0 4px #fcfcfc; /* fills the clip bleed added by bleedClipPath in flipbook.js */
}

.ptb-page > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    user-select: none;
    -webkit-user-select: none;
}

/* simple spinner until the image arrives */
.ptb-page:not(.ptb-loaded)::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid #e0e0e0;
    border-top-color: #9e9e9e;
    border-radius: 50%;
    animation: ptb-spin 0.8s linear infinite;
}

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

/* company branding at the bottom of interior pages (legacy .company-branding) */
.ptb-branding {
    position: absolute;
    bottom: 1.4%;
    font-family: Avalon, Arial, sans-serif;
    font-weight: bold;
    font-size: 1.45cqw;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.ptb-branding-right {
    right: 6%;
    max-width: 74%;
    text-align: right;
}

.ptb-branding-left {
    left: 5%;
    max-width: 80%;
}

.ptb-branding-white {
    color: #fff;
}

/* ---------- zoom ---------- */

.ptb-zoom {
    position: absolute;
    inset: 0;
    display: none;
    overflow: auto;
    background-color: #fcfcfc;
    cursor: grab;
    z-index: 10;
}

.ptb-zoom.ptb-zoom-open {
    display: block;
}

.ptb-zoom.ptb-dragging {
    cursor: grabbing;
}

/* keyboard focus ring on the zoom view (it is focusable so the arrow keys can scroll it) */
.ptb-zoom:focus-visible {
    outline: 2px solid #1b1d20;
    outline-offset: -2px;
}

.ptb-zoom-stage {
    display: flex;
    width: max-content;
    margin: 0 auto;
}

.ptb-zoom-stage > img {
    display: block;
    height: 100%;
    width: auto;
    aspect-ratio: 957 / 1200;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
}

.ptb-exit-hint {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: 0 1rem;
    line-height: 30px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font: 12px Arial, sans-serif;
    transition: opacity 0.5s;
    pointer-events: none;
}

.ptb-exit-hint.ptb-fade {
    opacity: 0;
}

/* ---------- toolbar ---------- */

.ptb-toolbar {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.15);
    /* keyboard focus ring: white so it shows on the red / gray toolbar (theme default is the primary color) */
    --rz-button-focus-outline: 2px solid #fff;
}

.ptb-toolbar .rz-numeric:focus-within {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ptb-toolbar .ptb-pagecount {
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

.ptb-toolbar .rz-numeric input {
    text-align: center;
}

/* page box: white in every state (theme is transparent until hover / focus) */
.ptb-toolbar .rz-numeric {
    --rz-input-background-color: #fff;
    --rz-input-hover-background-color: #fff;
    --rz-input-focus-background-color: #fff;
}

/* phones: icons only, smaller stage padding */
@media (max-width: 700px) {
    .ptb-toolbar .rz-button .rz-button-text {
        display: none;
    }

    .ptb-stage {
        padding: 0.5rem 0.5rem;
    }

    .ptb-side.rz-button {
        display: none;
    }
}

/* small phones (under 415px): hide Help to free toolbar room */
@media (max-width: 414px) {
    .ptb-toolbar .ptb-help.rz-button {
        display: none;
    }
}

/* ---------- not available ---------- */

.ptb-unavailable {
    min-height: 100vh;
    padding: 1rem;
    box-sizing: border-box;
    text-align: center;
}
