/* Storyfellow — living book contact sheet */

#screen-book.is-active {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    background: var(--st-bg, #f7f4ef);
}

#screen-book > .brand-bar {
    flex: 0 0 auto;
    width: 100%;
}

.book-layout {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 16px 32px;
    box-sizing: border-box;
}

.book-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.book-cover,
.book-spread {
    appearance: none;
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
    min-width: 0;
}

.book-cover-face,
.book-page {
    background: #fff;
    color: var(--st-ink, #1c1a17);
    border: 1px solid rgba(28, 26, 23, 0.08);
    box-shadow: 0 10px 28px rgba(28, 26, 23, 0.06);
    overflow: hidden;
}

.book-cover-face {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    min-height: 280px;
    aspect-ratio: 3 / 4;
    padding: 28px 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(28, 26, 23, 0.04)),
        #efe8dc;
}

.book-cover-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.book-cover-face.has-image .book-cover-copy {
    margin: -28px -24px -28px;
    padding: 48px 24px 28px;
    color: #f7f4ef;
    background: linear-gradient(180deg, rgba(28, 26, 23, 0), rgba(28, 26, 23, 0.72));
}

.book-cover-face.has-image .book-cover-subtitle,
.book-cover-face.has-image .book-cover-author {
    color: rgba(247, 244, 239, 0.86);
}

.book-cover-title,
.book-page-heading {
    margin: 0;
    font-family: var(--st-font-serif, Georgia, serif);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.book-cover-subtitle,
.book-page-subtitle,
.book-cover-author,
.book-page-author {
    margin: 0;
    font-size: 14px;
    letter-spacing: 0.01em;
    color: var(--st-muted, #6d675f);
}

.book-spread,
.book-spread.is-preview {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.book-page {
    flex: 1 1 0;
    min-width: 0;
    aspect-ratio: 5 / 8;
    padding: 18px 16px;
    font-family: var(--st-font-serif, Georgia, serif);
    font-size: 11px;
    line-height: 1.45;
}

.book-page.is-blank {
    background: #f3efe8;
    box-shadow: none;
}

.book-page-kicker {
    margin: 0 0 10px;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.book-page-paragraph {
    margin: 0 0 8px;
}

.book-page-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.book-preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    background: rgba(247, 244, 239, 0.96);
    overflow: hidden;
}

.book-preview[hidden] {
    display: none;
}

.book-preview-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 0 auto;
    padding: 12px 16px;
}

.book-nav {
    appearance: none;
    border: 1px solid rgba(28, 26, 23, 0.16);
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.book-cover-editor {
    display: grid;
    gap: 8px;
    flex: 0 0 auto;
    padding: 0 16px 8px;
}

.book-cover-editor[hidden] {
    display: none;
}

.book-cover-editor label {
    display: grid;
    gap: 4px;
    font-size: 13px;
}

.book-cover-editor input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(28, 26, 23, 0.16);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: 16px;
    padding: 8px 10px;
}

.book-cover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.book-cover-note {
    min-height: 0;
    margin: 0;
    font-size: 14px;
}

.book-preview-stage {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 8px 16px 28px;
}

.book-cover.is-preview,
.book-spread.is-preview {
    max-width: 920px;
    margin: 0 auto;
}

.book-cover.is-preview .book-cover-face {
    min-height: 420px;
}

.book-spread.is-preview .book-page {
    font-size: 15px;
    padding: 28px 24px;
}

@media (min-width: 960px) {
    .book-sheet {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .book-layout {
        padding: 8px 10px 24px;
    }

    .book-sheet {
        grid-template-columns: 1fr;
    }

    .book-cover-title {
        font-size: 22px;
    }

    .book-page {
        font-size: 10px;
        padding: 12px 10px;
    }

    .book-preview-bar {
        padding: 10px;
    }

    .book-nav {
        padding: 8px 12px;
    }

    .book-spread.is-preview .book-page {
        font-size: 12px;
        padding: 16px 12px;
    }

    .book-cover.is-preview .book-cover-face {
        min-height: 180px;
    }

    .book-cover-editor {
        padding: 0 10px 8px;
    }
}
