/* ════════════════════════════════════════════════════════════════
   layout_grimoire.css — AGENCEMENT DE RÉFÉRENCE « Grimoire »
   ----------------------------------------------------------------
   Actif uniquement quand <html class="layout-grimoire"> (posé par layout.js).
   Couvre TOUS les modules d'un coup : un rail de navigation vertical
   permanent est injecté (layout_grimoire.js) et le contenu se décale.
   Utilise les VARIABLES DE THÈME → compatible avec les 9 couleurs.

   À charger après app.css + app_themes.css sur toutes les pages.
   ════════════════════════════════════════════════════════════════ */

:root { --rail-w: 64px; }

/* ── Décalage global du contenu pour laisser place au rail ──────── */
html.layout-grimoire body { padding-left: var(--rail-w); }

/* La topbar existante reste, mais commence après le rail et s'allège */
html.layout-grimoire .topbar {
    left: var(--rail-w);
    min-height: 44px;
}
/* Les liens de navigation déjà présents dans la topbar deviennent
   redondants avec le rail → on peut les masquer (optionnel, décommentez) */
/* html.layout-grimoire .topbar .nav-btn[data-nav] { display:none; } */

/* ── Le rail (construit par layout_grimoire.js) ─────────────────── */
.gr-rail {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--rail-w);
    z-index: 700;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 10px 0;
    background: linear-gradient(180deg, var(--bg-panel), var(--bg-void));
    border-right: 1px solid var(--border-gold);
}
.gr-rail-logo {
    width: 40px; height: 40px; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; filter: drop-shadow(0 0 8px var(--gold-glow));
}
.gr-rail-spacer { flex: 1; }
.gr-rb {
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; text-decoration: none; cursor: pointer;
    color: var(--text-muted); border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    position: relative;
}
.gr-rb:hover { background: var(--bg-hover); color: var(--gold-light); }
.gr-rb.on {
    color: var(--bg-void);
    background: var(--gold);
    box-shadow: 0 0 14px var(--gold-glow);
}
/* Light/parchment : l'actif lit mieux en pastille douce */
html.theme-light .gr-rb.on { color: var(--bg-panel); }
/* Tooltip natif via title ; on ajoute une étiquette au survol */
.gr-rb::after {
    content: attr(data-label);
    position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
    white-space: nowrap; pointer-events: none; opacity: 0;
    font-family: 'Cinzel', serif; font-size: 11px; letter-spacing: .04em;
    color: var(--text-parchment);
    background: var(--bg-card); border: 1px solid var(--border-gold);
    border-radius: 6px; padding: 4px 9px;
    box-shadow: 0 4px 14px rgba(0,0,0,.4); transition: opacity .12s; z-index: 1;
}
.gr-rb:hover::after { opacity: 1; }

/* ── Primitive « lecture en colonne » (modules de contenu) ──────── */
/* Compendium : la zone de note s'affiche en colonne lisible centrée.   */
html.layout-grimoire .comp-note-body,
html.layout-grimoire .comp-reader {
    max-width: 760px; margin-inline: auto;
}
/* Référence (règles) : même traitement de confort de lecture.          */
html.layout-grimoire .reference-content,
html.layout-grimoire .ref-article {
    max-width: 820px; margin-inline: auto;
}
/* Hub : grilles un peu plus aérées quand on a gagné de la largeur.      */
html.layout-grimoire .hub-main { padding-left: 28px; }

/* ── Responsive : sous 760px, le rail passe en barre basse ──────── */
@media (max-width: 760px) {
    :root { --rail-w: 0px; }
    html.layout-grimoire body { padding-left: 0; padding-bottom: 56px; }
    html.layout-grimoire .topbar { left: 0; }
    .gr-rail {
        top: auto; right: 0; bottom: 0; width: auto; height: 54px;
        flex-direction: row; justify-content: space-around;
        border-right: 0; border-top: 1px solid var(--border-gold);
    }
    .gr-rail-logo, .gr-rail-spacer { display: none; }
    .gr-rb::after { display: none; }
}
