/* TaxBEN presentation as a book (November 2026): styles of book.js, used by the presentation page
   and by the small book at the left of the calculator on taxben.oecd.org. */

.tb-box {
    position: relative;
    transition: transform 0.55s ease;
}

.tb-book .deck-page {
    background-color: #fff;
    box-shadow: 0 3px 10px rgba(16, 29, 64, 0.22);
}

.tb-book .deck-page img {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.tb-frame .stf__item {
    cursor: pointer;
}

/* Closed book: a light shadow, so that it looks like a book that can be opened */
.tb-closed-front .stf__block,
.tb-closed-back .stf__block {
    filter: drop-shadow(0 4px 10px rgba(16, 29, 64, 0.35));
}

/* The fold in the middle of the open book, hidden while a page is being turned */
.tb-open.tb-landscape:not(.tb-flipping) .stf__block::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: 1000;
    width: 36px;
    margin-left: -18px;
    background: linear-gradient(90deg, rgba(16, 29, 64, 0) 0%, rgba(16, 29, 64, 0.16) 50%, rgba(16, 29, 64, 0) 100%);
    pointer-events: none;
}

/* ---- Pages turned from right to left: the closed book is moved to the middle ---- */

.tb-horizontal.tb-landscape.tb-closed-front .tb-box {
    transform: translateX(-25%);
}

.tb-horizontal.tb-landscape.tb-closed-back .tb-box {
    transform: translateX(25%);
}

/* ---- Pages turned from bottom to top: the book turned by 90 degrees, the slides by -90 degrees.
   Closed, the book is as high as one slide; open, as high as two slides, one above the other.
   --tb-w and --tb-h (width and height of a slide) are set by book.js. ---- */

.tb-vertical {
    position: relative;
    height: var(--tb-h, 150px);
    transition: height 0.55s ease;
}

.tb-vertical.tb-open {
    height: calc(2 * var(--tb-h, 150px));
}

.tb-vertical .tb-box {
    position: absolute;
    left: calc((var(--tb-w, 267px) - 2 * var(--tb-h, 150px)) / 2);
    top: calc((2 * var(--tb-h, 150px) - var(--tb-w, 267px)) / 2);
    transform: rotate(90deg);
}

.tb-vertical.tb-closed-front .tb-box {
    transform: rotate(90deg) translateX(-50%);
}

.tb-vertical .deck-page {
    overflow: hidden;
}

/* The page is 1080 x 1921 in the turned book; the slide (1921 x 1080) is turned back by -90 degrees */
.tb-vertical .deck-page img {
    position: absolute;
    left: -38.94%;
    top: 21.89%;
    width: 177.87%;
    height: 56.22%;
    object-fit: fill;
    transform: rotate(-90deg);
}

/* While a book is being measured or placed (enlarged book): no movement */
.tb-no-anim .tb-box,
.tb-no-anim.tb-vertical {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .tb-box,
    .tb-vertical {
        transition: none;
    }
}
