/* ========================================
   BOOK STYLES - Книга "Работа мозга"
   ======================================== */

/* ----------------------------------------
   Book Landing Page - Hero
   ---------------------------------------- */
.book-hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8rem 2rem 2.8rem;
    overflow: hidden;
}

.book-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(139, 0, 0, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(201, 162, 39, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, var(--vinyl-black) 0%, rgba(13, 13, 13, 0.95) 100%);
    z-index: 0;
}

.book-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.book-hero .section-label {
    font-family: 'PT Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--cherry);
    margin-bottom: 1.5rem;
}

.book-hero .section-label::before {
    content: '// ';
}

.book-title {
    font-family: 'TT Backwards Sans', 'Oswald', sans-serif;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--gold) 0%, #E8D48B 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.book-subtitle {
    font-family: 'PT Serif', Georgia, serif;
    font-size: 1.25rem;
    color: rgba(245, 240, 230, 0.7);
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.btn-start-reading {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--cherry) 0%, var(--cherry-light) 100%);
    color: var(--cream);
    font-family: 'PT Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    transition: all 0.3s ease;
}

.btn-start-reading:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 0, 0, 0.4);
}

/* ----------------------------------------
   Table of Contents
   ---------------------------------------- */
.book-toc {
    padding: 4rem 2rem 6rem;
    max-width: 1200px;
    margin: 0 auto;
}

.toc-intro {
    max-width: 700px;
    margin: 0 auto 3rem;
    text-align: center;
}

.toc-intro p {
    font-family: 'PT Serif', Georgia, serif;
    font-size: 1.1rem;
    color: rgba(245, 240, 230, 0.7);
    line-height: 1.8;
}

.toc-heading {
    font-family: 'PT Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--cherry);
    text-align: center;
    margin-bottom: 2rem;
}

.toc-heading::before {
    content: '// ';
}

.toc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.toc-card {
    display: block;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.08) 0%, rgba(13, 13, 13, 0.4) 100%);
    border: 1px solid rgba(139, 0, 0, 0.2);
    text-decoration: none;
    transition: all 0.3s ease;
}

.toc-card:hover {
    border-color: var(--gold);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.toc-number {
    font-family: 'PT Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--cherry);
    display: block;
    margin-bottom: 0.75rem;
}

.toc-title {
    font-family: 'TT Backwards Sans', 'Oswald', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--cream);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.toc-preview {
    font-family: 'PT Serif', Georgia, serif;
    font-size: 0.85rem;
    color: rgba(245, 240, 230, 0.5);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ----------------------------------------
   Chapter Navigation (Sticky)
   ---------------------------------------- */
.chapter-nav {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    z-index: 99;
    background: rgba(13, 13, 13, 0.85);
    border-bottom: 1px solid rgba(139, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chapter-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
}

.chapter-nav-link {
    font-family: 'PT Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(245, 240, 230, 0.6);
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chapter-nav-link.prev,
.chapter-nav-link.next {
    flex: 1;
    min-width: 0;
}

.chapter-nav-link.prev {
    justify-content: flex-start;
}

.chapter-nav-link.next {
    justify-content: flex-end;
    text-align: right;
}

.chapter-nav-link:hover {
    color: var(--gold);
}

.chapter-nav-link.toc {
    color: var(--cherry);
    flex-shrink: 0;
}

.chapter-nav-link.toc:hover {
    color: var(--cherry-light);
}

.chapter-nav-link.disabled {
    visibility: hidden;
}

.chapter-nav-link .arrow {
    font-size: 1rem;
}

/* ----------------------------------------
   Chapter Content
   ---------------------------------------- */
.chapter-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 7rem 2rem 2rem;  /* 112px сверху = 80px (nav) + отступ */
}

.chapter-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(139, 0, 0, 0.2);
}

.chapter-number {
    font-family: 'PT Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--cherry);
    display: block;
    margin-bottom: 1rem;
}

.chapter-title {
    font-family: 'TT Backwards Sans', 'Oswald', sans-serif;
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 600;
    color: var(--gold);
    line-height: 1.2;
}

.chapter-text {
    font-family: 'PT Serif', Georgia, serif;
}

.chapter-text p {
    font-size: 1.1rem;
    line-height: 1.9;
    color: rgba(245, 240, 230, 0.85);
    margin-bottom: 1.5rem;
    text-align: justify;
    hyphens: auto;
}

.chapter-text p:first-of-type::first-letter {
    font-size: 3.5rem;
    float: left;
    line-height: 1;
    padding-right: 0.5rem;
    color: var(--cherry);
    font-family: 'TT Backwards Sans', 'Oswald', sans-serif;
    font-weight: 600;
}

/* ----------------------------------------
   Chapter Images
   ---------------------------------------- */
.chapter-images {
    margin: 3rem 0;
    padding-top: 2rem;
    border-top: 1px solid rgba(139, 0, 0, 0.2);
}

.chapter-image {
    margin-bottom: 2rem;
}

.chapter-image img {
    width: 100%;
    height: auto;
    border: 1px solid rgba(139, 0, 0, 0.3);
    display: block;
}

.chapter-image figcaption {
    font-family: 'PT Mono', monospace;
    font-size: 0.8rem;
    color: rgba(245, 240, 230, 0.6);
    margin-top: 0.75rem;
    text-align: center;
    line-height: 1.4;
}

/* ----------------------------------------
   Chapter Footer Navigation
   ---------------------------------------- */
.chapter-footer-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
    border-top: 1px solid rgba(139, 0, 0, 0.2);
}

.btn-chapter {
    flex: 1;
    padding: 1.25rem 1rem;
    font-family: 'PT Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(245, 240, 230, 0.7);
    text-decoration: none;
    background: rgba(139, 0, 0, 0.08);
    border: 1px solid rgba(139, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-chapter:hover {
    color: var(--cream);
    border-color: var(--cherry);
    background: rgba(139, 0, 0, 0.15);
}

.btn-chapter.prev {
    text-align: left;
    justify-content: flex-start;
}

.btn-chapter.next {
    text-align: right;
    justify-content: flex-end;
}

.btn-chapter.toc {
    flex: 0.5;
    color: var(--cherry);
}

.btn-chapter.toc:hover {
    color: var(--cherry-light);
}

.btn-chapter.disabled {
    visibility: hidden;
}

/* ----------------------------------------
   Book CTA Section
   ---------------------------------------- */
.book-cta {
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.1) 0%, rgba(13, 13, 13, 0.5) 100%);
    border-top: 1px solid rgba(139, 0, 0, 0.2);
}

.book-cta-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.book-cta h2 {
    font-family: 'TT Backwards Sans', 'Oswald', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--cream);
    margin-bottom: 0.75rem;
}

