/* ===========================================================
   DICO MAISON — thème académique (repris du projet précédent)
   Version allégée : juste ce qu'il faut pour afficher des cartes
   de définitions, pas tout un moteur de SPA.
   =========================================================== */

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

:root {
    --bg-page: #faf6ec;
    --bg-carte: #ffffff;
    --bg-carte-alt: #f5efe0;
    --texte: #16324a;
    /* Utilisé pour TOUT le texte de lecture (catégorie, étymologie,
       remarque...), pas seulement les accents décoratifs — un ton or/brun
       clair y était encore jugé peu lisible même après un premier
       assombrissement (#a87c1e -> #7a5a14, ~5.5:1). Le bleu marine est
       fiable dans toutes les situations (~5.6:1 sur fond carte, ~8:1 sur
       fond page), donc c'est lui qui porte désormais tout le texte. */
    --texte-secondaire: #33506b;
    --bordure: #e5dcc3;
    /* Réservé aux éléments d'interface (badge, boutons, liens au survol,
       bordures) — plus jamais utilisé pour du texte à lire. */
    --accent: #7a5a14;
    --accent-hover: #5f4310;
    --accent-texte: #fffaf0;
    /* Georgia : dessinée par Matthew Carter spécifiquement pour rester
       lisible à l'écran à taille de texte courante (fort empattement, bonne
       hauteur d'x) — remplace Cormorant Garamond (élégante mais jugée peu
       lisible en lecture prolongée). Police système, pas de fichier à
       héberger. */
    --police: Georgia, 'Times New Roman', serif;
    --police-accent: Georgia, 'Times New Roman', serif;
    --radius-carte: 14px;
    --radius-bouton: 6px;
    --ombre: 0 4px 20px rgba(22, 50, 74, .08);
    --taille-base: 18px;
    --interligne: 1.7;
}

body {
    font-family: var(--police);
    font-size: var(--taille-base);
    line-height: var(--interligne);
    background: var(--bg-page);
    color: var(--texte);
}

/* Carcasse commune aux 3 pages de l'écosystème Dico Maison (dico.rushforth.fr
   pour Dico Maison/Extracteur, cette page pour Mots recherchés) — dupliquée
   à l'identique côté dico.rushforth.fr, projet séparé sans déploiement
   commun. Voir lib/rendu.js, rendreCarcasse(). */
.carcasse {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg-carte);
    border-bottom: 1px solid var(--bordure);
    box-shadow: 0 2px 10px rgba(22, 50, 74, .05);
}
.carcasse-rangee { max-width: 900px; margin: 0 auto; display: flex; }
.carcasse-onglet {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 15px 10px;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--texte-secondaire);
    font-family: var(--police);
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.carcasse-onglet svg { width: 18px; height: 18px; flex-shrink: 0; }
.carcasse-onglet:hover { color: var(--texte); background: var(--bg-carte-alt); }
.carcasse-onglet[aria-current="page"] { color: var(--accent); font-weight: bold; border-bottom-color: var(--accent); }

.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 25px 50px;
}

.lien-retour {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--texte-secondaire);
    text-decoration: none;
    font-size: 0.9em;
}
.lien-retour:hover { color: var(--accent); }

.header-haut { text-align: right; margin-bottom: 4px; }
.apropos-lien { color: var(--texte-secondaire); text-decoration: none; font-size: 0.85em; }
.apropos-lien:hover { color: var(--accent); }

.sous-titre {
    text-align: center;
    color: var(--texte-secondaire);
    font-style: italic;
    margin-top: -10px;
    margin-bottom: 12px;
}

.compteur {
    text-align: center;
    color: var(--texte-secondaire);
    font-size: 0.9em;
    margin-bottom: 30px;
}
.compteur a {
    color: var(--texte-secondaire);
    text-decoration: underline;
}
.compteur a:hover {
    color: var(--accent);
}

.prose p {
    margin-bottom: 14px;
}
.prose h2 {
    font-family: var(--police-accent);
    color: var(--texte);
    font-size: 1.4em;
    margin-top: 26px;
    margin-bottom: 8px;
}

