/* Motî walon — interface de traduction.
   Deux panneaux côte à côte, cartes claires, accent bleu.
   Aucune police distante : le site doit fonctionner hors ligne, on s'appuie
   donc sur la pile système — San Francisco sur Mac, Segoe UI sur Windows,
   Roboto sur Android. */

:root {
  --fond:        #f2f5f9;
  --carte:       #ffffff;
  --carte-creux: #f7f9fc;
  --texte:       #10202e;
  --texte-doux:  #536477;
  --texte-pale:  #8a99a8;
  --bord:        #dfe6ee;
  --bord-fort:   #c6d2df;
  --accent:      #0a4fd6;
  --accent-doux: #eaf1ff;
  --accent-fort: #0840ad;
  --alerte:      #b45309;
  --alerte-doux: #fef3e2;
  --manque:      #b91c1c;

  --r:       14px;
  --r-petit:  9px;
  --ombre:       0 1px 2px rgba(16,32,46,.05), 0 8px 24px -12px rgba(16,32,46,.18);
  --ombre-haute: 0 18px 48px -24px rgba(16,32,46,.45);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --mesure: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond:        #0d141c;
    --carte:       #161f2a;
    --carte-creux: #1c2733;
    --texte:       #e7edf4;
    --texte-doux:  #9fb0c2;
    --texte-pale:  #6b7c8e;
    --bord:        #253141;
    --bord-fort:   #33445a;
    --accent:      #5b9bff;
    --accent-doux: #16233a;
    --accent-fort: #7cb0ff;
    --alerte:      #e0a458;
    --alerte-doux: #2a2115;
    --manque:      #f27373;
    --ombre:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
    --ombre-haute: 0 18px 48px -24px rgba(0,0,0,.8);
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* Une règle de disposition écrase l'attribut « hidden » : on le rétablit. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: #fff; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px;
  border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── En-tête ──────────────────────────────────────────────────── */

.entete {
  background: var(--carte); border-bottom: 1px solid var(--bord);
  position: sticky; top: 0; z-index: 40;
}
.entete-inner {
  max-width: var(--mesure); margin: 0 auto;
  padding: .8rem clamp(1rem, 4vw, 2rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: inline-flex; align-items: center; gap: .6rem;
  color: var(--texte); font-weight: 700; letter-spacing: -.01em; }
.logo:hover { text-decoration: none; }
.logo-marque {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--accent); color: #fff;
  font-size: .95rem; font-weight: 800;
}
.logo-nom { font-size: 1.05rem; }
.nav { display: flex; gap: 1.4rem; font-size: .92rem; }
.nav a { color: var(--texte-doux); font-weight: 500; }
.nav a:hover { color: var(--accent); text-decoration: none; }

/* ── Accroche ─────────────────────────────────────────────────── */

main { max-width: var(--mesure); margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) 4rem; }

.hero { text-align: center; margin-bottom: clamp(1.6rem, 4vw, 2.4rem); }
.hero h1 { margin: 0 0 .6rem; font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.hero p { margin: 0 auto; max-width: 40rem; color: var(--texte-doux); }
.hero em { font-style: normal; color: var(--texte);
  background: var(--accent-doux); padding: .05em .35em; border-radius: 5px; }
.hero strong { color: var(--accent); }

/* ── Traducteur ───────────────────────────────────────────────── */

.panneaux {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--carte); border: 1px solid var(--bord);
  border-radius: var(--r); box-shadow: var(--ombre); overflow: hidden;
}
.panneau { display: flex; flex-direction: column; min-height: 15rem; }
.panneau-source { border-right: 1px solid var(--bord); }
.panneau-cible { background: var(--carte-creux); }

.panneau-tete {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem; border-bottom: 1px solid var(--bord);
  min-height: 3rem;
}
.langue { font-size: .9rem; font-weight: 600; color: var(--texte-doux);
  padding: .3rem .7rem; border-radius: 999px; }
.langue.actif { color: var(--accent); background: var(--accent-doux); }

.panneau-corps { flex: 1; padding: 1.1rem; }

#saisie {
  display: block; width: 100%; border: none; background: none; resize: none;
  color: var(--texte); font-family: inherit; font-size: 1.15rem;
  line-height: 1.5; padding: 0; min-height: 8rem; overflow: hidden;
}
#saisie::placeholder { color: var(--texte-pale); }
#saisie:focus { outline: none; }

.rendu { display: block; font-size: 1.15rem; line-height: 1.5;
  min-height: 8rem; }
