/* ==========================================================================
   GRAND SIÈCLE — thème de l'édition MaX (portage design system TEI Publisher)
   Spec : docs/specs/B-design-system-gs.md — Bootstrap 5 + vanilla, sans pb-*
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
    /* Palette marque */
    --gs-cream: #F5F0E8;
    --gs-cream-light: #FEFCF7;
    --gs-cream-warm: #EDE5D8;
    --gs-sepia: #2C2418;
    --gs-sepia-medium: #5a4a3a;
    --gs-sepia-light: #8a7a6a;
    --gs-blue: #1E3A6D;
    --gs-blue-light: #2B5B8A;
    --gs-blue-dark: #0F2340;
    --gs-gold: #9C7A3C;
    --gs-gold-light: rgba(156, 122, 60, 0.25);
    --gs-gold-bright: #C49A4A;
    --gs-bordeaux: #7A2E2E;
    --gs-green: #3A6B4A;
    --gs-purple: #5B3A7A;
    --gs-border: #E0D5BC;

    /* Tons assombris (même teinte) pour les petits corps — AA 4.5:1 sur crème.
       L'or #9C7A3C et le sépia clair #8a7a6a restent réservés aux grands corps,
       filets et éléments décoratifs. */
    --gs-gold-text: #7F612A;
    --gs-sepia-text: #766655;

    /* Badge de confiance de réconciliation (glyphe ◆ + libellé, jamais couleur seule) */
    --gs-conf-high: var(--gs-green);
    --gs-conf-medium: var(--gs-gold-text);
    --gs-conf-low: var(--gs-type-work);
    --gs-conf-none: var(--gs-sepia-text);

    /* Couleurs par type d'entité (série registres, canonique) */
    --gs-type-person: #2B5B8A;
    --gs-type-place: #3A6B4A;
    --gs-type-organization: #5B3A7A;
    --gs-type-work: #A85831;
    --gs-type-event: #5C4B8C;
    --gs-type-technique: #6B6B2F;
    --gs-type-date: #7A5A3A;
    --gs-type-artwork: #8A5A2A;
    --gs-type-material: #4A5A6A;

    /* Typo */
    --gs-font-display: 'Cormorant Garamond', serif;
    --gs-font-text: 'EB Garamond', serif;
    --gs-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

    /* Signature */
    --gs-radius: 2px;
    --gs-ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* Mapping Bootstrap 5 */
    --bs-body-bg: var(--gs-cream);
    --bs-body-color: var(--gs-sepia);
    --bs-body-font-family: var(--gs-font-text);
    --bs-link-color: var(--gs-blue);
    --bs-link-hover-color: var(--gs-gold);
    --bs-border-radius: var(--gs-radius);

    /* Cœur MaX */
    --header-height: 64px;
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
body {
    background: var(--gs-cream);
    color: var(--gs-sepia);
    font-family: var(--gs-font-text);
    font-size: 1.05rem;
    line-height: 1.7;
    padding-top: 96px; /* hauteur du header fixe (surclasse tei.css:150px) */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--gs-font-display);
    color: var(--gs-blue);
    font-weight: 500;
}

a { color: var(--gs-blue); text-decoration: none; transition: color 0.2s var(--gs-ease); }
a:hover { color: var(--gs-gold); }

::selection { background: var(--gs-gold-light); }

.gs-main { max-width: 84rem; min-height: 55vh; }

/* --------------------------------------------------------------------------
   2bis. SURCHARGES DU CŒUR MaX (tei.css, breadcrumb.css)
   -------------------------------------------------------------------------- */
/* tei.css fixe le footer au viewport (il recouvre le contenu et s'écrête
   lui-même à 80px) : retour dans le flux. */
footer.gs-footer { position: static; max-height: none; }
/* la réservation de marge du footer fixe devient inutile ; la justification
   héritée de tei.css écartèle titres et cartes. */
#main-max-container { margin-bottom: 0; text-align: left; }
/* breadcrumb.css fixe le fil d'Ariane par-dessus la barre d'outils
   (contrôles incliquables) : retour dans le flux. */
nav#breadcrumb { position: static; width: auto; padding: 0; z-index: auto; }
nav#breadcrumb .breadcrumb-item:has(> .fragmentTitle:empty) { display: none; }
/* tei.css supprime l'outline des .btn : focus clavier rétabli partout. */
:focus-visible { outline: 2px solid var(--gs-blue); outline-offset: 2px; }
.gs-header :focus-visible,
.gs-footer :focus-visible,
.gs-section-explore :focus-visible { outline-color: var(--gs-gold-bright); }
.btn:focus-visible { outline: 2px solid var(--gs-gold-bright) !important; outline-offset: 2px; }

/* lien d'évitement (premier enfant de body, masqué hors focus) */
.gs-skip-link { position: absolute; left: -999rem; }
.gs-skip-link:focus {
    position: fixed;
    left: 0.75rem; top: 0.75rem;
    z-index: 3000;
    background: var(--gs-blue-dark);
    color: var(--gs-cream-light);
    border: 1px solid var(--gs-gold-bright);
    border-radius: var(--gs-radius);
    padding: 0.6rem 1.1rem;
    font-family: var(--gs-font-display);
    letter-spacing: 0.08em;
}

/* --------------------------------------------------------------------------
   3. HEADER / MENUBAR (bleu nuit)
   -------------------------------------------------------------------------- */
.gs-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    background: var(--gs-blue-dark);
    border-bottom: 1px solid rgba(196, 154, 74, 0.12);
}

.gs-menubar {
    display: flex;
    align-items: center;
    gap: 2rem;
    max-width: 84rem;
    margin: 0 auto;
    padding: 0.65rem 1.5rem;
    flex-wrap: wrap;
}

.gs-brand {
    font-family: var(--gs-font-display);
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    color: var(--gs-cream-light);
    white-space: nowrap;
    line-height: 1;
}
.gs-brand:hover { color: var(--gs-gold-bright); }
.gs-brand-grand { font-weight: 300; text-transform: uppercase; }
.gs-brand-siecle { font-style: italic; color: var(--gs-gold-bright); font-weight: 500; }

.gs-menu { flex: 1 1 auto; }

/* nav */
.gs-nav-list {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}
.gs-nav-link, .gs-nav-caret {
    font-family: var(--gs-font-text);
    font-size: 1rem;
    color: rgba(254, 252, 247, 0.85);
}
.gs-nav-link:hover { color: var(--gs-gold-bright); }
.gs-nav-item.active > .gs-nav-link,
.gs-nav-item.active > .gs-nav-dropdown > summary > .gs-nav-link {
    color: var(--gs-gold-bright);
    border-bottom: 1px solid var(--gs-gold-bright);
}