.book-cta p {
    font-family: 'PT Serif', Georgia, serif;
    font-size: 1rem;
    color: rgba(245, 240, 230, 0.6);
    margin-bottom: 1.5rem;
}

.book-cta .btn-shop {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: transparent;
    color: var(--gold);
    font-family: 'PT Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid var(--gold);
    transition: all 0.3s ease;
}

.book-cta .btn-shop:hover {
    background: var(--gold);
    color: var(--vinyl-black);
}

/* ----------------------------------------
   Mobile Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
    .book-hero {
        min-height: 50vh;
        padding: 6rem 1.5rem 2.1rem;
    }

    .book-title {
        font-size: 2.5rem;
    }

    .book-subtitle {
        font-size: 1rem;
    }

    .chapter-nav {
        top: 56px;
    }

    .chapter-nav-inner {
        padding: 0.5rem 1rem;
    }

    .chapter-nav-link {
        font-size: 0.6rem;
    }

    .chapter-content {
        padding: 5rem 1.5rem 1rem;  /* 80px сверху = 56px (nav) + отступ */
    }

    .chapter-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .chapter-text p {
        font-size: 1rem;
        line-height: 1.8;
        text-align: left;
    }

    .chapter-text p:first-of-type::first-letter {
        font-size: 2.5rem;
    }

    .toc-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .toc-card {
        padding: 1.25rem;
    }

    .chapter-footer-nav {
        flex-direction: column;
        padding: 2rem 1.5rem 3rem;
    }

    .btn-chapter {
        padding: 1rem;
    }

    .btn-chapter.prev,
    .btn-chapter.next {
        text-align: center;
        justify-content: center;
    }

    .btn-chapter.toc {
        flex: 1;
        order: -1;
    }

    .book-toc {
        padding: 3rem 1.5rem 4rem;
    }
}

/* ----------------------------------------
   Reading Progress Indicator (optional)
   ---------------------------------------- */
.reading-progress {
    position: fixed;
    top: 80px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cherry) 0%, var(--gold) 100%);
    z-index: 101;
    width: 0%;
    transition: width 0.1s ease-out;
}

@media (max-width: 768px) {
    .reading-progress {
        top: 56px;
    }
}

/* ----------------------------------------
   Reading Settings Panel
   ---------------------------------------- */
