/*
 * Mise en page éditoriale des actualités : une seule feuille pour le site public et pour l'éditeur du CMS (TinyMCE, body_class "editorial"),
 * afin que ce qui est écrit soit ce qui est publié.
 *
 * Pourquoi elle existe : le site charge Tailwind, dont la remise à zéro (preflight) retire les marges des paragraphes, la taille et la graisse des titres,
 * les puces des listes et le style des citations. Le contenu saisi dans l'éditeur (HTML sémantique propre) s'affichait donc en bloc compact.
 * Toutes les valeurs ci-dessous sont explicites : elles ne dépendent d'aucune remise à zéro, ni de celle du navigateur ni de celle de Tailwind.
 */
.editorial {
    --ed-ink: #173443;
    --ed-text: #304b58;
    --ed-muted: #647b85;
    --ed-line: #dce6e7;
    --ed-teal: #27b7aa;
    --ed-teal-soft: #eaf8f6;
    --ed-night: #173443;
    --ed-night-soft: #edf3f6;
    color: var(--ed-text);
    font-family: "DM Sans", Arial, sans-serif;
    font-size: 1.05rem;
    line-height: 1.55;
    overflow-wrap: break-word;
}
body.editorial { margin: 16px; max-width: 812px; }

/* Les anciens articles forcent « Plus Jakarta Sans » sur chaque paragraphe (police absente du site) : la police du site fait foi. */
.editorial span[style*="font-family"] { font-family: inherit !important; }

