/*
 * Site look for the flipbook pages, which the frontend embeds in an iframe.
 * Loaded after general.css and v1/v2.css; only the chrome around the pages
 * changes, never the turn.js page layout or the link hotspots' positions.
 */
html,
body {
    margin: 0;
    /* turn.js sizes the book from the window width; never scroll sideways. */
    overflow-x: hidden;
    background: #f7f8f8;
    font-family: "Assistant", "Arial Hebrew", Arial, sans-serif;
}

#flipbook .page {
    box-shadow: 0 1px 2px rgb(21 29 34 / 0.08), 0 18px 40px -18px rgb(21 29 34 / 0.45);
}

/*
 * Embedded in the site (assets/turn/embed.js): the page and zoom buttons live
 * in the site's top bar, and the free band under the book lets a page turned
 * from a bottom corner swing down over the "desk" instead of being cut off by
 * the iframe edge. Flipbook.vue sizes the iframe with the same numbers.
 */
html.embedded .controls {
    display: none;
}

html.embedded body {
    padding-bottom: 4.5vw;
}

/* The iframe is sized to the book, which spans its full width: no inner scrolling. */
html.embedded,
html.embedded body {
    overflow-y: hidden;
}

@media (max-width: 1149.98px) {
    html.embedded body {
        padding-bottom: 9vw;
    }
}

/* Page navigation: round touch-size buttons (above the book when opened on its own). */
.controls {
    gap: 12px;
    /* general.css caps the row at 25vw; the zoom tools need more. */
    max-width: none;
    width: max-content;
    margin: 28px auto 20px;
}

.controls .num-link {
    display: grid;
    place-items: center;
    /* general.css gives every .controls div justify-content: space-between. */
    place-content: center;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 0 0 1px #d6dde0, 0 2px 6px -2px rgb(21 29 34 / 0.2);
    transition: background-color 150ms, box-shadow 150ms, opacity 150ms;
}

.controls .num-link::before,
.controls .num-link::after {
    content: none;
}

.controls .num-link img {
    width: 22px;
    height: 22px;
}

.controls .num-link:hover {
    opacity: 1;
    background: #fef7f4;
    box-shadow: 0 0 0 2px #e8632a, 0 4px 10px -4px rgb(232 99 42 / 0.45);
}

.controls .num-link:focus-visible {
    outline: 2px solid #be5427;
    outline-offset: 3px;
}

/* Zoom and magnifier (assets/turn/tools.js), desktop only. */
.controls .book-tools {
    gap: 12px;
    align-items: center;
}

.controls button.num-link {
    padding: 0;
    border: 0;
    font: inherit;
    color: #151d22;
}

.controls .num-link svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.controls .num-link:disabled {
    opacity: 0.4;
    background: #ffffff;
    box-shadow: 0 0 0 1px #d6dde0;
    cursor: default !important;
}

.controls .num-link[aria-pressed="true"] {
    color: #ffffff;
    background: #e8632a;
    box-shadow: 0 0 0 2px #e8632a, 0 4px 10px -4px rgb(232 99 42 / 0.45);
}

.controls .tools-divider {
    width: 1px;
    height: 28px;
    margin: 0 6px;
    background: #d6dde0;
}

.controls .zoom-level {
    min-width: 48px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #151d22;
}

@media not all and (hover: hover) and (pointer: fine) and (min-width: 1150px) {
    .controls .book-tools {
        display: none;
    }
}

/* Zoomed: the stage keeps the 100% book height and the pages scroll inside it. */
.zoomed .book-stage {
    height: calc((100vw - 15px) * 0.3525 + 25px);
    overflow: auto;
}

html.embedded.zoomed .book-stage {
    height: calc(100vw * 0.3525 + 25px);
}

.magnifying #flipbook {
    cursor: crosshair;
}

.book-lens {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    display: none;
    width: 200px;
    height: 200px;
    border-radius: 999px;
    background-color: #ffffff;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px #d6dde0, 0 18px 40px -18px rgb(21 29 34 / 0.55);
    pointer-events: none;
}

/* Side page-turn arrows. */
.browse.left,
.browse.right {
    opacity: 0.55;
}

.browse.left:hover,
.browse.right:hover {
    opacity: 1;
}

/* Clickable areas on the pages (appendix links, phone, e-mail). */
.v1-link:hover,
.v2-link:hover {
    background: rgb(232 99 42 / 0.18);
    border-radius: 4px;
}

@media (max-width: 1150px) {
    .controls {
        min-width: 0;
        max-width: none;
        width: max-content;
        margin: 18px auto 14px;
    }

    .controls .num-link {
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
    }
}