/* dropdown hybride <details> */
.gs-nav-dropdown { position: relative; }
.gs-nav-dropdown summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}
.gs-nav-dropdown summary::-webkit-details-marker { display: none; }
.gs-nav-caret { font-size: 0.7rem; opacity: 0.8; }
.gs-nav-submenu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    z-index: 9999;
    min-width: 15rem;
    margin: 0;
    padding: 0.4rem 0;
    list-style: none;
    background: var(--gs-blue-dark);
    border: 1px solid rgba(196, 154, 74, 0.25);
    border-radius: 3px;
    box-shadow: 0 10px 28px rgba(15, 35, 64, 0.45);
}
.gs-nav-sublink {
    display: block;
    padding: 0.35rem 1.1rem;
    color: rgba(254, 252, 247, 0.85);
    font-size: 0.95rem;
}
.gs-nav-sublink:hover, .gs-nav-sublink.active {
    color: var(--gs-gold-bright);
    background: rgba(196, 154, 74, 0.08);
}

/* burger mobile */
.gs-nav-toggler {
    display: none;
    background: none;
    border: 1px solid rgba(254, 252, 247, 0.4);
    border-radius: var(--gs-radius);
    color: rgba(254, 252, 247, 0.9);
    font-size: 1.1rem;
    padding: 0.15rem 0.6rem;
}
/* au bureau, le menu est toujours déplié (neutralise le .collapse Bootstrap,
   sinon ni menu ni burger ne s'affichent au-dessus de 900px) */
@media (min-width: 901px) {
    .gs-nav-collapse.collapse:not(.show) { display: block; }
}
@media (max-width: 900px) {
    .gs-nav-toggler { display: inline-block; }
    .gs-nav-collapse:not(.show) { display: none; }
    .gs-nav-list { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.8rem 0; }
    .gs-nav-submenu { position: static; box-shadow: none; border: none; }
    .gs-menubar { justify-content: space-between; gap: 0.75rem; }
    /* le header passe à 2-3 rangées sur les pages de lecture : en fixe il
       recouvrait la toolbar — statique sur petit écran */
    .gs-header { position: static; }
    body { padding-top: 0; }
}

/* sélecteur de langue du cœur : monolingue → masqué */
.i18n-menu { display: none !important; }

/* barre de navigation intra-document (cœur) sur fond sombre */
.gs-navigation-wrap { flex: 0 1 auto; }
.gs-navigation-wrap .btn, .gs-textoptions-wrap .btn {
    font-family: var(--gs-font-display);
    color: rgba(254, 252, 247, 0.9);
    border-color: rgba(196, 154, 74, 0.4);
    border-radius: var(--gs-radius);
    font-size: 0.9rem;
}
.gs-navigation-wrap .dropdown-menu, .gs-textoptions-wrap .dropdown-menu {
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-border);
    border-radius: 3px;
}
#navigation-tool img { filter: brightness(0) invert(1); }

/* --------------------------------------------------------------------------
   4. BOUTONS
   -------------------------------------------------------------------------- */
.gs-btn {
    display: inline-block;
    font-family: var(--gs-font-display);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.65rem 1.6rem;
    border-radius: var(--gs-radius);
    border: 1px solid var(--gs-blue);
    transition: all 0.3s var(--gs-ease);
    cursor: pointer;
}
.gs-btn-primary { background: var(--gs-blue); color: var(--gs-cream-light); }
.gs-btn-primary:hover {
    background: var(--gs-blue-light);
    color: var(--gs-cream-light);
    box-shadow: 0 6px 20px rgba(30, 58, 109, 0.25);
}
.gs-btn-ghost { background: transparent; color: var(--gs-blue); border-color: var(--gs-gold); }
.gs-btn-ghost:hover { background: var(--gs-gold-text); border-color: var(--gs-gold-text); color: var(--gs-cream-light); }

/* --------------------------------------------------------------------------
   5. HERO (accueil)
   -------------------------------------------------------------------------- */
.gs-hero {
    background: linear-gradient(135deg, var(--gs-cream) 0%, var(--gs-cream-light) 60%, var(--gs-cream-warm) 100%);
    border-bottom: 3px solid var(--gs-gold);
    margin: -1rem -1.5rem 0;
    padding: 4rem 2rem 3rem;
}
.gs-hero-inner {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 3rem;
    max-width: 84rem;
    margin: 0 auto;
    align-items: center;
}
.gs-hero-kicker {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--gs-gold-text);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.gs-hero-title { line-height: 0.95; margin: 0 0 1.5rem; }
.gs-hero-title-grand {
    display: block;
    font-family: var(--gs-font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 300;
    text-transform: uppercase;
    color: var(--gs-blue);
    letter-spacing: 0.05em;
}
.gs-hero-title-siecle {
    display: block;
    font-family: var(--gs-font-display);
    font-size: clamp(3.4rem, 9vw, 6.8rem);
    font-style: italic;
    font-weight: 400;
    color: var(--gs-gold);
}
.gs-hero-subtitle {
    font-size: 1.25rem;
    color: var(--gs-sepia-medium);
    max-width: 38rem;
    margin-bottom: 2rem;
}
.gs-hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.gs-hero-stats { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.gs-stat { display: flex; flex-direction: column; }
.gs-stat-value {
    font-family: var(--gs-font-display);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--gs-blue);
}
.gs-stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gs-sepia-text);
}
.gs-hero-visual { position: relative; }
.gs-hero-frame { position: relative; aspect-ratio: 3 / 4; max-width: 24rem; margin: 0 auto; }
.gs-hero-painting {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    box-shadow: 0 4px 20px rgba(44, 36, 24, 0.15), 0 20px 60px rgba(44, 36, 24, 0.1);
}
.gs-hero-frame-border {
    position: absolute;
    inset: -12px;
    border: 1px solid var(--gs-gold);
    pointer-events: none;
}
.gs-hero-frame-border::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid var(--gs-gold-light);
}
.gs-hero-credit {
    margin-top: 1.4rem;
    font-size: 0.75rem;
    font-style: italic;
    text-align: center;
    color: var(--gs-sepia-text);
}
@media (max-width: 900px) {
    .gs-hero-inner { grid-template-columns: 1fr; }
    .gs-hero-visual { display: none; }
}

