/* 
 * Le Choix d'Être - Custom Novel Stylesheet
 * Directory: /public_html/courses/language/french/le_choix_d_etre/
 * Fully isolated from etre_novel.
 */

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

/* Main Scoped Novel Container */
.cozy-novel-reader {
    /* Fonts definitions */
    --font-serif: 'EB Garamond', Georgia, serif;
    --font-ui: 'Lora', 'Georgia', serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Text Sizing Defaults */
    --font-size: 1.35rem;
    --line-height: 1.95;
    
    /* Default: Warm Cream Theme */
    --paper-bg: #faf7f0;
    --paper-text: #2d2621;
    --paper-border: #e8e3d5;
    --accent-color: #8e2b15;
    --accent-hover: #b1371e;
    --meta-color: #70655a;
    --btn-bg: #eae3d3;
    --btn-text: #2d2621;
    --btn-hover: #e0d8c3;
    --tooltip-shadow: rgba(45, 38, 33, 0.08);

    display: block;
    width: 100%;
    background-color: var(--paper-bg);
    color: var(--paper-text);
    font-family: var(--font-serif);
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
    min-height: calc(100vh - 160px); /* Fill space between header and footer */
}

/* Theme Classes Overrides */
.cozy-novel-reader.theme-cream {
    --paper-bg: #faf7f0;
    --paper-text: #2d2621;
    --paper-border: #e8e3d5;
    --accent-color: #8e2b15;
    --accent-hover: #b1371e;
    --meta-color: #70655a;
    --btn-bg: #eae3d3;
    --btn-text: #2d2621;
    --btn-hover: #e0d8c3;
    --tooltip-shadow: rgba(45, 38, 33, 0.08);
}

.cozy-novel-reader.theme-sepia {
    --paper-bg: #f3ebd8;
    --paper-text: #3c3024;
    --paper-border: #e2d4bc;
    --accent-color: #a04000;
    --accent-hover: #c05000;
    --meta-color: #7c6853;
    --btn-bg: #e6dabf;
    --btn-text: #3c3024;
    --btn-hover: #dbceb0;
    --tooltip-shadow: rgba(60, 48, 36, 0.09);
}

.cozy-novel-reader.theme-dusk {
    /* Muted grey/brown for neutral lighting */
    --paper-bg: #e6e8e5;
    --paper-text: #2f3331;
    --paper-border: #cbd0cc;
    --accent-color: #1a5c43;
    --accent-hover: #237b5a;
    --meta-color: #6a736f;
    --btn-bg: #d7dbd6;
    --btn-text: #2f3331;
    --btn-hover: #cbd0cb;
    --tooltip-shadow: rgba(47, 51, 49, 0.07);
}

/* When site is dark theme, Dusk becomes a dark slate */
.theme-dark .cozy-novel-reader.theme-dusk {
    --paper-bg: #2e3436;
    --paper-text: #d3d7cf;
    --paper-border: #41494c;
    --accent-color: #729fcf;
    --accent-hover: #8ae234;
    --meta-color: #888a85;
    --btn-bg: #252a2c;
    --btn-text: #d3d7cf;
    --btn-hover: #1e2224;
    --tooltip-shadow: rgba(0, 0, 0, 0.2);
}

.cozy-novel-reader.theme-charcoal {
    --paper-bg: #1a1614;
    --paper-text: #dbd3ca;
    --paper-border: #2c2522;
    --accent-color: #d19a4e;
    --accent-hover: #e3ae64;
    --meta-color: #92877e;
    --btn-bg: #2d2622;
    --btn-text: #dbd3ca;
    --btn-hover: #3b322c;
    --tooltip-shadow: rgba(0, 0, 0, 0.4);
}

/* Page Layout & Container */
.novel-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    box-sizing: border-box;
}

@media (max-width: 576px) {
    .novel-wrapper {
        padding: 1.5rem 1rem;
    }
    
    /* Header Controls Stack on Mobile */
    .novel-controls {
        flex-direction: column;
        gap: 1.25rem;
        align-items: center;
        text-align: center;
    }
    
    .theme-picker {
        width: 100%;
        justify-content: center;
    }
    
    .theme-picker-label {
        margin-right: 0.5rem;
    }

    .font-size-picker {
        width: 100%;
        justify-content: center;
    }
    
    .novel-nav-links {
        width: 100%;
        justify-content: center;
    }
    
    .novel-nav-btn {
        flex: 1;
        justify-content: center;
        text-align: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Footer Pagination Stack on Mobile */
    .novel-footer-nav {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .novel-footer-nav .novel-nav-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem; /* Slightly larger touch targets */
    }

    .novel-footer-nav span {
        text-align: center;
        order: -1; /* Place Page X of Y at the very top of the stack */
        margin-bottom: 0.25rem;
    }
}

/* Header & Controls bar */
.novel-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--paper-border);
    padding-bottom: 1rem;
    margin-bottom: 2.5rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

