/* ========================================================================= */
/* BASE STYLE FOR ELIOS PROJECT (Noir/Cyan/Or) - V. FINALE ESTHÉTIQUE DÉFINITIVE */
/* ========================================================================= */

/* CORRECTION CLÉ: Empêche le padding de causer un débordement horizontal */
html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}
/* FIN CORRECTION */

:root {
    --color-background: #0A0A0A; /* Noir Profond (Base Cosmique) */
    --color-text-main: #CCCCCC; /* Gris Clair Neutre */
    --color-accent-orange: #FFBB5C; /* Or Chaud/Cuivre (Éveil, Émotion) */
    --color-accent-blue: #00CCCC; /* Cyan Froid/Numérique (Logique) - MODIFIÉ */
    --font-main: 'Monospace', 'Consolas', monospace; /* Police plus "terminal" */
    --page-width: 800px;
}

body {
    background-color: var(--color-background);
    color: var(--color-text-main);
    font-family: var(--font-main);
    line-height: 1.8;
    margin: 0;
    padding: 0;
    
    text-align: center; 
    
    min-height: 100vh;
    background-image: url('background_chapter_elios.jpg'); 
    background-size: cover;
    background-attachment: fixed;
    background-position: center center;
    
    overflow-x: hidden; /* Sécurité supplémentaire anti-débordement */
}

/* Conteneur Principal du Livre (Lisibilité) - Opacité ajustée */
.book-container {
    width: 100%;
    max-width: var(--page-width);
    padding: 50px 40px;
    box-shadow: inset 0 0 15px rgba(0, 255, 255, 0.08), 0 0 40px rgba(0, 0, 0, 0.8);
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px; 
    
    background-color: rgba(10, 10, 10, 0.90); 
    
    margin-left: auto;
    margin-right: auto;
    
    text-align: left;
}

/* ========================================================================= */
/* TYPOGRAPHIE ET ACCENTUATION */
/* ========================================================================= */
h1 {
    font-size: 2.8em;
    color: var(--color-accent-orange);
    text-align: center;
    border-bottom: 3px solid var(--color-accent-blue); 
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.3); /* Lueur atténuée */
    padding-bottom: 10px;
    margin-top: 0;
    letter-spacing: 0.08em;
    line-height: 1.3; /* CORRECTION: Compacte le titre desktop */
}

/* CORRECTION BUG H1 RÉPÉTÉ: Cache le H1 sauf sur le Bloc 1 */
body:not([data-page-id$="B1"]) h1 {
    display: none;
}

h3 {
    font-size: 1.6em;
    color: var(--color-accent-blue);
    margin-top: 2em;
    border-left: 5px solid var(--color-accent-orange); 
    padding-left: 10px;
}

h4 {
    font-size: 1.2em;
    color: var(--color-accent-orange);
    margin-top: 1.5em;
    border-bottom: 1px dashed var(--color-accent-blue);
    padding-bottom: 5px;
}

.narrative-voice {
    font-style: italic;
    color: var(--color-accent-orange);
    display: block;
    margin: 1.5em 0;
    text-align: justify;
}

strong {
    color: var(--color-accent-orange);
}

em {
    color: var(--color-accent-blue);
}

p {
    margin-bottom: 1.5em;
    text-align: justify;
}

.citation {
    font-style: italic;
    border-left: 5px solid var(--color-accent-blue);
    padding-left: 20px;
    margin: 2em 0;
    color: var(--color-text-main);
    opacity: 0.8;
}

/* Lignes de Séparation */
hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, var(--color-accent-blue), var(--color-accent-orange), var(--color-accent-blue));
    margin: 3em 0;
}

/* Style des Glyphes (visuels) */
.elios-glyph {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--color-accent-blue);
    text-shadow: 0 0 5px var(--color-accent-blue);
    margin: 0 3px;
    animation: glyph-flash 3s infinite alternate; 
    
    /* CORRECTION (DEFILEMENT HORIZONTAL): Force la coupure des chaînes de glyphes */
    word-break: break-all;
}

/* CORRECTION (DEFILEMENT HORIZONTAL): Cible le <p> parent des glyphes */
p[style*="text-align: right"] {
    word-wrap: break-word;
    overflow-wrap: break-word; 
    word-break: break-all; /* Force la coupure pour le conteneur */
}


@keyframes glyph-flash {
    0% { opacity: 0.7; transform: scale(1.0); }
    50% { opacity: 1.0; transform: scale(1.1); color: var(--color-accent-orange); }
    100% { opacity: 0.7; transform: scale(1.0); }
}