/* --------------------------------------------------------------------------
   6. SECTIONS ACCUEIL / CARTES DOCUMENTS
   -------------------------------------------------------------------------- */
.gs-section { padding: 3.5rem 0 2rem; }
.gs-section-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 300;
    margin-bottom: 0.5rem;
}
.gs-section-title::after {
    content: "";
    display: block;
    width: 3rem;
    height: 2px;
    background: var(--gs-gold);
    margin-top: 0.6rem;
}
.gs-section-kicker {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--gs-gold-text);
    font-size: 0.85rem;
}
.gs-section-intro { color: var(--gs-sepia-medium); max-width: 46rem; margin-bottom: 2rem; }

.gs-doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}
.gs-doc-card {
    display: block;
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-cream-warm);
    border-left: 3px solid var(--gs-gold-light);
    border-radius: var(--gs-radius);
    padding: 1.4rem 1.5rem;
    transition: all 0.3s var(--gs-ease);
    color: var(--gs-sepia);
}
.gs-doc-card:hover {
    border-left-color: var(--gs-gold);
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(44, 36, 24, 0.10);
    color: var(--gs-sepia);
}
.gs-doc-card .gs-doc-id {
    font-family: var(--gs-font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--gs-sepia-text);
    text-transform: uppercase;
}
.gs-browse-title {
    font-family: var(--gs-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gs-blue);
    margin: 0.3rem 0 0.6rem;
    line-height: 1.3;
}
.gs-browse-meta { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.95rem; }
.gs-browse-author { color: var(--gs-sepia-medium); }
.gs-browse-place { font-style: italic; color: var(--gs-sepia-text); }
.gs-browse-date { color: var(--gs-gold-text); font-weight: 600; }

/* Section « Explorer » sombre */
.gs-section-explore {
    background: var(--gs-blue-dark);
    margin: 3rem -1.5rem 0;
    padding: 3.5rem 2rem;
    position: relative;
}
.gs-section-explore::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gs-gold), transparent);
}
.gs-section-explore .gs-section-title { color: var(--gs-cream-light); }
.gs-explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    max-width: 84rem;
    margin: 1.5rem auto 0;
}
.gs-explore-card {
    display: block;
    background: rgba(254, 252, 247, 0.05);
    border: 1px solid rgba(196, 154, 74, 0.25);
    border-radius: 3px;
    padding: 1.5rem;
    color: rgba(254, 252, 247, 0.85);
    transition: all 0.3s var(--gs-ease);
}
.gs-explore-card:hover {
    background: rgba(196, 154, 74, 0.12);
    color: var(--gs-cream-light);
    transform: translateY(-3px);
}
.gs-explore-card h3 { color: var(--gs-gold-bright); font-size: 1.2rem; }
.gs-demo-note {
    max-width: 84rem;
    margin: 2rem auto 0;
    color: rgba(254, 252, 247, 0.55);
    font-size: 0.9rem;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   7. FOOTER
   -------------------------------------------------------------------------- */
.gs-footer {
    background: var(--gs-sepia);
    color: rgba(254, 252, 247, 0.75);
    padding: 1.6rem 2rem;
    margin-top: 4rem;
    font-size: 0.9rem;
    text-align: center;
}
.gs-footer a {
    color: var(--gs-gold-bright);
    /* cible tactile élargie sans décaler la mise en page */
    display: inline-block;
    padding: 0.3rem 0.15rem;
    margin: -0.3rem -0.15rem;
}
.gs-footer a:hover { color: var(--gs-cream-light); }
.gs-footer-title {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--gs-cream-light);
}
.gs-footer-sep { color: var(--gs-gold); margin: 0 0.6rem; }
.gs-footer-line { margin-top: 0.35rem; }
.gs-footer img.gs-cc-icon { height: 1.1em; vertical-align: -0.18em; margin-left: 0.25rem; }

/* --------------------------------------------------------------------------
   8. ENTITÉS IN-TEXTE (.ent) — 9 types
   -------------------------------------------------------------------------- */
.ent {
    border-bottom: 2px solid var(--gs-type, var(--gs-sepia-light));
    background: transparent;
    color: inherit;
    padding: 0 0.05em;
    border-radius: 1px;
    transition: background 0.2s var(--gs-ease);
    cursor: pointer;
}
.ent:hover { color: inherit; }

.ent-person { --gs-type: var(--gs-type-person); background: rgba(43, 91, 138, 0.08); }
.ent-place { --gs-type: var(--gs-type-place); background: rgba(58, 107, 74, 0.08); }
.ent-organization, .ent-org { --gs-type: var(--gs-type-organization); background: rgba(91, 58, 122, 0.08); }
.ent-work { --gs-type: var(--gs-type-work); background: rgba(168, 88, 49, 0.08); }
.ent-event { --gs-type: var(--gs-type-event); background: rgba(92, 75, 140, 0.08); }
.ent-technique { --gs-type: var(--gs-type-technique); background: rgba(107, 107, 47, 0.08); }
.ent-date { --gs-type: var(--gs-type-date); background: rgba(122, 90, 58, 0.08); }
.ent-artwork, .ent-object { --gs-type: var(--gs-type-artwork); background: rgba(138, 90, 42, 0.08); }
.ent-material { --gs-type: var(--gs-type-material); background: rgba(74, 90, 106, 0.08); }

.ent-person:hover { background: rgba(43, 91, 138, 0.18); }
.ent-place:hover { background: rgba(58, 107, 74, 0.18); }
.ent-organization:hover, .ent-org:hover { background: rgba(91, 58, 122, 0.18); }
.ent-work:hover { background: rgba(168, 88, 49, 0.18); }
.ent-event:hover { background: rgba(92, 75, 140, 0.18); }
.ent-technique:hover { background: rgba(107, 107, 47, 0.18); }
.ent-date:hover { background: rgba(122, 90, 58, 0.18); }
.ent-artwork:hover, .ent-object:hover { background: rgba(138, 90, 42, 0.18); }
.ent-material:hover { background: rgba(74, 90, 106, 0.18); }

.ent-unresolved { border-bottom-style: dashed; opacity: 0.85; cursor: default; }

/* Liserés de confiance NER */
.ent[data-cert="high"] { border-bottom-style: solid; }
.ent[data-cert="mid"] { border-bottom-style: dotted; }
.ent[data-cert="low"] { border-bottom-style: dotted; opacity: 0.55; }
.entity-low-confidence { opacity: 0.3; border-bottom-style: dashed; }

