/*
Theme Name: Reefact Atelier
Theme URI: https://reefact.net/
Author: Sylvain Aurat
Author URI: https://reefact.net/about-me/
Description: Thème enfant de Twenty Twenty-Five pour Reefact — direction « Atelier » : cartes, Nunito, bleu Reefact, modes clair et sombre.
Template: twentytwentyfive
Requires at least: 6.7
Requires PHP: 8.0
Version: 1.0.16
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: reefact-atelier
*/

/* ---------- Mode sombre : on réaffecte les couleurs du thème ---------- */
html[data-theme="dark"] {
	--wp--preset--color--base: #12181E;
	--wp--preset--color--surface: #1B232B;
	--wp--preset--color--contrast: #EAF0F4;
	--wp--preset--color--muted: #A9B5BF;
	--wp--preset--color--accent: #5CAEDB;
	--wp--preset--color--line: #2A343E;
	color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) {
		--wp--preset--color--base: #12181E;
		--wp--preset--color--surface: #1B232B;
		--wp--preset--color--contrast: #EAF0F4;
		--wp--preset--color--muted: #A9B5BF;
		--wp--preset--color--accent: #5CAEDB;
		--wp--preset--color--line: #2A343E;
		color-scheme: dark;
	}
}

:root {
	--reefact-radius: 18px;
	--reefact-radius-lg: 24px;
	--reefact-shadow: 0 1px 2px rgba(16, 40, 60, 0.06), 0 8px 24px rgba(16, 40, 60, 0.07);
}
html[data-theme="dark"] { --reefact-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]) { --reefact-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
}

body { -webkit-font-smoothing: antialiased; }
::selection { background: var(--wp--preset--color--brand); color: var(--wp--preset--color--ink); }
:focus-visible { outline: 3px solid var(--wp--preset--color--brand); outline-offset: 3px; border-radius: 6px; }

