/* ============================================================================
   EDITEUR_ARTICLE.CSS — Apparence de l'éditeur de texte visuel (espace responsable)
   ============================================================================
   La zone d'écriture reprend exactement l'apparence de lecture (contenu_article.css, classe
   « contenu-riche ») : ce que la personne voit en écrivant est ce que le public verra.
   Ici : seulement la barre d'outils, les panneaux et les repères d'édition.

   Sections : 1. Conteneur  2. Barre d'outils  3. Panneaux  4. Zone d'écriture  5. Repères d'édition
              6. Conseils  7. Petits écrans
   ============================================================================ */


/* ==========================================================================
   1. CONTENEUR
   ======================================================================== */

.editeur-article {
  border: 1px solid var(--line, #d8d3c4);
  border-radius: 10px;
  background: var(--paper-raised, #fff);
  overflow: hidden;
}

.editeur-article .visuel-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


/* ==========================================================================
   2. BARRE D'OUTILS
   ======================================================================== */

.ed-barre {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 12px;
  background: var(--paper, #faf7f0);
  border-bottom: 1px solid var(--line, #d8d3c4);
  position: sticky;
  top: 0;
  z-index: 5;
}

.ed-groupe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-right: 14px;
  border-right: 1px solid var(--line, #d8d3c4);
}

.ed-groupe:last-child { border-right: 0; padding-right: 0; }

.ed-bouton {
  font: inherit;
  font-size: 0.9em;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line, #d8d3c4);
  border-radius: 8px;
  background: var(--paper-raised, #fff);
  color: var(--ink, #1f1d18);
  cursor: pointer;
}

.ed-bouton:hover { border-color: var(--leaf, #1f5c3f); }

.ed-bouton[aria-pressed="true"] {
  background: var(--ink, #1f1d18);
  color: var(--paper, #faf7f0);
  border-color: var(--ink, #1f1d18);
  font-weight: 700;
}

.ed-bouton.ed-principal {
  background: var(--leaf, #1f5c3f);
  border-color: var(--leaf, #1f5c3f);
  color: #fff;
}

.ed-bouton:focus-visible,
.ed-liste:focus-visible,
.ed-zone:focus-visible,
.ed-panneau input:focus-visible,
.ed-panneau select:focus-visible {
  outline: 3px solid var(--sky, #1d4ed8);
  outline-offset: 2px;
}

.ed-champ {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ed-etiquette {
  font-size: 0.85em;
  color: var(--ink-soft, #4a463b);
}

.ed-liste {
  font: inherit;
  font-size: 0.9em;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid var(--line, #d8d3c4);
  border-radius: 8px;
  background: var(--paper-raised, #fff);
  color: var(--ink, #1f1d18);
}


/* ==========================================================================
   3. PANNEAUX (lien, tableau, image, fichier, contrôle)
   ======================================================================== */

.ed-panneau {
  padding: 12px 14px;
  background: var(--paper, #faf7f0);
  border-bottom: 1px solid var(--line, #d8d3c4);
}

.ed-panneau[hidden] { display: none; }

.ed-panneau-titre {
  margin: 0 0 8px;
  font-size: 1em;
}

.ed-formulaire {
  display: grid;
  gap: 10px;
}

.ed-champ-large label {
  display: block;
  font-size: 0.9em;
  font-weight: 600;
  margin-bottom: 3px;
}

.ed-champ-large input[type="text"],
.ed-champ-large input[type="number"],
.ed-champ-large select {
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
  font: inherit;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line, #d8d3c4);
  border-radius: 8px;
  background: var(--paper-raised, #fff);
  color: var(--ink, #1f1d18);
}

.ed-aide-champ {
  margin: 4px 0 0;
  font-size: 0.85em;
  color: var(--ink-soft, #4a463b);
}

.ed-champ-case {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.ed-champ-case input { margin-top: 5px; width: 18px; height: 18px; }

.ed-fieldset {
  border: 1px solid var(--line, #d8d3c4);
  border-radius: 8px;
  padding: 6px 10px 8px;
  margin: 0;
}

.ed-fieldset legend { font-size: 0.9em; font-weight: 600; padding: 0 4px; }

.ed-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.ed-radio { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.ed-radio input { width: 18px; height: 18px; }

.ed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ed-retour { margin: 0; font-size: 0.9em; }
.ed-retour:empty { display: none; }

.ed-controle ul { margin: 6px 0 0; padding-left: 20px; }
.ed-controle li { margin-bottom: 6px; }
.ed-controle .ed-ok { font-weight: 600; color: var(--leaf, #1f5c3f); }


/* ==========================================================================
   4. ZONE D'ÉCRITURE
   ======================================================================== */

.ed-zone {
  width: 100%;
  max-width: none;          /* la mise en forme de lecture limite la largeur : ici la zone remplit tout le champ */
  box-sizing: border-box;
  min-height: 320px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--paper-raised, #fff);
}

.ed-zone:focus-visible {
  outline-offset: -3px;     /* le cadre reste à l'intérieur du champ (le conteneur masque ce qui dépasse) */
}

.ed-zone:empty::before {
  content: "Écrivez ici…";
  color: var(--muted, #6b665a);
}


/* ==========================================================================
   5. REPÈRES D'ÉDITION (invisibles pour le public)
   ======================================================================== */

/* Image ou fichier sélectionné : cadre bien visible, pas seulement une couleur */
.ed-zone .ed-selectionne {
  outline: 3px solid var(--sky, #1d4ed8);
  outline-offset: 3px;
  cursor: default;
}

/* Dans l'éditeur, les fiches de fichier ne s'ouvrent pas : on les modifie */
.ed-zone .fiche-piece { cursor: default; }
.ed-zone .fiche-lien { pointer-events: none; }

/* Les figures flottantes sont déjà gérées par contenu_article.css : on laisse un espace pour cliquer à côté */
.ed-zone .fig img { cursor: pointer; }

/* Tableaux : cellules visibles même vides */
.ed-zone table td,
.ed-zone table th { min-width: 3em; height: 2em; }


/* ==========================================================================
   6. CONSEILS
   ======================================================================== */

.ed-conseils {
  padding: 10px 14px;
  border-top: 1px solid var(--line, #d8d3c4);
  background: var(--paper, #faf7f0);
  font-size: 0.9em;
}

.ed-conseils summary { cursor: pointer; font-weight: 600; }
.ed-conseils ul { margin: 8px 0 0; padding-left: 20px; }
.ed-conseils li { margin-bottom: 4px; }


/* ==========================================================================
   7. PETITS ÉCRANS
   ======================================================================== */

@media (max-width: 640px) {
  .ed-groupe { border-right: 0; padding-right: 0; }
  .ed-barre { position: static; }
  .ed-zone { padding: 12px; max-height: none; }
}
