/* Éditeur de wikitexte (public/js/wikitext-editor.js) : coloration syntaxique par une couche
   placée sous le textarea, dont le texte est transparent, et mode visuel Parsoid. */
.wt-editor {
    --wt-heading: #0b5394;
    --wt-template: #8a3ffc;
    --wt-template-bg: rgba(138, 63, 252, .07);
    --wt-param: #b45309;
    --wt-link: #0a7d32;
    --wt-link-target: #0a7d32;
    --wt-ext: #0e7490;
    --wt-tag: #b91c1c;
    --wt-comment: #6b7280;
    --wt-markup: #c2410c;
    --wt-table: #9d174d;
    position: relative;
    border-radius: var(--bs-border-radius);
    background: var(--bs-body-bg);
}
[data-theme="nord"] .wt-editor,
[data-theme="sombre"] .wt-editor {
    --wt-heading: #7cb7ff;
    --wt-template: #c4a5ff;
    --wt-template-bg: rgba(196, 165, 255, .1);
    --wt-param: #fbbf24;
    --wt-link: #6ee7a0;
    --wt-link-target: #6ee7a0;
    --wt-ext: #67e8f9;
    --wt-tag: #fca5a5;
    --wt-comment: #9ca3af;
    --wt-markup: #fdba74;
    --wt-table: #f9a8d4;
}
.wt-editor.wt-readonly { background: var(--bs-tertiary-bg); }
.wt-editor .wt-backdrop {
    position: absolute;
    inset: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-wrap: break-word;
    color: var(--bs-body-color);
    border-color: transparent;
    background: transparent;
}
.wt-editor textarea.wt-input {
    position: relative;
    background: transparent !important;
    color: transparent;
    caret-color: var(--bs-body-color);
}
.wt-editor textarea.wt-input::selection { background: rgba(13, 110, 253, .3); color: transparent; }
.wt-backdrop .wt-heading { color: var(--wt-heading); font-weight: 700; }
.wt-backdrop .wt-tpl { background: var(--wt-template-bg); border-radius: 2px; }
.wt-backdrop .wt-tpl-brace, .wt-backdrop .wt-tpl-name { color: var(--wt-template); font-weight: 600; }
.wt-backdrop .wt-pipe { color: var(--wt-template); }
.wt-backdrop .wt-param { color: var(--wt-param); }
.wt-backdrop .wt-link-brace, .wt-backdrop .wt-link-target { color: var(--wt-link-target); }
.wt-backdrop .wt-link-target { text-decoration: underline; text-decoration-style: dotted; }
.wt-backdrop .wt-link { color: var(--wt-link); }
.wt-backdrop .wt-ext { color: var(--wt-ext); }
.wt-backdrop .wt-tag { color: var(--wt-tag); }
.wt-backdrop .wt-comment { color: var(--wt-comment); font-style: italic; }
.wt-backdrop .wt-markup { color: var(--wt-markup); font-weight: 700; }
.wt-backdrop .wt-table { color: var(--wt-table); font-weight: 700; }
.wt-backdrop .wt-entity, .wt-backdrop .wt-magic { color: var(--wt-param); }
.wt-backdrop .wt-marker { color: var(--wt-template); background: var(--wt-template-bg); font-weight: 700; }

/* Mode visuel : HTML Parsoid modifiable, modèles non modifiables */
.wt-visual {
    font-family: var(--bs-body-font-family);
    font-size: .95rem;
    overflow: auto;
    resize: vertical;
    padding: .75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-body-bg);
}
.wt-visual:focus { outline: 2px solid rgba(13, 110, 253, .4); }
.wt-visual [contenteditable="false"] { outline: 1px dashed rgba(138, 63, 252, .5); background: rgba(138, 63, 252, .06); cursor: default; }
.wt-visual table.wikitable { border-collapse: collapse; margin: .5rem 0; }
.wt-visual table.wikitable > * > tr > th,
.wt-visual table.wikitable > * > tr > td { border: 1px solid var(--bs-border-color); padding: .2rem .4rem; }
.wt-visual h2, .wt-visual h3, .wt-visual h4, .wt-visual h5 { border-bottom: 1px solid var(--bs-border-color); padding-bottom: .15rem; }
.wt-visual h2 { font-size: 1.4rem; } .wt-visual h3 { font-size: 1.2rem; } .wt-visual h4 { font-size: 1.05rem; }
.wt-visual img { max-width: 100%; height: auto; }
.wt-visual link, .wt-visual meta { display: none; }
.wt-visual a.new { color: #ba0000; }
.wt-busy { opacity: .6; pointer-events: none; }
