/* ===== VARIABLES & RESET ===== */
:root {
    /* Couleurs africaines traditionnelles */
    --color-gold: #C19A6B;
    --color-earth: #8B4513;
    --color-sand: #E1B378;
    --color-night: #1A1A2E;
    --color-mud: #3D2B1F;
    --color-ivory: #F5F5DC;
    --color-river: #5D8AA8;
    
    --primary: #1B2E3C;
    --accent: #E09F3E;
    --text-light: #F1E4C3;
    
    /* Typographie */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Espacements */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 3rem;
    --space-xl: 5rem;
    
    /* Transitions */
    --transition-fast: 200ms ease;
    --transition-normal: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms ease;
    
    /* Effets */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
    --glow-gold: 0 0 20px rgba(193, 154, 107, 0.5);
    
    --nav-height: 60px;          /* hauteur de navigation par défaut */
    --welcome-padding: clamp(8px, 3vh, 32px);  /* Min réduit pour éviter enfoncement */
    --welcome-gap: clamp(6px, 2.5vh, 28px);    /* Gap min réduit */
    --content-max-width: 860px;
    --content-max-height: calc(100svh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));  /* Plus de marge safe */
}


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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--color-night) 0%, var(--color-mud) 100%);
    color: var(--color-ivory);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ===== LOADER ===== */
.zawadi-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-night);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity var(--transition-slow);
}

.loader-content {
    text-align: center;
}

.ankh-symbol {
    font-size: 4rem;
    color: var(--color-gold);
    animation: pulse 2s infinite;
    margin-bottom: var(--space-md);
}

.loader-text {
    font-family: var(--font-heading);
    color: var(--color-sand);
    margin-bottom: var(--space-sm);
    letter-spacing: 2px;
}


/* Annotation Modal */
.annotation-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    border: none;
    border-radius: 16px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(12px);
    color: #fff;
    max-width: 90vw;
    width: 400px;
    padding: 0;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s ease;
}

.annotation-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.annotation-modal-content {
    position: relative;
    padding: 1.5rem;
}

.annotation-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: #FFD700;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.annotation-close:hover {
    opacity: 1;
}

.annotation-body {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-top: 0.5rem;
    padding-right: 1rem;
    color: #f0f0f0;
}

/* Style des notes de bas de page dans le texte */
.text-modal-content sup {
    font-size: 0.7rem;
    vertical-align: super;
    line-height: 1;
}

.text-modal-content sup a {
    text-decoration: none;
    color: #FFD700;
    font-weight: bold;
}

.text-modal-content sup a:hover {
    text-decoration: underline;
}

/* Liste des notes en bas de page */
.text-modal-content hr + section ol,
.text-modal-content section ol {
    font-size: 0.75rem;
    color: #ccc;
    margin-top: 1rem;
    padding-left: 1.2rem;
}

.text-modal-content li {
    margin-bottom: 0.5rem;
}

.text-modal-content li a {
    color: #FFD700;
    text-decoration: none;
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-gold), var(--color-sand));
    width: 0%;
    animation: loading 3s ease-in-out infinite;
}

.nav-btn.home-btn {
    /*background: linear-gradient(135deg, var(--color-gold), #E6B800);*/
    /*color: var(--color-night);*/
    color: var(--color-gold);
}

.nav-btn.home-btn:hover {
    background: linear-gradient(135deg, #E6B800, var(--color-gold));
    transform: scale(1.05);
}

.nav-btn.home-btn:active {
    transform: scale(0.95);
}

/* Animation du bouton Home */
@keyframes pulseHome {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.nav-btn.home-btn.new {
    animation: pulseHome 2s infinite;
    box-shadow: 0 0 10px rgba(225, 173, 107, 0.5);
}


/* Responsive : cache le texte sur mobile */
@media (max-width: 480px) {
    .nav-btn.home-btn .btn-text {
        display: none;
    }
    .nav-btn.home-btn .btn-icon {
        font-size: 1.2rem;
    }
}


/* ===== CONTAINER ===== */
.safari-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}


/* ===== NEW WELCOME SCREEN – VERSION FINALE ROBUSTE ===== */
.welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;  /* Sans !important pour permettre au JS de cacher */
    align-items: center;
    justify-content: center;
    padding: var(--welcome-padding);
    background: linear-gradient(135deg, var(--color-night) 0%, #2D1B00 100%);
    background-image: url('/assets/images/heros.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    visibility: visible;
    opacity: 1;  /* Sans !important pour JS override */
}


.welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    /*background: url('/assets/images/texture.jpg');*/
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
}

.welcome-content {
    position: relative;
    z-index: 2;
    width: min(92%, var(--content-max-width));
    max-height: var(--content-max-height);
    padding: clamp(12px, 4vw, 42px);  /* Padding min réduit pour mobile */
    background: rgba(26, 26, 46, 0.78);
    border-radius: 26px;
    border: 2px solid rgba(193, 154, 107, 0.4);
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow-y: auto;  /* Scroll actif, pas de coupe en bas */
    -webkit-overflow-scrolling: touch;
    gap: var(--welcome-gap);
    box-sizing: border-box;
    margin: auto;
}

/* Scrollbar stylée pour visibility sur mobile */
.welcome-content::-webkit-scrollbar {
    width: 6px;
}

.welcome-content::-webkit-scrollbar-thumb {
    background: var(--color-gold);
    border-radius: 3px;
}

/* RESPONSIVE CONSOLIDÉ – zéro cassure */
@media (max-width: 480px) {
    .welcome-content {
        padding: clamp(8px, 3vw, 20px);  /* Encore plus petit sur petit mobile */
        border-radius: 20px;
        max-height: calc(100svh - env(safe-area-inset-bottom) - 8px);  /* Anti-enfoncement bas */
    }
    
    .welcome-actions {
        gap: 6px;
    }
    
    .copyright-notice {
        font-size: 0.7rem;
        padding-top: 6px;
    }
}

@media (max-height: 620px) {
    .welcome-content {
        padding: clamp(8px, 2vh, 20px);
        gap: clamp(4px, 2vh, 14px);
    }
    
    .experience-hint {
        font-size: 0.75rem;
    }
}

/* Paysage critique (le plus sensible) */
@media (orientation: landscape) and (max-height: 560px) {
    .welcome-content {
        padding: clamp(8px, 1.5vh, 16px);
        gap: clamp(3px, 1vh, 10px);
        max-height: calc(92svh - env(safe-area-inset-bottom));
    }
    
    .logo-symbol { font-size: 2.5rem; }
    .welcome-title { font-size: 1.7rem; }
    .welcome-subtitle { font-size: 0.95rem; }
    .intro-phrase { font-size: 0.9rem; line-height: 1.15; }
    .experience-hint { display: none; }
    .copyright-notice { font-size: 0.65rem; }
}

/* Très très petit paysage (comme ton bloc proposé, adapté) */
@media (max-height: 450px) and (orientation: landscape) {
    .welcome-content {
        padding: 8px 12px;
        gap: 4px;
        max-height: calc(100svh - 10px);
    }
    .welcome-logo {
        margin-bottom: 2px;
    }
    .logo-symbol {
        font-size: 1.8rem;
        margin-bottom: 0;
    }
    .welcome-title {
        font-size: 1.3rem;
        margin-bottom: 0;
    }
    .welcome-subtitle {
        font-size: 0.8rem;
        margin-bottom: 2px;
    }
    .welcome-intro {
        margin: 2px 0 4px;
    }
    .intro-phrase {
        font-size: 0.9rem;
        margin-bottom: 2px;
        line-height: 1.2;
    }
    .intro-divider {
        margin: 2px 0;
    }
    .divider-symbol {
        font-size: 1rem;
    }
    .welcome-intro .intro-credit {
        padding: 0.3rem 0.2rem 0.1rem;
        margin-top: 2px;
        border-top-width: 1px;
    }
    .credit-line {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }
    .credit-author {
        font-size: 1rem;
        border-bottom-width: 1px;
    }
    .welcome-actions {
        gap: 2px;
        margin-bottom: 2px;
    }
    .welcome-btn {
        padding: 6px 10px;
        min-width: 140px;
        font-size: 0.7rem;
    }
    .experience-hint {
        display: none;
    }
    .copyright-notice {
        margin-top: 2px;
        padding-top: 2px;
        font-size: 0.5rem;
    }
}

/* Desktop large : Compact comme sur 730x400 */
@media (min-width: 1024px) {
    .welcome-content {
        max-width: 730px;  /* Limite largeur pour compacité */
        padding: clamp(20px, 4vh, 32px);  /* Moins de padding pour ressembler à petit écran */
        gap: clamp(12px, 3vh, 24px);  /* Gaps réduits */
    }
    
    .logo-symbol { font-size: clamp(3rem, 6vw, 4rem); }
    .welcome-title { font-size: clamp(2rem, 4vw, 2.8rem); }
    .welcome-subtitle { font-size: clamp(1rem, 2vw, 1.3rem); }
    .intro-phrase { font-size: clamp(1rem, 2vw, 1.2rem); }
    .experience-hint { font-size: 0.85rem; }
    .copyright-notice { font-size: 0.8rem; }
}

/* Safe-areas renforcées */
@supports (padding-top: env(safe-area-inset-top)) {
    .welcome-screen {
        padding-top: max(var(--welcome-padding), env(safe-area-inset-top));
        padding-bottom: max(var(--welcome-padding), env(safe-area-inset-bottom));
        padding-left: max(var(--welcome-padding), env(safe-area-inset-left));
        padding-right: max(var(--welcome-padding), env(safe-area-inset-right));
    }
    
    .welcome-content {
        max-height: calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    }
}

/* Scrollbar stylée pour visibility sur mobile */
.welcome-content::-webkit-scrollbar {
    width: 6px;
}

.welcome-content::-webkit-scrollbar-thumb {
    background: var(--color-gold);
    border-radius: 3px;
}


/* ===== END NEW WELCOME SCREEN – VERSION FINALE ROBUSTE ===== */





/* Éléments internes sans margins fixes */
.welcome-logo,
.welcome-intro,
.welcome-actions,
.copyright-notice {
    margin: 0;
    width: 100%;
}

.welcome-logo {
    margin-bottom: 0;
}

.logo-symbol {
    font-size: clamp(3.6rem, 12vw, 6.5rem);
    color: var(--color-gold);
    text-shadow: var(--glow-gold);
    animation: pulse 2.2s infinite ease-in-out;
    display: block;
}

.welcome-title {
    font-size: clamp(2.1rem, 8vw, 3.9rem);
    line-height: 1.05;
    margin: 0;
}

.welcome-subtitle {
    font-size: clamp(1.05rem, 4.2vw, 1.65rem);
    margin: 4px 0 0;
}

.welcome-intro {
    max-width: 680px;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    width: 100%;
    max-width: 340px;
}

.welcome-btn {
    width: 100%;
    max-width: 320px;
    padding: 15px 28px;
    font-size: clamp(0.95rem, 3.5vw, 1.1rem);
}

.experience-hint {
    margin-top: 8px;
    padding: 12px 18px;
    font-size: clamp(0.82rem, 3vw, 0.92rem);
    max-width: 100%;
}



.intro-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: var(--space-xl);
    color: rgba(255, 255, 255, 0.9);
}


