/* ============================================================
   storyboard/cinematic.css
   War Journey cinematic intro / epilogue overlay.
   All classes are prefixed sbc- (storyboard-cinematic) to
   avoid any collision with existing migration-map styles.
   ============================================================ */

/* ── Overlay backdrop ──────────────────────────────────────── */
.sbc-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background:
        linear-gradient(180deg, rgba(246, 241, 232, 0.5), rgba(21, 14, 8, 0.66)),
        url('/Home/home-background.jpg') center center / cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 16px 24px;
    opacity: 0;
    transition: opacity 0.65s ease;
    cursor: default;
}

/* Keep map/storyboard chrome hidden while cinematic overlays hand off. */
body.mm-sbc-ui-suppressed #mm-storyboard-modal,
body.mm-sbc-ui-suppressed #mm-sb-dock-modal,
body.mm-sbc-ui-suppressed #mm-sidebar,
body.mm-sbc-ui-suppressed #mm-war-playback-controls {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ── Diary spread (open book) ──────────────────────────────── */
.sbc-spread {
    display: flex;
    width: 100%;
    max-width: 980px;
    max-height: 84vh;
    border-radius: 3px;
    box-shadow:
        0 36px 110px rgba(0, 0, 0, 0.88),
        0 4px 14px  rgba(0, 0, 0, 0.55);
    overflow: hidden;
    cursor: default;
    animation: sbc-appear 1.1s cubic-bezier(0.22, 0.8, 0.22, 1) both;
}

.sbc-spread-book {
    display: block;
    width: min(82vw, 920px);
    max-width: 920px;
    max-height: 84vh;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.sbc-book-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 8;
    box-sizing: border-box;
    padding: 0 7px 6px;
}

.sbc-book-bg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 34px 70px rgba(0, 0, 0, 0.56));
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.sbc-book-surface {
    position: absolute;
    top: 11.2%;
    bottom: 15.6%;
    overflow: hidden;
    border-radius: 24px;
    box-shadow: none;
}

.sbc-book-surface-left {
    left: 13%;
    width: 32.2%;
    transform: none;
}

.sbc-book-surface-right {
    left: 54.3%;
    width: 31.7%;
    transform: none;
}

