/* Book-specific styles - common styles are in common.css */

:root {
    --readMax: 760px; /* Override for book reader */
}

.center-title {
    max-width: 1200px;
    margin: 0 0 0 25%;
    padding: 24px 20px;
    text-align: center;
}

.center-title .book-top {
    font-size: 30px;
    letter-spacing: -.03em;
    line-height: 1.1;
    font-weight: 500;
    color: var(--accent);
}

.center-title .book-sub {
    margin-top: 10px;
    font-size: 19px;
    letter-spacing: -.015em;
    color: rgba(16, 17, 20, .90);
    line-height: 1.4;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(16, 17, 20, .02);
    cursor: pointer;
    color: var(--text);
    user-select: none;
    line-height: 1;
    transition: all 0.2s ease;
    font-size: 15px;
    font-weight: 450;
}

.btn:hover {
    border-color: rgba(37, 99, 235, .35);
    background: rgba(37, 99, 235, .06);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
}

/* Book-specific shell layout */
.shell {
    max-width: 1200px;
    margin: 24px auto 48px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.toc {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 14px;
}

details.section {
    border: 1px solid rgba(16, 17, 20, .10);
    border-radius: 14px;
    background: rgba(16, 17, 20, .01);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.25s ease;
}

details.section[open] {
    border-color: rgba(37, 99, 235, .28);
    background: rgba(37, 99, 235, .04);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .08);
}

summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: background 0.2s ease;
}

summary:hover {
    background: rgba(16, 17, 20, .02);
}

summary::-webkit-details-marker {
    display: none;
}

.sec-badge {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, .10);
    border: 1px solid rgba(124, 58, 237, .22);
    color: rgba(16, 17, 20, .90);
    font-size: 13px;
    font-weight: 500;
    margin-top: 1px;
}

.sec-meta {
    min-width: 0;
}

/* Section titles same size as chapter titles */
.sec-meta .sec-name {
    line-height: 1.3;
    font-size: 17px;
    font-weight: 450;
    color: var(--accent);
    font-family: var(--serif);
}

.preface-label {
    color: var(--accent);
    font-family: var(--serif);
}

.sec-meta .sec-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.4;
}

.chapters {
    border-top: 1px solid rgba(16, 17, 20, .10);
    padding: 12px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toc-link {
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: rgba(16, 17, 20, .92);
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.toc-link:hover {
    background: rgba(16, 17, 20, .03);
    border-color: rgba(16, 17, 20, .10);
    transform: translateX(2px);
}

.toc-link.active {
    background: rgba(37, 99, 235, .10);
    border-color: rgba(37, 99, 235, .25);
    color: var(--text);
}

/* Allow wrapping, no truncation */
.toc-link .label {
    flex: 1;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    line-height: 1.4;
    font-size: 17px;
}

.reader {
    padding: 0;
    overflow: hidden;
}

.reader-head {
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--panel2);
}

.reader-head .h-title {
    font-size: 24px;
    letter-spacing: -.02em;
    line-height: 1.25;
    margin: 0;
    font-weight: 500;
    color: var(--accent);
}

.reader-body {
    padding: 28px 22px 12px;
}

.prose {
    max-width: var(--readMax);
    margin: 0 auto;
    font-family: var(--serif);
    font-size: 19px;
    color: rgba(16, 17, 20, .96);
    line-height: 1.7;
}

.prose p {
    margin: 0 0 20px;
}

.reader-foot {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-top: 1px solid var(--border);
    background: rgba(16, 17, 20, .01);
}

.navbtn {
    flex: 1;
    max-width: 300px;
    text-align: left;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(16, 17, 20, .12);
    background: rgba(16, 17, 20, .02);
    transition: all 0.2s ease;
    cursor: pointer;
}

.navbtn:hover {
    border-color: rgba(37, 99, 235, .30);
    background: rgba(37, 99, 235, .06);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .12);
}

.navbtn .small {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 450;
}

.navbtn .big {
    display: block;
    font-size: 14px;
    white-space: normal;
    line-height: 1.35;
    font-weight: 450;
}

.navbtn.disabled {
    opacity: .45;
    pointer-events: none;
}

.mobile-only {
    display: none;
}

@media (max-width: 980px) {
    .center-title .book-top {
        font-size: 24px;
    }

    .center-title .book-sub {
        font-size: 17px;
    }

    .shell {
        grid-template-columns: 1fr;
        margin: 20px auto 40px;
        padding: 0 16px;
    }

    .toc {
        position: fixed;
        top: 80px;
        left: 12px;
        right: 12px;
        max-height: calc(100vh - 96px);
        display: none;
        padding: 12px;
    }

    .toc.open {
        display: block;
    }

    .mobile-only {
        display: inline-flex;
    }

    .prose {
        font-size: 18px;
        line-height: 1.65;
    }

    .prose p {
        margin: 0 0 18px;
    }

    .navbtn {
        max-width: none;
        padding: 11px 14px;
    }

    .reader-head {
        padding: 18px 18px 16px;
    }

    .reader-head .h-title {
        font-size: 22px;
    }

    .reader-body {
        padding: 24px 18px 10px;
    }
}