/* ===== WELCOME INTRO – ÉLÉGANCE & LISIBILITÉ ===== */
.welcome-intro {
    max-width: 700px;
    margin: 2rem auto 3rem;
    text-align: center;
    animation: introAppear 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Phrase principale */
.welcome-intro .intro-phrase,
.welcome-intro p:first-of-type {  /* si vous utilisez la structure simple */
    font-family: var(--font-heading);  /* Cinzel ou votre police de titres */
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    font-weight: 400;
    line-height: 1.4;
    color: #fff;
    text-shadow: 0 2px 12px rgba(193, 154, 107, 0.2);
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

/* Séparateur décoratif (pour remplacer les "~~~") */
.intro-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    max-width: 120px;
}

.divider-symbol {
    font-size: 1.8rem;
    color: var(--color-gold);
    opacity: 0.9;
    animation: softPulse 4s infinite ease-in-out;
}

/* Texte secondaire (crédit, auteur) */
.welcome-intro .intro-credit,
.welcome-intro p:last-of-type {
    font-family: var(--font-body);
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: rgba(245, 245, 220, 0.85);
    line-height: 1.6;
    max-width: 550px;
    margin: 0 auto;
    font-style: normal;
    border-top: 1px solid rgba(193, 154, 107, 0.2);
    padding-top: 1.5rem;
}

.credit-author {
    display: block;
    margin-top: 0.5rem;
    color: var(--color-gold);
    font-weight: 400;
    letter-spacing: 1px;
}

/* Adaptation pour la structure simple (avec <br> et <small>) */
.welcome-intro p:first-of-type {
    /* déjà stylé ci‑dessus */
}
.welcome-intro p:last-of-type {
    /* déjà stylé */
}
.welcome-intro strong {
    display: block;
    font-size: 2rem;
    color: var(--color-gold);
    line-height: 0.5;
    margin: 1rem 0;
}
.welcome-intro small {
    font-size: 0.9rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
}

/* Animation d’apparition */
@keyframes introAppear {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes softPulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Responsive : ajustements */
@media (max-width: 768px) {
    .welcome-intro {
        margin: 1.5rem auto 2rem;
        padding: 0 1rem;
    }
    .intro-divider {
        gap: 0.5rem;
    }
    .divider-line {
        max-width: 60px;
    }
}
/* ===== FIN WELCOME INTRO – ÉLÉGANCE & LISIBILITÉ ===== */

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.welcome-btn {
    padding: 1.2rem 2.5rem;
    border: 2px solid var(--color-gold);
    background: transparent;
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    letter-spacing: 1px;
}

.welcome-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: translateY(-2px);
    box-shadow: var(--glow-gold);
}

.secondary-btn {
    border-color: var(--color-river);
    color: var(--color-river);
}

.secondary-btn:hover {
    background: var(--color-river);
    color: white;
}

.experience-hint {
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--color-gold);
}

/* ===== NAVIGATION ===== */
.main-navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-lg);
    z-index: 100;
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
}

.nav-left, .nav-right {
    display: flex;
    gap: var(--space-sm);
}

.nav-center {
    text-align: center;
}

.book-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-gold);
    letter-spacing: 2px;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.progress-bar-nav {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill-nav {
    height: 100%;
    background: linear-gradient(90deg, var(--color-gold), var(--color-sand));
    width: 0%;
    transition: width var(--transition-normal);
}

.page-counter {
    font-size: 0.9rem;
    color: var(--color-sand);
}

.nav-btn {
    background: transparent;
    border: 1px solid rgba(193, 154, 107, 0.3);
    color: var(--color-gold);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-normal);
}

.nav-btn:hover {
    background: rgba(193, 154, 107, 0.1);
    border-color: var(--color-gold);
    transform: translateY(-1px);
}

/* ===== BOOK VIEWPORT - RESPONSIVE ===== */
.book-viewport {
    width: 100%;
    height: calc(100svh - 50px);
    margin-top: 50px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    background: var(--color-night);
}

.pages-container {
    display: flex;
    height: 100%;
    overflow: hidden;
    transition: transform var(--transition-normal);
    will-change: transform;
   touch-action: pan-y;
   width: calc(100vw * var(--total-pages, 1));
   will-change: transform;
}