@keyframes sbc-appear {
    from { transform: scale(0.96) translateY(14px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

/* Single-page variant used for epilogue */
.sbc-spread-single {
    max-width: 500px;
}

/* ── Pages ─────────────────────────────────────────────────── */
.sbc-page {
    background: #f5f0e4;
    padding: 32px 28px 28px;
    display: flex;
    flex-direction: column;
    font-family: Georgia, 'Times New Roman', serif;
    overflow-y: auto;
}

.sbc-page-left {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(247, 241, 228, 0.08), rgba(208, 190, 156, 0.12));
    padding: 6.8% 7.6% 8.6%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.sbc-page-right {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    padding: 8% 6% 8% 6%;
    background: linear-gradient(180deg, rgba(247, 241, 228, 0.04), rgba(208, 190, 156, 0.06));
}

.sbc-page-epilogue {
    flex: 1;
    align-items: center;
    text-align: center;
}

/* ── Spine ─────────────────────────────────────────────────── */
.sbc-playback-veil {
    position: fixed;
    inset: 0;
    z-index: 9499;
    background: #060402;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.95s ease;
}

/* ── Photo area (left page) ────────────────────────────────── */
.sbc-photo-wrap {
    position: relative;
    width: min(96%, 318px);
    aspect-ratio: 0.72 / 1;
    height: auto;
    display: flex;
    flex-direction: column;
    margin: 13% 0 0 10.5%;
    border: 0;
    box-shadow: none;
    border-radius: 10px;
    overflow: hidden;
    background: #d8c9a2;
    transform: rotate(0.55deg);
}

.sbc-photo {
    display: block;
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    object-fit: contain;
    object-position: center 42%;
    background: #d8c9a2;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

.sbc-photo-caption {
    position: static;
    margin: 0;
    width: 100%;
    padding: 7px 8px;
    font-size: 11px;
    color: #5b4224;
    font-style: italic;
    text-align: center;
    line-height: 1.4;
    background: rgba(216, 201, 162, 0.75);
    backdrop-filter: none;
    border-radius: 0;
    border-top: 0;
}

/* ── Decorative ruled lines (below photo, left page) ────────── */
.sbc-ruled-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding-top: 6px;
}

.sbc-ruled-line {
    height: 1px;
    background: rgba(90, 60, 20, 0.16);
}

/* ── Right-page typography ─────────────────────────────────── */
.sbc-title-main {
    margin: 0 0 5px;
    font-size: 22px;
    font-weight: normal;
    font-style: italic;
    color: #2a1a0c;
    line-height: 1.2;
    text-align: center;
}

.sbc-title-sub {
    margin: 0 0 14px;
    font-size: 13px;
    color: #6b4f2a;
    font-style: italic;
    letter-spacing: 0.05em;
    text-align: center;
}

.sbc-divider {
    border: none;
    border-top: 1px solid rgba(116, 88, 42, 0.24);
    margin: 0 0 18px;
}

.sbc-right-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 97%;
    max-width: 382px;
    margin: 0 auto 0 -2%;
    justify-content: center;
    padding-top: 9%;
    padding-bottom: 10%;
    box-sizing: border-box;
    transform: translate(-10px, -24px);
}

.sbc-body-copy {
    --sbc-line-step: 22px;
    position: relative;
    flex: 0 0 auto;
    margin-top: 10px;
    margin-bottom: 4px;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
    border: 0;
    box-shadow: none;
}

.sbc-body-lines-panel {
    display: none;
}

.sbc-body-text-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
    transform: translateY(0);
}

.sbc-body-line {
    margin: 0;
    min-height: var(--sbc-line-step);
    padding: 0;
    font-size: 16.1px;
    line-height: var(--sbc-line-step);
    color: #3a2917;
    text-align: left;
    hyphens: auto;
    text-shadow: none;
}

.sbc-body-line:last-child {
    padding-bottom: 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.sbc-action-btn {
    align-self: center;
    margin-top: 24px;
    padding: 10px 30px;
    background: #4a2c14;
    color: #f5eedd;
    border: 1px solid #6b4020;
    border-radius: 3px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: background 0.2s ease;
}

.sbc-action-stack {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}

.sbc-action-btn-secondary {
    margin-top: 0;
    background: #6b4020;
    color: #f5eedd;
}

.sbc-action-btn:hover,
.sbc-action-btn:focus {
    background: #6b4020;
    outline: none;
}

.sbc-skip-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: rgba(90, 60, 20, 0.5);
    font-style: italic;
    text-align: center;
}

/* ── Auto-advance progress bar ─────────────────────────────── */
.sbc-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
}

.sbc-progress-fill {
    height: 100%;
    width: 0;
    background: #c8922a;
    /* transition set dynamically in JS */
}

/* ── Responsive — stack pages vertically on small screens ───── */
@media (max-width: 640px) {
    .sbc-spread-book {
        width: min(96vw, 720px);
        max-width: 96vw;
    }

    .sbc-book-surface {
        top: 8.4%;
        bottom: 12.6%;
        border-radius: 18px;
    }

    .sbc-book-surface-left {
        left: 12.8%;
        width: 32.8%;
    }

    .sbc-book-surface-right {
        left: 54%;
        width: 32.4%;
    }

    .sbc-page-left {
        padding: 5.5% 7% 9%;
    }

    .sbc-page-right {
        padding: 9.5% 9.5% 11% 8.5%;
    }

    .sbc-title-main {
        font-size: 16px;
    }

    .sbc-body-line {
        font-size: 12px;
        line-height: 16px;
        min-height: 16px;
    }

    .sbc-body-copy {
        --sbc-line-step: 16px;
        min-height: 130px;
    }

    .sbc-divider {
        margin-bottom: 10px;
    }
}