h1 {
    text-align: center;
    color: var(--texte);
    font-family: var(--police-accent);
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.carte-resultat {
    background: var(--bg-carte-alt);
    border: 1px solid var(--bordure);
    border-radius: var(--radius-carte);
    padding: 18px 22px;
    margin-bottom: 16px;
}

.carte-resultat > summary {
    list-style: none;
    cursor: pointer;
}
.carte-resultat > summary::-webkit-details-marker { display: none; }

.carte-resultat[open] > summary {
    margin-bottom: 6px;
}

.carte-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.carte-entete-gauche {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.carte-entete strong {
    font-family: var(--police-accent);
    font-size: 1.3em;
}

/* Le mot vedette de chaque carte reste à sa place dans l'en-tête mais ne
   s'affiche que la carte ouverte — évite de le répéter, identique, sur
   chaque carte d'une même fiche quand elles sont toutes fermées. */
.mot-vedette-carte { display: none; }
.carte-resultat[open] > summary .mot-vedette-carte { display: inline; }

/* Discrète par défaut (contrôle secondaire face au badge et aux boutons) :
   plus petite, plus pâle, ne s'affirme qu'au survol/focus ou une fois
   cochée. */
.case-pdf {
    accent-color: var(--texte-secondaire);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: .55;
    transition: opacity .15s;
}
.case-pdf:checked,
.case-pdf:hover,
.case-pdf:focus-visible {
    opacity: 1;
}

.chevron {
    color: var(--texte-secondaire);
    font-size: 1.3em;
    line-height: 1;
    transition: transform .15s;
    flex-shrink: 0;
}
.carte-resultat[open] > summary .chevron {
    transform: rotate(90deg);
}

/* Regroupe badge + icône pour que .carte-entete-gauche (flex-wrap) les
   déplace comme un seul bloc sur petit écran, plutôt que de laisser l'icône
   seule, orpheline, sur sa propre ligne. */
.badge-et-lien {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Simple étiquette, jamais cliquable elle-même — voir .icone-lien-externe
   pour l'action (ouvrir la source, ou copier + ouvrir pour l'Académie). */
.badge-source {
    background: var(--accent);
    color: var(--accent-texte);
    border: none;
    border-radius: var(--radius-bouton);
    padding: 3px 10px;
    font-size: 0.8em;
    font-family: inherit;
    letter-spacing: 0.02em;
    white-space: normal;
    text-decoration: none;
    cursor: default;
    display: inline-block;
}

/* Icône d'action à côté du badge — soit un <a> qui ouvre la source dans un
   nouvel onglet, soit un <button> qui copie le mot (Académie française, pas
   d'URL directe par mot). Même traité, contour repris des icônes de la
   carcasse (currentColor). */
.icone-lien-externe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--bordure);
    background: var(--bg-carte);
    color: var(--texte-secondaire);
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
    transition: .15s;
}
.icone-lien-externe svg { width: 14px; height: 14px; }
.icone-lien-externe:hover, .icone-lien-externe:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-texte);
}

/* Bulle de confirmation pour l'icône "copier" (Académie française) — le mot
   est réellement copié dès le survol/focus (voir site/js/liens-sources.js),
   pas seulement au clic, donc la bulle peut l'affirmer immédiatement plutôt
   que d'annoncer juste une intention. */
.icone-lien-externe[data-mode="copier"] { position: relative; }
.icone-lien-externe[data-mode="copier"]::after {
    content: "Le mot est copié en ouvrant le lien";
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--texte);
    color: var(--bg-page);
    font-family: var(--police);
    font-size: 0.75rem;
    font-style: normal;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s, transform .15s;
    z-index: 5;
}
.icone-lien-externe[data-mode="copier"]:hover::after,
.icone-lien-externe[data-mode="copier"]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.barre-editions-legende {
    font-size: 0.85em;
    font-style: italic;
    color: var(--texte-secondaire);
    margin-bottom: 10px;
}

.carte-bloc + .carte-bloc {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--bordure);
}

.bloc-categorie {
    font-family: var(--police-accent);
    font-style: italic;
    color: var(--texte-secondaire);
    margin-bottom: 4px;
}

/* Case à cocher par édition (Académie française) — même traitement discret
   que les cases de l'en-tête, alignée avec le libellé de l'édition. */
.bloc-edition-case {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    cursor: pointer;
}
.bloc-edition-case .bloc-categorie { margin-bottom: 0; }

.bloc-etymologie,
.bloc-remarque {
    color: var(--texte-secondaire);
    font-style: italic;
    font-size: 0.95em;
    margin-bottom: 6px;
}

.bloc-etymologie-titre {
    font-style: normal;
    font-weight: bold;
}

.carte-definitions p {
    margin-bottom: 6px;
    white-space: pre-line;
}

.bloc-complement-titre {
    font-family: var(--police-accent);
    font-weight: bold;
    font-size: 0.85em;
    margin-top: 10px;
    margin-bottom: 2px;
    color: var(--texte-secondaire);
}

.bloc-complement-texte {
    font-size: 0.9em;
    white-space: pre-line;
}

.carte-erreur {
    color: var(--texte-secondaire);
    font-style: italic;
}

/* Export PDF */
.barre-pdf {
    text-align: center;
    margin-bottom: 18px;
}

.barre-pdf-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Légende + Tout cocher/décocher sur une seule ligne, sous les boutons. */
.barre-pdf-legende {
    font-size: 0.85em;
    font-style: italic;
    color: var(--texte-secondaire);
    margin-top: 8px;
}
.lien-cases {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-style: inherit;
    text-decoration: underline;
    cursor: pointer;
    font-family: var(--police);
    font-size: 1em;
}
.lien-cases:hover, .lien-cases:focus-visible { color: var(--accent); }

