/* ==========================================================================
   Plume — styles du CONTENU editable.
   Tout ce qui se trouve ici decrit le document lui-meme, pas l'interface :
   c'est cette feuille que reprend l'export HTML et l'impression.
   ========================================================================== */

.editor{
  outline:none;
  font-family:var(--doc-font,Georgia,'Times New Roman',serif);
  font-size:var(--doc-size,17px);
  line-height:1.62;
  color:var(--ink);
  word-wrap:break-word;
  overflow-wrap:break-word;
  -webkit-user-select:text;
  user-select:text;
  caret-color:var(--accent);
  hyphens:auto;
}

/* La famille du corps de texte arrive par --doc-font (voir data/fonts.js).
   Les <span style="font-family"> poses sur une selection la surchargent
   naturellement : aucune regle n'est necessaire pour eux. */

/* Document vide : l'invite est posee en surimpression, jamais inseree dans
   le DOM edite (sinon le curseur et la composition du clavier sautent). */
.editor{position:relative}
.editor.is-empty::before{
  content:attr(data-placeholder);
  position:absolute;top:0;left:0;right:0;
  color:var(--ink-3);
  pointer-events:none;
  white-space:pre-wrap;
}

.editor p{margin:0 0 .85em}
.editor p:last-child{margin-bottom:0}

.editor h1,.editor h2,.editor h3{
  line-height:1.25;letter-spacing:-.018em;font-weight:680;
  margin:1.5em 0 .5em;
}
.editor h1:first-child,.editor h2:first-child,.editor h3:first-child{margin-top:0}
.editor h1{font-size:1.72em}
.editor h2{font-size:1.38em}
.editor h3{font-size:1.16em;font-weight:660}

.editor ul,.editor ol{margin:0 0 .9em;padding-left:1.5em}
.editor li{margin-bottom:.3em}
.editor li::marker{color:var(--ink-3)}

.editor blockquote{
  margin:0 0 .9em;padding:.2em 0 .2em 1em;
  border-left:3px solid var(--accent);
  color:var(--ink-2);font-style:italic;
}

.editor pre{
  margin:0 0 .9em;padding:12px 14px;
  background:var(--surface-2);border:1px solid var(--line);
  border-radius:10px;overflow-x:auto;
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  font-size:.88em;line-height:1.5;white-space:pre-wrap;
}
.editor code{
  background:var(--surface-2);border-radius:5px;padding:.1em .35em;
  font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;font-size:.9em;
}
.editor pre code{background:none;padding:0}

.editor hr{
  border:0;border-top:1px solid var(--line-2);
  margin:1.6em 0;
}

.editor a{color:var(--accent-texte);text-decoration:underline;text-underline-offset:2px}

.editor img{
  max-width:100%;height:auto;display:block;
  border-radius:10px;margin:.6em 0;
}
.editor img[data-size="small"]{max-width:45%}
.editor img[data-size="medium"]{max-width:70%}
.editor img[data-size="large"]{max-width:100%}
.editor img[data-align="center"]{margin-left:auto;margin-right:auto}
.editor img[data-align="right"]{margin-left:auto}
.editor img.is-selected{outline:2.5px solid var(--accent);outline-offset:2px}
.editor img.is-missing{
  min-height:90px;background:var(--surface-2);
  border:1px dashed var(--line-2);
}

/* ------------------------------ tableaux ------------------------------ */
.editor table{
  border-collapse:collapse;width:100%;margin:0 0 1em;
  font-size:.95em;table-layout:fixed;
}
.editor th,.editor td{
  border:1px solid var(--line-2);
  padding:8px 10px;text-align:left;vertical-align:top;
  min-width:44px;word-break:break-word;
}
.editor th{background:var(--surface-2);font-weight:640}
.editor tr.is-active td,.editor tr.is-active th{background:color-mix(in srgb,var(--accent) 7%,transparent)}
.editor .table-wrap{overflow-x:auto;margin:0 0 1em;-webkit-overflow-scrolling:touch}
.editor .table-wrap table{margin:0}

/* ------------------------------ alignements ------------------------------ */
.editor [style*="text-align: center"],
.editor [style*="text-align:center"]{text-align:center}
.editor [style*="text-align: right"],
.editor [style*="text-align:right"]{text-align:right}