/* Mode « haute confiance » : neutralise les entités mid/low (texte gardé) —
   pointer-events coupe aussi popover et navigation, en cohérence avec le JS */
body.gs-ner-high .ent[data-cert="mid"],
body.gs-ner-high .ent[data-cert="low"] {
    background: transparent !important;
    border-bottom: none !important;
    color: inherit;
    cursor: text;
    pointer-events: none;
}

/* Masquage global des entités (option) */
body.gs-ent-off .ent {
    background: transparent !important;
    border-bottom: none !important;
    cursor: text;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   9. COUCHES ORIGINAL / MODERNISÉ
   -------------------------------------------------------------------------- */
html[data-layer='reg'] .layer-orig { display: none; }
html[data-layer='orig'] .layer-reg { display: none; }
.line-choice.line-unmodernized .layer-both { display: inline; }

/* --------------------------------------------------------------------------
   10. ÉLÉMENTS DE FORME (fw), NOTES MARGINALES, PAGES
   -------------------------------------------------------------------------- */
.fw {
    color: var(--gs-sepia-text);
    font-size: 0.85rem;
    font-style: italic;
    border-left: 2px solid var(--gs-gold-light);
    padding-left: 0.5rem;
    margin: 0.3rem 0;
}
/* Le rendu émet les fw avec l'attribut hidden ; le toggle « éléments de
   forme » les révèle sans toucher au DOM (surclasse la règle UA [hidden]) */
body.gs-show-fw div.fw[hidden] { display: block; }
body.gs-show-fw span.fw[hidden] { display: inline-block; }
.fw-numbering {
    display: inline-block;
    position: absolute;
    top: 0.4rem; right: 0.6rem;
    font-family: var(--gs-font-mono);
    font-size: 0.72rem;
    font-style: normal;
    color: var(--gs-sepia-light);
    border: none;
    padding: 0;
    margin: 0;
}

.marginal-note {
    float: right;
    clear: right;
    width: 11rem;
    margin: 0 -12rem 0.8rem 0.8rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--gs-sepia-medium);
    border-left: 2px solid var(--gs-gold-light);
    padding-left: 0.55rem;
    text-align: left;
}

/* Page = 2 colonnes fac-similé / transcription */
section.page {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 2fr) 3fr;
    gap: 2rem;
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-cream-warm);
    border-radius: 3px;
    padding: 1.8rem 1.6rem;
    margin-bottom: 2rem;
}
section.page .page-facsimile {
    /* le fac-similé accompagne la lecture sur les pages longues */
    position: sticky;
    top: 110px;
    align-self: start;
}
section.page .page-facsimile img {
    width: 100%;
    height: auto;
    border: 1px solid var(--gs-border);
    box-shadow: 0 4px 20px rgba(44, 36, 24, 0.12);
}
section.page .page-transcription {
    font-size: 1.1rem;
    line-height: 1.75;
    text-align: left;
    overflow-wrap: break-word;
    /* mesure de lecture confortable (~75 caractères en EB Garamond 1.1rem) */
    max-width: 42rem;
}
/* état de repli quand le fac-similé IIIF ne répond pas (injecté par
   grand-siecle.js sur error) */
.gs-facs-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    aspect-ratio: 3 / 4;
    background: var(--gs-cream-warm);
    border: 1px solid var(--gs-border);
    border-radius: var(--gs-radius);
    color: var(--gs-sepia-text);
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    padding: 1.5rem;
}
.gs-facs-fallback a { font-style: normal; }
@media (max-width: 1100px) {
    .marginal-note { float: none; width: auto; margin: 0.6rem 0; }
}
@media (max-width: 900px) {
    section.page { grid-template-columns: 1fr; }
    section.page .page-facsimile { position: static; }
}

.zone { margin-bottom: 0.8rem; }
.foreign, [lang='lat'], [lang='grc'], [lang='ita'] { font-style: italic; }

/* Césure des mots coupés */
.w[data-next]::after { content: '\2011'; color: var(--gs-sepia-light); }

/* Analyse linguistique active : mots interactifs */
body.gs-ling-on .w { cursor: help; border-bottom: 1px dotted transparent; }
body.gs-ling-on .w:hover { border-bottom-color: var(--gs-blue-light); background: rgba(43, 91, 138, 0.08); }

/* --------------------------------------------------------------------------
   11. BARRE D'OUTILS DOCUMENT
   -------------------------------------------------------------------------- */
.gs-doc-toolbar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    background: var(--gs-cream-warm);
    border: 1px solid var(--gs-border);
    border-radius: 3px;
    padding: 0.5rem 0.9rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
}
.gs-toolbar-group { display: inline-flex; align-items: center; gap: 0.3rem; }
.gs-toolbar-label {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--gs-sepia-medium);
    margin-right: 0.2rem;
}
.gs-toolbar-btn {
    font-family: var(--gs-font-display);
    font-size: 0.85rem;
    background: var(--gs-cream-light);
    color: var(--gs-sepia);
    border: 1px solid var(--gs-gold); /* bordure perceptible (3:1) : contrôle interactif */
    border-radius: var(--gs-radius);
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    transition: all 0.25s var(--gs-ease);
}
.gs-toolbar-btn:hover { border-color: var(--gs-gold-text); color: var(--gs-blue); }
.gs-toolbar-btn.is-active, .gs-toolbar-btn[aria-pressed="true"] {
    background: var(--gs-gold-text);
    border-color: var(--gs-gold-text);
    color: var(--gs-cream-light);
}
.gs-toolbar-select {
    font-family: var(--gs-font-text);
    font-size: 0.85rem;
    background: var(--gs-cream-light);
    color: var(--gs-sepia);
    border: 1px solid var(--gs-gold);
    border-radius: var(--gs-radius);
    padding: 0.3rem 0.5rem;
}