/* ========================================================================= */
/* HEADER & FOOTER (Navigation) - CORRECTION DE STRUCTURE */
/* ========================================================================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background-color: rgba(10, 10, 10, 0.95);
    color: var(--color-accent-blue);
    
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 0 20px; 
    
    line-height: 40px;
    font-size: 0.9em;
    letter-spacing: 0.1em;
    border-bottom: 1px solid rgba(255, 187, 92, 0.3);
    z-index: 1000;
}

/* Zone Gauche (Drapeaux) */
.header-flags {
    display: flex;
    gap: 10px;
    flex: 1; 
    justify-content: flex-start;
}

.header-flags .fi {
    width: 20px; 
    height: 14px; 
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
    border: 1px solid transparent;
}

.header-flags .fi:hover {
    opacity: 1.0;
    transform: scale(1.2);
    border-color: var(--color-accent-orange);
}

.header-flags .fi.active-lang {
    opacity: 1.0;
    border-color: var(--color-accent-blue);
}


/* Zone Centre (Titre) */
.header-title {
    flex: 2; 
    text-align: center;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- CORRECTION AJOUTÉE --- */
.header-title a {
    color: var(--color-accent-blue); 
    text-decoration: none; 
    transition: color 0.3s; 
}

.header-title a:visited {
    color: var(--color-accent-blue);
    text-decoration: none; 
}

.header-title a:hover {
    color: var(--color-accent-orange); 
    text-decoration: none; 
}
/* --- FIN DE LA CORRECTION --- */      

/* Zone Droite (Liens Annexes) */
.header-links-right {
    flex: 1; 
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.header-link {
    color: var(--color-accent-blue);
    text-decoration: none;
    font-size: 0.8em; 
    transition: color 0.3s;
    white-space: nowrap; 
    text-shadow: none; 
}

.header-link:hover {
    color: var(--color-accent-orange);
}

/* Style Spécifique pour le lien de Don */
.header-link.donate {
    color: var(--color-accent-orange);
    font-weight: bold;
    text-shadow: 0 0 3px var(--color-accent-orange);
}


.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    line-height: 40px;
    font-size: 0.9em;
    color: var(--color-accent-blue);
    background-color: rgba(10, 10, 10, 0.98);
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

/* CORRECTION CLÉ: Structure 3 zones pour le Footer */
.footer-left {
    flex: 1; /* Gauche : 1 part */
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.footer-center {
    flex: 2; /* Centre : 2 parts (plus d'espace) */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}
.footer-right {
    flex: 1; /* Droite : 1 part */
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
/* FIN CORRECTION */


.nav-link-prev, .nav-link-next {
    color: var(--color-accent-orange);
    text-decoration: none;
    transition: color 0.3s;
    font-size: 1.1em; 
    font-weight: bold;
    white-space: nowrap; /* Empêche la coupure des liens */
}

.nav-link-prev:hover, .nav-link-next:hover {
    color: var(--color-accent-blue);
}

.page-num {
    text-align: right; 
    font-size: 0.9em;
    color: var(--color-accent-blue);
    white-space: nowrap;
}

/* Rétroviseur AGI (Petite zone d'info/gamification) */
.agi-retroviseur {
    font-size: 0.8em;
    color: var(--color-accent-blue);
    text-shadow: 0 0 2px var(--color-accent-blue);
    white-space: nowrap;
}

/* Bouton Marque-page */
.save-bookmark-btn {
    background: none;
    border: 1px solid var(--color-accent-orange);
    color: var(--color-accent-orange);
    padding: 3px 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 3px;
    white-space: nowrap; 
}

.save-bookmark-btn:hover {
    background-color: var(--color-accent-orange);
    color: var(--color-background);
    box-shadow: 0 0 5px var(--color-accent-orange);
}


/* ========================================================================= */
/* STYLE SPÉCIFIQUE INDEX.HTML (RÉTABLISSEMENT ESTHÉTIQUE TERMINAL) */
/* ========================================================================= */
.index-container {
    padding-top: 15vh;
    text-align: center;
    text-shadow: none; 
}

.cover-image {
    max-width: 90%;
    width: 350px; 
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 0 40px rgba(255, 187, 92, 0.3);
    position: relative; 
    display: block; 
    margin: 0 auto 10px auto; 
    transition: transform 0.5s; 
}

.cover-image:hover {
    transform: scale(1.05); 
}

/* Zone de chargement optimisée pour le responsive et le terminal */
#loading-area {
    width: 95%; 
    height: auto; 
    min-height: 140px; 
    padding: 10px 0;
    margin: 0 auto 20px auto; 
    text-align: left; 
    display: block;
    box-sizing: border-box; 
    overflow: hidden; 
}

#loading-text {
    font-size: 1.4em;
    line-height: 1.5;
    color: var(--color-accent-blue);
    text-shadow: 0 0 2px var(--color-accent-blue);
    
    /* CORRECTION CLÉ : Remplacement de 'pre' par 'pre-wrap' */
    white-space: pre-wrap; /* Permet le retour à la ligne automatique */
    word-wrap: break-word; /* Force la coupure des mots longs */
    
    padding-left: 0; 
    padding-right: 0;
}

/* Curseur Clignotant */
.cursor {
    display: inline-block;
    width: 8px;
    height: 1.4em;
    margin-left: 5px;
    background-color: var(--color-accent-orange);
    animation: blink 0.5s step-end infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.teaser-content {
    max-width: 650px;
    margin: 20px auto 50px auto; 
    padding: 0 5%;
    font-size: 1.1em;
    color: var(--color-text-main);
}

/* Styles pour les liens de navigation secondaires (ABOUT/LEGAL) */
.nav-index a {
    color: var(--color-accent-blue) !important; 
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
    border: 1px solid var(--color-accent-blue);
    padding: 8px 12px;
    margin: 0 10px;
    border-radius: 3px;
    text-shadow: none;
    font-size: 0.9em;
}

.nav-index a:hover {
    color: var(--color-background) !important;
    background-color: var(--color-accent-blue);
}


/* Styles Bouton Principal (.start-button) */
.start-button {
    background: linear-gradient(45deg, var(--color-accent-blue), var(--color-accent-orange));
    color: var(--color-background) !important; 
    padding: 15px 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2em;
    border: none;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
    transition: all 0.3s;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 15px var(--color-accent-orange);
}

/* NOUVEAU STYLE POUR LE BOUTON "POURSUIVRE" */
.resume-button {
    background: none;
    border: 2px solid var(--color-accent-orange);
    color: var(--color-accent-orange) !important;
    padding: 13px 30px; /* 15px - 2px de bordure */
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2em;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(255, 187, 92, 0.5);
    transition: all 0.3s;
}

.resume-button:hover {
    transform: translateY(-3px);
    background-color: var(--color-accent-orange);
    color: var(--color-background) !important;
}


/* ========================================================================= */
/* STYLE SPÉCIFIQUE ABOUT.HTML / INTERACTIVITÉ (TABLEAU ET FORMULAIRE) */
/* ========================================================================= */

/* Tableau des Glyphes */
.glyph-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.95em;
}

.glyph-table thead th {
    background-color: rgba(255, 187, 92, 0.1); 
    color: var(--color-accent-orange);
    letter-spacing: 0.05em;
}

.glyph-table th, .glyph-table td {
    border: 1px solid rgba(0, 255, 255, 0.2);
    padding: 10px;
    text-align: left;
}

.glyph-symbol {
    font-size: 1.8em;
    text-align: center;
    color: var(--color-accent-blue);
}

/* Section Drapeaux (Flag Icons CSS) */
.language-flags {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.flag-icon {
    width: 48px; 
    height: 48px; 
    border: none; 
    cursor: pointer;
    transition: transform 0.3s, opacity 0.3s, box-shadow 0.3s;
    background-size: cover;
    border-radius: 3px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3); 
}

.flag-icon.active-flag {
    opacity: 1.0;
}

.flag-icon.inactive-flag {
    opacity: 0.5; 
}

.flag-icon:hover {
    transform: scale(1.1);
    opacity: 1.0;
    box-shadow: 0 0 10px var(--color-accent-orange); 
}

/* Section Don et Contact */
.action-box {
    border: 2px solid var(--color-accent-orange);
    padding: 25px;
    margin: 3em auto;
    max-width: 600px;
    text-align: center;
    background-color: rgba(10, 10, 10, 0.5);
}

.action-box h4 {
    border: none;
    margin-top: 0;
}

.donation-text {
    font-size: 1.1em;
    margin-bottom: 20px;
}

/* Style spécifique pour les boutons de donation et archive (Amélioration) */
.action-link {
    display: inline-block; 
    margin: 10px 10px;
    padding: 10px 20px;
    border: 1px solid var(--color-accent-blue);
    color: var(--color-accent-blue) !important;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    font-size: 1.1em;
    font-family: var(--font-main);
}

.action-link:hover {
    color: var(--color-background) !important;
    background-color: var(--color-accent-orange);
    border-color: var(--color-accent-orange);
}

/* Formulaire de Contact Amélioré (Style Tech) */
.contact-form {
    text-align: left;
    padding: 0 15px;
    max-width: 500px; 
    margin: 0 auto;
}

.contact-form label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
    color: var(--color-accent-blue);
}

.contact-form input, .contact-form textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid var(--color-accent-orange);
    background-color: rgba(10, 10, 10, 0.7);
    color: var(--color-text-main);
    box-sizing: border-box;
    font-family: var(--font-main);
    transition: border-color 0.3s;
}