.rendu:empty::before { content: "Traduction"; color: var(--texte-pale); }
.rendu.travaille { opacity: .4; }

.panneau-pied {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; padding: .55rem 1.1rem; min-height: 2.9rem;
  border-top: 1px solid var(--bord);
  font-size: .78rem; color: var(--texte-pale);
}
.compteur { font-variant-numeric: tabular-nums; }
.effacer {
  appearance: none; border: none; background: none; cursor: pointer;
  color: var(--texte-pale); font-size: .85rem; padding: .25rem .45rem;
  border-radius: 6px; line-height: 1;
}
.effacer:hover { background: var(--bord); color: var(--texte); }

.copier {
  appearance: none; display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid var(--bord-fort); background: var(--carte);
  color: var(--texte-doux); cursor: pointer;
  font-size: .78rem; font-weight: 500; padding: .34rem .7rem;
  border-radius: var(--r-petit);
}
.copier:hover { color: var(--accent); border-color: var(--accent); }

/* Bouton d'inversion, à cheval sur la séparation. */
.permuter {
  position: absolute; left: 50%; top: 1.5rem; transform: translate(-50%, 0);
  z-index: 5; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--bord); background: var(--carte);
  color: var(--texte-doux); cursor: pointer;
  box-shadow: 0 1px 3px rgba(16,32,46,.12);
  transition: color .15s, border-color .15s, transform .25s;
}
.permuter:hover { color: var(--accent); border-color: var(--accent); }
.permuter:active { transform: translate(-50%, 0) rotate(180deg); }

/* Marques d'incertitude : discrètes, mais lisibles. */
.mot { border-radius: 3px; transition: background .12s; }
.mot-valider { border-bottom: 2px solid var(--alerte); cursor: help; }
.mot-absent { border-bottom: 2px dotted var(--manque);
  color: var(--texte-doux); cursor: help; }
.mot-valider:hover, .mot-absent:hover { background: var(--alerte-doux); }

.marque { display: inline-block; width: 1.1em; height: 0;
  vertical-align: middle; margin: 0 .3em 0 .7em; }
.marque:first-child { margin-left: 0; }
.marque-valider { border-bottom: 2px solid var(--alerte); }
.marque-absent  { border-bottom: 2px dotted var(--manque); }
.legende { display: inline-flex; align-items: center; }

.aide { margin: .9rem .2rem 0; font-size: .82rem; color: var(--texte-pale); }

/* Note au survol d'un mot douteux. */
.mot[data-note] { position: relative; }
.mot[data-note]:hover::after {
  content: attr(data-note);
  position: absolute; left: 0; top: calc(100% + .45rem); z-index: 30;
  width: max-content; max-width: 21rem;
  background: var(--texte); color: var(--carte);
  padding: .5rem .7rem; border-radius: var(--r-petit);
  font-size: .78rem; line-height: 1.45; font-weight: 400;
  box-shadow: var(--ombre-haute);
}

/* ── Dictionnaire ─────────────────────────────────────────────── */

.dictionnaire { margin-top: clamp(2.5rem, 6vw, 4rem); }
.dictionnaire h2 { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 700;
  letter-spacing: -.015em; }

.quete { position: relative; }
.quete-loupe { position: absolute; left: 1rem; top: 50%;
  transform: translateY(-50%); color: var(--texte-pale); pointer-events: none; }
#quete {
  width: 100%; padding: .95rem 1rem .95rem 2.9rem;
  border: 1px solid var(--bord); border-radius: var(--r);
  background: var(--carte); color: var(--texte);
  font-family: inherit; font-size: 1.02rem; box-shadow: var(--ombre);
}
#quete::placeholder { color: var(--texte-pale); }
#quete:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-doux); }

.suggestions {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + .4rem);
  margin: 0; padding: .3rem; list-style: none; max-height: 21rem;
  overflow-y: auto; background: var(--carte);
  border: 1px solid var(--bord); border-radius: var(--r);
  box-shadow: var(--ombre-haute);
}
.suggestions li { padding: .55rem .8rem; cursor: pointer;
  border-radius: var(--r-petit); display: flex; gap: .8rem; align-items: baseline; }
.suggestions li:hover, .suggestions li[aria-selected="true"] {
  background: var(--accent-doux); }
.suggestions .s-lemme { font-weight: 600; }
.suggestions .s-fr { color: var(--texte-pale); font-size: .86rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Article ──────────────────────────────────────────────────── */

.article {
  margin-top: 1.2rem; padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--carte); border: 1px solid var(--bord);
  border-radius: var(--r); box-shadow: var(--ombre);
}
.article-seule { margin-top: 0; }

