/**
 * Heyzine-aligned flipbook chrome — design tokens taken from Heyzine’s public viewer stylesheet
 * (cdnc.heyzine.com/flipbook/css/prod5.min.css): magazine viewport proportions, primary slate,
 * page shadow, gutter gradients, UI typography. Runtime flip logic remains turn.js + PDF.js locally.
 *
 * Background SVG: back5.svg — same asset family as Heyzine viewer backgrounds (stored locally).
 */

:root {
    --hz-primary: #3e545e;
    --hz-primary-deep: #2d3d44;
    --hz-ui-bg: rgba(255, 255, 255, 0.88);
    --hz-font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* prod5: .magazine-viewport .container / .page — classic spread */
    --hz-magazine-spread-w: 922px;
    --hz-magazine-spread-h: 600px;
    --hz-page-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    --hz-shell-outer-shadow:
        0 4px 6px rgba(0, 0, 0, 0.06),
        0 24px 48px rgba(0, 0, 0, 0.18);
}

/* Shell: dark stage + subtle illustration (Heyzine-like staging) */
.flipbook-canvas-wrap.flipbook-turn-shell.hz-heyzine-viewport {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    padding: clamp(10px, 2vw, 20px);
    text-align: center;
    line-height: 0;
    box-shadow: var(--hz-shell-outer-shadow);
    background-color: #12161a;
    background-image: url("../images/heyzine-back5.svg");
    background-size: cover;
    background-position: center;
}

.flipbook-canvas-wrap.flipbook-turn-shell.hz-heyzine-viewport::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    pointer-events: none;
    background: radial-gradient(
        ellipse 130% 90% at 50% 42%,
        rgba(18, 22, 26, 0.28) 0%,
        rgba(10, 12, 15, 0.82) 100%
    );
}

.flipbook-turn-shell .flipbook-turn {
    position: relative;
    z-index: 1;
    margin: 0 auto;
}

/* Hard covers — slate tone from --primary-color */
.flipbook-turn .hard {
    background: linear-gradient(
        155deg,
        #5a7380 0%,
        var(--hz-primary) 42%,
        var(--hz-primary-deep) 100%
    ) !important;
    color: #f2f6f8 !important;
    border: none !important;
}

.flip-cover-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 1.5rem;
    text-align: center;
    font-weight: 600;
    font-family: var(--hz-font-ui);
    letter-spacing: 0.02em;
    box-sizing: border-box;
}

.flip-cover-inner span {
    font-size: clamp(1rem, 2.8vw, 1.35rem);
}

.flip-cover-inner small {
    display: block;
    margin-top: 0.75rem;
    font-weight: 400;
    opacity: 0.88;
    font-size: 0.85rem;
}

/* Paper pages — prod5 .magazine .page shadow */
.flipbook-turn .page.pdf-page {
    position: relative;
    overflow: hidden;
    background: #fff !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: var(--hz-page-shadow);
}

/* Gutter shading — matches prod5 .magazine .even / .odd .gradient spine cues */
.flipbook-turn .page.pdf-page::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.flipbook-turn .page.pdf-page canvas {
    position: relative;
    z-index: 1;
}

.flipbook-turn .page.even.pdf-page::after {
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0) 91%,
        rgba(0, 0, 0, 0.17) 100%
    );
}

.flipbook-turn .page.odd.pdf-page::after {
    background: linear-gradient(
        to left,
        rgba(0, 0, 0, 0) 91%,
        rgba(0, 0, 0, 0.14) 100%
    );
}

.flipbook-viewer-head {
    font-family: var(--hz-font-ui);
    font-weight: 400;
}

.flipbook-page-label {
    font-family: var(--hz-font-ui);
    font-size: 0.88rem;
    color: #3a4249;
}

.flipbook-toolbar button {
    font-family: var(--hz-font-ui);
    border: 1px solid rgba(62, 84, 94, 0.35);
    background: var(--hz-ui-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.flipbook-toolbar button:hover:not(:disabled) {
    border-color: rgba(62, 84, 94, 0.55);
    background: #fff;
}

.btn-flipbook-logout {
    font-family: var(--hz-font-ui);
    background: rgba(255, 255, 255, 0.65) !important;
    border-color: rgba(62, 84, 94, 0.35) !important;
    color: var(--hz-primary-deep) !important;
}

.flipbook-note {
    font-family: var(--hz-font-ui);
    font-weight: 400;
}
