
/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

/* CSS Variables - Light Mode */
:root {
    --background: hsl(40, 33%, 98%);
    --foreground: hsl(30, 10%, 15%);
    --primary: hsl(350, 65%, 35%);
    --primary-foreground: hsl(40, 33%, 98%);
    --secondary: hsl(35, 30%, 92%);
    --muted: hsl(35, 20%, 94%);
    --muted-foreground: hsl(30, 10%, 45%);
    --border: hsl(35, 25%, 88%);
    --reading-bg: hsl(40, 35%, 97%);
    --reading-text: hsl(30, 15%, 20%);
    --progress: hsl(350, 65%, 45%);
}

/* Dark Mode */
.dark {
    --background: hsl(30, 15%, 8%);
    --foreground: hsl(35, 20%, 90%);
    --primary: hsl(35, 60%, 65%);
    --primary-foreground: hsl(30, 15%, 8%);
    --secondary: hsl(30, 15%, 15%);
    --muted: hsl(30, 12%, 18%);
    --muted-foreground: hsl(35, 15%, 55%);
    --border: hsl(30, 12%, 20%);
    --reading-bg: hsl(30, 15%, 8%);
    --reading-text: hsl(35, 20%, 85%);
    --progress: hsl(35, 60%, 55%);
}

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

body {
    font-family: 'Lora', Georgia, serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.header-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Navigation Buttons */
.nav-button {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.nav-button:hover {
    background-color: var(--secondary);
    color: var(--primary);
}

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

.nav-button.primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.nav-button.primary:hover {
    opacity: 0.9;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 280px;
    background-color: var(--muted);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1.5rem;
    z-index: 50;
}

.sidebar-hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sidebar-author {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.chapter-list {
    list-style: none;
}

.chapter-item {
    margin-bottom: 0.5rem;
}

.chapter-link {
    display: block;
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--foreground);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.chapter-link:hover {
    background-color: var(--secondary);
}

.chapter-link.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.chapter-number {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.chapter-link.active .chapter-number {
    color: var(--primary-foreground);
    opacity: 0.8;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding-top: 56px;
    min-height: 100vh;
}

.main-content.sidebar-hidden {
    margin-left: 0;
}

/* Article */
article {
    min-height: calc(100vh - 56px);
}

.chapter-header {
    padding: 4rem 1.5rem 3rem;
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
}

.chapter-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
    display: inline-block;
}

.chapter-title {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--foreground);
}

.chapter-divider {
    width: 4rem;
    height: 1px;
    background-color: var(--primary);
    opacity: 0.3;
    margin: 0 auto;
}

/* Chapter Illustration */
.illustration-container {
    padding: 0 1.5rem 2rem;
    max-width: 680px;
    margin: 0 auto;
}

.illustration {
    max-width: 24rem;
    width: 100%;
    height: auto;
    opacity: 0.8;
    display: block;
    margin: 0 auto;
}

.dark .illustration {
    filter: invert(1);
    opacity: 0.7;
}

/* Chapter Content */
.chapter-content {
    padding: 0 1.5rem 4rem;
    max-width: 680px;
    margin: 0 auto;
}

.reading-text {
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--reading-text);
}

.reading-text:first-of-type::first-letter {
    font-size: 3rem;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    float: left;
    margin-right: 0.75rem;
    margin-top: 0.25rem;
    color: var(--primary);
    line-height: 1;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--foreground);
}

/* Chapter Navigation */
.chapter-nav {
    max-width: 680px;
    margin: 4rem auto 0;
    padding: 2rem 1.5rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chapter-nav-info {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--muted);
    z-index: 99;
}

.progress-fill {
    height: 100%;
    background-color: var(--progress);
    transition: width 0.1s;
}

/* Index Page */
.index-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

.index-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.index-subtitle {
    font-size: 1.25rem;
    color: var(--muted-foreground);
    text-align: center;
    margin-bottom: 3rem;
    line-height: 1.6;
}

.index-author {
    text-align: center;
    font-size: 1.125rem;
    color: var(--foreground);
    margin-bottom: 3rem;
}

.index-chapters {
    margin-top: 3rem;
}

.index-chapter-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background-color: var(--muted);
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.index-chapter-item:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
}

.index-chapter-link {
    text-decoration: none;
    color: var(--foreground);
    display: block;
}

.index-chapter-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .chapter-title {
        font-size: 2rem;
    }
    
    .index-title {
        font-size: 2rem;
    }
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--foreground);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background-color: var(--secondary);
}

/* Contact Info */
.contact-info {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--muted);
    border-radius: 0.5rem;
}

.contact-info p {
    margin: 0.5rem 0;
    font-family: 'Inter', sans-serif;
}