.reading-settings {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.reading-settings-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(139, 0, 0, 0.9);
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.reading-settings-toggle:hover {
    background: var(--cherry);
    transform: scale(1.05);
}

.reading-settings-toggle svg {
    width: 22px;
    height: 22px;
}

.reading-settings-panel {
    background: rgba(13, 13, 13, 0.95);
    border: 1px solid rgba(139, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    display: none;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.reading-settings-panel.open {
    display: flex;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-label {
    font-family: 'PT Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cherry);
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.font-size-btn {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid rgba(139, 0, 0, 0.3);
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'PT Serif', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.font-size-btn:hover {
    background: rgba(139, 0, 0, 0.4);
    border-color: var(--cherry);
}

.font-size-btn:active {
    transform: scale(0.95);
}

.font-size-value {
    font-family: 'PT Mono', monospace;
    font-size: 0.8rem;
    color: rgba(245, 240, 230, 0.7);
    min-width: 40px;
    text-align: center;
}

.theme-toggle {
    display: flex;
    gap: 0.5rem;
}

.theme-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(139, 0, 0, 0.3);
    cursor: pointer;
    font-family: 'PT Mono', monospace;
    font-size: 0.7rem;
    transition: all 0.2s ease;
}

.theme-btn.dark {
    background: var(--vinyl-black);
    color: var(--cream);
}

.theme-btn.light {
    background: #F5ECD7;
    color: #2C2416;
}

.theme-btn.active {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(201, 162, 39, 0.3);
}

.theme-btn:hover:not(.active) {
    border-color: var(--cherry);
}

/* ----------------------------------------
   Light (Sepia) Theme for Book
   ---------------------------------------- */
body.light-theme {
    background: #F5ECD7;
    color: #2C2416;
}

body.light-theme .chapter-content {
    background: #F5ECD7;
}

body.light-theme .chapter-header {
    border-bottom-color: rgba(139, 0, 0, 0.15);
}

body.light-theme .chapter-number {
    color: #8B4513;
}

body.light-theme .chapter-title {
    color: #5C3D2E;
}

body.light-theme .chapter-text p {
    color: #2C2416;
}

body.light-theme .chapter-text p:first-of-type::first-letter {
    color: #8B4513;
}

body.light-theme .chapter-image img {
    border-color: rgba(139, 0, 0, 0.2);
}

body.light-theme .chapter-image figcaption {
    color: #5C4033;
}

body.light-theme .chapter-footer-nav {
    border-top-color: rgba(139, 0, 0, 0.15);
}

body.light-theme .btn-chapter {
    background: rgba(139, 0, 0, 0.05);
    border-color: rgba(139, 0, 0, 0.15);
    color: #5C4033;
}

body.light-theme .btn-chapter:hover {
    background: rgba(139, 0, 0, 0.1);
    border-color: #8B4513;
    color: #2C2416;
}

body.light-theme .btn-chapter.toc {
    color: #8B4513;
}

body.light-theme nav {
    background: rgba(245, 236, 215, 0.95);
    border-bottom-color: rgba(139, 0, 0, 0.1);
}

body.light-theme .logo {
    color: #8B4513;
}

body.light-theme .nav-links a {
    color: #5C4033;
}

body.light-theme .nav-links a:hover,
body.light-theme .nav-links a.active {
    color: #8B4513;
}

body.light-theme .burger-menu span {
    background: #5C4033;
}

body.light-theme .reading-progress {
    background: linear-gradient(90deg, #8B4513 0%, #C9A227 100%);
}

body.light-theme footer {
    background: #EDE4CF;
    border-top: 1px solid rgba(139, 0, 0, 0.1);
    color: #5C4033;
}

body.light-theme .reading-settings-toggle {
    background: rgba(139, 69, 19, 0.9);
    border-color: rgba(201, 162, 39, 0.4);
}

body.light-theme .reading-settings-toggle:hover {
    background: #8B4513;
}

body.light-theme .reading-settings-panel {
    background: rgba(245, 236, 215, 0.98);
    border-color: rgba(139, 0, 0, 0.2);
}

body.light-theme .settings-label {
    color: #8B4513;
}

body.light-theme .font-size-btn {
    background: rgba(139, 69, 19, 0.1);
    border-color: rgba(139, 69, 19, 0.2);
    color: #5C4033;
}

body.light-theme .font-size-btn:hover {
    background: rgba(139, 69, 19, 0.2);
    border-color: #8B4513;
}

body.light-theme .font-size-value {
    color: #5C4033;
}

/* Font size variations */
body.font-size-small .chapter-text p {
    font-size: 0.95rem;
    line-height: 1.8;
}

body.font-size-medium .chapter-text p {
    font-size: 1.1rem;
    line-height: 1.9;
}

body.font-size-large .chapter-text p {
    font-size: 1.3rem;
    line-height: 2;
}

body.font-size-xlarge .chapter-text p {
    font-size: 1.5rem;
    line-height: 2.1;
}

@media (max-width: 768px) {
    .reading-settings {
        bottom: 1rem;
        right: 1rem;
    }

    .reading-settings-toggle {
        width: 44px;
        height: 44px;
    }

    .reading-settings-panel {
        min-width: 180px;
        padding: 0.875rem;
    }

    body.font-size-small .chapter-text p {
        font-size: 0.9rem;
    }

    body.font-size-medium .chapter-text p {
        font-size: 1rem;
    }

    body.font-size-large .chapter-text p {
        font-size: 1.15rem;
    }

    body.font-size-xlarge .chapter-text p {
        font-size: 1.3rem;
    }
}