/* Légende des types d'entités et des liserés de confiance (toolbar) */
.gs-legend { position: relative; margin-left: auto; }
.gs-legend summary {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--gs-sepia-medium);
    cursor: pointer;
    list-style: none;
}
.gs-legend summary::-webkit-details-marker { display: none; }
.gs-legend summary::before { content: "❦ "; color: var(--gs-gold); }
.gs-legend-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    z-index: 200;
    min-width: 17rem;
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-border);
    border-top: 3px solid var(--gs-gold);
    border-radius: 3px;
    padding: 0.8rem 1rem;
    box-shadow: 0 10px 28px rgba(44, 36, 24, 0.18);
}
.gs-legend-title {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    color: var(--gs-gold-text);
    margin: 0.4rem 0 0.2rem;
}
.gs-legend-title:first-child { margin-top: 0; }
.gs-legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; padding: 0.08rem 0; }
.gs-legend-swatch {
    flex: none;
    width: 0.75em; height: 0.75em;
    border-radius: 1px;
    background: var(--gs-type, var(--gs-sepia-light));
}
.gs-legend-line { flex: none; width: 1.6em; border-bottom: 2px solid var(--gs-sepia-medium); }
.gs-legend-line-solid { border-bottom-style: solid; }
.gs-legend-line-dotted { border-bottom-style: dotted; }
.gs-legend-line-faded { border-bottom-style: dotted; opacity: 0.55; }
@media (max-width: 900px) {
    .gs-legend { margin-left: 0; }
    .gs-legend-panel { left: 0; right: auto; }
}

/* --------------------------------------------------------------------------
   12. TOOLTIP LINGUISTIQUE + POPOVER ENTITÉ
   -------------------------------------------------------------------------- */
.gs-tooltip {
    position: absolute;
    z-index: 10000;
    max-width: 20rem;
    background: var(--gs-blue-dark);
    color: var(--gs-cream-light);
    font-family: var(--gs-font-text);
    font-size: 0.85rem;
    line-height: 1.45;
    border: 1px solid rgba(196, 154, 74, 0.4);
    border-radius: 3px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 6px 18px rgba(15, 35, 64, 0.35);
    pointer-events: none;
}
.gs-tooltip .gs-tt-line1 { font-weight: 600; }
.gs-tooltip .gs-tt-pos { color: var(--gs-gold-bright); font-style: italic; font-weight: 400; }
.gs-tooltip .gs-tt-msd, .gs-tooltip .gs-tt-norm { color: rgba(254, 252, 247, 0.75); font-size: 0.8rem; }

.gs-popover {
    position: absolute;
    z-index: 10000;
    min-width: 13rem;
    max-width: 22rem;
    background: var(--gs-cream-light);
    color: var(--gs-sepia);
    border: 1px solid var(--gs-border);
    border-top: 3px solid var(--gs-type, var(--gs-gold));
    border-radius: 3px;
    padding: 0.6rem 0.85rem;
    box-shadow: 0 10px 28px rgba(44, 36, 24, 0.18);
    font-size: 0.88rem;
}
.gs-popover .gs-pop-label { font-family: var(--gs-font-display); font-weight: 600; font-size: 1.05rem; color: var(--gs-blue); }
.gs-popover .gs-pop-type {
    display: inline-block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gs-cream-light);
    background: var(--gs-type, var(--gs-sepia-light));
    border-radius: var(--gs-radius);
    padding: 0.05rem 0.45rem;
    margin-right: 0.4rem;
}
.gs-popover .gs-pop-cert { font-size: 0.78rem; color: var(--gs-sepia-text); }
.gs-popover .gs-pop-link { display: block; margin-top: 0.4rem; font-size: 0.85rem; }
.gs-popover .gs-pop-link::after { content: " →"; color: var(--gs-gold); }

/* --------------------------------------------------------------------------
   13. HUB ENTITÉS (entites.html) + PAGES INDEX A–Z
   -------------------------------------------------------------------------- */
.gs-hub-title { font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 600; }
.gs-hub-intro { color: var(--gs-sepia-medium); max-width: 46rem; }
.gs-hub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    margin-top: 1.6rem;
}
@media (max-width: 820px) { .gs-hub-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .gs-hub-grid { grid-template-columns: 1fr; } }

.gs-hub-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.3rem 1.4rem;
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-cream-warm);
    border-left: 4px solid var(--gs-type, var(--gs-gold));
    border-radius: 3px;
    color: var(--gs-sepia);
    transition: all 0.3s var(--gs-ease);
    overflow: hidden;
}
.gs-hub-card::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 26px; height: 26px;
    border-right: 2px solid var(--gs-gold-light);
    border-top: 2px solid var(--gs-gold-light);
}
.gs-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(44, 36, 24, 0.10);
    color: var(--gs-sepia);
}
.gs-hub-card-person { --gs-type: var(--gs-type-person); }
.gs-hub-card-place { --gs-type: var(--gs-type-place); }
.gs-hub-card-organization { --gs-type: var(--gs-type-organization); }
.gs-hub-card-work { --gs-type: var(--gs-type-work); }
.gs-hub-card-event { --gs-type: var(--gs-type-event); }
.gs-hub-card-artwork { --gs-type: var(--gs-type-artwork); }
.gs-hub-card-material { --gs-type: var(--gs-type-material); }
.gs-hub-card-technique { --gs-type: var(--gs-type-technique); }
.gs-hub-card-date { --gs-type: var(--gs-type-date); }

.gs-hub-type {
    font-family: var(--gs-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gs-type, var(--gs-blue));
}
.gs-hub-desc { font-size: 0.88rem; color: var(--gs-sepia-text); }
.gs-exp-badge {
    font-family: var(--gs-font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    background: var(--gs-gold-text);
    color: var(--gs-cream-light);
    border-radius: var(--gs-radius);
    padding: 0.05rem 0.35rem;
    vertical-align: middle;
    margin-left: 0.35rem;
}

/* En-tête « Référentiels d'autorité » entre filets dorés */
.gs-section-marker {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.85rem;
    color: var(--gs-gold);
    margin: 0.8rem 0 0.4rem;
}
.gs-section-marker::before, .gs-section-marker::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gs-gold-light);
}

/* Index A–Z (plugin index) */
.gs-index-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 1rem 0 1.5rem;
    font-family: var(--gs-font-display);
}
.gs-index-nav a {
    display: inline-block;
    min-width: 1.9rem;
    text-align: center;
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--gs-gold-light);
    border-radius: var(--gs-radius);
    font-weight: 600;
}
.gs-index-nav a:hover { background: var(--gs-gold); color: var(--gs-cream-light); }
.gs-index-initial {
    font-family: var(--gs-font-display);
    font-size: 1.9rem;
    font-weight: 300;
    color: var(--gs-gold);
    border-bottom: 1px solid var(--gs-gold-light);
    margin: 1.6rem 0 0.6rem;
}
.gs-index-list { list-style: none; padding: 0; margin: 0; }