.page-slide {
    flex: 0 0 100vw;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    will-change: transform;
}

.page-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: transform var(--transition-normal);
}

.page-image:hover {
    transform: scale(1.02);
}

.page-overlay {
    position: absolute;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.9);
    padding: var(--space-sm) var(--space-md);
    border-radius: 50px;
    border: 1px solid var(--color-gold);
    backdrop-filter: blur(5px);
    z-index:3;
}

.page-number {
    color: var(--color-gold);
    font-family: var(--font-heading);
    letter-spacing: 1px;
    z-index: 4;
}

/* ===== SIDEPANELS - RESPONSIVE ===== */
.soundtrack-panel,
.chapters-nav {
    position: fixed;
    top: 60px;
    width: 100%;
    max-width: 400px;
    height: calc(85vh - 10px);
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(20px);
    z-index: 90;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}


.soundtrack-panel {
    right: 0;
}

.chapters-nav {
    left: 0;
    border-left: none;
    border-right: 1px solid rgba(193, 154, 107, 0.3);
    transform: translateX(-100%);
}

.panel-header,
.chapters-header {
    padding: var(--space-md);
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-family: var(--font-heading);
    color: var(--color-gold);
    font-size: 1.3rem;
}

.panel-close,
.chapters-close {
    background: transparent;
    border: none;
    color: var(--color-gold);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.panel-close:hover,
.chapters-close:hover {
    background: rgba(193, 154, 107, 0.1);
}

/* ===== TRACK LIST ===== */
.track-list {
    padding: var(--space-md);
    overflow-y: auto;
    flex: 1;
}

/* Activer le scroll vertical sur ces conteneurs */
.text-modal-content,
.track-list,
.chapters-list {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Assurer une hauteur limitée pour le scroll */
.track-list {
    max-height: 60vh;
}

.chapters-list {
    max-height: 70vh;
}

.text-modal-content {
    max-height: 60vh;
}

.track-item {
    display: flex;
    align-items: center;
    padding: var(--space-sm);
    border-radius: 8px;
    margin-bottom: var(--space-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.track-item.active {
    background: rgba(193, 154, 107, 0.1);
    border-left: 3px solid var(--color-gold);
}

.track-number {
    width: 30px;
    color: var(--color-sand);
    font-family: var(--font-heading);
}

.track-info {
    flex: 1;
}

.track-title {
    color: var(--color-ivory);
    font-weight: 600;
}

.track-composer {
    color: var(--color-sand);
    font-size: 0.9rem;
}

.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: var(--space-md);
    background: rgba(26, 26, 46, 0.9);
    border-top: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.control-btn {
    background: transparent;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: scale(1.1);
}

.volume-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.volume-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-gold);
    cursor: pointer;
}

/* ===== CHAPTERS ===== */
.chapters-list {
    padding: var(--space-md);
    list-style: none;
}

.chapter-item {
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.chapter-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--color-river);
    transform: translateX(5px);
}

.chapter-item.current {
    background: rgba(193, 154, 107, 0.1);
    border-left-color: var(--color-gold);
}

/* ===== READING MODE ===== */
.reading-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-night);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.reading-header {
    padding: var(--space-md);
    background: rgba(26, 26, 46, 0.9);
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reading-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
}

.reading-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
}

.reading-controls {
    padding: var(--space-md);
    background: rgba(26, 26, 46, 0.9);
    border-top: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
}

.reading-btn {
    background: transparent;
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.reading-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: scale(1.1);
}


/* ===== TEXT MODAL ===== */
.text-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-night);
    z-index: 200;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-sizing: content-box;
}

#textModal {
    box-sizing: content-box;
}

.text-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.text-modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    
    /* Superposition : couleur semi-transparente + image */
   /* background: linear-gradient(
        rgba(26, 26, 46, 0.3), 
        rgba(26, 26, 46, 0.3)
    ), url('/assets/images/1280x450.jpg') center / cover no-repeat;
    
    backdrop-filter: blur(10px);*/
}

@media (min-width: 1024px) {
    .text-modal-header {
        height: 20vh; /* ou mieux : utiliser aspect-ratio */
        aspect-ratio: 1280 / 450; /* 2.84 */
        /*min-height: 150px;*/
    }
}




.text-modal-meta {
    flex: 1;
    margin-left: 20px;
}

.text-modal-title {
    font-family: var(--font-heading);
    color: var(--color-gold);
    font-size: 1.5rem;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.text-modal-page {
    color: var(--color-sand);
    font-size: 0.9rem;
    opacity: 0.8;
}

.text-modal-close {
    background: transparent;
    border: none;
    color: var(--color-gold);
    font-size: 2rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    
    background: rgba(20, 15, 10, 0.25);         /* voile sombre très léger */
    backdrop-filter: blur(2px);                  /* flou artistique */
    -webkit-backdrop-filter: blur(2px);
}

.text-modal-close:hover {
    background: rgba(193, 154, 107, 0.1);
    transform: rotate(90deg);
}

.text-modal-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.text-modal-content strong {
    color: var(--color-gold);
    font-weight: 600;
}

.text-modal-content em {
    color: var(--color-sand);
    font-style: italic;
}

.text-modal-content h3 {
    color: var(--color-gold);
    margin: 2rem 0 1rem 0;
    font-family: var(--font-heading);
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    padding-bottom: 0.5rem;
}

.text-modal-content blockquote {
    border-left: 3px solid var(--color-gold);
    padding-left: 1.5rem;
    margin-left: 0;
    color: var(--color-sand);
    font-style: italic;
    background: rgba(193, 154, 107, 0.05);
    padding: 1rem;
    border-radius: 0 5px 5px 0;
}

/*.text-modal-footer {
    padding: 20px;
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid rgba(193, 154, 107, 0.3);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}*/

.text-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.text-btn {
    background: transparent;
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-normal);
    font-family: var(--font-heading);
    font-size: 0.95rem;
}

.text-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: translateY(-2px);
}

.text-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.text-btn:disabled:hover {
    background: transparent;
    color: var(--color-gold);
}

/* ===== TEXT TRIGGER ON PAGES ===== */
.text-trigger {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 10;
}

.text-trigger-btn {
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-normal);
    font-family: var(--font-body);
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.text-trigger-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(193, 154, 107, 0.3);
}

.trigger-icon {
    font-size: 1.1rem;
}

.trigger-text {
    font-weight: 500;
}

/* ===== READING MODE UPDATES ===== */
.reading-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-night);
    z-index: 200;
    display: none;
    flex-direction: column;
}

.reading-mode.hidden {
    display: none;
}

.reading-mode:not(.hidden) {
    display: flex !important; 
}

