/*
 * narralis.css - Identité visuelle Narralis
 * Habillage propre à « La Bibliothèque des Mondes ».
 *
 * Ce fichier :
 *   1. surcharge les tokens sémantiques de main.css avec la palette Narralis
 *      (ambiance bibliothèque : bleu nuit, or, parchemin) ;
 *   2. ajoute les tokens propres à Narralis (parchemin, couleurs des 6 séquences) ;
 *   3. définit les composants spécifiques : hero, Ned, bulle, cartes-livres,
 *      Salle des Outils.
 *
 * À charger APRÈS main.css.
 * Narralis - Edulutic SRL
 */

/* ===== Surcharge des tokens : thème « bibliothèque » ===== */
:root {
    --fond:           #0d1526;
    --surface:        #131f38;
    --surface-2:      #1c2b4a;
    --voile:          rgba(9, 15, 28, 0.6);
    --texte:          #e9e3d3;
    --texte-doux:     #a9b2c4;
    --accent:         #d4af37;   /* or */
    --accent-clair:   #f2d98b;
    --sur-accent:     #0d1526;   /* nuit, posé sur l'or */
    --bordure:        rgba(255, 255, 255, 0.08);
    --bordure-accent: rgba(212, 175, 55, 0.25);
    --halo-accent:    rgba(212, 175, 55, 0.5);
    --ombre:          rgba(0, 0, 0, 0.45);

    /* Tokens propres à Narralis */
    --parchemin:      #ece0c4;
    --parchemin-doux: #cdbf9c;

    /* Couleurs des 6 séquences */
    --s1: #e8813a;   /* orange chaud   - Le Conte brisé      */
    --s2: #c77dbb;   /* rose/mauve     - Le Portrait effacé  */
    --s3: #8c2f39;   /* rouge bordeaux - L'Accusé            */
    --s4: #2f6b4f;   /* vert forêt     - Le Manuel perdu     */
    --s5: #6a4c93;   /* violet         - La Galerie des Voix */
    --s6: #4a5568;   /* gris ardoise   - La Chambre noire    */
}

/* ===== Fond d'ambiance ===== */
body {
    background:
        radial-gradient(1200px 600px at 50% -10%, var(--surface-2), transparent 60%),
        linear-gradient(180deg, var(--surface) 0%, var(--fond) 100%);
}

/* ===== Hero ===== */
.hero { padding: 46px 0 28px; }
.hero__grille {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    align-items: end;
}
.hero__illu {
    position: relative;
    border-radius: var(--rayon);
    overflow: hidden;
    box-shadow: 0 20px 50px var(--ombre);
    border: 1px solid var(--bordure-accent);
}
.hero__illu svg,
.hero__illu-img { display: block; width: 100%; height: auto; }

.hero__scene { display: flex; align-items: flex-start; gap: 18px; }

/* Ned - Compagnon de Voyage (illustration du hero) */
.ned {
    flex: 0 0 auto;
    width: clamp(90px, 11vw, 112px);
    filter: drop-shadow(0 0 22px rgba(212, 175, 55, 0.3));
    animation: flotte 5s ease-in-out infinite;
}
.ned svg,
.ned__img { display: block; width: 100%; height: auto; }
@keyframes flotte {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* Bulle de dialogue (parchemin) */
.bulle {
    position: relative;
    margin-top: clamp(8px, 1.5vw, 24px);
    background: var(--parchemin);
    color: #2a2416;
    font-family: var(--serif);
    font-size: 1.05rem;
    line-height: 1.5;
    padding: 18px 20px;
    border-radius: var(--rayon);
    box-shadow: 0 10px 30px var(--ombre);
}
.bulle::after {
    content: "";
    position: absolute;
    left: -14px; top: 30px;
    border: 8px solid transparent;
    border-right-color: var(--parchemin);
}

/* ===== Grille des livres ===== */
.livres {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}
.livre {
    --accent: var(--s1);
    position: relative;
    border-radius: var(--rayon);
    padding: 22px 20px 20px;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.15)),
        var(--surface-2);
    border: 1px solid var(--bordure);
    border-left: 5px solid var(--accent);
    text-decoration: none;
    color: var(--texte);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.livre__numero {
    font-family: var(--serif);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-transform: uppercase;
}
.livre__icone { width: 54px; height: 54px; margin: 14px 0 16px; color: var(--accent); }
.livre__icone svg { width: 100%; height: 100%; display: block; }
.livre__titre { font-size: 1.35rem; margin-bottom: 4px; }
.livre__type { font-size: 0.85rem; color: var(--texte-doux); }
.livre__etat {
    margin-top: auto;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 7px;
}