.art-tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem;
  padding-bottom: .9rem; border-bottom: 1px solid var(--bord); }
.art-lemme { margin: 0; font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.art-cat { font-size: .78rem; font-weight: 600; color: var(--accent);
  background: var(--accent-doux); padding: .2rem .55rem; border-radius: 999px; }
.art-api { font-size: .85rem; color: var(--texte-pale); font-family: var(--mono); }
.art-via { width: 100%; margin: .2rem 0 0; font-size: .82rem;
  color: var(--texte-pale); }
.art-resume { margin: 1rem 0 0; font-size: 1.05rem; color: var(--texte-doux); }
.art-resume strong { color: var(--texte); }

.art-bloc { margin-top: 1.7rem; }
.art-bloc-titre { margin: 0 0 .8rem; font-size: .74rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--texte-pale); }

.sens-liste { margin: 0; padding: 0; list-style: none; counter-reset: sens; }
.sens-item { counter-increment: sens; position: relative;
  padding-left: 2rem; margin-bottom: 1rem; }
.sens-item::before {
  content: counter(sens); position: absolute; left: 0; top: .12em;
  display: grid; place-items: center; width: 1.35rem; height: 1.35rem;
  border-radius: 50%; background: var(--accent-doux); color: var(--accent);
  font-size: .72rem; font-weight: 700;
}
.sens-fr { font-weight: 600; }
.sens-def { color: var(--texte-doux); }
.citation { display: block; margin-top: .35rem; padding: .5rem .8rem;
  background: var(--carte-creux); border-radius: var(--r-petit);
  font-size: .9rem; color: var(--texte-doux); }
.citation-source { display: block; font-size: .72rem; color: var(--texte-pale);
  margin-top: .2rem; }

.aires { display: grid; gap: .1rem; }
.aire-ligne { display: flex; gap: 1rem; padding: .5rem 0;
  border-bottom: 1px solid var(--bord); }
.aire-ligne:last-child { border-bottom: none; }
.aire-nom { flex: 0 0 9rem; font-size: .74rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--texte-pale);
  padding-top: .2em; }
.aire-formes { flex: 1; display: flex; flex-wrap: wrap; gap: .35rem; }
.aire-formes span { background: var(--carte-creux);
  border: 1px solid var(--bord); padding: .1rem .5rem; border-radius: 999px;
  font-size: .88rem; }

.expressions { margin: 0; padding: 0; list-style: none; }
.expressions li { padding: .45rem 0; border-bottom: 1px solid var(--bord); }
.expressions li:last-child { border-bottom: none; }
.expressions .spot { margin-left: .5rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--alerte); }

.formes-liste { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0;
  padding: 0; list-style: none; }
.formes-liste li { font-size: .8rem; color: var(--texte-doux);
  background: var(--carte-creux); border: 1px solid var(--bord);
  padding: .2rem .55rem; border-radius: 999px; }

.voisins { margin: 0; line-height: 2.1; }
.voisins a { background: var(--accent-doux); padding: .18rem .6rem;
  border-radius: 999px; font-size: .92rem; }
.voisins a:hover { text-decoration: none; background: var(--accent); color: #fff; }

.art-retour { margin: 2rem 0 0; padding-top: 1rem;
  border-top: 1px solid var(--bord); font-size: .88rem; }
.vide { color: var(--texte-pale); }

/* ── Chiffres ─────────────────────────────────────────────────── */

.chiffres { margin-top: clamp(2.5rem, 6vw, 4rem); display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.chiffre { background: var(--carte); border: 1px solid var(--bord);
  border-radius: var(--r); padding: 1.1rem 1.2rem; }
.chiffre strong { display: block; font-size: 1.5rem; font-weight: 700;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chiffre span { font-size: .85rem; color: var(--texte-pale); }

/* ── Index du dictionnaire ────────────────────────────────────── */

.section-titre { display: flex; align-items: baseline; gap: .9rem;
  margin: 0 0 1rem; }
.section-titre h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700; letter-spacing: -.025em; }
.section-numero { font-size: .74rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); }
.section-filet { flex: 1; height: 1px; background: var(--bord); }

.index-intro { max-width: 42rem; color: var(--texte-doux); }
.index-lettres { display: grid; gap: .6rem; margin-top: 1.8rem;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); }
.index-lettre {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .5rem; padding: .8rem .9rem; background: var(--carte);
  border: 1px solid var(--bord); border-radius: var(--r-petit);
  color: var(--texte); box-shadow: var(--ombre);
}
.index-lettre:hover { text-decoration: none; border-color: var(--accent);
  background: var(--accent-doux); }