.reading-mode.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.reading-header {
    padding: 20px;
    background: rgba(26, 26, 46, 0.95);
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.reading-info {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.reading-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    overflow: hidden;
}

.reading-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.reading-controls {
    padding: 20px;
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.reading-btn {
    background: transparent;
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.reading-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: scale(1.1);
}

/* ===== DIFFÉRENCIATION VISUELLE ===== */
/* Pour bien distinguer les deux modes */

.reading-mode .reading-header {
    border-bottom-color: var(--color-river);
}

.reading-mode .reading-btn {
    border-color: var(--color-river);
    color: var(--color-river);
}

.reading-mode .reading-btn:hover {
    background: var(--color-river);
    color: white;
}

.reading-mode .reading-info {
    color: var(--color-river);
}

.text-modal .text-modal-header {
    border-bottom-color: var(--color-sand);
}

.text-modal .text-btn {
    border-color: var(--color-sand);
    color: var(--color-sand);
}

.text-modal .text-btn:hover {
    background: var(--color-sand);
    color: var(--color-night);
}

.text-modal .text-modal-title {
    color: var(--color-sand);
}

/* ===== RESPONSIVE TEXT MODAL ===== */
@media (max-width: 768px) {
    .text-modal-content {
        padding: 20px;
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .text-modal-title {
        font-size: 1.2rem;
    }
    
    .text-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .text-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .text-btn {
        width: 100%;
        justify-content: center;
    }
    
    .text-trigger-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .trigger-text {
        display: none; /* Cacher le texte sur mobile, garder juste l'icône */
    }
    
    .text-trigger-btn {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        justify-content: center;
        padding: 0;
    }
    
    .reading-content {
        padding: 20px;
    }
    
    .reading-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .text-modal-header {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .text-modal-meta {
        margin-left: 0;
    }
    
    .text-modal-content {
        padding: 15px;
        font-size: 0.95rem;
    }
    
    .text-modal-footer {
        padding: 15px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.text-modal.active {
    animation: slideUp 0.3s ease;
}

.reading-mode.active {
    animation: slideDown 0.3s ease;
}

/* ===== SCROLLBAR STYLING ===== */
.text-modal-content::-webkit-scrollbar {
    width: 8px;
}

.text-modal-content::-webkit-scrollbar-track {
    background: rgba(26, 26, 46, 0.5);
    border-radius: 4px;
}

.text-modal-content::-webkit-scrollbar-thumb {
    background: var(--color-gold);
    border-radius: 4px;
}

.text-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-sand);
}


/* ===== PAGE ACTIONS ===== */
.page-actions {
    display: flex;
    gap: 15px;
    margin: 25px 0;
    justify-content: center;
    flex-wrap: wrap;
}

.page-action-btn {
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-normal);
    font-family: var(--font-body);
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.page-action-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(193, 154, 107, 0.3);
}

.page-action-btn.zoom-btn {
    border-color: var(--color-river);
    color: var(--color-river);
}

.page-action-btn.zoom-btn:hover {
    background: var(--color-river);
    color: white;
}

.page-action-btn.text-btn {
    border-color: var(--color-sand);
    color: var(--color-sand);
}

.page-action-btn.text-btn:hover {
    background: var(--color-sand);
    color: var(--color-night);
}

/* Sur mobile, empiler les boutons */
@media (max-width: 768px) {
    .page-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .page-action-btn {
        width: 200px;
        justify-content: center;
    }
}

/* ===== ROTATE ALERT (optionnel, suggestion douce) ===== */
.rotate-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-night);
    z-index: 300;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.rotate-alert.show {
    opacity: 1;
}

.rotate-content {
    text-align: center;
    padding: var(--space-xl);
    background: rgba(26, 26, 46, 0.9);
    border-radius: 15px;
    border: 2px solid var(--color-gold);
    backdrop-filter: blur(10px);
    max-width: 90%;
}

.rotate-icon {
    font-size: 3rem;
    color: var(--color-gold);
    margin-bottom: var(--space-md);
    animation: gentlePulse 2s infinite alternate;
}

.rotate-content p {
    color: var(--color-ivory);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Par défaut - mode paysage/horizontal */
.pages-container {
    flex-direction: row;
    height: 100%;
}

.page-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Mode portrait sur mobile */
@media (max-width: 768px) and (orientation: portrait) {
    .book-viewport {
        height: auto;
        min-height: calc(100svh - 50px);
        overflow-x: auto;
        overflow-y: auto;
        scroll-snap-type: x mandatory;
         -webkit-overflow-scrolling: touch;
    }
    
    .pages-container {
        flex-direction: row;
        width: calc(100% * var(--total-pages, 1));
        height: 100%;
        overflow: hidden;
    }
    
    .page-slide {
        flex: 0 0 100vw;
        height: 100%;
        scroll-snap-align: center;
    }
    
    .page-placeholder {
        width: 90vw;
        height: auto;
        min-height: 70vh;
        margin: 0 auto;
    }
    
    /* Ajustement de la navigation pour le mode portrait */
    .main-navigation {
        height: 60px;
        padding: 0 var(--space-md);
    }
    
    .book-title {
        font-size: 1.1rem;
    }
    
    .nav-btn .btn-text {
        display: none;
    }
    
    .nav-btn {
        padding: 0.5rem;
        min-width: 40px;
        min-height: 40px;
    }
}

/* Mode paysage sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .book-viewport {
        overflow: auto;
    }
    
    .pages-container {
        flex-direction: row;
    }
    
    .page-slide {
        flex: 0 0 100vw;
    }
    
    .main-navigation {
        height: 50px;
        padding: 0 var(--space-sm);
    }
    
    .book-title {
        font-size: 1rem;
    }
    
    .progress-bar-nav {
        width: 120px;
    }
}

/* Desktop - toujours horizontal */
@media (min-width: 769px) {
    .book-viewport {
        overflow: hidden;
    }
    
    .pages-container {
        flex-direction: row;
        width: calc(100vw * var(--total-pages, 1));
    }
    
    .page-slide {
        flex: 0 0 100vw;
    }
}

/* Ajustements pour très petits écrans */
@media (max-width: 480px) {
    .main-navigation {
        height: 50px;
        padding: 0 var(--space-sm);
    }
    
    .nav-center {
        flex: 1;
        margin: 0 var(--space-xs);
    }
    
    .book-title {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .progress-indicator {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .progress-bar-nav {
        width: 100px;
    }
    
    .page-counter {
        font-size: 0.8rem;
    }
}

/* Animation douce pour l'icône */
@keyframes gentlePulse {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: rotate(90deg) scale(1.1);
        opacity: 1;
    }
}

/* Mode portrait très étroit */
@media (max-height: 500px) and (orientation: portrait) {
    .book-viewport {
        height: calc(100svh - 50px);
        margin-top: 50px;
    }
    
    .main-navigation {
        height: 50px;
    }
    
    .page-placeholder {
        min-height: 60vh;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes loading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .main-navigation {
        padding: 0 var(--space-md);
    }
    
    .book-title {
        font-size: 1.3rem;
    }
    
    .progress-bar-nav {
        width: 150px;
    }
}

@media (max-width: 768px) {
    .welcome-title {
        font-size: 2.5rem;
    }
    
    .welcome-content {
        padding: var(--space-lg);
    }
    
    .soundtrack-panel,
    .chapters-nav {
        width: 100%;
        transform: translateY(100%);
    }
    
    .soundtrack-panel {
        transform: translateY(100%);
    }
    
    .chapters-nav {
        transform: translateY(-100%);
    }
    
    .nav-btn .btn-text {
        display: none;
    }
    
    .nav-btn {
        padding: 0.8rem;
        width: 45px;
        height: 45px;
        justify-content: center;
    }
    
    .rotate-alert {
        display: flex;
    }
}

@media (max-width: 480px) {
    :root {
        --space-lg: 2rem;
        --space-xl: 3rem;
    }
    
    .welcome-title {
        font-size: 2rem;
    }
    
    .logo-symbol {
        font-size: 3.5rem;
    }
    
    .welcome-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.visible {
    transform: translateX(0) !important;
}

.fade-in {
    animation: fadeIn var(--transition-normal) forwards;
}

.slide-in {
    animation: slideIn var(--transition-normal) forwards;
}

/* ===== PRINT STYLES ===== */
@media print {
    .main-navigation,
    .welcome-screen,
    .soundtrack-panel,
    .chapters-nav,
    .reading-mode {
        display: none !important;
    }
    
    .book-viewport {
        margin-top: 0;
        height: auto;
        overflow: visible;
    }
    
    .pages-container {
        flex-direction: column;
        transform: none !important;
    }
    
    .page-slide {
        flex: none;
        height: auto;
        page-break-inside: avoid;
        margin-bottom: 2cm;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


.placeholder-hint {
    font-size: 0.9rem;
    color: var(--color-sand);
    margin-top: 1rem;
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* Suggestions de rotation douces */
.hint-text {
    color: var(--color-sand);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}


/* ===== TYPOGRAPHIE DES PAGES – ÉLÉGANCE & DOPAMINE ===== */

/* Symbole décoratif (rose) */
.placeholder-symbol {
    font-size: 4rem;
    /*color: var(--color-gold);*/
    text-shadow: 0 0 20px rgba(193, 154, 107, 0.8);
    animation: softFloat 6s infinite ease-in-out;
    display: inline-block;
    margin-bottom: 0.5rem;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

/* Animation de flottement pour le symbole */
@keyframes softFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Numéro de page (h3) */
.placeholder-content h3 {
    font-family: var(--font-heading); /* Cinzel */
    font-size: 2.2rem;
    font-weight: 400;
    color: var(--color-ivory);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin: 0.5rem 0 0.2rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    position: relative;
    display: inline-block;
    
    background: rgba(20, 15, 10, 0.8);         /* voile sombre très léger */
    backdrop-filter: blur(2px);                  /* flou artistique */
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(193, 154, 107, 0.2);
    border-radius: 60px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    padding: 8px 8px;
}

/* Léger ornement sous le numéro (optionnel) */
.placeholder-content h3::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: 0.5rem auto 0;
    
}

/* Premier paragraphe : "Waridi wa Kemet" */
.placeholder-content p:first-of-type {
    font-family: var(--font-body);
    font-size: 1.4rem;
    font-weight: 400;
    font-style: italic;
    color: var(--color-sand);
    /*text-shadow: 0 0 8px rgba(225, 179, 120, 0.3);*/
    letter-spacing: 1px;
    margin: 0.3rem 0 0.5rem;
    line-height: 1.3;
    transition: all 0.3s ease;
    opacity: 0.9;
    background: rgba(20, 15, 10, 0.25);         /* voile sombre très léger */
    backdrop-filter: blur(2px);                  /* flou artistique */
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(193, 154, 107, 0.2);
    border-bottom: 1px dashed pink;
    border-radius: 60px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
   
}

/* Effet au survol (optionnel, pour un bonus interactif) */
.placeholder-content:hover p:first-of-type {
    color: var(--color-gold);
    text-shadow: 0 0 12px var(--color-gold);
    transform: scale(1.02);
}

/* Second paragraphe : "La Rose d'Afrique" (classe .placeholder-subtitle) */
.placeholder-subtitle {
    font-family: 'Inter', var(--font-body);
    font-size: 1rem;
    font-weight: 300;
    color: rgba(245, 245, 220, 0.9);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 0.2rem 0 1rem;
    opacity: 0.9;
    background: rgba(20, 15, 10, 0.25);         /* voile sombre très léger */
    backdrop-filter: blur(2px);                  /* flou artistique */
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(193, 154, 107, 0.2);
    border-radius: 60px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
    border-bottom: 1px dashed pink; /*rgba(193, 154, 107, 0.3);*/
    padding-bottom: 0.3rem;
    display: inline-block;
}

/* Indice de navigation (placeholder-hint) – plus discret mais lisible */
.placeholder-hint {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: rgba(225, 179, 120, 0.7);
    background: rgba(26, 26, 46, 0.6);
    backdrop-filter: blur(4px);
    padding: 0.4rem 1rem;
    border-radius: 40px;
    border: 1px solid rgba(193, 154, 107, 0.2);
    display: inline-block;
    margin-top: 1rem;
    transition: background 0.3s;
}

.placeholder-hint:hover {
    background: rgba(26, 26, 46, 0.8);
    border-color: var(--color-gold);
}

/* Adaptation mobile */
@media (max-width: 480px) {
    .placeholder-symbol {
        font-size: 3rem;
    }
    .placeholder-content h3 {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }
    .placeholder-content p:first-of-type {
        font-size: 1.2rem;
    }
    .placeholder-subtitle {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }
    .placeholder-hint {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }
}
/* ===== FIN TYPOGRAPHIE DES PAGES – ÉLÉGANCE & DOPAMINE ===== */

.placeholder-subtitle {
    color: var(--color-gold);
    font-style: italic;
    margin: 0.5rem 0 1rem 0;
}

.placeholder-hint {
    font-size: 0.9rem;
    color: var(--color-sand);
    margin-top: 1.5rem;
    font-style: italic;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
}

/* Amélioration de la navigation sur mobile */
@media (max-width: 768px) {
    .nav-left, .nav-right {
        flex: 0 0 auto;
    }
    
    .nav-center {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .soundtrack-panel,
    .chapters-nav {
        width: 100%;
        max-width: 400px;
    }
    
    .soundtrack-panel {
        right: 0;
        transform: translateX(100%);
    }
    
    .chapters-nav {
        left: 0;
        transform: translateX(-100%);
    }
}

/* Support du geste de swipe plus évident */
.page-slide::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(193, 154, 107, 0.2);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

@media (max-width: 768px) {
    .page-slide::after {
        opacity: 0.3;
    }
}

/* Animation de swipe hint */
@keyframes swipeHint {
    0% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

@media (max-width: 768px) and (orientation: portrait) {
    .page-slide:first-child::after {
        animation: swipeHint 2s infinite;
        content: '→';
        color: var(--color-gold);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }
}


/* Boutons de navigation tactiles (pour mobile) */
.touch-nav-buttons {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
    pointer-events: none;
}

.touch-nav-btn {
    width: 50px;
    height: 50px;
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid var(--color-gold);
    border-radius: 50%;
    color: var(--color-gold);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0.7;
    transition: all var(--transition-fast);
    backdrop-filter: blur(5px);
}

.touch-nav-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(193, 154, 107, 0.2);
}

@media (min-width: 769px) {
    .touch-nav-buttons {
        display: none;
    }
}

.welcome-logo {
    margin-bottom: 30px;
}

.logo-symbol {
    font-size: clamp(3rem, 8vw, 5rem);
    color: var(--color-gold);
    margin-bottom: 15px;
    text-shadow: var(--glow-gold);
    display: block;
    animation: pulse 2s infinite;
}

.welcome-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: var(--color-gold);
    margin-bottom: 10px;
    letter-spacing: 2px;
    line-height: 1.2;
}

.welcome-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--color-sand);
    font-style: italic;
    margin-bottom: 30px;
}

.intro-text {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    line-height: 1.6;
    margin-bottom: 40px;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 40px;
    align-items: center;
}

.welcome-btn {
    padding: 15px 30px;
    border: 2px solid var(--color-gold);
    background: transparent;
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: clamp(0.9rem, 2vw, 1rem);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 1px;
    min-width: 250px;
    max-width: 300px;
}

.welcome-btn:hover {
    background: var(--color-gold);
    color: var(--color-night);
    transform: translateY(-3px);
    box-shadow: var(--glow-gold);
}

.secondary-btn {
    border-color: var(--color-river);
    color: var(--color-river);
}

.secondary-btn:hover {
    background: var(--color-river);
    color: white;
}

.experience-hint {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border-left: 4px solid var(--color-gold);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.copyright-notice {
    margin-top: 30px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== ROTATE ALERT - RESPONSIVE ===== */
.rotate-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-night);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.rotate-alert.show {
    opacity: 1;
    visibility: visible;
}

.rotate-content {
    text-align: center;
    padding: 40px;
    background: rgba(26, 26, 46, 0.9);
    border-radius: 20px;
    border: 2px solid var(--color-gold);
    max-width: 500px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.rotate-icon {
    font-size: clamp(3rem, 8vw, 4rem);
    color: var(--color-gold);
    margin-bottom: 20px;
    display: block;
    animation: rotate 3s linear infinite;
}

.rotate-alert p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    line-height: 1.5;
    margin-bottom: 25px;
    color: var(--color-ivory);
}

/* ===== NAVIGATION - RESPONSIVE ===== */
.main-navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    z-index: 100;
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
}

.nav-left, .nav-right {
    display: flex;
    gap: 10px;
    flex: 1;
}

.nav-center {
    flex: 2;
    text-align: center;
    min-width: 0; /* Important pour le text-overflow */
}

.book-title {
    font-family: var(--font-heading);
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: var(--color-gold);
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
    justify-content: center;
}

.progress-bar-nav {
    width: 150px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.progress-fill-nav {
    height: 100%;
    background: linear-gradient(90deg, var(--color-gold), var(--color-sand));
    width: 0%;
    transition: width var(--transition-normal);
}

.page-counter {
    font-size: 0.8rem;
    color: var(--color-sand);
    white-space: nowrap;
}

.nav-btn {
    background: transparent;
    border: 1px solid rgba(193, 154, 107, 0.3);
    color: var(--color-gold);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-normal);
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: rgba(193, 154, 107, 0.1);
    border-color: var(--color-gold);
}

.pages-container {
    /*display: flex;
    height: 100%;*/
    overflow: hidden;
   /* transition: transform var(--transition-normal);*/
    will-change: transform;
    
    
    display: flex;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.page-slide {
    flex: 0 0 100vw;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
}



/* PLACEHOLDER */
.page-placeholder {
    position: relative;
    width: 90%;
    height: 90%;
    /*background-image: url('/assets/images/page-placeholder.jpg');*/
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid var(--color-gold);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}


.page-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/assets/images/1280x450.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    /* Effets souhaités */
    filter: blur(0.2px);
    /*filter: grayscale();*/
    /*opacity: 0.4; */
    border-radius: inherit;
    z-index: 1;
}

/* Mobile portrait : tout est centré (déjà ok) */
@media (max-width: 768px) and (orientation: portrait) {
    .page-placeholder {
        width: 90vw;
        height: auto;
        min-height: 70vh;
        aspect-ratio: auto;
    }
}

.placeholder-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 30px;
    max-width: 500px;
    text-shadow: 0 2px 4px rgba(0,0,0,6.5);
}


.placeholder-symbol {
    font-size: clamp(2rem, 6vw, 3rem);
    /*color: var(--color-gold);*/
    margin-bottom: 15px;
    display: block;
    opacity: 0.5;
    
}

.placeholder-content h3 {
    font-family: var(--font-heading);
    color: var(--color-gold);
    margin-bottom: 10px;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
}

.placeholder-content p {
    color: var(--color-gold);
    margin-bottom: 5px;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.placeholder-hint {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: var(--color-sand);
    margin-top: 20px;
    font-style: italic;
    opacity: 0.8;
}

.page-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.9);
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid var(--color-gold);
    backdrop-filter: blur(5px);
    min-width: 100px;
    text-align: center;
}

.page-number {
    color: var(--color-gold);
    font-family: var(--font-heading);
    letter-spacing: 1px;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}


.soundtrack-panel {
    right: 0;
    border-left: 1px solid rgba(193, 154, 107, 0.3);
}

.chapters-nav {
    left: 0;
    border-right: 1px solid rgba(193, 154, 107, 0.3);
    transform: translateX(-100%);
}

.soundtrack-panel.visible {
    transform: translateX(0);
}

.chapters-nav.visible {
    transform: translateX(0);
}

.panel-header,
.chapters-header {
    padding: 20px;
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-title {
    font-family: var(--font-heading);
    color: var(--color-gold);
    font-size: 1.2rem;
}

.panel-close,
.chapters-close {
    background: transparent;
    border: none;
    color: var(--color-gold);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.panel-close:hover,
.chapters-close:hover {
    background: rgba(193, 154, 107, 0.1);
}



.player-controls {
    padding: 20px;
    background: rgba(26, 26, 46, 0.9);
    border-top: 1px solid rgba(193, 154, 107, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.control-btn {
    background: transparent;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
}

.volume-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-gold);
    cursor: pointer;
}

/* ===== TOUCH CONTROLS - MOBILE ===== */
.touch-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 50;
    padding: 0 20px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.touch-controls:hover {
    opacity: 1;
}

.touch-btn {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.touch-btn:active {
    transform: scale(0.95);
    background: var(--color-gold);
    color: var(--color-night);
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablettes (768px et plus) */
@media (min-width: 768px) {
    .main-navigation {
        height: 70px;
        padding: 0 30px;
    }
    
    .book-viewport {
        height: calc(100svh - 70px);
        margin-top: 70px;
    }
    
    .soundtrack-panel,
    .chapters-nav {
        top: 70px;
        height: calc(100vh - 70px);
    }
    
    .nav-btn .btn-text {
        display: inline;
    }
    
    .welcome-content {
        padding: 40px;
    }
    
    .welcome-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .welcome-btn {
        min-width: 200px;
    }
}

/* Desktop (1024px et plus) */
@media (min-width: 1024px) {
    .book-title {
        font-size: 1.5rem;
    }
    
    .progress-bar-nav {
        width: 200px;
    }
    
    .soundtrack-panel,
    .chapters-nav {
        width: 350px;
    }
    
    .touch-controls {
        display: none; /* Cacher les contrôles tactiles sur desktop */
    }
}

/* Petits mobiles (480px et moins) */
@media (max-width: 480px) {
    .welcome-content {
        padding: 20px 15px;
        margin: 10px;
        max-width: 95%;
    }
    
    .logo-symbol {
        font-size: 2.5rem;
    }
    
    .welcome-title {
        font-size: 1.8rem;
    }
    
    .nav-btn .btn-text {
        display: none;
    }
    
    .nav-btn {
        padding: 8px;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
    
    .page-counter {
        font-size: 0.7rem;
    }
    
    .progress-bar-nav {
        width: 100px;
    }
    
    .reading-progress {
        display: none !important;
    }
    
    page-placeholder,
    .page-placeholder::before {
        background-image: url('/assets/images/page-placeholder-portrait.jpg');
        background-size: contain;
        background-position: top center;
        background-repeat: no-repeat;
    }
}

/* Mode portrait (hauteur > largeur) */
@media (max-height: 700px) and (orientation: portrait) {
    .welcome-content {
        padding: 4px;
        max-width: 95%;
    }
    
    .logo-symbol {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }
    
    .welcome-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .intro-text {
        margin-bottom: 25px;
        font-size: 0.9rem;
    }
    
    .welcome-actions {
        margin-bottom: 25px;
    }
    
    .welcome-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Mode paysage (largeur > hauteur) sur mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .welcome-content {
        max-width: 700px;
        padding: 20px;
    }
    
    .welcome-logo {
        margin-bottom: 15px;
    }
    
    .logo-symbol {
        font-size: 2.5rem;
    }
    
    .welcome-title {
        font-size: 2rem;
    }
    
    .intro-text {
        margin-bottom: 20px;
        font-size: 0.9rem;
        max-width: 90%;
    }
    
    .welcome-actions {
        flex-direction: row;
        margin-bottom: 20px;
    }
    
    .welcome-btn {
        min-width: 180px;
        padding: 10px 15px;
    }
    
    .experience-hint {
        display: none; /* Cacher en paysage pour économiser l'espace */
    }
}

/* Très grands écrans */
@media (min-width: 1400px) {
    .welcome-content {
        max-width: 900px;
        padding: 50px;
    }
    
    .logo-symbol {
        font-size: 6rem;
    }
    
    .welcome-title {
        font-size: 4rem;
    }
    
    .intro-text {
        font-size: 1.3rem;
        max-width: 700px;
    }
    
    .welcome-btn {
        padding: 20px 40px;
        font-size: 1.1rem;
        min-width: 300px;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .pages-container {
        transition: none;
    }
}

@media (prefers-contrast: high) {
    :root {
        --color-gold: #FFD700;
        --color-night: #000000;
        --color-ivory: #FFFFFF;
    }
    
    .welcome-btn,
    .nav-btn {
        border-width: 3px;
    }
}

/* Support de la dark mode automatique */
@media (prefers-color-scheme: dark) {
    /* Les couleurs sont déjà adaptées pour le mode sombre */
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.text-center {
    text-align: center;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* ===== DEBUG TOOLS (à enlever en production) ===== */
.debug-info {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: #0f0;
    padding: 5px 10px;
    font-family: monospace;
    font-size: 12px;
    z-index: 99999;
    border-radius: 5px;
    display: none;
}

/* Afficher en développement */
body.debug .debug-info {
    display: block;
}


/* ===== MODE TEXTE – EXPÉRIENCE DOPAMINE ===== */
.text-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.text-modal.active {
    opacity: 1;
    visibility: visible;
}

/* En‑tête minimaliste */
.text-modal-header {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(193, 154, 107, 0.2);
}

.text-modal-meta {
    flex: 1;
}

.text-modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--color-gold);
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.text-modal-page {
    font-size: 0.85rem;
    color: var(--color-sand);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Corps de texte – l’essentiel */
.text-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 3rem;
    line-height: 1.9;
    font-size: 1.2rem;
    color: rgba(245, 245, 220, 0.95);
    font-family: var(--font-body);
    font-weight: 300;
    scroll-behavior: smooth;
}

/* Largeur de colonne idéale pour la lecture */
@media (min-width: 768px) {
    .text-modal-content {
        width: 70%;
        max-width: 800px;
        margin: 0 auto;
        padding: 3rem 4rem;
    }
}

/* Décorations subtiles */
.text-modal-content p {
    margin-bottom: 1.8rem;
    position: relative;
}

.text-modal-content p:first-of-type::first-letter {
    font-size: 4.2rem;
    float: left;
    line-height: 0.8;
    margin-right: 0.6rem;
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(193, 154, 107, 0.3);
}

/* Séparateur décoratif entre paragraphes (motif africain) */
.text-modal-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: 2.5rem 0;
    opacity: 0.3;
}

/* Pied de page avec récompense mentale */
.text-modal-footer {
    padding: 1.2rem 2rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(193, 154, 107, 0.2);
    
}

.text-controls {
    display: flex;
    gap: 1rem;
}

.text-btn {
    background: transparent;
    border: 1px solid rgba(193, 154, 107, 0.3);
    color: var(--color-sand);
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.text-btn:hover:not(:disabled) {
    background: rgba(193, 154, 107, 0.1);
    border-color: var(--color-gold);
    color: var(--color-gold);
    transform: translateY(-1px);
}

.text-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Bouton de fermeture plus élégant */
.text-modal-close {
    font-size: 2.2rem;
    color: var(--color-gold);
    opacity: 0.6;
    transition: all 0.3s;
}
.text-modal-close:hover {
    opacity: 1;
    transform: rotate(90deg) scale(1.1);
}

/* Indicateur de progression de lecture (récompense visuelle) */
.reading-progress {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--color-sand);
    font-size: 0.9rem;
}

.progress-dots {
    display: flex;
    gap: 0.4rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(193, 154, 107, 0.3);
    transition: all 0.2s ease;
}

.dot.active {
    background: var(--color-gold);
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--color-gold);
}

/* Petit "cadeau" : citation aléatoire au survol */
.text-modal-footer:hover::after {
    content: "";
    font-size: 0.8rem;
    color: rgba(193, 154, 107, 0.6);
    font-style: italic;
    margin-left: 1rem;
}

/* Paragraphes avec animation d’apparition */
.text-modal-content p {
    animation: textReveal 0.8s ease forwards;
    opacity: 0;
    transform: translateY(15px);
    animation-delay: calc(0.1s * var(--p-index, 1));
}

@keyframes textReveal {
    to { opacity: 1; transform: translateY(0); }
}

/* ===== FIN MODE TEXTE – EXPÉRIENCE DOPAMINE ===== */

/* ===== CRÉDIT AUTEUR ===== */
.welcome-intro .intro-credit {
    position: relative;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-ivory);
    line-height: 1.5;
    max-width: 600px;
    margin: 2rem auto 0;
    padding: 1.5rem 1rem 0.5rem;
    border-top: 2px solid rgba(193, 154, 107, 0.3);
    text-align: center;
}

.credit-line {
    display: block;
    font-weight: 300;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.credit-line em {
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--color-sand);
    font-weight: 400;
}

.credit-author {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-gold);
    text-shadow: 0 0 15px rgba(193, 154, 107, 0.6);
    letter-spacing: 2px;
    border-bottom: 2px solid var(--color-gold);
    padding-bottom: 0.2rem;
    margin-top: 0.3rem;
    transition: all 0.3s ease;
}

.credit-author:hover {
    transform: translateY(-2px);
    text-shadow: 0 0 25px var(--color-gold);
    border-bottom-color: var(--color-sand);
}



.welcome-intro .intro-credit {
    animation: creditFadeIn 1s ease-out forwards;
}

@keyframes creditFadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.credit-line {
    transition: color 0.3s ease;
}

.credit-author:hover + .credit-line,
.credit-line:hover {
    color: var(--color-sand);
}


/* ULTIME */

@media (min-width: 1px) {
  /* Style unique pour tous les appareils */
   .welcome-content {
        padding: 8px 12px !important;
        gap: 4px;
        max-height: calc(100svh - 10px);
    }
    .welcome-logo {
        margin-bottom: 2px;
    }
    .logo-symbol {
        font-size: 1.8rem !important;
        margin-bottom: 0;
    }
    .welcome-title {
        font-size: 1.3rem !important;
        margin-bottom: 0;
    }
    .welcome-subtitle {
        font-size: 0.8rem !important;
        margin-bottom: 2px;
    }
    .welcome-intro {
        margin: 2px 0 4px !important;
    }
    .intro-phrase {
        font-size: 0.9rem !important;
        margin-bottom: 2px;
        line-height: 1.2;
    }
    .intro-divider {
        margin: 2px 0;
    }
    .divider-symbol {
        font-size: 1rem;
    }
    .welcome-intro .intro-credit {
        padding: 0.3rem 0.2rem 0.1rem !important;
        margin-top: 2px;
        border-top-width: 1px;
    }
    .credit-line {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }
    .credit-author {
        font-size: 1rem;
        border-bottom-width: 1px;
    }
    .welcome-actions {
        gap: 2px;
        margin-bottom: 2px;
    }
    .welcome-btn {
        padding: 6px 10px !important;
        min-width: 140px !important;
        font-size: 0.7rem;
    }
    .experience-hint {
        display: none !important;
    }
    .copyright-notice {
        margin-top: 2px;
        padding-top: 2px;
        font-size: 0.5rem;
    }
}


/* ===== WELCOME SCREEN – EXTREME COMPACT POUR PAYSAGE < 450px DE HAUT ===== */
@media (max-height: 450px) and (orientation: landscape), (min-width: 1024px) {
   
    
    /* --- Ajustements du placeholder (contenu des pages) --- */
    .placeholder-content {
        padding: 4px !important;
    }
    .placeholder-symbol {
        font-size: 2rem !important;
        margin-bottom: 0.2rem !important;
    }
    .placeholder-content h3 {
        font-size: 1.2rem !important;
        margin: 0.2rem 0;
    }
    .placeholder-content h3::after {
        width: 40px;
        margin: 0.3rem auto 0;
    }
    .placeholder-content p:first-of-type {
        font-size: 0.9rem !important;
        margin: 0.1rem 0;
    }
    .placeholder-subtitle {
        font-size: 0.8rem !important;
        margin: 0.1rem 0 0.4rem;
        padding-bottom: 0.3rem;
    }
    .placeholder-hint {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem;
        margin-top: 0.5rem !important;
    }
    .page-overlay {
        bottom: 10px;
        padding: 4px 12px;
    }
    .page-number {
        font-size: 0.7rem;
    }
    
    
    
    .pages-container {
    width: calc(100vw * var(--total-pages, 1));
    }
}


/* Adaptation pour les très petits paysages */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 480px) {
    .page-placeholder {
        min-height: 58vh;
        width: 88%;
    }
    .placeholder-content {
        padding: 18px;
    }
    .placeholder-symbol {
        font-size: 2.6rem;
    }
    .placeholder-content h3 {
        font-size: 1.35rem;
    }
    
    .experience-hint {
        display: none;
    }
    
    .experience-hint {
        display: none !important;
    }
    .copyright-notice {
        margin-top: 2px;
        padding-top: 2px;
        font-size: 0.5rem;
    }
    
}

/* RESPONSIVE CONSOLIDÉ – zéro cassure */
@media (max-width: 480px) {
    .welcome-content {
        padding: clamp(8px, 3vw, 20px);  /* Encore plus petit sur petit mobile */
        border-radius: 20px;
        max-height: calc(100svh - env(safe-area-inset-bottom) - 8px);  /* Anti-enfoncement bas */
    }
    
    .welcome-actions {
        gap: 6px;
    }
    
    .copyright-notice {
        font-size: 0.7rem;
        padding-top: 6px;
    }
    
    .experience-hint {
        display: none !important;
    }
    .copyright-notice {
        margin-top: 2px;
        padding-top: 2px;
        font-size: 0.5rem;
    }
}

@media (max-height: 620px) {
    .welcome-content {
        padding: clamp(8px, 2vh, 20px);
        gap: clamp(4px, 2vh, 14px);
    }
    
    .experience-hint {
        font-size: 0.75rem;
    }
    
}

/* Paysage critique (le plus sensible) */
@media (orientation: landscape) and (max-height: 560px) {
    .welcome-content {
        padding: clamp(8px, 1.5vh, 16px);
        gap: clamp(3px, 1vh, 10px);
        max-height: calc(92svh - env(safe-area-inset-bottom));
    }
    
    .logo-symbol { font-size: 2.5rem; }
    .welcome-title { font-size: 1.7rem; }
    .welcome-subtitle { font-size: 0.95rem; }
    .intro-phrase { font-size: 0.9rem; line-height: 1.15; }
    .experience-hint { display: none; }
    .copyright-notice { font-size: 0.65rem; }
}

/* Très très petit paysage */
@media (orientation: landscape) and (max-height: 450px) {
    .welcome-content {
        padding: clamp(6px, 1vh, 12px);
        gap: clamp(2px, 0.8vh, 6px);
    }
    .logo-symbol { font-size: 2rem; }
    .welcome-title { font-size: 1.4rem; }
    .copyright-notice { display: none; }  /* Cache si trop petit */
}

/* Safe-areas renforcées */
@supports (padding-top: env(safe-area-inset-top)) {
    .welcome-screen {
        padding-top: max(var(--welcome-padding), env(safe-area-inset-top));
        padding-bottom: max(var(--welcome-padding), env(safe-area-inset-bottom));
        padding-left: max(var(--welcome-padding), env(safe-area-inset-left));
        padding-right: max(var(--welcome-padding), env(safe-area-inset-right));
    }
    
    .welcome-content {
        max-height: calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    }
}


/* Ajouts pour centrage parfait sur mobile & desktop */
@media (max-width: 768px) {
    .welcome-screen {
        
        padding: clamp(8px, 2vh, 20px);  /* Moins de padding sur petit mobile */
        
    }
    
    
    .welcome-content {
        width: 96%;  /* Plus large sur mobile pour éviter décalage */
        margin: auto;
    }
}

@media (min-width: 1024px) {
   
    .experience-hint {
        display: none !important;
    }
    .copyright-notice {
        margin-top: 2px;
        padding-top: 2px;
        font-size: 0.5rem;
    }
}

/* Safe-areas pour iOS/Android (évite décalage bas/haut) */
@supports (padding-top: env(safe-area-inset-top)) {
    .welcome-screen {
        padding-top: max(var(--welcome-padding), env(safe-area-inset-top));
        padding-bottom: max(var(--welcome-padding), env(safe-area-inset-bottom));
        padding-left: max(var(--welcome-padding), env(safe-area-inset-left));
        padding-right: max(var(--welcome-padding), env(safe-area-inset-right));
    }
}

.text-modal-content {
    max-height: calc(100vh - 100px);  /* 100px ≈ header + footer + paddings ;*/
}

/* ===== MEDIA QUERIES POUR TEXTURES ADAPTATIVES ===== */

/* 1. Très petits mobiles (largeur ≤ 480px) */
@media (max-width: 480px) and (orientation: portrait),
       (max-width: 480px) and (orientation: landscape) and (max-height: 480px) {
     /* Texture pour très petits écrans (portrait ou paysage très plat) */
    .welcome-screen::before {
        content: '';
        position: absolute;
        inset: 0;
        background: url('/assets/images/texture.jpg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        /*opacity: 0.09;*/
        pointer-events: none;
        background-size: cover;
    }
}

/* 2. Mobiles standards (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) and (orientation: portrait),
       (min-width: 481px) and (max-width: 768px) and (orientation: landscape) and (max-height: 600px) {
    /* Texture pour mobiles */
    .welcome-screen::before {
        content: '';
        position: absolute;
        inset: 0;
        background: url('/assets/images/1280x720.jpg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        /*opacity: 0.09;*/
        pointer-events: none;
        background-size: cover;
    }
    
}

/* 3. Tablettes (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait),
       (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    /* Texture pour tablettes (portrait et paysage) */
    .welcome-screen::before {
        content: '';
        position: absolute;
        inset: 0;
        background: url('/assets/images/1024x481.jpg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        /*opacity: 0.09;*/
        pointer-events: none;
        background-size: cover;
    }
    
}

/* 4. Desktop (≥ 1025px) */
@media (min-width: 1025px) {
  /* Texture pour desktop */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/1024x481.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
  
}

/* 5. Grands écrans (≥ 1400px) */
@media (min-width: 1400px) {
  /* Texture pour très grands écrans (ultrawide) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/1024x481.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
  
}

/* 6. Orientation paysage spécifique pour écrans plats (ex: téléphone en paysage) */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 568px) {
  /* Texture pour paysage sur petits écrans (type smartphone) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/texture.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}

/* 7. Écrans avec ratio large (≥ 16/9) */
@media (min-aspect-ratio: 16/9) {
  /* Texture pour écrans larges (16:9, 21:9, etc.) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/16x9.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}

@media (max-aspect-ratio: 2/1) {
  /* Texture pour écrans plus carrés (2:1) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/2x1.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}

/* 8. Écrans avec ratio plutôt carré (≤ 4/3) */
@media (max-aspect-ratio: 4/3) {
  /* Texture pour écrans plus carrés (4:3, 3:2, etc.) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/texture.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}


@media (max-aspect-ratio: 5/3) {
  /* Texture pour écrans plus carrés (5:3) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/5x3.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}


/* 9. Combinaison orientation portrait et ratio étroit */
@media (orientation: portrait) and (max-aspect-ratio: 3/4) {
  /* Texture pour portrait très étroit (ex: téléphone vertical) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/texture.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}

/* 10. Combinaison orientation paysage et ratio très large */
@media (orientation: landscape) and (min-aspect-ratio: 18/9) {
  /* Texture pour paysage ultra large (ex: cinémascope) */
  .welcome-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/images/1024x481.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /*opacity: 0.09;*/
    pointer-events: none;
    background-size: cover;
  }
}