/*
    The page-turning reader (index.html): the bar on top, the book in the rest of the window. Bootstrap does the
    bar; only what Bootstrap has no class for is here — the window-filling layout, the book's pages and the
    magnifier. The site's dark grey (#3b4041, the backoffice bar) is the table the magazine lies on.
*/
html,
body.folhear {
    height: 100%;
}

body.folhear {
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
    background: #3b4041;
    color: #fff;
}

.folhear-barra {
    flex: 0 0 auto;
    min-height: 3rem;
    background: #2a2e2f;
    color: #fff;
}

.folhear-titulo {
    min-width: 0;
    font-size: 1rem;
    font-weight: normal;
    color: #fff;
}

.folhear-pagina {
    width: 3.75rem;
    text-align: center;
}

/* The table: the book is centred in it by the library (StPageFlip, "stretch"), as large as it fits */
.folhear-palco {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 1rem;
}

.folhear-livro {
    width: 100%;
    height: 100%;
}

/* With autoSize off the library leaves the wrapper's height to us: the whole table */
#livro .stf__wrapper {
    height: 100%;
}

/* A page: white paper, its picture (a canvas) as large as it fits — a page of another size than the first keeps its
   own shape. The library's own rule stretches every canvas in the book; this one is more specific. */
#livro .folhear-folha {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

#livro .folhear-folha canvas {
    position: static;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* Not drawn yet (pages are drawn near the one open, and dropped far from it) */
#livro .folhear-folha:not(.pronta) {
    background: #f1f1f1;
}

.folhear-estado {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.folhear-estado[hidden] {
    display: none;
}

.folhear-estado a {
    color: #fff;
}

/* The magnifier: the open page(s) drawn larger, moved by scrolling */
.folhear-lupa {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    background: #3b4041;
}

.folhear-lupa[hidden] {
    display: none;
}

.folhear-lupa-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    gap: 0;
    padding: 1rem;
}

.folhear-lupa-area canvas {
    flex: 0 0 auto;
    margin: auto;
    background: #fff;
}

.folhear-lupa-area canvas + canvas {
    margin-left: 0;
}

.folhear-lupa-area canvas:has(+ canvas) {
    margin-right: 0;
}