/* Card DISPONIBLE : brillante, cliquable, animation légère */
/* Léger flottement haut/bas en boucle pour attirer l'œil */
.livre--dispo {
    cursor: pointer;
    animation: flotte-carte 3.2s ease-in-out infinite;
}
@keyframes flotte-carte {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}
.livre--dispo .livre__etat { color: var(--accent-clair); }
.livre--dispo::before {
    content: "";
    position: absolute; inset: -40%;
    background: radial-gradient(circle at 30% 20%, rgba(232, 129, 58, 0.35), transparent 55%);
    opacity: 0.6;
    animation: pulse 4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes pulse {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 0.75; }
}
.livre--dispo:hover,
.livre--dispo:focus-visible {
    animation: none;   /* on fige le flottement au survol pour laisser jouer le soulèvement */
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(232, 129, 58, 0.28);
    border-color: var(--accent);
    outline: none;
}

/* Card VERROUILLÉE : grisée, cadenas, non cliquable */
.livre--bloque { filter: grayscale(0.75) brightness(0.7); cursor: not-allowed; }
.livre--bloque .livre__etat { color: var(--texte-doux); }
.livre__cadenas {
    position: absolute; top: 16px; right: 16px;
    width: 26px; height: 26px; color: var(--texte-doux);
    opacity: 0.85;
}

/* ===== Salle des Outils ===== */
.outils {
    display: flex; align-items: center; gap: 26px;
    background:
        linear-gradient(160deg, rgba(212, 175, 55, 0.08), rgba(0, 0, 0, 0.2)),
        var(--surface);
    border: 1px solid var(--bordure-accent);
    border-radius: var(--rayon);
    padding: 26px 28px;
    flex-wrap: wrap;
}
.outils__ned { width: 74px; flex: 0 0 auto; }
.outils__ned svg { width: 100%; height: auto; display: block; }
.outils__txt { flex: 1 1 240px; }
.outils__txt h3 { font-size: 1.35rem; color: var(--accent-clair); margin-bottom: 4px; }
.outils__txt p { color: var(--texte-doux); font-size: 0.95rem; }

/* ===== Responsive (composants Narralis) ===== */
@media (max-width: 860px) {
    .hero__grille { grid-template-columns: 1fr; }
    .livres { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .livres { grid-template-columns: 1fr; }
    .hero__scene { flex-direction: column; align-items: center; text-align: center; }
    .bulle::after { display: none; }
}

/* ===== Prologue - Livre 0 « Le Livre des Ordres » ===== */
/* Carte distincte, verte, plus petite que les 6 livres principaux. */
:root { --s0: #2D9D78; }
.prologue { display: flex; }
.livre-0 {
    display: flex; align-items: center; gap: 18px;
    max-width: 520px; padding: 16px 20px;
    text-decoration: none; color: var(--texte);
    border-radius: var(--rayon);
    border: 1px solid rgba(45, 157, 120, 0.35);
    border-left: 5px solid var(--s0);
    background: linear-gradient(160deg, rgba(45, 157, 120, 0.14), rgba(0, 0, 0, 0.15)), var(--surface-2);
    position: relative; overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.livre-0:hover { transform: translateY(-4px); box-shadow: 0 14px 32px rgba(45, 157, 120, 0.25); }
.livre-0__badge {
    position: absolute; top: 10px; right: 12px;
    font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase;
    padding: 3px 9px; border-radius: 999px;
    background: var(--s0); color: #06251b; font-weight: 700;
}
.livre-0__icone { flex: 0 0 auto; width: 44px; height: 44px; color: var(--s0); }
.livre-0__icone svg { width: 100%; height: 100%; display: block; }
.livre-0__txt { display: flex; flex-direction: column; gap: 2px; }
.livre-0__titre { font-family: var(--serif); font-size: 1.2rem; color: #7fe0bd; }
.livre-0__type { font-size: 0.78rem; color: var(--texte-doux); }
.livre-0__desc { font-size: 0.9rem; color: var(--texte-doux); margin-top: 4px; }

/* Message affiché quand on clique sur un livre encore verrouillé par le prologue */
.msg-prologue {
    margin: 0 auto 20px; max-width: 640px; text-align: center;
    padding: 12px 18px; border-radius: 12px;
    background: rgba(45, 157, 120, 0.14);
    border: 1px solid rgba(45, 157, 120, 0.35);
    color: #a7e0c0; font-size: 0.95rem;
}
@media (max-width: 560px) { .livre-0 { flex-direction: column; text-align: center; align-items: flex-start; } }
