:root {
    --header-bg: #263532;
    --body-bg: #131413;
    --content-bg: #1a1d1b;
    --small-text: #44525a;
    --large-text: #dcccbb;
    --accent: #8a9a94;
    --max-content-width: 800px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--body-bg);
    color: var(--large-text);
    line-height: 1.7;
    min-height: 100vh;
}

/* Navigation */
.top-nav {
    background-color: var(--header-bg);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-link {
    color: var(--large-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
    display: inline-block;
}

.back-link:hover {
    color: var(--accent);
}

/* Main Content */
.book-page {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

/* Book Header */
.book-header {
    text-align: center;
    padding: 2rem 0 3rem;
    border-bottom: 1px solid rgba(138, 154, 148, 0.2);
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out;
}

.book-title {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--large-text);
    margin-bottom: 1rem;
}

.book-meta {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Synopsis Section */
.synopsis {
    background-color: var(--content-bg);
    padding: 2.5rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    border-left: 4px solid var(--accent);
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.synopsis h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--large-text);
    font-weight: 400;
}

.synopsis p {
    margin-bottom: 1rem;
    color: rgba(220, 204, 187, 0.9);
}

.synopsis p:last-of-type {
    margin-bottom: 0;
}

.content-warning {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(138, 154, 148, 0.2);
    font-size: 0.9rem;
    color: var(--accent);
}

/* Chapters Section */
.chapters {
    margin-bottom: 4rem;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.chapters h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--large-text);
    font-weight: 400;
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chapter-link {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    background-color: var(--content-bg);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.chapter-link:hover {
    background-color: rgba(38, 53, 50, 0.4);
    border-left-color: var(--accent);
    transform: translateX(8px);
}

.chapter-number {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.25rem;
    color: var(--accent);
    font-weight: 700;
    min-width: 3rem;
}

.chapter-title {
    font-size: 1rem;
    color: var(--large-text);
    font-weight: 400;
}

/* Chapter Content */
.chapter-content {
    margin-bottom: 4rem;
    padding-top: 2rem;
    scroll-margin-top: 100px; /* Account for sticky nav */
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.chapter-prompt {
    text-align: left;
    color: var(--accent);
    font-size: 1.125rem;
    padding: 3rem 0;
    font-style: italic;
}

.chapter-content h3 {
    font-family: 'Libre Baskerville', serif;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--large-text);
    font-weight: 400;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(138, 154, 148, 0.3);
}

.chapter-content p {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: rgba(220, 204, 187, 0.95);
}

.chapter-content p:first-of-type {
    margin-top: 0;
}

.chapter-content p:first-of-type::first-letter {
    font-size: 3.5em;
    line-height: 0.8;
    float: left;
    margin: 0.1em 0.15em 0 0;
    font-family: 'Libre Baskerville', serif;
    color: var(--accent);
}

/* Chapter Navigation Controls */
.chapter-nav-controls {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(138, 154, 148, 0.2);
}

.nav-button {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    padding: 0.875rem 1.75rem;
    background-color: rgba(38, 53, 50, 0.4);
    color: var(--large-text);
    border: 1px solid rgba(138, 154, 148, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.nav-button:hover:not(:disabled) {
    background-color: rgba(38, 53, 50, 0.6);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#prev-chapter {
    margin-right: auto;
}

#next-chapter {
    margin-left: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid rgba(138, 154, 148, 0.2);
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
    display: inline-block;
}

.footer-link:hover {
    color: var(--large-text);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-nav {
        padding: 1.25rem 1.5rem;
    }
    
    .book-page {
        padding: 2rem 1.5rem 3rem;
    }
    
    .book-header {
        padding: 1.5rem 0 2rem;
    }
    
    .book-title {
        font-size: 2rem;
    }
    
    .synopsis {
        padding: 1.75rem;
    }
    
    .chapter-link {
        padding: 1rem 1.25rem;
        gap: 1rem;
    }
    
    .chapter-number {
        font-size: 1.1rem;
        min-width: 2.5rem;
    }
    
    .chapter-title {
        font-size: 0.95rem;
    }
    
    .chapter-content h3 {
        font-size: 1.5rem;
    }
    
    .chapter-content p {
        font-size: 1rem;
    }
    
    .chapter-nav-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-button {
        width: 100%;
        margin: 0 !important;
    }
}

@media (max-width: 480px) {
    .book-page {
        padding: 1.5rem 1rem 2.5rem;
    }
    
    .synopsis {
        padding: 1.5rem;
    }
    
    .chapter-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .top-nav,
    .chapters,
    footer {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .chapter-content {
        page-break-after: always;
    }
}