.editorial p { margin: 0 0 12px; }
.editorial h2, .editorial h3, .editorial h4 { color: var(--ed-ink); font-family: "Roboto Slab", Georgia, serif; font-weight: 700; }
.editorial h2 { margin: 28px 0 11px; font-size: 1.55rem; line-height: 1.22; }
.editorial h3 { margin: 20px 0 9px; font-size: 1.2rem; line-height: 1.3; }
.editorial h4 { margin: 16px 0 8px; font-size: 1.05rem; line-height: 1.35; }
.editorial > :first-child, .editorial > :first-child > :first-child { margin-top: 0; }
.editorial strong, .editorial b { color: var(--ed-ink); font-weight: 700; }
.editorial a { color: #168f86; text-decoration: underline; text-underline-offset: 2px; }
.editorial a:hover { color: var(--ed-ink); }
.editorial mark { padding: 0 .15em; background: #fff3bf; color: inherit; }
.editorial hr { margin: 26px 0; border: 0; border-top: 1px solid var(--ed-line); }
.editorial small { font-size: .85em; }

/* Alignements : l'éditeur les enregistre en style en ligne ; la justification coupe les mots proprement (lang="fr"). */
.editorial [style*="text-align: justify"], .editorial [style*="text-align:justify"] { text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; }

.editorial ul, .editorial ol { margin: 0 0 12px; padding-left: 1.4rem; }
.editorial ul { list-style: disc; }
.editorial ol { list-style: decimal; }
.editorial li { margin: 0 0 5px; padding-left: .15rem; }
.editorial li > ul, .editorial li > ol { margin: 5px 0 0; }
.editorial li > p { margin-bottom: 5px; }

/* Citation : barre turquoise, fond légèrement teinté, police de titre en italique ; l'attribution est un <cite> en fin de bloc. */
.editorial blockquote {
    margin: 18px 0;
    padding: 16px 20px;
    border-left: 4px solid var(--ed-teal);
    border-radius: 0 8px 8px 0;
    background: var(--ed-teal-soft);
    color: var(--ed-ink);
    font-family: "Roboto Slab", Georgia, serif;
    font-size: 1.06rem;
    font-style: italic;
    line-height: 1.5;
}
.editorial blockquote > :first-child { margin-top: 0; }
.editorial blockquote > :last-child { margin-bottom: 0; }
.editorial blockquote p { margin: 0 0 8px; }
.editorial blockquote cite { display: block; margin-top: 2px; color: var(--ed-muted); font-family: "DM Sans", Arial, sans-serif; font-size: .85rem; font-style: normal; font-weight: 600; }
.editorial blockquote cite::before { content: "— "; }

/* Tableaux */
.editorial table { display: table; width: 100%; max-width: 100%; margin: 18px 0; border-collapse: collapse; font-size: .93rem; line-height: 1.45; }
.editorial th, .editorial td { padding: 9px 12px; border: 1px solid var(--ed-line); text-align: left; vertical-align: top; }
.editorial th { background: #f3f8f8; color: var(--ed-ink); font-weight: 700; }
.editorial td p, .editorial th p { margin: 0 0 6px; }
.editorial td > :last-child, .editorial th > :last-child { margin-bottom: 0; }

/*
 * Encadré (« À retenir ») : un tableau à une seule cellule, sans en-tête, comme dans les CMS PhiloGest et PhiloReg.
 * Reconnu par sa structure, les contenus existants restent donc compatibles ; la classe cms-callout est posée par le bouton de l'éditeur.
 */
.editorial table.cms-callout,
.editorial table:has(tr:only-child > td:only-child):not(:has(th)) {
    display: block;
    overflow: visible;
    margin: 18px 0;
    padding: 16px 20px;
    border: 0;
    border-left: 4px solid var(--ed-night);
    border-radius: 0 8px 8px 0;
    background: var(--ed-night-soft);
    font-size: 1rem;
    line-height: 1.5;
}
.editorial table.cms-callout :is(tbody, tr, td),
.editorial table:has(tr:only-child > td:only-child):not(:has(th)) :is(tbody, tr, td) { display: block; padding: 0; border: 0; }
.editorial table.cms-callout td > p,
.editorial table:has(tr:only-child > td:only-child):not(:has(th)) td > p { margin: 0 0 6px; }
.editorial table.cms-callout td > :last-child,
.editorial table:has(tr:only-child > td:only-child):not(:has(th)) td > :last-child { margin-bottom: 0; }

@media (max-width: 640px) { .editorial table { display: block; overflow-x: auto; } }

/* Images, légendes, blocs techniques */
.editorial img { display: block; max-width: 100%; height: auto; margin: 18px auto; border-radius: 8px; }
.editorial figure { margin: 18px 0; }
.editorial figcaption { margin-top: 6px; color: var(--ed-muted); font-size: .82rem; text-align: center; }
.editorial details { margin: 14px 0; padding: 12px 16px; border: 1px solid var(--ed-line); border-radius: 8px; }
.editorial summary { color: var(--ed-ink); font-weight: 700; cursor: pointer; }
.editorial pre { max-width: 100%; margin: 14px 0; padding: 14px; overflow: auto; border-radius: 8px; background: #102733; color: #f8fafc; font-size: .88rem; line-height: 1.5; }
.editorial code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; }
.editorial .cms-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 18px 0; }
.editorial .cms-gallery figure { margin: 0; }
.editorial .cms-gallery img { margin: 0; }
.editorial .cms-embed-frame, .editorial .cms-video-frame { position: relative; margin: 18px 0; aspect-ratio: 16 / 9; }
.editorial .cms-embed-frame iframe, .editorial .cms-video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

/* Bloc « Sources », affiché entre le bandeau et le premier paragraphe */
.article-sources { margin: 0 0 22px; padding: 12px 16px; border: 1px solid #dbe5ea; border-radius: 10px; background: #f6f9fb; }
.article-sources__title { margin: 0 0 6px; color: #647b85; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.article-sources ul { margin: 0; padding: 0; list-style: none; }
.article-sources li { margin: 0 0 3px; font-size: .86rem; line-height: 1.45; }
.article-sources li:last-child { margin-bottom: 0; }
.article-sources a { color: #304b58; text-decoration: underline; text-underline-offset: 2px; }
.article-sources a:hover { color: #168f86; }
.article-sources__publisher { color: #647b85; }