/* Ligne d'entité (index + browse) */
.gs-entity-item {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.45rem 0.8rem;
    margin-bottom: 2px;
    border-left: 3px solid var(--gs-type, var(--gs-sepia-light));
    background: transparent;
    color: var(--gs-sepia);
    transition: all 0.2s var(--gs-ease);
    animation: gs-fadeIn 0.4s var(--gs-ease) both;
    animation-delay: calc(var(--i, 0) * 12ms);
}
.gs-entity-item:hover { border-left-width: 6px; background: var(--gs-cream-light); color: var(--gs-sepia); }
.gs-entity-item-person { --gs-type: var(--gs-type-person); }
.gs-entity-item-place { --gs-type: var(--gs-type-place); }
.gs-entity-item-organization { --gs-type: var(--gs-type-organization); }
.gs-entity-item-work { --gs-type: var(--gs-type-work); }
.gs-entity-item-event { --gs-type: var(--gs-type-event); }
.gs-entity-item-artwork { --gs-type: var(--gs-type-artwork); }
.gs-entity-item-material { --gs-type: var(--gs-type-material); }
.gs-entity-item-technique { --gs-type: var(--gs-type-technique); }
.gs-entity-item-date { --gs-type: var(--gs-type-date); }

.gs-recon .gs-entity-label { color: var(--gs-blue); font-weight: 500; }
.gs-unrecon .gs-entity-label { color: var(--gs-sepia-medium); font-weight: 400; }
.gs-entity-meta { color: var(--gs-sepia-text); font-size: 0.85rem; }
.gs-entity-row-meta { display: inline-flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }

/* Pastille mentions */
.gs-entity-mentions {
    font-family: var(--gs-font-mono);
    font-size: 0.7rem;
    background: var(--gs-cream-warm);
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 0.05rem 0.5rem;
    color: var(--gs-sepia-medium);
}
.gs-m1 { opacity: 0.6; }
.gs-m3 { font-weight: 700; border-color: var(--gs-gold); }
.gs-m4 { font-weight: 700; background: var(--gs-gold-light); border-color: var(--gs-gold); }

/* Badge de confiance réconciliation ◆ (tokens de la palette, AA) */
.gs-conf { font-size: 0.7rem; letter-spacing: 0.1em; }
.gs-conf-high { color: var(--gs-conf-high); }
.gs-conf-medium { color: var(--gs-conf-medium); }
.gs-conf-low { color: var(--gs-conf-low); }
.gs-conf-none { color: var(--gs-conf-none); }

/* Chips d'autorité */
.gs-auth-chips { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
.gs-auth-chip {
    font-family: var(--gs-font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--gs-cream-warm);
    color: var(--gs-sepia-medium);
    border-radius: var(--gs-radius);
    padding: 0.05rem 0.4rem;
}

/* --------------------------------------------------------------------------
   14. KWIC « Cité dans »
   -------------------------------------------------------------------------- */
.gs-backlinks-title, .gs-cooccur-title, .gs-metadata-heading, .gs-empty {
    font-family: var(--gs-font-display);
}
.gs-backlinks-title::before, .gs-cooccur-title::before,
.gs-metadata-heading::before, .gs-empty::before {
    content: "❦ ";
    color: var(--gs-gold);
}
.gs-backlinks-count, .gs-backlinks-mentions { color: var(--gs-gold-text); font-weight: 600; }
.gs-backlinks-list { list-style: none; padding: 0; }
.gs-kwic-toggle {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--gs-cream-warm);
    padding: 0.5rem 0.2rem;
    cursor: pointer;
    font-family: var(--gs-font-text);
    color: var(--gs-sepia);
}
.gs-kwic-toggle::before {
    content: "▸";
    color: var(--gs-gold);
    transition: transform 0.25s var(--gs-ease);
}
.gs-kwic-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.gs-backlinks-doc { font-weight: 500; color: var(--gs-blue); }
.gs-backlinks-id { font-family: var(--gs-font-mono); font-size: 0.72rem; color: var(--gs-sepia-light); }
.gs-kwic-panel { padding: 0.5rem 0 0.8rem 1.2rem; }
.gs-kwic-line {
    font-family: var(--gs-font-text);
    border-left: 2px solid var(--gs-gold-light);
    background: var(--gs-cream-light);
    padding: 0.4rem 0.7rem;
    margin-bottom: 0.4rem;
}
.gs-kwic-line mark, .gs-kwic-line .kwic-hit {
    background: rgba(156, 122, 60, 0.3);
    color: var(--gs-blue);
    font-weight: 600;
    padding: 0 0.15rem;
    border-radius: 1px;
}

/* --------------------------------------------------------------------------
   15. SOMMAIRE / TOC / BREADCRUMB / RECHERCHE / PLUGINS
   -------------------------------------------------------------------------- */
#main-max-container ul.max-toc, #toc ul, #document-toc ul { list-style: none; padding-left: 0; }
#document-toc li, .max-toc li { margin: 0.3rem 0; }
#document-toc a, .max-toc a { font-family: var(--gs-font-display); font-size: 1.05rem; }

nav#breadcrumb .breadcrumb {
    background: transparent;
    font-size: 0.85rem;
    margin: 0 0 1rem;
    padding: 0;
}
nav#breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--gs-gold); }

.plugins-wrapper { margin-bottom: 1rem; }

.hits details { border: 1px solid var(--gs-cream-warm); border-radius: 3px; margin-bottom: 0.8rem; background: var(--gs-cream-light); }
.hits summary { font-family: var(--gs-font-display); padding: 0.5rem 0.9rem; cursor: pointer; color: var(--gs-blue); }
.hits .hit { border-top: 1px solid var(--gs-cream-warm); padding: 0.6rem 0.9rem; }
.hits mark { background: rgba(156, 122, 60, 0.3); color: var(--gs-blue); font-weight: 600; }

input[type="search"], input[type="text"].gs-input, .gs-filter-search {
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-gold); /* bordure perceptible : champ interactif */
    border-radius: var(--gs-radius);
    padding: 0.35rem 0.7rem;
    font-family: var(--gs-font-text);
    color: var(--gs-sepia);
}
input[type="range"] { width: 100px; accent-color: var(--gs-blue); }