/* Liens : bleu intermédiaire pour le texte normal, bleu du logo pour le gras */
a { text-decoration-color: var(--wp--preset--color--brand); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
strong a, a strong, b a, a b, .reefact-strong-link { color: var(--wp--preset--color--brand); }

/* ---------- Titres : toujours en Nunito ---------- */
h1, h2, h3, h4, h5, h6, .wp-block-heading, .wp-block-post-title, .wp-block-query-title, .wp-block-site-title { font-family: var(--wp--preset--font-family--nunito); font-weight: 800; }

/* ---------- En-tête ---------- */
.reefact-header > .wp-block-group { flex-wrap: nowrap; gap: 24px; }
.reefact-header .reefact-nav { flex: 1 1 auto; justify-content: flex-end; }
.reefact-header .reefact-nav .wp-block-navigation__container { justify-content: flex-end; }
.reefact-header { padding-top: 20px; padding-bottom: 20px; }
.reefact-logo img { display: block; height: 34px; width: auto; }
.reefact-nav a { text-decoration: none; font-weight: 700; font-size: 0.9375rem; }
.reefact-nav .wp-block-navigation-item__content { display: inline-block; padding: 8px 12px; border-radius: 999px; transition: transform .15s ease; }
.reefact-nav .wp-block-navigation-item__content:hover { transform: translateY(-2px); }
.reefact-nav .current-menu-item > .wp-block-navigation-item__content,
.reefact-nav .wp-block-navigation-item.is-current > .wp-block-navigation-item__content { background: var(--wp--preset--color--brand); color: var(--wp--preset--color--ink); }
/* ---------- Boutons ronds de l'en-tête (recherche, clair / sombre) ---------- */
:root { --reefact-btn-bg: #CED8E2; --reefact-btn-fg: #6E8CA8; --reefact-btn-other: #27313B; }
html.is-dark { --reefact-btn-bg: #27313B; --reefact-btn-fg: #CED8E2; --reefact-btn-other: #CED8E2; }
.reefact-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 0 0 auto; min-width: 0; }
.reefact-icon-btn {
	width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; padding: 0;
	background: var(--reefact-btn-bg); color: var(--reefact-btn-fg);
	transition: background-color .35s ease, box-shadow .35s ease, color .35s ease;
}
.reefact-icon-btn svg { width: 20px; height: 20px; display: block; }
.reefact-icon-btn:focus-visible { outline-offset: 4px; border-radius: 50%; }

/* Recherche : la loupe prend la place du menu */
.reefact-search-toggle svg { stroke: currentColor; }
.reefact-search-toggle .icon-close { display: none; }
.reefact-search-toggle:not(.just-toggled):hover { color: var(--wp--preset--color--brand); box-shadow: 0 0 0 4px rgba(92,174,219,.22), 0 0 16px rgba(92,174,219,.45); }
.reefact-search { display: none; flex: 1 1 auto; min-width: 0; max-width: 560px; margin: 0; }
.reefact-search input {
	width: 100%; height: 44px; box-sizing: border-box; padding: 0 20px; margin: 0;
	border: 1.5px solid var(--wp--preset--color--line); border-radius: 22px;
	background: var(--wp--preset--color--surface); color: var(--wp--preset--color--contrast);
	font: inherit; font-size: 0.9375rem; outline: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.reefact-search input::placeholder { color: var(--wp--preset--color--muted); opacity: 1; }
.reefact-search input:focus { border-color: var(--wp--preset--color--brand); box-shadow: 0 0 0 3px rgba(92,174,219,.25); }
.reefact-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.reefact-header.is-searching .reefact-nav { display: none; }
.reefact-header.is-searching .reefact-actions { flex: 1 1 auto; }
.reefact-header.is-searching .reefact-search { display: block; animation: reefact-search-in .25s ease; }
.reefact-header.is-searching .reefact-search-toggle .icon-search { display: none; }
.reefact-header.is-searching .reefact-search-toggle .icon-close { display: block; }
@keyframes reefact-search-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Bouton clair / sombre */
.reefact-theme-toggle {
	--moon: #6E8CA8; --moon-hover: #E3E9EF;
	--sun: #F6C453; --sun-hover: #E8603C;
}
.reefact-theme-toggle .icon-sun { display: none; }
.reefact-theme-toggle .icon-moon path { fill: var(--moon); transition: fill .35s ease; }
.reefact-theme-toggle .icon-sun circle { fill: var(--sun); transition: fill .35s ease; }
.reefact-theme-toggle .icon-sun path { stroke: var(--sun); transition: stroke .35s ease; }
html.is-dark .reefact-theme-toggle .icon-sun { display: block; }
html.is-dark .reefact-theme-toggle .icon-moon { display: none; }
/* Survol : on annonce le mode suivant (fond et halo de l'autre bouton) */
html:not(.is-dark) .reefact-theme-toggle:not(.just-toggled):hover { background: var(--reefact-btn-other); box-shadow: 0 0 0 4px rgba(39,49,59,.22), 0 0 16px rgba(39,49,59,.35); }
html:not(.is-dark) .reefact-theme-toggle:not(.just-toggled):hover .icon-moon path { fill: var(--moon-hover); }
html.is-dark .reefact-theme-toggle:not(.just-toggled):hover { background: var(--reefact-btn-other); box-shadow: 0 0 0 4px rgba(206,216,226,.35), 0 0 18px rgba(206,216,226,.45); }
html.is-dark .reefact-theme-toggle:not(.just-toggled):hover .icon-sun circle { fill: var(--sun-hover); }
html.is-dark .reefact-theme-toggle:not(.just-toggled):hover .icon-sun path { stroke: var(--sun-hover); }

@media (max-width: 599px) {
	.reefact-header.is-searching .reefact-logo { display: none; }
}

/* ---------- Cartes ---------- */
.reefact-card,
.reefact-cards .wp-block-post,
.reefact-cards > li {
	background: var(--wp--preset--color--surface);
	border-radius: var(--reefact-radius);
	box-shadow: var(--reefact-shadow);
	overflow: hidden;
	transition: transform .15s ease;
	display: flex; flex-direction: column;
}
.reefact-cards .wp-block-post:hover, .reefact-cards > li:hover, a.reefact-card:hover { transform: translateY(-2px); }
.reefact-cards .wp-block-post-featured-image, .reefact-cards .reefact-thumb { margin: 0; aspect-ratio: 29 / 20; overflow: hidden; background: var(--wp--preset--color--line); }
.reefact-cards .wp-block-post-featured-image img, .reefact-cards .reefact-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reefact-card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.reefact-cards .wp-block-post-title { font-size: 1.25rem; line-height: 1.3; margin: 0; }
.reefact-cards .wp-block-post-title a, .reefact-cards h3 a { color: inherit; text-decoration: none; }
.reefact-cards .wp-block-post-excerpt { font-size: 0.9375rem; line-height: 1.5; color: var(--wp--preset--color--muted); margin: 0; }
.reefact-cards .wp-block-post-excerpt__more-link { display: none; }
.reefact-meta { font-size: 0.8125rem; font-weight: 600; color: var(--wp--preset--color--muted); margin-top: auto; padding-top: 8px; }
.reefact-meta > * { display: inline; }
.reefact-cards ul.wp-block-post-template, ul.reefact-cards { gap: 24px; }
ul.reefact-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Pastilles de thème */
.reefact-pill { margin: 0 !important; display: flex; align-items: center; line-height: 1; }
/* Pastilles côte à côte (thème + dossier) : même ligne, mêmes dimensions */
.reefact-hero .wp-block-cover__inner-container > .wp-block-group { align-items: center; }
.reefact-pill a {
	display: inline-block; padding: 5px 11px; border-radius: 999px; text-decoration: none;
	font-size: 0.75rem; font-weight: 800; line-height: 1.3;
	background: rgba(255,255,255,.92); color: #13202B;
}
.reefact-pill .wp-block-post-terms__separator { display: none; }
.reefact-pill a + a { display: none; }
.category-architecture .reefact-pill a, body.pillar-architecture .reefact-pill a { background: var(--wp--preset--color--arch-tint); color: var(--wp--preset--color--arch-deep); }
.category-modelisation-metier .reefact-pill a, body.pillar-modelisation-metier .reefact-pill a { background: var(--wp--preset--color--mod-tint); color: var(--wp--preset--color--mod-deep); }
.category-ingenierie-logicielle .reefact-pill a, body.pillar-ingenierie-logicielle .reefact-pill a { background: var(--wp--preset--color--ing-tint); color: var(--wp--preset--color--ing-deep); }
.category-culture-leadership .reefact-pill a, body.pillar-culture-leadership .reefact-pill a { background: var(--wp--preset--color--cul-tint); color: var(--wp--preset--color--cul-deep); }
.category-artificial-intelligence .reefact-pill a, body.pillar-artificial-intelligence .reefact-pill a { background: var(--wp--preset--color--ia-tint); color: var(--wp--preset--color--ia-deep); }

/* Cartes de thème (accueil) */
.reefact-card.reefact-pillar-card { border-top: 5px solid var(--wp--preset--color--brand); padding: 20px; min-height: 110px; text-decoration: none; color: var(--wp--preset--color--contrast); gap: 6px; }
.reefact-pillar-card strong { font-size: 1.125rem; line-height: 1.25; color: var(--wp--preset--color--contrast); }
.reefact-pillar-card .reefact-count { font-size: 0.875rem; color: var(--wp--preset--color--muted); }
.reefact-pillar-card.p-arch { border-top-color: var(--wp--preset--color--arch); }
.reefact-pillar-card.p-mod { border-top-color: var(--wp--preset--color--mod); }
.reefact-pillar-card.p-ing { border-top-color: var(--wp--preset--color--ing); }
.reefact-pillar-card.p-cul { border-top-color: var(--wp--preset--color--cul); }
.reefact-pillar-card.p-ia { border-top-color: var(--wp--preset--color--ia); }

/* Boutons secondaires (contour bleu, sans fond) */
.wp-block-button.is-style-outline > .wp-block-button__link,
.reefact-outline {
	background: transparent; color: var(--wp--preset--color--contrast);
	border: 0; box-shadow: inset 0 0 0 1.5px var(--wp--preset--color--brand);
}

/* ---------- Accueil ---------- */
.reefact-intro h1 .reefact-accent { color: var(--wp--preset--color--brand); }
.reefact-featured .wp-block-post { border-radius: var(--reefact-radius-lg); }
.reefact-featured .wp-block-post-title { font-size: 1.875rem; }
.reefact-section-title { font-size: 1.5rem; margin: 0; }
.reefact-dossiers { list-style: none; padding: 0; margin: 24px 0 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.reefact-dossiers li { display: flex; }
.reefact-dossiers a { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; line-height: 1.3; min-height: 52px; box-sizing: border-box; padding: 10px 16px; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--wp--preset--color--brand); text-decoration: none; color: inherit; font-weight: 700; }
.reefact-dossiers .n { color: var(--wp--preset--color--muted); font-weight: 600; }
.reefact-author { background: var(--wp--preset--color--brand); color: var(--wp--preset--color--ink); border-radius: var(--reefact-radius-lg); padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.reefact-author img { border-radius: 50%; width: 64px; height: 64px; }
.reefact-author a { color: var(--wp--preset--color--ink); font-weight: 800; }
.reefact-author p { margin: 0; line-height: 1.55; }

/* ---------- Article ---------- */
.reefact-hero.wp-block-cover { border-radius: var(--reefact-radius-lg); overflow: hidden; box-shadow: var(--reefact-shadow); }
.reefact-hero .wp-block-cover__background {
	background: linear-gradient(180deg, rgba(10,22,32,0) 30%, rgba(10,22,32,.55) 58%, rgba(10,22,32,.88) 100%) !important;
	opacity: 1 !important;
}
.reefact-hero .wp-block-cover__inner-container { width: 100%; max-width: 900px; color: #FFFFFF; }
.reefact-hero .wp-block-post-title { color: #FFFFFF; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; }
.reefact-hero .wp-block-post-excerpt { color: rgba(255,255,255,.9); font-style: italic; font-size: 1.25rem; line-height: 1.45; }
.reefact-hero .wp-block-post-excerpt__more-link { display: none; }
.reefact-hero .reefact-meta { color: rgba(255,255,255,.85); padding-top: 0; }
.reefact-hero .reefact-meta a { color: inherit; }
.reefact-hero .reefact-pill a { background: var(--wp--preset--color--brand) !important; color: var(--wp--preset--color--ink) !important; }
/* Badges de format (étiquettes) : contour à la couleur choisie, blanc par défaut */
.reefact-hero .reefact-format-pill a { background: rgba(10, 16, 22, .25) !important; color: #FFFFFF !important; box-shadow: inset 0 0 0 1.5px var(--badge-color, rgba(255,255,255,.85)); }
/* Dossier : pas un badge, une ligne de série avec sa progression, sous les pastilles */
.reefact-dossier-line { order: 10; flex-basis: 100%; margin: 6px 0 0 !important; line-height: 1.2; }
.reefact-dossier-line a { display: inline-flex; align-items: center; gap: 10px; color: #FFFFFF; text-decoration: none; font-size: 0.875rem; }
.reefact-dossier-line .steps { display: inline-flex; gap: 4px; }
.reefact-dossier-line .steps i { display: block; width: 18px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.reefact-dossier-line .steps i.on { background: var(--wp--preset--color--brand); }
.reefact-dossier-line .k { font-size: 0.6875rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .75); }
.reefact-dossier-line .name { font-weight: 800; }
.reefact-dossier-line .pos { color: rgba(255, 255, 255, .75); font-weight: 600; font-variant-numeric: tabular-nums; }
.reefact-dossier-line a:hover .name { text-decoration: underline; text-decoration-color: var(--wp--preset--color--brand); text-underline-offset: 3px; }
.reefact-hero .reefact-meta, .reefact-hero .wp-block-post-excerpt, .reefact-hero .wp-block-post-title { margin-top: 12px; }

.reefact-article { display: grid; grid-template-columns: 1fr; gap: 40px; }
@media (min-width: 1100px) {
	.reefact-article { grid-template-columns: 320px minmax(0, 1fr); column-gap: 56px; align-items: start; }
	.reefact-article:not(:has(.reefact-toc-wrap)) { grid-template-columns: minmax(0, 1fr); }
	.reefact-article .reefact-content { width: 100%; max-width: 800px; margin-left: auto; margin-right: auto; }
	.reefact-toc-wrap { position: sticky; top: 24px; }
	.reefact-toc { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; }
}
.reefact-toc-wrap { min-width: 0; }
.reefact-toc { background: var(--wp--preset--color--surface); border-radius: var(--reefact-radius); box-shadow: var(--reefact-shadow); padding: 18px; font-size: 0.9375rem; }
.reefact-toc summary { font-weight: 800; cursor: pointer; list-style: none; }
.reefact-toc summary::-webkit-details-marker { display: none; }
.reefact-toc ol { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.reefact-toc a { display: block; padding: 6px 10px; border-radius: 10px; text-decoration: none; color: var(--wp--preset--color--muted); font-weight: 600; }
.reefact-toc a:hover { color: var(--wp--preset--color--contrast); }
.reefact-toc li.is-h3 a { padding-left: 22px; font-weight: 500; }
.reefact-toc a.is-active { color: var(--wp--preset--color--brand); box-shadow: inset 0 0 0 1.5px var(--wp--preset--color--brand); }
.reefact-toc-fab { display: none; }
@media (max-width: 1099px) {
	.reefact-toc-fab {
		display: inline-flex; position: fixed; right: 16px; bottom: 24px; z-index: 50; align-items: center; gap: 8px;
		height: 48px; padding: 0 18px; border: 0; border-radius: 24px; cursor: pointer;
		background: var(--wp--preset--color--brand); color: var(--wp--preset--color--ink); font: 800 15px/1 var(--wp--preset--font-family--nunito);
		box-shadow: 0 6px 20px rgba(16,40,60,.25);
	}
}

.reefact-content > * { max-width: 760px; }
.reefact-content h2, .reefact-content h3 { scroll-margin-top: 24px; }
/* Sous-titres saisis en bloc « préformaté » juste sous un H2 : affichés comme des chapôs */
.reefact-content h2 { margin-top: 2.2em; margin-bottom: 0; }
.reefact-content h2:first-child { margin-top: 0; }
.reefact-content h2 + .wp-block-preformatted {
	background: none; border: 0; padding: 0; margin-top: 10px; line-height: 1.5;
	font-family: var(--wp--preset--font-family--nunito); font-style: italic; font-size: 1.125rem;
	color: var(--wp--preset--color--muted); white-space: normal;
}
.reefact-content pre, .reefact-content .wp-block-code { border-radius: 14px; overflow-x: auto; }
.reefact-content img { border-radius: 12px; }
.reefact-content .wp-block-image img[src$=".png"] { background: #FFFFFF; }
.reefact-content figure.wp-block-table table { border-collapse: collapse; }

.reefact-dossier-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.reefact-dossier-nav a { display: block; padding: 22px 24px; text-decoration: none; color: inherit; }
.reefact-dossier-nav .label { display: block; font-size: 0.8125rem; font-weight: 700; color: var(--wp--preset--color--muted); }
.reefact-dossier-nav .title { display: block; margin-top: 6px; font-size: 1.125rem; font-weight: 800; line-height: 1.3; }
.reefact-dossier-nav .next { text-align: right; }

/* ---------- Pied de page ---------- */
.reefact-footer { color: var(--wp--preset--color--muted); font-size: 0.875rem; }
.reefact-footer a { color: inherit; }

/* ---------- Mouvements réduits ---------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; }
	.reefact-cards .wp-block-post:hover, .reefact-cards > li:hover, a.reefact-card:hover,
	.reefact-nav .wp-block-navigation-item__content:hover { transform: none; }
}

.reefact-empty { color: var(--wp--preset--color--muted); font-size: 0.9375rem; }

@media (max-width: 781px) {
	.reefact-hero.wp-block-cover { padding: 24px 20px !important; min-height: 440px !important; }
	.reefact-toc-fab { opacity: 0; pointer-events: none; transition: opacity .2s ease; }
	.reefact-toc-fab.is-visible { opacity: 1; pointer-events: auto; }
}

/* ---------- Défilement infini ---------- */
.reefact-infinite .wp-block-query-pagination { display: none; }
.reefact-infinite-status { margin: 32px 0 0; min-height: 1.5em; text-align: center; color: var(--wp--preset--color--muted); font-size: 0.9375rem; }

/* ---------- Blocs de code (Enlighter) ---------- */
/* Même espace au-dessus et en dessous que les autres blocs */
.reefact-content .enlighter-default { margin: var(--wp--style--block-gap, 24px) 0 0 !important; border: 1px solid var(--wp--preset--color--line); border-radius: 12px; }
/* Mode sombre : fond sombre et coloration accordée à la palette */
html.is-dark .enlighter-default { background: #0E1419 !important; }
html.is-dark .enlighter-default .enlighter > div:hover { background: rgba(255, 255, 255, 0.04) !important; }
html.is-dark .enlighter-default .enlighter-text,
html.is-dark .enlighter-default .enlighter-m0,
html.is-dark .enlighter-default .enlighter-m1,
html.is-dark .enlighter-default .enlighter-m2,
html.is-dark .enlighter-default .enlighter-m3,
html.is-dark .enlighter-default .enlighter-e0,
html.is-dark .enlighter-default .enlighter-e1 { color: #EAF0F4 !important; }
html.is-dark .enlighter-default .enlighter-k0,
html.is-dark .enlighter-default .enlighter-k1,
html.is-dark .enlighter-default .enlighter-k4,
html.is-dark .enlighter-default .enlighter-k6,
html.is-dark .enlighter-default .enlighter-k7,
html.is-dark .enlighter-default .enlighter-k8,
html.is-dark .enlighter-default .enlighter-k9 { color: #5CAEDB !important; }
html.is-dark .enlighter-default .enlighter-k2,
html.is-dark .enlighter-default .enlighter-k3,
html.is-dark .enlighter-default .enlighter-k5 { color: #BA9CDE !important; }
html.is-dark .enlighter-default .enlighter-s0,
html.is-dark .enlighter-default .enlighter-s1,
html.is-dark .enlighter-default .enlighter-s2,
html.is-dark .enlighter-default .enlighter-s3,
html.is-dark .enlighter-default .enlighter-s4,
html.is-dark .enlighter-default .enlighter-s5,
html.is-dark .enlighter-default .enlighter-s6,
html.is-dark .enlighter-default .enlighter-s7,
html.is-dark .enlighter-default .enlighter-s8,
html.is-dark .enlighter-default .enlighter-s9 { color: #E69F89 !important; }
html.is-dark .enlighter-default .enlighter-c0,
html.is-dark .enlighter-default .enlighter-c1,
html.is-dark .enlighter-default .enlighter-c2,
html.is-dark .enlighter-default .enlighter-c3,
html.is-dark .enlighter-default .enlighter-c4,
html.is-dark .enlighter-default .enlighter-c5,
html.is-dark .enlighter-default .enlighter-c6,
html.is-dark .enlighter-default .enlighter-c7,
html.is-dark .enlighter-default .enlighter-c8,
html.is-dark .enlighter-default .enlighter-c9 { color: #8C9BA8 !important; font-style: italic; }
html.is-dark .enlighter-default .enlighter-n0,
html.is-dark .enlighter-default .enlighter-n1,
html.is-dark .enlighter-default .enlighter-n2,
html.is-dark .enlighter-default .enlighter-n3,
html.is-dark .enlighter-default .enlighter-n4,
html.is-dark .enlighter-default .enlighter-n5,
html.is-dark .enlighter-default .enlighter-n6,
html.is-dark .enlighter-default .enlighter-n7,
html.is-dark .enlighter-default .enlighter-n8,
html.is-dark .enlighter-default .enlighter-n9 { color: #F6C453 !important; }
html.is-dark .enlighter-default .enlighter-g0,
html.is-dark .enlighter-default .enlighter-g1,
html.is-dark .enlighter-default .enlighter-g2,
html.is-dark .enlighter-default .enlighter-g3,
html.is-dark .enlighter-default .enlighter-g4,
html.is-dark .enlighter-default .enlighter-g5,
html.is-dark .enlighter-default .enlighter-g6,
html.is-dark .enlighter-default .enlighter-g7,
html.is-dark .enlighter-default .enlighter-g8,
html.is-dark .enlighter-default .enlighter-g9,
html.is-dark .enlighter-default .enlighter-x0,
html.is-dark .enlighter-default .enlighter-x1,
html.is-dark .enlighter-default .enlighter-x2,
html.is-dark .enlighter-default .enlighter-x3,
html.is-dark .enlighter-default .enlighter-x4,
html.is-dark .enlighter-default .enlighter-x5,
html.is-dark .enlighter-default .enlighter-x6,
html.is-dark .enlighter-default .enlighter-x7,
html.is-dark .enlighter-default .enlighter-x8,
html.is-dark .enlighter-default .enlighter-x9 { color: #A9B5BF !important; }
html.is-dark .enlighter-default .enlighter-toolbar .enlighter-btn { background-color: #1B232B; border-color: #2A343E; }
/* Respiration intérieure (la table d'Enlighter ignore le padding : on le met sur son conteneur) */
.reefact-content .enlighter-default .enlighter-code { padding: 14px 10px !important; }
.reefact-content .enlighter-default .enlighter,
.reefact-content .enlighter-default .enlighter * { font-family: var(--wp--preset--font-family--mono), ui-monospace, monospace !important; font-size: 0.8125rem !important; line-height: 1.6 !important; }

/* ---------- Citations : même taille que le texte ---------- */
.reefact-content .wp-block-quote,
.reefact-content .wp-block-quote p,
.reefact-content blockquote,
.reefact-content blockquote p { font-size: inherit; line-height: inherit; }
/* Angles arrondis nets : le fond est porté par le cadre seul, rien ne déborde */
.reefact-content .enlighter-default { overflow: hidden; background-clip: padding-box; }
.reefact-content .enlighter-default .enlighter-code,
.reefact-content .enlighter-default .enlighter { background: transparent !important; }
html.is-dark .reefact-content .enlighter-default { background: #0E1419 !important; }

/* ---------- Pastille de thème posée sur l'image des cartes ---------- */
.reefact-cards .wp-block-post, .reefact-cards > li { position: relative; container-type: inline-size; }
.reefact-cards .reefact-card-body > .reefact-pill {
	position: absolute; z-index: 1; left: 14px;
	top: calc(100cqw * 20 / 29 - 12px); transform: translateY(-100%);
}
.reefact-cards .reefact-card-body > .reefact-pill a { box-shadow: 0 2px 10px rgba(0, 0, 0, .28); }

/* ---------- Lexique : liens et fiche au survol ---------- */
.reefact-content a.reefact-lexicon-link { text-decoration-style: dotted; text-decoration-thickness: 2px; cursor: help; }
.reefact-lexicon-pop {
	display: none; position: absolute; z-index: 1000; width: min(380px, calc(100vw - 24px)); box-sizing: border-box;
	padding: 18px 20px 16px; border-radius: 18px;
	background: var(--wp--preset--color--surface); color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--line);
	box-shadow: 0 2px 6px rgba(16, 40, 60, .08), 0 18px 48px rgba(16, 40, 60, .18);
	opacity: 0; transform: translateY(6px) scale(.98); transform-origin: var(--arrow-x, 50%) top;
	transition: opacity .18s ease, transform .18s ease;
}
html.is-dark .reefact-lexicon-pop { box-shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 18px 48px rgba(0, 0, 0, .55); }
.reefact-lexicon-pop.is-above { transform: translateY(-6px) scale(.98); transform-origin: var(--arrow-x, 50%) bottom; }
.reefact-lexicon-pop.is-open { opacity: 1; transform: none; }
.reefact-lexicon-pop::before {
	content: ""; position: absolute; left: var(--arrow-x, 50%); top: -7px; width: 12px; height: 12px; margin-left: -6px;
	background: inherit; border-left: 1px solid var(--wp--preset--color--line); border-top: 1px solid var(--wp--preset--color--line);
	transform: rotate(45deg);
}
.reefact-lexicon-pop.is-above::before { top: auto; bottom: -7px; transform: rotate(225deg); }
.reefact-lexicon-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.reefact-lexicon-label { font-size: 0.6875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--wp--preset--color--brand); }
.reefact-lexicon-title { font-size: 1.125rem; font-weight: 800; line-height: 1.25; }
.reefact-lexicon-body { max-height: 240px; overflow: hidden; font-size: 0.875rem; line-height: 1.6; color: var(--wp--preset--color--contrast); }
.reefact-lexicon-body p { margin: 0 0 .7em; }
.reefact-lexicon-body img, .reefact-lexicon-body figure { display: none; }
.reefact-lexicon-pop.has-more .reefact-lexicon-body { -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.reefact-lexicon-more { display: inline-block; margin-top: 10px; font-size: 0.875rem; font-weight: 800; color: var(--wp--preset--color--brand); text-decoration: none; }
.reefact-lexicon-more:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .reefact-lexicon-pop { transform: none !important; } }

/* ---------- Dossiers : le petit dossier s'ouvre au survol ---------- */
.reefact-dossiers .t { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.reefact-folder { position: relative; flex: 0 0 26px; width: 26px; height: 20px; }
.reefact-folder .tab { position: absolute; left: 0; top: 0; width: 11px; height: 5px; border-radius: 2px 2px 0 0; background: var(--wp--preset--color--brand); }
.reefact-folder .back { position: absolute; inset: 3px 0 0; border-radius: 3px; background: var(--wp--preset--color--brand); }
.reefact-folder .sheet {
	position: absolute; left: 4px; right: 4px; bottom: 3px; height: 13px; border-radius: 2px;
	background: #FFFFFF; box-shadow: 0 0 0 1px #DCE6EE;
	transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
html.is-dark .reefact-folder .sheet { background: #EAF0F4; box-shadow: 0 0 0 1px #A9B5BF; }
.reefact-folder .s2 { transition-delay: .05s; }
.reefact-folder .s3 { transition-delay: .1s; }
.reefact-folder .front {
	position: absolute; left: 0; right: 0; bottom: 0; height: 13px; border-radius: 2px 2px 3px 3px;
	background: #2E98D1; transform-origin: bottom; transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.reefact-dossiers a:hover .front, .reefact-dossiers a:focus-visible .front { transform: perspective(60px) rotateX(-55deg); }
.reefact-dossiers a:hover .s1, .reefact-dossiers a:focus-visible .s1 { transform: translateY(-7px) rotate(-8deg); }
.reefact-dossiers a:hover .s2, .reefact-dossiers a:focus-visible .s2 { transform: translateY(-9px); }
.reefact-dossiers a:hover .s3, .reefact-dossiers a:focus-visible .s3 { transform: translateY(-7px) rotate(8deg); }
@media (prefers-reduced-motion: reduce) { .reefact-folder .front, .reefact-folder .sheet { transform: none !important; } }