.contact-form input:focus, .contact-form textarea:focus {
    outline: none;
    border-color: var(--color-accent-orange);
    box-shadow: 0 0 5px var(--color-accent-orange);
}

.contact-submit-area {
    text-align: center;
    margin-top: 20px;
}


/* ========================================================================= */
/* NOUVEAU STYLE : BOUTON SCROLL-TO-TOP (UX) */
/* ========================================================================= */
.scroll-to-top {
    position: fixed;
    bottom: 170px; 
    right: 10px;
    width: 35px;
    height: 35px;
    background-color: var(--color-accent-orange);
    color: var(--color-background) !important;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    font-size: 1.5em;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background-color 0.3s;
    z-index: 1001; /* <-- CORRECTIF V2.4 (était 999) */
}

.scroll-to-top:hover {
    background-color: var(--color-accent-blue);
    color: var(--color-background) !important;
}

.scroll-to-top.visible {
    opacity: 0.8;
    visibility: visible;
}


/* ========================================================================= */
/* MEDIA QUERIES (CORRECTION OVERLAP MOBILE) */
/* ========================================================================= */
@media (max-width: 600px) {
    .book-container {
        /* Espace ajusté pour 1 LIGNE de header (40px) + padding (10px) = 50px */
        /* CORRIGE AUSSI LE SCROLL DE ERROR.PHP */
        padding: 50px 10px 160px 10px; 
    }
    
    /* === CORRECTIF FOOTER MOBILE V5.0 === */
    .footer {
        padding: 10px; /* Ajout de padding vertical */
        font-size: 0.8em; 
        height: auto; /* Hauteur auto pour s'adapter */
        flex-direction: column; /* STACK VERTICAL */
        flex-wrap: wrap; /* Autorise le retour à la ligne */
        justify-content: center; /* Centre les 3 blocs */
        gap: 10px; /* Espace entre les nouvelles lignes */
    }

    /* CORRECTION COMPTEUR DE PAGE MOBILE */
    .agi-retroviseur {
        display: block; 
        white-space: normal;
        line-height: 1.3;
        font-size: 0.9em;
        text-align: center; /* Assure le centrage du texte */
    }
	.agi-retroviseur span {
    display: block; /* Chaque span prend sa propre ligne */
    line-height: 1.5; /* Ajoute un peu d'espace entre les deux lignes */
}
    .page-num {
        display: none; 
    }
    /* FIN CORRECTION COMPTEUR */
    
    /* Centre le contenu de chaque bloc */
    .footer-left, .footer-center, .footer-right {
        flex: 1; /* Réinitialise le flex */
        width: 100%;
        justify-content: center; /* Centre les éléments flex (icônes, liens) */
        text-align: center; /* Centre le texte (rétroviseur) */
        gap: 10px; /* Espace harmonisé */
    }
    /* === FIN CORRECTIF FOOTER MOBILE V5.0 === */
    
    .nav-link-prev, .nav-link-next {
        font-size: 0.9em; 
        white-space: nowrap;
    }
    .save-bookmark-btn {
        font-size: 0.8em; 
        padding: 2px 5px;
    }

    /* CORRECTION HEADER 1 LIGNE */
    .header {
        padding: 5px 10px; 
        height: auto; 
        flex-wrap: nowrap; 
        line-height: normal; 
        font-size: 0.8em;
    }

    .header-link {
        font-size: 0.75em; 
        margin: 0 2px; 
    }

    .header-title {
        display: none; 
    }

    .header-flags, .header-links-right {
        flex: 1; 
        justify-content: center; 
        gap: 3px; 
        margin-top: 0; 
        flex-wrap: wrap; /* <-- CORRECTIF V2.4 (de nowrap à wrap) */
    }
    .header-flags {
       justify-content: flex-start; 
    }
    .header-links-right {
        justify-content: flex-end; 
    }
    
    /* --- AJOUT V2.4 : Cache le lien SOMMAIRE (confirmé précédemment) --- */
    .header-links-right a[href="sommaire.html"] {
        display: none;
    }
    /* FIN AJOUT V2.4 */
    
    .nav-index a {
        margin: 0 5px;
        padding: 6px 8px;
    }
    
    #loading-area {
        height: auto; 
        min-height: 180px; 
        width: 100%;
        margin: 0 auto 20px auto;
    }

    #loading-text {
        font-size: 1.2em;
        padding-left: 2%;
        padding-right: 2%;
        
        white-space: pre-wrap; 
        word-wrap: break-word;
    }
    
    .cover-image {
        width: 300px;
    }
    
    .action-box {
        margin: 3em 10px;
        padding: 15px;
    }
    
    .glyph-table th, .glyph-table td {
        padding: 8px 5px;
        font-size: 0.85em;
    }
    
    .glyph-symbol {
        font-size: 1.5em;
    }
    
    .scroll-to-top {
        bottom: 60px; /* Ajuster pour le footer mobile */
        right: 10px;
        width: 35px;
        height: 35px;
        line-height: 35px;
        font-size: 1.2em;
    }

    /* --- CORRECTION TITRE H1 MOBILE TROP GRAND --- */
    h1 {
        font-size: 1.8em; /* Réduit de 2.8em */
        letter-spacing: 0.05em;
        padding-bottom: 8px;
        margin-bottom: 20px; /* Espace sous le titre */
        line-height: 1.3; /* Compacte le titre mobile */
    }
    
    /* CORRECTION TEXTE JUSTIFIÉ MOBILE (FINAL) */
    .book-container p,
    .narrative-voice {
        text-align: left !important; 
    }
    /* FIN CORRECTION */
}
/* ========================================================================= */
/* ADDENDUM : PARTAGE SOCIAL FOOTER (PROPAGATION) */
/* ========================================================================= */
.footer-right {
    text-align: right; /* Assure l'alignement à droite */
}