/* ------------------------------ recherche ------------------------------ */
.editor mark.tdt-hit{
  background:#ffe38a;color:#2a2200;border-radius:3px;
}
.editor mark.tdt-hit.is-current{background:#ffb02e;color:#2a1700}
:root[data-theme="dark"] .editor mark.tdt-hit{background:#6b5a14;color:#fff6d8}
:root[data-theme="dark"] .editor mark.tdt-hit.is-current{background:#b07d12;color:#fff}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .editor mark.tdt-hit{background:#6b5a14;color:#fff6d8}
  :root:not([data-theme="light"]) .editor mark.tdt-hit.is-current{background:#b07d12;color:#fff}
}
::highlight(tdt-hit){background-color:#ffe38a;color:#2a2200}
::highlight(tdt-hit-current){background-color:#ffb02e;color:#2a1700}

/* Texte dicte, encore provisoire : gris, non selectionnable. */
.editor .dictation-draft{color:var(--ink-3);background:var(--surface-2);border-radius:4px}

/* ------------------------------ mise en page ------------------------------ */

/* Saut de page : un filet a l'ecran, une vraie coupure sur le papier. */
.page-break{
  height:0;
  border-top:2px dashed var(--line-2);
  margin:26px 0 30px;
  position:relative;
  user-select:none;
  -webkit-user-select:none;
}
.page-break::after{
  content:"Saut de page";
  position:absolute;
  top:-9px;left:50%;transform:translateX(-50%);
  background:var(--surface);
  padding:0 10px;
  font-size:11px;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--ink-3);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}

/* En-tete, pied et numeros : invisibles a l'ecran, poses a l'impression. */
.running,
.page-numbers{display:none}

/* ------------------------------ vue page (js/pageview.js) ------------------------------ */

/* La feuille à sa VRAIE largeur et ses vraies marges, réduite par `zoom`
   (posé par pageview.js). Le fond blanc et l'ombre passent aux feuilles
   dessinées derrière le texte : la `.page` n'est plus qu'un cadre. */
.page.est-pagee{
  width:var(--pv-w);max-width:none;box-sizing:border-box;
  padding:var(--pv-mt) var(--pv-mr) var(--pv-mb) var(--pv-ml);
  min-height:var(--pv-hauteur,auto);
  background:transparent;border:0;border-radius:0;box-shadow:none;
}
/* La typographie de l'impression (css/print.css), pour que les lignes
   coupent au même mot à l'écran et sur le papier. */
.page.est-pagee .editor:not(.est-word):not(.est-copie){font-size:11.5pt;line-height:1.5}
.page.est-pagee .editor{position:relative;z-index:1}
.pv-feuilles{position:absolute;left:0;right:0;top:0;pointer-events:none;z-index:0}
.pv-feuille{
  position:absolute;left:0;right:0;
  background:var(--surface);border:1px solid var(--line);
  box-shadow:0 1px 3px rgba(15,20,35,.08),0 6px 22px rgba(15,20,35,.07);
}
.pv-entete,.pv-pied{
  position:absolute;left:var(--pv-ml);right:var(--pv-mr);
  font:9pt/1.3 Arimo,Arial,sans-serif;color:var(--ink-3);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.pv-pied{display:flex;justify-content:space-between;gap:12px}
.pv-pied span{overflow:hidden;text-overflow:ellipsis}
/* Un intercalaire ne se voit pas, ne se sélectionne pas, ne s'imprime pas. */
.pv-saut{display:block;user-select:none;-webkit-user-select:none;pointer-events:none}
/* Le saut de page demandé : la feuille suivante le montre déjà. */
/* Lot 101 : un saut de SECTION dit ce qui le suit (orientation, en-tête). */
.editor .saut-section{border-top-color:color-mix(in srgb,var(--accent) 55%,var(--line-2));cursor:pointer}
.editor .saut-section::after{content:attr(data-libelle);color:var(--accent);text-transform:none;letter-spacing:0;font-weight:600}
.editor .w-calcul,.editor .w-champ[data-champ^="="]{cursor:pointer;font-variant-numeric:tabular-nums}
.page.est-pagee .page-break{border-top:0;margin:0}
/* Lot 187 (rapport n° 19) : la feuille réduite le dit (pageview.js, pastille). */
.pv-pastille{position:sticky;top:8px;z-index:5;display:flex;align-items:center;gap:10px;width:max-content;max-width:calc(100% - 24px);
  margin:8px auto 0;padding:4px 4px 4px 14px;border-radius:999px;background:var(--ink);color:var(--surface);font-size:13px;box-shadow:var(--shadow-sm)}
.pv-pastille[hidden]{display:none}
.pv-pastille button{min-height:40px;padding:0 14px;border-radius:999px;background:var(--surface);color:var(--ink);font-weight:600;font-size:13px}
.page.est-pagee .page-break::after{display:none}
/* Plusieurs colonnes : la pagination n'est pas calculée (dit dans le menu). */
.page.est-pagee.pv-colonnes{min-height:auto}

/* Colonnes : on empeche un titre de rester seul en bas d'une colonne. */
.editor h1,.editor h2,.editor h3{break-after:avoid-column}

/* ------------------------------ sommaire ------------------------------ */

.editor .toc{
  border:1px solid var(--line);
  border-radius:10px;
  padding:14px 16px;
  margin:0 0 1.2em;
  background:var(--surface-2);
  user-select:none;
  -webkit-user-select:none;
}
.editor .toc__title{
  margin:0 0 8px;
  font-size:.82em;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--ink-3);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}
.editor .toc__list{display:flex;flex-direction:column;gap:2px}
.editor .toc__item{
  display:block;
  padding:5px 0;
  color:var(--ink);
  text-decoration:none;
  font-size:.95em;
  line-height:1.4;
}
.editor .toc__item--2{padding-left:16px;font-size:.9em;color:var(--ink-2)}
.editor .toc__item--3{padding-left:32px;font-size:.87em;color:var(--ink-2)}
.editor .toc__item:active{color:var(--accent-texte)}

/* Cible d'un lien interne : un bref eclat, sinon on ne sait pas ou on a atterri. */
.editor .is-flash{
  animation:flash 0.9s ease-out;
  border-radius:4px;
}
@keyframes flash{
  0%,25%{background:color-mix(in srgb,var(--accent) 22%,transparent)}
  100%{background:transparent}
}

/* ------------------------------ notes de bas de page ------------------------------ */

.editor sup.fn-ref{
  color:var(--accent-texte);
  font-weight:650;
  cursor:pointer;
  padding:0 1px;
  user-select:none;
  -webkit-user-select:none;
}
.editor .footnotes{
  border-top:1px solid var(--line-2);
  margin-top:2.4em;
  padding-top:.8em;
  font-size:.85em;
  color:var(--ink-2);
}
.editor .footnotes__title{
  margin:0 0 .5em;
  font-size:.86em;
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:var(--ink-3);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}
.editor .footnotes__note{margin:0 0 .45em;line-height:1.5}
.editor .footnotes__n{color:var(--accent-texte);font-weight:650;margin-right:.2em}

/* ------------------------------ commentaires ------------------------------ */

.editor .comment-mark{
  background:color-mix(in srgb,#f5a524 26%,transparent);
  border-bottom:2px solid #f5a524;
  border-radius:2px;
  cursor:pointer;
}
.editor .comment-mark.is-resolved{
  background:none;
  border-bottom:2px dotted var(--line-2);
}

/* ------------------------------ figures ------------------------------ */

.editor figure{margin:0 0 1em}
.editor figcaption{
  font-size:.85em;
  color:var(--ink-3);
  text-align:center;
  margin-top:.45em;
  font-style:italic;
}

/* ------------------------------ documents venus de Word (lot 15) ------------------------------
   Un fichier Word porte ses PROPRES valeurs, posées en style en ligne par
   js/docxread.js : marges, interlignes, tailles des titres. La typographie
   de Plume (titres agrandis, marges en em, interligne 1,62) ne doit pas s'y
   ajouter : on la neutralise, et ce qui reste est ce que Word aurait montré. */
.editor.est-word{line-height:var(--doc-lh,1.2207);hyphens:manual}
.editor.est-word :is(p,h1,h2,h3,h4,h5,h6,blockquote,li){
  margin:0;font-size:inherit;font-weight:inherit;letter-spacing:normal;line-height:inherit;color:inherit;
}
.editor.est-word :is(h1,h2,h3,h4,h5,h6):first-child{margin-top:0}
.editor.est-word :is(ul,ol){margin:0;padding-left:18pt}
.editor.est-word li{margin-bottom:0}
.editor.est-word li::marker{color:inherit}
.editor.est-word table{width:auto;max-width:100%;margin:0;font-size:inherit;table-layout:auto}
.editor.est-word :is(td,th){border:0;padding:0 5.4pt;min-width:0;font-weight:inherit;background:none}
.editor.est-word a{color:#0563C1}

/* Une tabulation : un vrai caractère, rendu à la largeur d'une tabulation. */
.editor .w-tab{white-space:pre;tab-size:4}
/* Un numéro composé (« 1.2.3. ») écrit en tête de l'élément de liste. */
.editor .w-num{user-select:none;-webkit-user-select:none}
/* Un champ de Word (PAGE, DATE, REF…) : son résultat, non modifiable. */
.editor .w-champ{background:color-mix(in srgb,var(--ink-3) 12%,transparent);border-radius:2px}
/* Le repère de coupure de page noté par Word : invisible, il sert à la mesure. */
.editor .w-coupure{display:none}
/* Un îlot : ce que Plume garde tel quel sans savoir le modifier. */
.editor .ooxml{
  display:inline-block;max-width:100%;vertical-align:middle;
  border:1px dashed var(--line-2);border-radius:4px;padding:2px 7px;
  font-size:.86em;line-height:1.4;color:var(--ink-2);background:var(--surface-2);
  user-select:none;-webkit-user-select:none;
}
.editor div.ooxml{display:block;margin:6px 0}
.editor .ooxml__label{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  font-size:.78em;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);
}

/* ------------------------------ révisions (lot 15) ------------------------------ */
.editor ins.rev{text-decoration:underline;text-decoration-color:var(--rev,#C2410C);color:var(--rev,#C2410C);text-underline-offset:2px}
.editor del.rev{text-decoration:line-through;text-decoration-color:var(--rev,#C2410C);color:var(--rev,#C2410C)}
.editor.rev-final del.rev{display:none}
.editor.rev-final ins.rev{text-decoration:none;color:inherit}
.editor.rev-original ins.rev{display:none}
.editor.rev-original del.rev{text-decoration:none;color:inherit}

/* ------------------------------ orthographe (lot 15) ------------------------------ */
::highlight(faute){
  text-decoration-line:underline;text-decoration-style:wavy;text-decoration-color:#D83A41;
  text-decoration-thickness:1.4px;text-underline-offset:3px;
}
/* la grammaire (lot 26) : un double trait bleu, pour ne jamais se confondre avec le rouge
   (et lisible par qui ne distingue pas les couleurs : le trait n'a pas la même forme) */
::highlight(grammaire){
  text-decoration-line:underline;text-decoration-style:double;text-decoration-color:var(--gram,#2F6FDB);
  text-decoration-thickness:1.4px;text-underline-offset:3px;
}

/* ------------------------------ formules (js/maths/katex.js) ------------------------------ */
/* Le dessin est dans l'ombre de l'élément ; ici, sa place dans la page. Le
   texte linéaire (« (a+b)/2 ») n'est jamais affiché quand l'ombre existe. */
.editor .math{cursor:pointer}
.editor .math--bloc{display:block;margin:.55em 0}
.editor .math.is-selected{border-radius:4px}

/* ------------------------------ énoncés (js/maths/theoremes.js) ------------------------------ */
/* La présentation d'amsthm : en-tête en gras, énoncé en italique pour les
   théorèmes et leurs cousins ; droit pour les définitions ; « Remarque » et
   « Démonstration » en italique, non numérotées. À l'écran, un filet discret
   dit où l'énoncé commence et finit ; il ne s'imprime pas. */
.editor .thm{margin:.9em 0;padding:.05em 0 .05em .75em;border-left:3px solid color-mix(in srgb,var(--accent) 28%,transparent)}
.editor .thm > p{margin:.15em 0}
.editor .thm__tete{-webkit-user-select:none;user-select:none}
.editor .thm__nom{font-weight:700}
.editor :is(.thm--theoreme,.thm--proposition,.thm--propriete,.thm--lemme,.thm--corollaire) > p:not(.thm__tete){font-style:italic}
.editor :is(.thm--remarque,.thm--demonstration) .thm__nom{font-weight:400;font-style:italic}
.editor .thm--demonstration{border-left-style:dashed}
.editor .thm [data-qed]{margin:0}
/* Un renvoi : « (3) », « théorème 2 ». En rouge s'il ne mène plus nulle part. */
.editor .math-ref{color:var(--accent-texte);white-space:nowrap}
.editor .math-ref.is-perdu{color:var(--danger)}
/* Lot 26 : légendes numérotées, renvois, tables des figures, bibliographie */
.editor .leg-num{font-weight:650}
.editor p.legende{font-size:.86em;color:var(--ink-2);text-align:center;margin:1.1em 0 .4em;font-style:italic}
.editor p.legende .leg-num{font-style:normal}
.editor .renvoi{color:var(--accent-texte);white-space:nowrap}
.editor .renvoi.is-perdu{color:var(--danger)}
.editor .liste-figures,.editor .bibliographie{border:1px solid var(--line);border-radius:12px;padding:12px 16px;margin:1em 0;background:var(--surface-2);user-select:none}
.editor .liste-figures__titre,.editor .bibliographie__titre{font-weight:700;margin:0 0 .5em}
.editor .liste-figures__item{margin:.2em 0}
.editor .bibliographie__item{margin:.35em 0;padding-left:1.6em;text-indent:-1.6em}
.editor .cite{color:var(--accent-texte);white-space:nowrap}
.editor .cite.is-perdu{color:var(--danger)}
/* Un résultat encadré, comme sur une copie. */
.editor .encadre{border:1.4px solid currentColor;padding:.3em .6em;width:fit-content;max-width:100%}

/* ------------------------------ copie de maths (js/maths/copie.js) ------------------------------ */
/* Une copie : sa base (Tinos 12 pt, interligne 1,5) est posée par main.js. */
.editor.est-copie{font-family:var(--doc-font,Tinos,'Times New Roman',serif);font-size:var(--doc-size,16px);line-height:1.5}
.page.est-pagee .editor.est-copie{font-size:12pt;line-height:1.5}
.editor .copie-entete{
  display:grid;grid-template-columns:max-content 1fr;gap:2px 12px;align-items:baseline;
  margin:0 0 1.2em;padding:.6em .8em;border:1px solid currentColor;border-radius:0;
  font-size:.92em;cursor:pointer;-webkit-user-select:none;user-select:none;
}
.editor .copie-entete__l{font-weight:700}
.editor h2.exo{font-size:1.15em;margin:1.3em 0 .5em;padding-bottom:.15em;border-bottom:1px solid currentColor}
.editor h3.exo--partie{font-size:1.02em;margin:1em 0 .4em;border:0;font-style:italic}
/* Les questions : 1. puis a) — comme sur un sujet. */
@counter-style plume-alpha-parenthese{system:extends lower-alpha;suffix:") "}
.editor.est-copie ol ol{list-style-type:plume-alpha-parenthese}
/* La marge du correcteur : un filet rouge, sur chaque feuille de la vue page. */
.page.est-pagee.marge-correcteur .pv-feuille::before{
  content:"";position:absolute;top:0;bottom:0;left:calc(var(--pv-ml) - 5mm);
  border-left:1.2px solid #e0453d;opacity:.85;
}

/* ------------------------------ figures (js/maths/figures.js) ------------------------------ */
.editor .fig-maths{display:block;margin:.9em 0;color:inherit}

/* Lot 31 : césure automatique (dictionnaire français du navigateur ; <html lang="fr">). */
.editor.ed-cesure{ -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 6 3 3; }

/* Lot 74 : un [champ] d'un modèle, à remplir. Surligné à l'écran ; un appui le sélectionne. */
/* ⚠️ Le surlignage est une OMBRE, pas un fond : en écrivant par-dessus un champ, Chrome recopie le
   fond de l'élément supprimé sur le texte tapé (un <span style="background-color">) ; l'ombre, non. */
.editor mark.a-remplir{background:transparent;color:inherit;border-radius:3px;padding:0 2px;box-shadow:inset 0 -1.15em 0 color-mix(in srgb,var(--accent) 16%,transparent),inset 0 -1.5px 0 color-mix(in srgb,var(--accent) 55%,transparent);cursor:text}
@media print{.editor mark.a-remplir{background:none;box-shadow:none;padding:0}}

/* Lot 109 (rapport n° 11) — dessiner au stylet dans le document (js/stylet.js). */
.stylet__outils{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-bottom:8px}
.stylet__encre{width:32px;height:32px;border-radius:50%;background:var(--e);border:2px solid var(--surface);box-shadow:0 0 0 1px var(--line-2);flex:0 0 auto}
.stylet__encre.is-on{box-shadow:0 0 0 3px var(--accent)}
.stylet__ep{min-height:34px;border-radius:var(--r-sm);border:1px solid var(--line-2);background:var(--surface);color:var(--ink);padding:0 6px}
.stylet__outils [aria-pressed="true"]{background:var(--accent-soft);color:var(--accent-texte)}
.stylet__toile{display:block;width:100%;background:#fff;border:1px solid var(--line-2);border-radius:var(--r-md);cursor:crosshair;
  background-image:radial-gradient(circle,rgba(26,26,46,.12) 1px,transparent 1.2px);background-size:22px 22px}
/* Un dessin reste sur du papier blanc, comme à l'impression : l'encre ne disparaît pas en thème sombre. */
.editor img[data-encre]{background:#fff;border-radius:6px;cursor:pointer}

/* Lot 212 (rapport n° 20) : la liste à cocher. */
.editor ul.taches{list-style:none;padding-left:.2em}
.editor ul.taches>li{padding-left:0}
.editor .coche{cursor:pointer;user-select:none;-webkit-user-select:none;font-family:'Segoe UI Symbol','Noto Sans Symbols 2','DejaVu Sans',sans-serif}
.editor ul.taches>li.faite{color:var(--ink-3);text-decoration:line-through;text-decoration-thickness:1px}
.editor ul.taches>li.faite>.coche{text-decoration:none;display:inline-block}
