/* ============================================
   L'OMBRE D'UN ÉCRAN — Style Complet
   Un livre numérique professionnel
   ============================================ */

/* ─── Variables ─── */
:root {
    --bg-paper: #faf8f3;
    --bg-paper-dark: #f0ece3;
    --ink-primary: #2c2416;
    --ink-secondary: #5a4d3b;
    --ink-muted: #8a7e6b;
    --accent: #8b4513;
    --accent-light: #a0522d;
    --border-light: #d4cfc4;
    --shadow-soft: rgba(44, 36, 22, 0.06);
    --shadow-medium: rgba(44, 36, 22, 0.12);
    --font-serif: Georgia, "Times New Roman", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Georgia", serif;
    --max-width: 720px;
    --radius: 4px;
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 18px;
}

body {
    font-family: var(--font-serif);
    background-color: var(--bg-paper);
    color: var(--ink-primary);
    line-height: 1.85;
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: var(--accent);
    color: #fff;
}

/* ─── Navigation ─── */
.book-nav {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 2rem;
    background: rgba(250, 248, 243, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.book-nav.top {
    top: 0;
}

.book-nav.bottom {
    bottom: 0;
    border-bottom: none;
    border-top: 1px solid var(--border-light);
}

.book-brand {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: 0.15em;
}

.nav-btn {
    text-decoration: none;
    color: var(--ink-secondary);
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-btn:hover:not(.disabled) {
    background: var(--ink-primary);
    color: var(--bg-paper);
    border-color: var(--ink-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.nav-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.page-indicator {
    color: var(--ink-muted);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

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

/* ─── Book Header ─── */
.book-header {
    text-align: center;
    padding: 4rem 0 3rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-light);
}

.book-title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 400;
    color: var(--ink-primary);
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 0.8rem;
}

.book-subtitle {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--ink-muted);
    font-weight: 400;
}

/* ─── Part Header ─── */
.part-header {
    text-align: center;
    padding: 3.5rem 0 2.5rem;
    margin: 2rem 0;
}

.part-title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--accent);
    margin-bottom: 0.6rem;
}

.part-subtitle {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-style: italic;
    color: var(--ink-secondary);
    font-weight: 400;
}

/* ─── Prologue ─── */
.prologue {
    padding: 2rem 0;
}

.prologue .part-title {
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    text-align: center;
    margin-bottom: 0.3rem;
}

.prologue .chapter-subtitle {
    text-align: center;
    font-size: 1.5rem;
    font-style: italic;
    color: var(--ink-secondary);
    margin-bottom: 2rem;
    font-weight: 400;
}

/* ─── Chapter ─── */
.chapter {
    padding: 2.5rem 0;
}

.chapter-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.chapter-title {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.chapter-subtitle {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-style: italic;
    color: var(--ink-primary);
    font-weight: 400;
    line-height: 1.3;
}

/* ─── Chapter Text ─── */
.chapter-text p {
    margin-bottom: 1.4rem;
    text-align: justify;
    hyphens: auto;
    font-size: 1.05rem;
    color: var(--ink-primary);
}

.chapter-text p:first-of-type::first-letter {
    font-size: 3.2rem;
    float: left;
    line-height: 0.8;
    padding-right: 0.15em;
    padding-top: 0.1em;
    color: var(--accent);
    font-family: var(--font-display);
}

/* ─── Dialogue ─── */
.dialogue {
    font-style: italic;
    margin: 1.8rem 0 1.8rem 2.5rem !important;
    padding-left: 1.2rem;
    border-left: 3px solid var(--accent);
    color: var(--ink-secondary) !important;
    position: relative;
}

.dialogue::before {
    content: "";
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    opacity: 0.6;
}

/* ─── Section Separator ─── */
.section-separator {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-light), transparent);
    margin: 3rem auto;
    max-width: 200px;
    position: relative;
}

.section-separator::after {
    content: "❧";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-paper);
    padding: 0 1rem;
    color: var(--accent);
    font-size: 1.2rem;
    font-family: var(--font-serif);
}

/* ─── Scroll Animations ─── */
.scroll-hidden {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Epilogue & End ─── */
.epilogue-header {
    text-align: center;
    padding: 4rem 0 2rem;
}

.book-end {
    text-align: center;
    padding: 4rem 0 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-light);
}

.book-end h2 {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.dedication {
    font-style: italic;
    color: var(--ink-muted);
    font-size: 0.95rem;
    line-height: 2;
    margin-top: 2rem;
}

.final-line {
    margin-top: 3rem;
    font-style: italic;
    color: var(--ink-secondary);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    
    .book-title {
        font-size: 2rem;
    }
    
    .book-content {
        padding: 1rem 1.2rem 4rem;
    }
    
    .book-nav {
        padding: 0.7rem 1rem;
    }
    
    .nav-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .book-brand {
        display: none;
    }
    
    .chapter-text p:first-of-type::first-letter {
        font-size: 2.5rem;
    }
    
    .dialogue {
        margin-left: 1rem !important;
    }
}

@media (max-width: 480px) {
    .book-title {
        font-size: 1.6rem;
    }
    
    .chapter-subtitle {
        font-size: 1.2rem;
    }
    
    .page-indicator {
        display: none;
    }
}

/* ─── Print Styles ─── */
@media print {
    .book-nav {
        display: none;
    }
    
    body {
        background: white;
        padding: 0;
    }
    
    .book-content {
        max-width: 100%;
    }
    
    .scroll-hidden {
        opacity: 1 !important;
        transform: none !important;
    }
}