.bouton-principal,
.bouton-secondaire {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-bouton);
    padding: 10px 22px;
    font-size: 1em;
    font-family: var(--police);
    cursor: pointer;
    transition: .2s;
}
.bouton-principal svg,
.bouton-secondaire svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bouton-principal {
    background: var(--accent);
    color: var(--accent-texte);
    border: none;
}
.bouton-principal:hover:not(:disabled) {
    background: var(--accent-hover);
}
.bouton-principal:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.bouton-secondaire {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}
.bouton-secondaire:hover:not(:disabled) {
    background: var(--bg-carte-alt);
    border-color: var(--accent-hover);
    color: var(--accent-hover);
}
.bouton-secondaire:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Index global */
.liste-mots {
    list-style: none;
    columns: 3;
    gap: 20px;
}
.liste-mots li { margin-bottom: 6px; break-inside: avoid; }
.liste-mots a {
    /* Un mot long et sans espace (ex. "épistémologique") ne peut pas se
       replier normalement : sans ça, il déborde de sa colonne et chevauche
       la colonne voisine sur petit écran. */
    overflow-wrap: break-word;
    color: var(--texte);
    text-decoration: none;
}
.liste-mots a:hover { color: var(--accent); }

/* Une section par langue : remplace l'étiquette de langue par mot par un
   vrai regroupement (demande explicite de l'utilisateur). */
.section-langue { margin-bottom: 36px; }
.section-langue.masquee { display: none; }
.section-langue-titre {
    display: flex;
    align-items: baseline;
    gap: 10px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 7px;
    margin-bottom: 12px;
}
.section-langue-titre h2 {
    font-family: var(--police-accent);
    color: var(--texte);
    font-size: 1.3em;
    font-weight: 600;
}
.section-langue-titre .compte {
    color: var(--texte-secondaire);
    font-size: 0.8em;
}
.liste-mots li.masque { display: none; }

/* Filtre en direct de l'index (js/filtre-mots.js) */
.filtre-mots { max-width: 380px; margin: 0 auto 34px; position: relative; }
.filtre-mots input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    font-family: var(--police);
    font-size: 1rem;
    color: var(--texte);
    background: var(--bg-carte);
    border: 1px solid var(--bordure);
    border-radius: 999px;
}
.filtre-mots input:focus { outline: none; border-color: var(--accent); }
.filtre-mots svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--accent); }
.aucun-resultat { text-align: center; color: var(--texte-secondaire); font-style: italic; padding: 10px 0 20px; }

/* Onglets de langue sous la barre de filtre (js/filtre-mots.js bascule
   .section-langue via l'attribut hidden au clic). */
.onglets-langue { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 0 0 30px; }
.onglet-langue {
    font-family: var(--police);
    font-size: 0.92rem;
    color: var(--texte-secondaire);
    background: none;
    border: 1px solid var(--bordure);
    border-radius: 999px;
    padding: 7px 16px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.onglet-langue .compte { color: var(--texte-secondaire); font-size: 0.85em; }
.onglet-langue:hover { border-color: var(--accent); color: var(--accent); }
.onglet-langue[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); font-weight: 600; }
.onglet-langue[aria-current="page"] .compte { color: var(--accent-texte); opacity: .85; }

/* Glossaires (mots regroupés sous un nom de catégorie libre à la
   recherche, ex. "Insectes") : avant l'index alphabétique général de
   chaque langue, jamais à la place. */
.glossaires { margin-bottom: 10px; }
.section-glossaire {
    background: var(--bg-carte-alt);
    border: 1px solid var(--bordure);
    border-radius: var(--radius-carte);
    padding: 16px 22px;
    margin-bottom: 16px;
}
.section-glossaire-titre {
    display: flex;
    align-items: baseline;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}
.section-glossaire-titre::-webkit-details-marker { display: none; }
.section-glossaire[open] > .section-glossaire-titre { margin-bottom: 10px; }
.section-glossaire-titre h3 { font-family: var(--police-accent); color: var(--accent); font-size: 1.05em; font-weight: 600; }
.section-glossaire-titre .compte { color: var(--texte-secondaire); font-size: 0.8em; }
.section-glossaire-titre .chevron { margin-left: auto; }
.section-glossaire[open] > .section-glossaire-titre .chevron { transform: rotate(90deg); }
.section-glossaire .liste-mots { columns: 3; }
.titre-index-general { color: var(--texte-secondaire); font-size: 0.95em; font-weight: normal; font-style: italic; margin: 18px 0 10px; }

/* Petit écran : 3 colonnes de mots deviennent trop étroites (voir aussi
   .liste-mots a, overflow-wrap, filet de sécurité si un mot très long
   passe quand même). */
@media (max-width: 480px) {
    .liste-mots { columns: 2; }
}