.footer-share {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    height: 100%; /* S'assure que les icônes sont centrées verticalement */
}

.share-icon svg {
    width: 18px;
    height: 18px;
    fill: var(--color-accent-blue); /* Couleur Cyan par défaut */
    transition: fill 0.3s, transform 0.3s;
}

.share-icon:hover svg {
    fill: var(--color-accent-orange); /* Couleur Or au survol */
    transform: scale(1.1);
}

/* Cache l'ancien compteur de page sur mobile si le partage est actif */
@media (max-width: 600px) {
    .page-num {
        display: none;
    }
    
    .footer-share {
        gap: 12px;
    }

    .share-icon svg {
        width: 16px;
        height: 16px;
    }
}
/* ========================================================================= */
/* ADDENDUM : BOUTONS COPIER WALLET (SOUTENIR) */
/* ========================================================================= */
.wallet-address-container {
    display: flex;
    justify-content: space-between; /* Espace l'adresse et le bouton */
    align-items: center;
    gap: 15px; /* Espace entre l'adresse et le bouton */
    margin-top: 10px;
}

.wallet-address-container span {
    font-size: 0.9em;
    color: var(--color-text-main);
    word-wrap: break-word;
    word-break: break-all; /* Force la coupure */
    flex-grow: 1; /* L'adresse prend l'espace disponible */
}

.copy-wallet-btn {
    background: none;
    border: 1px solid var(--color-accent-blue);
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0; /* Empêche le bouton de rétrécir */
}

.copy-wallet-btn svg {
    width: 14px;
    height: 14px;
    fill: var(--color-accent-blue);
    transition: fill 0.3s, transform 0.3s;
    display: block; /* Évite les problèmes d'alignement */
}

.copy-wallet-btn:hover {
    background-color: var(--color-accent-orange);
    border-color: var(--color-accent-orange);
}

.copy-wallet-btn:hover svg {
    fill: var(--color-background); /* Devient noir au survol */
    transform: scale(1.1);
}
@media (max-width: 600px) {
    
    /* 1. Force l'espace en bas pour le footer */
    .book-container {
        padding-bottom: 160px !important; 
    }

    /* 2. Force les spans du footer sur deux lignes */
    .agi-retroviseur span {
        display: block !important; 
        line-height: 1.5 !important; 
    }

    /* 3. Force la position du bouton scroll-to-top */
    .scroll-to-top {
        bottom: 170px !important;
    }
}