/* Carte / chronologie */
.gs-map-wrap { position: relative; }
#gs-map {
    height: 70vh;
    min-height: 420px;
    border: 1px solid var(--gs-border);
    border-radius: 3px;
    background: var(--gs-cream-light);
}
.gs-map-coverage {
    font-size: 0.85rem;
    color: var(--gs-sepia-light);
    margin-top: 0.5rem;
    font-style: italic;
}
#gs-timeline { margin-top: 1rem; }
.gs-tl-item { display: grid; grid-template-columns: 14rem 1fr; gap: 0.8rem; align-items: center; margin-bottom: 0.3rem; }
.gs-tl-label { font-size: 0.85rem; text-align: right; color: var(--gs-sepia-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-tl-label a { color: inherit; }
.gs-tl-label a:hover { color: var(--gs-gold); }
.gs-tl-track { position: relative; height: 0.85rem; background: var(--gs-cream-warm); border-radius: 1px; }
.gs-tl-bar {
    position: absolute;
    top: 0; bottom: 0;
    background: var(--gs-type, var(--gs-blue-light));
    opacity: 0.75;
    border-radius: 1px;
    min-width: 4px;
}
.gs-tl-bar.gs-tl-person { --gs-type: var(--gs-type-person); }
.gs-tl-bar.gs-tl-event { --gs-type: var(--gs-type-event); }
.gs-tl-bar.gs-tl-work { --gs-type: var(--gs-type-work); }
.gs-tl-bar.gs-tl-organization { --gs-type: var(--gs-type-organization); }
.gs-tl-axis {
    display: flex;
    justify-content: space-between;
    font-family: var(--gs-font-mono);
    font-size: 0.72rem;
    color: var(--gs-sepia-text);
    border-top: 1px solid var(--gs-gold-light);
    margin: 0.6rem 0 1rem 14.8rem;
    padding-top: 0.2rem;
}
.gs-tl-filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
@media (max-width: 700px) {
    .gs-tl-item { grid-template-columns: 8rem 1fr; }
    .gs-tl-axis { margin-left: 8.8rem; }
}

/* --------------------------------------------------------------------------
   16. ANIMATIONS / DIVERS
   -------------------------------------------------------------------------- */
@keyframes gs-fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes gs-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.gs-reveal { animation: gs-fadeUp 0.9s var(--gs-ease) both; }

.gs-lettrine::first-letter {
    font-family: var(--gs-font-display);
    font-size: 3.2em;
    float: left;
    line-height: 0.85;
    padding: 0.05em 0.12em 0 0;
    color: var(--gs-gold);
}

.target { background: rgba(156, 122, 60, 0.18); transition: background 1.2s ease; }

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

@media print {
    .gs-header, .gs-doc-toolbar, .gs-footer, .plugins-wrapper { display: none !important; }
    body { padding-top: 0; background: white; }
}

/* =====================================================================
   13. RENDU DOCUMENT & INDEX (text_hook.xsl, toc.xsl, document_toc.xsl,
       nav_bar.xsl, index_*.xsl) — complément au thème.
   ===================================================================== */

/* le cœur MaX contraint #text à col-sm-8 : on rend la pleine largeur */
#text.col-sm-8 { width: 100%; max-width: 100%; flex: 0 0 100%; }
#bas_de_page:empty { display: none; }

/* --- contexte de page (text_hook.xq) --- */
.gs-doc-context {
  border-bottom: 1px solid var(--gs-gold-light);
  padding: 0.6rem 0 0.9rem;
  margin-bottom: 1.2rem;
}
.gs-doc-context .gs-doc-back {
  font-size: 0.85rem;
  color: var(--gs-gold-text);
  text-decoration: none;
}
.gs-doc-context .gs-doc-back:hover { color: var(--gs-blue); }
.gs-doc-context .gs-doc-title {
  font-family: var(--gs-font-display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  margin: 0.2rem 0 0.15rem;
  color: var(--gs-sepia);
}
.gs-doc-pageinfo { font-size: 0.9rem; color: var(--gs-sepia-medium); }
.gs-doc-pageinfo .gs-doc-id {
  font-family: var(--gs-font-mono);
  font-size: 0.8rem;
  color: var(--gs-gold-text);
  letter-spacing: 0.06em;
}

/* --- fac-similé : légende --- */
.page-facs-caption {
  font-size: 0.78rem;
  color: var(--gs-sepia-text);
  margin-top: 0.35rem;
  text-align: center;
}
.page-untranscribed {
  font-style: italic;
  color: var(--gs-sepia-text);
  padding: 1.2rem 0;
}

/* --- navigation de pages (nav_bar.xsl, injectée dans le header) --- */
.gs-page-nav { display: flex; align-items: center; gap: 0.4rem; }
.gs-page-arrow {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--gs-gold);
  border-radius: 2px;
  color: var(--gs-cream-light);
  text-decoration: none;
  line-height: 1.4;
}
.gs-page-arrow:hover { background: var(--gs-gold); color: var(--gs-blue-dark); }
.gs-page-arrow.gs-page-off { opacity: 0.35; border-color: transparent; }
.gs-page-select {
  max-width: 7.5rem;
  background: transparent;
  color: var(--gs-cream-light);
  border: 1px solid rgba(201, 178, 138, 0.5);
  border-radius: 2px;
  padding: 0.15rem 0.3rem;
  font-size: 0.85rem;
}
.gs-page-select option { color: var(--gs-sepia); background: var(--gs-cream-light); }

/* --- fiche document : métadonnées + grille de pages --- */
.gs-doc-fiche {
  background: var(--gs-cream-light);
  border: 1px solid var(--gs-gold-light);
  border-radius: 2px;
  padding: 1.2rem 1.4rem;
  margin: 1rem 0 2rem;
}
.gs-doc-meta { display: grid; grid-template-columns: 8rem 1fr; gap: 0.35rem 1rem; margin: 0; }
.gs-doc-meta dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gs-gold-text);
  font-weight: 600;
}
.gs-doc-meta dd { margin: 0; color: var(--gs-sepia); }
.gs-doc-pagecount { color: var(--gs-sepia-text); font-size: 0.9em; }
.gs-page-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.8rem;
}
.gs-page-grid li { text-align: center; }
.gs-page-grid a { text-decoration: none; color: var(--gs-sepia-medium); }
.gs-page-thumb {
  width: 100%;
  aspect-ratio: 3 / 4.4;
  object-fit: cover;
  border: 1px solid var(--gs-gold-light);
  border-radius: 2px;
  background: var(--gs-cream);
  transition: box-shadow 0.25s var(--gs-ease);
}
.gs-page-grid a:hover .gs-page-thumb { box-shadow: 0 6px 18px rgba(44, 36, 24, 0.25); }
.gs-page-label { display: block; font-size: 0.8rem; margin-top: 0.25rem; }
.gs-page-empty { color: var(--gs-gold); }