/* Theme Switcher buttons */
.theme-picker {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.theme-picker-label {
    color: var(--meta-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.25rem;
    font-weight: 500;
}

/* Font Size Picker */
.font-size-picker {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    font-family: var(--font-sans);
}

.font-picker-label {
    color: var(--meta-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.25rem;
    font-weight: 500;
}

.font-size-btn {
    text-decoration: none;
    color: var(--btn-text);
    background-color: var(--btn-bg);
    border: 1px solid var(--paper-border);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.85rem;
    outline: none;
}

.font-size-btn:hover:not(:disabled) {
    background-color: var(--btn-hover);
    color: var(--accent-color);
}

.font-size-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.font-size-indicator {
    color: var(--paper-text);
    font-weight: 500;
    min-width: 42px;
    text-align: center;
    font-size: 0.85rem;
}

.theme-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--paper-border);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, border-color 0.2s;
    outline: none;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.theme-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-color);
    transition: transform 0.2s;
}

.theme-btn.active::after {
    transform: translate(-50%, -50%) scale(1);
}

.theme-btn.btn-cream-color { background-color: #faf7f0; }
.theme-btn.btn-sepia-color { background-color: #f3ebd8; }
.theme-btn.btn-dusk-color { background-color: #e6e8e5; }
.theme-btn.btn-charcoal-color { background-color: #1a1614; }

/* Navigation buttons (e.g. Back to Contents, cover) */
.novel-nav-links {
    display: flex;
    gap: 0.75rem;
}

.novel-nav-btn {
    text-decoration: none;
    color: var(--btn-text);
    background-color: var(--btn-bg);
    border: 1px solid var(--paper-border);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.novel-nav-btn:hover {
    background-color: var(--btn-hover);
    color: var(--paper-text);
    text-decoration: none;
}

/* Classic Gallimard-Style Book Cover */
.gallimard-cover {
    background-color: var(--paper-bg);
    border: 1px solid var(--paper-border);
    padding: 4rem 2rem;
    text-align: center;
    border-radius: 6px;
    position: relative;
    box-shadow: 0 4px 25px rgba(0,0,0,0.03);
    margin: 1.5rem auto;
    max-width: 520px;
    box-sizing: border-box;
}

/* Red double-border frame on Cover */
.gallimard-frame {
    border: 3px double var(--accent-color);
    padding: 3rem 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 480px;
}

.cover-author {
    font-family: var(--font-sans);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--paper-text);
    font-weight: 500;
    margin-bottom: 2rem;
}

.cover-title-group {
    margin: 3rem 0;
}

.cover-title {
    font-family: 'Playfair Display', var(--font-serif);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--accent-color);
    margin: 0;
    line-height: 1.15;
    font-weight: 700;
}

.cover-translation {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-style: italic;
    color: var(--meta-color);
    margin-top: 0.5rem;
}

.cover-subtitle {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--meta-color);
    margin-top: 1.5rem;
    font-weight: 600;
}

.cover-publisher {
    font-family: 'Playfair Display', var(--font-serif);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    margin-top: 3rem;
    font-weight: bold;
    border-top: 1px solid var(--paper-border);
    padding-top: 1.5rem;
    display: inline-block;
    width: 60%;
    margin-left: 20%;
    margin-right: 20%;
}

.cover-actions {
    margin-top: 3.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cover-btn {
    text-decoration: none;
    font-family: var(--font-ui);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: inline-block;
    width: 80%;
    max-width: 280px;
    text-align: center;
}

.cover-btn-primary {
    background-color: var(--accent-color);
    color: #ffffff !important;
    border: 2px solid var(--accent-color);
}

.cover-btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(142, 43, 21, 0.25);
    text-decoration: none;
}

.cover-btn-secondary {
    background-color: var(--paper-bg);
    color: var(--accent-color) !important;
    border: 2px solid var(--accent-color);
}

.cover-btn-secondary:hover {
    background-color: var(--btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
    text-decoration: none;
}

/* Reader Typography & Layout */
.reader-pane {
    line-height: var(--line-height, 1.95);
    font-size: var(--font-size, 1.35rem);
    text-align: justify;
    max-width: 700px;
    margin: 0 auto;
}

.reader-pane p {
    margin-top: 0;
    margin-bottom: 1.6rem;
    text-indent: 2rem; /* Classic book indent */
}

/* No indent on first paragraph or headers */
.reader-pane p.first-paragraph, 
.reader-pane p:first-of-type,
.reader-pane .no-indent {
    text-indent: 0;
}

/* elegant section break stars */
.section-divider {
    text-align: center;
    margin: 3rem 0;
    color: var(--paper-border);
    font-size: 1.5rem;
    letter-spacing: 0.5em;
}

/* Drop Cap Styling */
.drop-cap {
    float: left;
    font-family: 'Playfair Display', var(--font-serif);
    font-size: 4.8rem;
    line-height: 0.82;
    margin-right: 0.65rem;
    margin-top: 0.15rem;
    color: var(--accent-color);
    font-weight: 700;
    text-transform: uppercase;
}

/* Interactive French Phrase */
.french-phrase {
    border-bottom: 1.5px dotted var(--accent-color);
    cursor: pointer;
    position: relative;
    padding: 0 1px;
    transition: background-color 0.2s, color 0.1s;
    font-weight: 500;
}

.french-phrase:hover {
    background-color: rgba(142, 43, 21, 0.08);
    color: var(--accent-hover);
}

/* Custom Tooltip Container */
.novel-tooltip {
    position: absolute;
    background-color: var(--paper-bg);
    color: var(--paper-text);
    border: 1px solid var(--paper-border);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    box-shadow: 0 4px 15px var(--tooltip-shadow), 0 1px 3px rgba(0,0,0,0.05);
    z-index: 1000;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: auto; /* allow interacting with button */
}

.novel-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.tooltip-translation {
    font-weight: 600;
    font-style: italic;
    color: var(--accent-color);
}

.tooltip-tts-btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 1px solid var(--paper-border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.tooltip-tts-btn:hover {
    background: var(--btn-hover);
    color: var(--accent-color);
}

/* Wisdom Links / miarazzo.com quotes */
.wisdom-link {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1.5px solid var(--accent-color);
    transition: all 0.2s;
    font-style: italic;
    font-weight: 500;
}

.wisdom-link:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
    background-color: rgba(142, 43, 21, 0.05);
    text-decoration: none;
}

/* Table of Contents Styling */
.toc-container {
    max-width: 650px;
    margin: 2rem auto;
}

.toc-title {
    font-family: 'Playfair Display', var(--font-serif);
    font-size: 2.2rem;
    text-align: center;
    color: var(--accent-color);
    margin-bottom: 2.5rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-family: var(--font-ui);
}

.toc-link {
    color: var(--paper-text);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.toc-link:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.toc-dots {
    flex-grow: 1;
    border-bottom: 1px dotted var(--paper-border);
    margin: 0 0.8rem;
    height: 1px;
}

.toc-page {
    color: var(--meta-color);
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

/* Chapter Headers */
.chapter-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.chapter-number {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--meta-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-family: 'Playfair Display', var(--font-serif);
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: var(--accent-color);
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.chapter-subtitle {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-style: italic;
    color: var(--meta-color);
    margin-top: 0;
}

/* Bottom Pagination & Navigation */
.novel-footer-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--paper-border);
    margin-top: 4rem;
    padding-top: 1.5rem;
    font-family: var(--font-sans);
}

/* Clean toast container to avoid overlapping site layout */
#novel-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.novel-toast {
    background: var(--paper-bg);
    color: var(--paper-text);
    border: 1px solid var(--paper-border);
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    animation: slideIn 0.3s ease forwards;
    max-width: 320px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Epigraph block styles (for quotes at the beginning of chapters) */
.epigraph-block {
    text-align: center;
    max-width: 500px;
    margin: 2.5rem auto 3rem auto;
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--paper-text);
    font-family: var(--font-serif);
}

.epigraph-text {
    font-style: italic;
    margin-bottom: 0.5rem;
    text-indent: 0 !important;
}

.epigraph-source {
    font-size: 0.95rem;
    color: var(--meta-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-sans);
}

/* Chapter Illustrations styling */
.chapter-illustration-container {
    max-width: 700px;
    margin: 0 auto 2.5rem auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: center;
}

.chapter-illustration {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--paper-border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.chapter-illustration:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}