.index-lettre-l { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.index-lettre-n { font-size: .72rem; color: var(--texte-pale);
  font-variant-numeric: tabular-nums; }

.liste-mots { list-style: none; margin: 1.4rem 0 0; padding: 0;
  columns: 2; column-gap: 2.5rem; }
.liste-mots li { break-inside: avoid; padding: .4rem 0;
  border-bottom: 1px solid var(--bord); }
.liste-mots a { font-weight: 600; }
.liste-fr { display: block; font-size: .82rem; color: var(--texte-pale);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pagination { margin-top: 1.5rem; font-size: .88rem; color: var(--texte-pale); }

/* ── Dialogue ─────────────────────────────────────────────────── */

.dialogue {
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
  max-width: 29rem; width: calc(100% - 2rem); padding: 0;
  border-radius: var(--r); box-shadow: var(--ombre-haute);
}
.dialogue::backdrop { background: rgba(16,32,46,.5); backdrop-filter: blur(3px); }
.dialogue form { padding: 1.5rem; }
.dialogue h3 { margin: 0 0 .3rem; font-size: 1.2rem; font-weight: 700;
  letter-spacing: -.015em; }
.dialogue-contexte { margin: 0 0 1.1rem; font-size: .92rem;
  color: var(--texte-doux); }
.fleche-petite { color: var(--accent); padding: 0 .35em; }
.dialogue label { display: block; margin: .9rem 0 .3rem; font-size: .78rem;
  font-weight: 600; color: var(--texte-doux); }
.facultatif { font-weight: 400; color: var(--texte-pale); }
.dialogue input, .dialogue select, .dialogue textarea {
  width: 100%; padding: .6rem .7rem; background: var(--carte-creux);
  border: 1px solid var(--bord); color: var(--texte);
  font-family: inherit; font-size: .98rem; border-radius: var(--r-petit);
}
.dialogue input:focus, .dialogue select:focus, .dialogue textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-doux); }
.dialogue-actions { display: flex; justify-content: flex-end; gap: .6rem;
  margin-top: 1.3rem; }

.bouton, .bouton-fantome {
  appearance: none; cursor: pointer; border-radius: var(--r-petit);
  font-size: .9rem; font-weight: 600; padding: .6rem 1.1rem;
  border: 1px solid transparent;
}
.bouton { background: var(--accent); color: #fff; }
.bouton:hover { background: var(--accent-fort); }
.bouton-fantome { background: none; color: var(--texte-doux);
  border-color: var(--bord-fort); }
.bouton-fantome:hover { color: var(--texte); border-color: var(--texte-doux); }

.brouhaha {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1.2rem);
  z-index: 50; background: var(--texte); color: var(--carte);
  padding: .65rem 1.1rem; border-radius: var(--r-petit); opacity: 0;
  font-size: .88rem; font-weight: 500;
  transition: opacity .22s, transform .22s; pointer-events: none;
  box-shadow: var(--ombre-haute);
}
.brouhaha.visible { opacity: 1; transform: translate(-50%, 0); }

/* ── Pied ─────────────────────────────────────────────────────── */

.pied { border-top: 1px solid var(--bord); background: var(--carte); }
.pied-inner { max-width: var(--mesure); margin: 0 auto;
  padding: 1.8rem clamp(1rem, 4vw, 2rem) 2.5rem;
  font-size: .85rem; color: var(--texte-pale); }
.pied-inner p { margin: 0 0 .5rem; max-width: 48rem; }
.pied strong { color: var(--texte-doux); }

/* ── Écrans étroits ───────────────────────────────────────────── */

@media (max-width: 44rem) {
  .panneaux { grid-template-columns: 1fr; }
  .panneau-source { border-right: none; border-bottom: 1px solid var(--bord); }
  /* Le bouton d'inversion se place à la charnière entre les deux panneaux. */
  .permuter { top: calc(50% - 19px); left: auto; right: 1.1rem;
    transform: none; }
  .permuter:active { transform: rotate(180deg); }
  .panneau { min-height: 11rem; }
  #saisie, .rendu { min-height: 5rem; }
  .liste-mots { columns: 1; }
  .aire-ligne { flex-direction: column; gap: .3rem; }
  .aire-nom { flex: none; }
  .nav { gap: 1rem; font-size: .88rem; }
}