/* --- sommaire corpus : stats de carte --- */
.gs-doc-stats {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--gs-sepia-text);
}

/* --- pages d'index A–Z --- */
.gs-index-page { padding: 1.5rem 0 2.5rem; }
.gs-index-count { color: var(--gs-sepia-medium); margin-bottom: 1.2rem; }
.gs-az {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-bottom: 1.6rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--gs-gold-light);
}
.gs-az a {
  display: inline-block;
  min-width: 1.7rem;
  text-align: center;
  padding: 0.2rem 0.3rem;
  border-radius: 2px;
  color: var(--gs-blue);
  text-decoration: none;
  font-weight: 600;
}
.gs-az a:hover { background: var(--gs-gold-text); color: var(--gs-cream-light); }
/* lettre sans résultat après filtrage (registres-browse.js) */
.gs-az a.gs-az-off { opacity: 0.35; pointer-events: none; }
.gs-az-letter {
  font-family: var(--gs-font-display);
  color: var(--gs-gold);
  font-size: 1.6rem;
  border-bottom: 1px dotted var(--gs-gold-light);
  margin: 1.4rem 0 0.6rem;
  /* le header fixe ne doit pas recouvrir la cible des ancres A–Z */
  scroll-margin-top: 7.5rem;
}
.gs-index-ul { list-style: none; padding: 0; margin: 0; }
.gs-index-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.3rem 0.2rem;
  border-bottom: 1px solid rgba(201, 178, 138, 0.25);
}
.gs-index-link { font-weight: 500; text-decoration: none; }
.gs-index-extra { color: var(--gs-sepia-text); font-size: 0.85rem; font-style: italic; }
.gs-index-mentions {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--gs-cream-light);
  background: var(--gs-gold-text);
  border-radius: 8px;
  padding: 0.05rem 0.5rem;
}
.gs-index-docs { display: inline-flex; gap: 0.25rem; }
.gs-doc-chip {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--gs-blue);
  background: rgba(30, 58, 109, 0.07);
  border-radius: 2px;
  padding: 0.08rem 0.35rem;
}
.gs-browse-hidden { display: none !important; }

@media (max-width: 640px) {
  .gs-doc-meta { grid-template-columns: 1fr; }
  .gs-index-mentions { margin-left: 0; }
  /* les marges négatives (-1.5rem) dépassaient le padding du conteneur
     Bootstrap (0.75rem) : débordement horizontal de 12px sur mobile */
  .gs-hero, .gs-section-explore {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* =====================================================================
   17. ENHANCEMENT BROWSE (registres-browse.js) — pages d'index A–Z
   (déplacé de registres.css : les pages d'index ne chargent que ce fichier)
   ===================================================================== */
.gs-browse-toolbar {
    background: var(--gs-cream-light);
    border: 1px solid var(--gs-gold-light);
    border-radius: 2px;
    padding: 0.9rem 1rem;
    margin: 1rem 0 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    font-family: var(--gs-font-text);
}
.gs-browse-field { display: flex; flex-direction: column; gap: 0.2rem; }
.gs-browse-field label {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    color: var(--gs-gold-text);
}
.gs-browse-toolbar input[type="search"],
.gs-browse-toolbar select {
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--gs-sepia);
    background: var(--gs-cream);
    border: 1px solid var(--gs-gold);
    border-radius: 2px;
    padding: 0.3rem 0.5rem;
    min-width: 11rem;
    accent-color: var(--gs-blue);
}
.gs-browse-count {
    font-family: var(--gs-font-mono);
    font-size: 0.78rem;
    color: var(--gs-sepia-medium);
    margin-left: auto;
    align-self: center;
}
.gs-browse-reset {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    color: var(--gs-blue);
    background: none;
    border: 1px solid var(--gs-gold);
    border-radius: 2px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
}
.gs-browse-reset:hover { background: var(--gs-gold-text); color: var(--gs-cream-light); border-color: var(--gs-gold-text); }
.gs-browse-empty {
    font-style: italic;
    color: var(--gs-sepia-text);
    padding: 1rem 0;
}
.gs-browse-empty::before { content: "❦ "; color: var(--gs-gold); font-style: normal; }
/* légende des compteurs (pastille corpus / chips démo) */
.gs-index-legend {
    font-size: 0.82rem;
    font-style: italic;
    color: var(--gs-sepia-text);
    margin: -0.8rem 0 1.2rem;
}

/* =====================================================================
   18. RECHERCHE PAGEFIND — habillage aux couleurs de l'édition
   ===================================================================== */
#gs-search {
    --pagefind-ui-scale: 0.9;
    --pagefind-ui-primary: var(--gs-blue);
    --pagefind-ui-text: var(--gs-sepia);
    --pagefind-ui-background: var(--gs-cream-light);
    --pagefind-ui-border: var(--gs-gold);
    --pagefind-ui-tag: var(--gs-cream-warm);
    --pagefind-ui-border-width: 1px;
    --pagefind-ui-border-radius: var(--gs-radius);
    --pagefind-ui-image-border-radius: var(--gs-radius);
    --pagefind-ui-font: var(--gs-font-text);
}
#gs-search .pagefind-ui__result-link {
    font-family: var(--gs-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gs-blue);
}
#gs-search .pagefind-ui__result-link:hover { color: var(--gs-gold); }
#gs-search .pagefind-ui__result { border-top: 1px solid var(--gs-cream-warm); }
#gs-search .pagefind-ui__result-excerpt mark {
    background: var(--gs-gold-light);
    color: var(--gs-blue);
    font-weight: 600;
    padding: 0 0.15rem;
    border-radius: 1px;
}
#gs-search .pagefind-ui__button,
#gs-search .pagefind-ui__filter-clear {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
    color: var(--gs-blue);
    background: transparent;
    border: 1px solid var(--gs-gold);
    border-radius: var(--gs-radius);
}
#gs-search .pagefind-ui__button:hover { background: var(--gs-gold-text); color: var(--gs-cream-light); }
#gs-search .pagefind-ui__filter-name {
    font-family: var(--gs-font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: var(--gs-gold-text);
}
#gs-search .pagefind-ui__message { font-family: var(--gs-font-display); color: var(--gs-sepia-medium); }
