/* Compostage Maroc : page article (body.cmpost) — complète guides.css */

/* --- Barre de progression de lecture -------------------------------------------- */
.cmpost-progress {
	position: fixed; z-index: 99; left: 0; right: 0; top: var(--cm-header-h, 76px); height: 4px; pointer-events: none;
	background: linear-gradient(90deg, var(--g-leaf), var(--g-green)); transform: scaleX(0); transform-origin: left;
}
.admin-bar .cmpost-progress { top: calc(var(--cm-header-h, 76px) + 32px); }

/* --- En-tête sur la terre -------------------------------------------------------- */
body.cmpost .cm-article__header {
	position: relative; isolation: isolate;
	padding: clamp(2.2rem, 1.5rem + 3vw, 4rem) 0 clamp(9rem, 6rem + 10vw, 15rem);
	background: radial-gradient(ellipse 70% 80% at 50% 40%, rgb(18 12 8 / .55), rgb(18 12 8 / .82)), var(--g-soil) url(/wp-content/uploads/cm-3d/soil-compost-maroc.webp) center / cover;
	color: var(--g-root); text-align: center;
}
body.cmpost .cm-article__header::after { /* bord de papier déchiré */
	content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: clamp(26px, 3vw, 46px);
	background: url(/wp-content/uploads/cm-3d/torn-edge.svg) 0 0 / 100% 100% no-repeat; filter: drop-shadow(0 -3px 4px rgb(0 0 0 / .3));
}
body.cmpost .cm-article__header .cm-container { max-width: calc(54rem + 2 * var(--cm-gutter, 1rem)); }
body.cmpost .cm-article__header .cm-breadcrumbs { display: flex; justify-content: center; margin-bottom: 1.6rem; color: var(--g-root-soft); }
body.cmpost .cm-article__header .cm-breadcrumbs ol { justify-content: center; }
body.cmpost .cm-article__header .cm-breadcrumbs a { color: var(--g-root) !important; }
body.cmpost .cm-article__header .cm-breadcrumbs li, body.cmpost .cm-article__header .cm-breadcrumbs [aria-current] { color: var(--g-root-soft) !important; }
@media (max-width: 700px) { body.cmpost .cm-article__header .cm-breadcrumbs li:last-child { display: none; } }
body.cmpost .cm-article__cat { margin: 0 0 1rem; animation: cmguides-rise .6s var(--g-ease) both; }
body.cmpost .cm-article__cat a {
	display: inline-flex; align-items: center; min-height: 36px; padding: .35rem 1rem; border-radius: 999px;
	background: var(--g-leaf); color: #1b2a12 !important; font-weight: 800; font-size: .92rem; text-decoration: none;
}
body.cmpost .cm-article__title {
	margin: 0 auto; max-width: 20ch; color: #fff; font-size: clamp(2.2rem, 1.3rem + 3.6vw, 4.2rem); line-height: 1.02; letter-spacing: -.02em;
	text-shadow: 0 2px 24px rgb(0 0 0 / .4); animation: cmguides-rise .7s var(--g-ease) both .08s;
}
body.cmpost .cm-article__lead {
	margin: 1.2rem auto 0; max-width: 42rem; color: var(--g-root); font-size: clamp(1.08rem, 1rem + .4vw, 1.3rem); line-height: 1.55;
	animation: cmguides-rise .7s var(--g-ease) both .16s;
}
body.cmpost .cm-article__meta {
	display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem; margin: 1.4rem 0 0; color: var(--g-root-soft); font-size: .95rem;
	animation: cmguides-rise .7s var(--g-ease) both .24s;
}
body.cmpost .cm-article__meta > span { display: inline-flex; align-items: center; gap: .45rem; }
body.cmpost .cm-article__meta > span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--g-leaf); }

/* --- Image à la une, à cheval sur le bord déchiré -------------------------------- */
body.cmpost .cm-article__figure {
	position: relative; z-index: 2; max-width: calc(64rem + 2 * var(--cm-gutter, 1rem));
	margin: calc(-1 * clamp(7rem, 4.5rem + 8vw, 12rem)) auto clamp(2rem, 1.5rem + 2vw, 3rem);
	animation: cmguides-rise .9s var(--g-ease) both .3s;
}
body.cmpost .cm-article__figure img { border-radius: 24px; box-shadow: 0 34px 60px -34px rgb(20 13 9 / .85); background: #efe6d3; }

/* --- Feuille de lecture ---------------------------------------------------------- */
body.cmpost .cm-article__content {
	position: relative; max-width: calc(46rem + 2 * clamp(1.25rem, .5rem + 4vw, 4rem));
	padding: clamp(1.6rem, 1rem + 3vw, 3.6rem) clamp(1.25rem, .5rem + 4vw, 4rem) !important;
	background: var(--g-card); border-radius: 24px; box-shadow: 0 1px 0 rgb(58 42 29 / .08), 0 30px 60px -44px rgb(36 25 18 / .75);
	color: var(--g-ink); font-size: 1.12rem; line-height: 1.75;
}
@media (max-width: 700px) { body.cmpost .cm-article__content { width: auto; margin-inline: .6rem; border-radius: 18px; } }
body.cmpost .cm-article__content > p { color: #4a3a2c; }
body.cmpost .cm-article__content > p:first-of-type::first-letter { /* lettrine */
	float: left; margin: .08em .12em 0 0; color: var(--g-forest); font-family: var(--cm-font-heading, Georgia, serif); font-weight: 800; font-size: 3.6em; line-height: .8;
}
body.cmpost .cm-article__content a { color: var(--g-forest); font-weight: 700; text-decoration: underline; text-decoration-color: rgb(82 127 58 / .45); text-decoration-thickness: 2px; text-underline-offset: .22em; }
body.cmpost .cm-article__content a:hover { text-decoration-color: var(--g-green); }
body.cmpost .cm-article__content > h2 {
	position: relative; margin: 2.6em 0 .7em; padding-top: 1.2rem; color: var(--g-forest); font-size: clamp(1.6rem, 1.3rem + 1.1vw, 2.2rem); line-height: 1.12; scroll-margin-top: calc(var(--cm-header-h, 76px) + 1.5rem);
}
body.cmpost .cm-article__content > h2::before { /* petite pousse au-dessus de chaque partie */
	content: ""; position: absolute; left: 0; top: -.4rem; width: 34px; height: 24px; background: url(/wp-content/uploads/cm-3d/home-mark.svg) left center / contain no-repeat;
}
body.cmpost .cm-article__content > h3 { margin: 1.8em 0 .5em; color: var(--g-ink); font-size: clamp(1.25rem, 1.1rem + .5vw, 1.45rem); line-height: 1.2; scroll-margin-top: calc(var(--cm-header-h, 76px) + 1.5rem); }
body.cmpost .cm-article__content > ul { list-style: none; padding: 0; margin: 0 0 1.4em; display: grid; gap: .55em; }
body.cmpost .cm-article__content > ul > li { position: relative; padding-left: 1.9rem; }
body.cmpost .cm-article__content > ul > li::before {
	content: ""; position: absolute; left: .3rem; top: .55em; width: .75rem; height: .42rem; border-left: 2.5px solid var(--g-green); border-bottom: 2.5px solid var(--g-green); transform: rotate(-45deg);
}
body.cmpost .cm-article__content > ol { list-style: none; padding: 0; margin: 0 0 1.4em; display: grid; gap: .7em; counter-reset: cmol; }
body.cmpost .cm-article__content > ol > li { position: relative; padding-left: 2.9rem; counter-increment: cmol; min-height: 2rem; }
body.cmpost .cm-article__content > ol > li::before {
	content: counter(cmol); position: absolute; left: 0; top: .05em; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
	background: var(--g-forest); color: #fff; font-weight: 800; font-size: .95rem; line-height: 1;
}
body.cmpost .cm-article__content figure, body.cmpost .cm-article__content .wp-block-image { margin: 2em 0; }
body.cmpost .cm-article__content figure img, body.cmpost .cm-article__content .wp-block-image img { width: 100%; height: auto; border-radius: 16px; box-shadow: 0 20px 40px -30px rgb(20 13 9 / .8); }
body.cmpost .cm-article__content figcaption { margin-top: .6rem; color: var(--g-soft); font-size: .92rem; text-align: center; }
body.cmpost .cm-article__content .wp-block-image img[class*="wp-image-"] { max-height: min(74vh, 640px); object-fit: cover; }
body.cmpost .cm-article__content figcaption small { display: block; margin-top: .2rem; font-size: .8rem; opacity: .8; }
body.cmpost .cm-article__content figcaption small a { color: inherit; }
body.cmpost .cm-article__content blockquote {
	margin: 2em 0; padding: 1.2rem 1.4rem; border: 0; border-left: 4px solid var(--g-leaf); border-radius: 0 14px 14px 0; background: #efe6d3;
	font-family: var(--cm-font-heading, Georgia, serif); font-size: 1.2rem; font-style: italic; color: var(--g-ink);
}
body.cmpost .cm-article__content table { width: 100%; border-collapse: collapse; font-size: 1rem; }
body.cmpost .cm-article__content th, body.cmpost .cm-article__content td { padding: .7rem .8rem; border-bottom: 1px solid rgb(58 42 29 / .14); text-align: left; }
body.cmpost .cm-article__content th { background: #efe6d3; color: var(--g-ink); }

/* --- Sommaire -------------------------------------------------------------------- */
.cmpost-toc { margin: 0 0 2rem; border-radius: 16px; background: #efe6d3; font-size: 1rem; line-height: 1.4; }
.cmpost-toc summary {
	display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; padding: .8rem 1.2rem; cursor: pointer; list-style: none;
	color: var(--g-forest); font-weight: 800; font-family: var(--cm-font-heading, Georgia, serif); font-size: 1.2rem;
}
.cmpost-toc summary::-webkit-details-marker { display: none; }
.cmpost-toc summary::after { content: ""; width: .6rem; height: .6rem; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .25s var(--g-ease); }
.cmpost-toc[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.cmpost-toc ol { list-style: none; margin: 0; padding: 0 1.2rem 1.1rem; display: grid; gap: .15rem; counter-reset: toc; }
.cmpost-toc li { counter-increment: toc; }
.cmpost-toc a {
	position: relative; display: block; padding: .45rem .6rem .45rem 2.1rem; border-radius: 10px; color: var(--g-soft) !important; text-decoration: none !important; font-weight: 600 !important;
	transition: background-color .2s, color .2s;
}
.cmpost-toc a::before { content: counter(toc); position: absolute; left: .6rem; top: .45rem; color: var(--g-green); font-weight: 800; font-size: .9rem; }
.cmpost-toc a:hover { background: rgb(255 255 255 / .55); color: var(--g-ink) !important; }
.cmpost-toc a.is-active { background: var(--g-forest); color: #fff !important; }
.cmpost-toc a.is-active::before { color: var(--g-leaf); }
.cmpost-toc a:focus-visible { outline: 3px solid #f2b632; outline-offset: 2px; }
/* grand écran : sommaire fixe dans la marge gauche de la feuille */
@media (min-width: 1440px) {
	.cmpost-toc-wrap.is-rail { position: absolute; top: 0; bottom: 0; right: calc(100% + 1.6rem); width: 220px; }
	.cmpost-toc-wrap.is-rail .cmpost-toc {
		position: sticky; top: calc(var(--cm-header-h, 76px) + 1.6rem); margin: 0; max-height: calc(100vh - var(--cm-header-h, 76px) - 3.2rem); overflow: auto;
		background: rgb(251 248 241 / .85);
	}
	.cmpost-toc-wrap.is-rail summary { pointer-events: none; min-height: 0; padding: .8rem .9rem .5rem; }
	.cmpost-toc-wrap.is-rail summary::after { display: none; }
	.cmpost-toc-wrap.is-rail ol { padding: 0 .4rem .6rem; font-size: .95rem; }
}

/* --- Pied d'article et « À lire aussi » ------------------------------------------ */
body.cmpost .cm-article__footer { max-width: calc(46rem + 2 * var(--cm-gutter, 1rem)); margin-top: 1.8rem; }
body.cmpost .cm-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
body.cmpost .cm-tags a {
	display: inline-flex; align-items: center; min-height: 40px; padding: .4rem 1rem; border-radius: 999px; border: 1.5px solid rgb(58 42 29 / .25);
	background: var(--g-card); color: var(--g-ink) !important; font-weight: 700; font-size: .95rem; text-decoration: none;
}
body.cmpost .cm-tags a::before { content: "#"; margin-right: .2rem; color: var(--g-green); }
body.cmpost .cm-tags a:hover { border-color: var(--g-forest); }
body.cmpost .cm-related { margin-top: clamp(3rem, 2rem + 3vw, 5rem); padding: 0; background: none; border: 0; }
body.cmpost .cm-related .cm-container { max-width: 1240px; }
body.cmpost .cm-related__title { margin: 0 0 1.4rem; color: var(--g-forest); font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.6rem); }

@media (prefers-reduced-motion: reduce) {
	body.cmpost .cm-article__cat, body.cmpost .cm-article__title, body.cmpost .cm-article__lead, body.cmpost .cm-article__meta, body.cmpost .cm-article__figure { animation: none; }
	.cmpost-progress { display: none; }
}
