/* =========================================================================
   Chiwarà Project : fiche projet (CPT « projet »), version mixte.

   La mise en page (bandes, conteneurs, titres, surtitres, trait, boucle des
   projets liés, bande de contact, bouton) est dans le modèle Elementor
   « Fiche projet » (614), en classes globales chp-*.
   Cette feuille ne style que :
     - le contenu rendu par les codes courts [chiwara_fiche bloc="…"]
       (inc/chiwara-fiche.php) : galerie, données, statut, mini-carte,
       intervention, résultats, partenaires, techniques, pagination ;
     - ce qu'Elementor ne sait pas exprimer : rythme des paragraphes de la
       présentation, survol d'une carte qui agit sur ses enfants, masquage
       des bandes vides (:has), image absente dans la boucle.
   Points de rupture alignés sur le kit : tablette ≤ 1199 px, mobile ≤ 767 px.
   ========================================================================= */

.chp-fiche {
	--chp-encre: var(--couleur-espresso, #4F2F17);
	--chp-brun: var(--couleur-brun, #655045);
	--chp-sable: var(--couleur-sable-fiche, #EACF8C);
	--chp-creme: var(--couleur-creme, #FAF6EC);
	--chp-rouge: var(--couleur-rouge-bandeau, #9E292D);
	--chp-jaune: var(--couleur-jaune, #FFC824);
	--chp-jaune-clair: var(--couleur-jaune-clair, #FFDE7A);
	--chp-bordure: var(--couleur-bordure, #E0DDD3);
	--chp-sauge: var(--couleur-sauge, #8EBEA8);
	--chp-filet-clair: rgba(250, 246, 236, 0.32);
	--chp-titres: var(--police-titres, "Barlow Condensed"), "Arial Narrow", sans-serif;
	--chp-texte: var(--police-texte, "Mulish"), "Segoe UI", Roboto, sans-serif;
	--chp-largeur: var(--largeur-conteneur, 1280px);
	--chp-marge: var(--marge-laterale, clamp(1.5rem, 0.62rem + 3.756vw, 4rem));
	--chp-gouttiere: var(--gouttiere, clamp(1rem, 0.648rem + 1.502vw, 2rem));
	--chp-lecture: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
	font-size: var(--taille-corps, clamp(1.0625rem, 1.041rem + 0.094vw, 1.125rem));
	line-height: 1.65;
	text-align: left;
}

/* Widgets v3 (code court, contenu de l'article) dans les conteneurs atomiques : pleine largeur. */
.chp-fiche .elementor-widget-shortcode,
.chp-fiche .elementor-widget-theme-post-content { width: 100%; max-width: 100%; }
.chp-fiche .elementor-shortcode { display: block; }
.chp-fiche .e-collection-loop-item, .chp-fiche [role="listitem"] { min-width: 0; }

/* Remise à zéro sans spécificité, pour le contenu des codes courts uniquement. */
:where(.chp-fiche .elementor-shortcode) :where(h1, h2, h3, p, ul, ol, dl, dd, figure) { margin: 0; padding: 0; }
:where(.chp-fiche .elementor-shortcode) :where(ul, ol) { list-style: none; }
:where(.chp-fiche .elementor-shortcode) :where(img) { display: block; max-width: 100%; height: auto; }
:where(.chp-fiche .elementor-shortcode) :where(a) { color: inherit; }
.chp-fiche :focus-visible { outline: 2px solid var(--chp-encre); outline-offset: 3px; }
.chp-fiche .chp-bande-rouge :focus-visible { outline-color: #FFFFFF; }

/* ---------- Bandes sans contenu : masquées (visibles en grisé dans l'éditeur) ---------- */
.chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) { display: none; }
body.elementor-editor-active .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) { display: flex; opacity: 0.45; outline: 2px dashed var(--chp-rouge); outline-offset: -6px; }
/* Deux bandes blanches rendues côte à côte par le masquage des bandes vides : filet de séparation. */
.chp-bande-blanc + .chp-bande-blanc,
.chp-bande-blanc + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-blanc,
.chp-bande-blanc + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-blanc,
.chp-bande-blanc + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-conditionnelle:not(:has(.chp-bloc-rempli)) + .chp-bande-blanc { border-top: 1px solid var(--chp-bordure); }

/* ---------- Pastille de statut ---------- */
.chp-badge {
	display: inline-flex;
	align-items: center;
	min-height: 1.625rem;
	padding: 0.15rem 0.7rem;
	border-radius: 2px;
	font-family: var(--chp-texte);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--chp-encre);
	background: transparent;
	box-shadow: inset 0 0 0 1.5px currentColor;
}
.chp-badge--acheve { background: var(--chp-sauge); box-shadow: none; }
.chp-badge--en-cours { background: var(--chp-jaune); box-shadow: none; }

/* ---------- Listes à tirets ---------- */
.chp-tirets li { position: relative; padding-left: 2rem; }
.chp-tirets li + li { margin-top: 0.6rem; }
.chp-tirets li::before { content: ""; position: absolute; left: 0; top: 0.82em; width: 1rem; height: 1.5px; background: currentColor; }

/* ---------- Galerie : grande image, flèches, défilement, vignettes ---------- */
.chp-galerie { background: #FFFFFF; }
.chp-galerie__scene {
	position: relative;
	width: 100%;
	aspect-ratio: 2 / 1;
	max-height: min(680px, calc(100vh - var(--hauteur-entete, 88px) - 7rem));
	min-height: 260px;
	overflow: hidden;
	background: #1E140C;
	touch-action: pan-y;
}
.chp-galerie__vue { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 0.7s ease, visibility 0s linear 0.7s; }
.chp-galerie__vue.est-active { opacity: 1; visibility: visible; transition: opacity 0.7s ease, visibility 0s; }
.chp-galerie__vue img { width: 100%; height: 100%; object-fit: cover; }
.chp-galerie__credit {
	position: absolute;
	right: 1rem;
	bottom: 1rem;
	max-width: calc(100% - 12rem);
	padding: 0.3rem 0.65rem;
	background: rgba(30, 20, 12, 0.78);
	color: #FFFFFF;
	font-size: 0.8125rem;
	line-height: 1.35;
	letter-spacing: 0.02em;
}
.chp-galerie__fleche {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.25rem;
	height: 3.25rem;
	margin-top: -1.625rem;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(255, 255, 255, 0.92);
	color: var(--chp-encre);
	cursor: pointer;
	transition: background-color 0.16s ease, color 0.16s ease;
}
.chp-galerie__fleche:hover { background: var(--chp-rouge); color: #FFFFFF; }
.chp-galerie__fleche--prec { left: var(--chp-marge); }
.chp-galerie__fleche--suiv { right: var(--chp-marge); }
.chp-galerie__fleche svg, .chp-galerie__lecture svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
.chp-galerie__barre {
	position: absolute;
	left: 1rem;
	bottom: 1rem;
	z-index: 2;
	display: flex;
	align-items: center;
	background: rgba(30, 20, 12, 0.78);
	color: #FFFFFF;
}
.chp-galerie__lecture {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}
.chp-galerie__lecture:hover { background: var(--chp-rouge); }
.chp-galerie__lecture .chp-icone-lecture { display: none; }
.chp-galerie.est-en-pause .chp-galerie__lecture .chp-icone-pause { display: none; }
.chp-galerie.est-en-pause .chp-galerie__lecture .chp-icone-lecture { display: block; }
.chp-galerie__compteur { padding: 0 0.75rem 0 0.25rem; font-size: 0.8125rem; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.chp-galerie__vignettes { max-width: calc(var(--chp-largeur) + 2 * var(--chp-marge)); margin: 0 auto; padding: 0.875rem var(--chp-marge) 0; }
.chp-galerie__vignettes ul { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: thin; padding-bottom: 0.875rem; }
.chp-galerie__vignette {
	position: relative;
	flex: none;
	width: 7.5rem;
	aspect-ratio: 3 / 2;
	padding: 0;
	border: 0;
	background: var(--chp-creme);
	cursor: pointer;
	opacity: 0.62;
	transition: opacity 0.16s ease;
}
.chp-galerie__vignette img { width: 100%; height: 100%; object-fit: cover; }
.chp-galerie__vignette::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.5rem; height: 3px; background: var(--chp-rouge); transform: scaleX(0); transition: transform 0.2s ease; }
.chp-galerie__vignette:hover, .chp-galerie__vignette[aria-current="true"] { opacity: 1; }
.chp-galerie__vignette[aria-current="true"]::after { transform: scaleX(1); }
.chp-galerie--seule .chp-galerie__vignettes { display: none; }

/* ---------- Données (bande sable) ---------- */
.chp-donnees__grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(var(--chp-lignes, 2), auto); grid-auto-flow: column; gap: 1.75rem var(--chp-gouttiere); align-content: start; }
.chp-donnee { display: flex; flex-direction: column; gap: 0.3rem; }
.chp-donnee dt, .chp-role__libelle {
	font-family: var(--chp-texte);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--chp-brun);
}
.chp-donnee dd { font-family: var(--chp-titres); font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem); font-weight: 500; line-height: 1.22; color: var(--chp-encre); }

/* Mini-carte : posée sur le sable, sans tuile ; pays du projet en brique, blanc au survol. */
.chp-colonne-statut > .elementor-widget-shortcode { width: auto; }
.chp-minicarte { display: block; width: 12rem; max-width: 100%; color: var(--chp-rouge); text-decoration: none; }
.chp-minicarte svg { display: block; width: 100%; height: auto; overflow: visible; }
.chp-minicarte .pays { fill: rgba(255, 255, 255, 0.3); stroke: var(--chp-rouge); stroke-opacity: 0.5; stroke-width: 0.7px; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill 0.25s ease; }
.chp-minicarte .pays path { vector-effect: non-scaling-stroke; }
.chp-minicarte .pays.est-projet { fill: var(--chp-rouge); stroke-opacity: 1; }
.chp-minicarte:is(a):is(:hover, :focus-visible) .pays.est-projet { fill: #FFFFFF; }
.chp-minicarte__legende { display: block; margin-top: 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.3; color: var(--chp-rouge); }
.chp-minicarte:is(a):is(:hover, :focus-visible) .chp-minicarte__legende { color: var(--chp-encre); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Titre et présentation (bande blanche) ---------- */
.chp-presentation, .chp-presentation p { font-size: var(--chp-lecture); line-height: 1.7; color: var(--chp-encre); }
.chp-presentation p { max-width: 68ch; margin: 0; }
.chp-presentation p + p { margin-top: 1.1em; }
.chp-fiche .ch-fil-ariane { margin: 0; }
.chp-fiche .ch-fil-ariane ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; list-style: none; }
.chp-fiche .ch-fil-ariane li { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--chp-texte); font-size: 0.8125rem; font-weight: 600; line-height: 1.6; letter-spacing: 0.06em; text-transform: uppercase; color: var(--chp-brun); }
.chp-fiche .ch-fil-ariane li + li::before { content: "›"; color: var(--chp-brun); }
.chp-fiche .ch-fil-ariane a { color: var(--chp-rouge); text-decoration: none; }
.chp-fiche .ch-fil-ariane a:hover { color: var(--chp-encre); text-decoration: underline; text-underline-offset: 3px; }
.chp-fiche .ch-fil-ariane [aria-current="page"] { color: var(--chp-encre); }

/* ---------- Notre intervention (bande crème) ---------- */
.chp-intervention { font-size: var(--chp-lecture); line-height: 1.65; }

/* ---------- Résultats (bande rouge) ---------- */
.chp-resultats { color: var(--chp-creme); }
.chp-chiffres { display: flex; flex-wrap: wrap; }
.chp-chiffre { flex: 1 1 0; min-width: 11rem; padding: 0.5rem var(--chp-gouttiere) 0.5rem 0; }
.chp-chiffre + .chp-chiffre { padding-left: var(--chp-gouttiere); border-left: 1px solid var(--chp-filet-clair); }
.chp-chiffre__ligne { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.5rem; }
.chp-chiffre__valeur { font-family: var(--chp-titres); font-size: var(--taille-chiffre, clamp(2.75rem, 2.134rem + 2.629vw, 4.5rem)); font-weight: 500; line-height: 1; letter-spacing: 0.01em; color: var(--chp-jaune); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chp-chiffre__unite { font-family: var(--chp-titres); font-size: 1.375rem; font-weight: 500; line-height: 1.1; letter-spacing: 0.02em; color: #FFFFFF; }
.chp-chiffre__libelle { margin-top: 0.6rem; max-width: 26ch; font-size: 0.9375rem; line-height: 1.5; color: var(--chp-creme); }
.chp-resultats__liste { columns: 2 20rem; column-gap: calc(var(--chp-gouttiere) * 2); font-size: var(--chp-lecture); }
.chp-resultats__liste li { break-inside: avoid; }
.chp-chiffres + .chp-resultats__liste { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--chp-filet-clair); font-size: inherit; }
.chp-resultats__source { margin-top: 2rem; font-size: 0.8125rem; letter-spacing: 0.02em; color: rgba(250, 246, 236, 0.86); }

/* ---------- Partenaires (bande blanche) ---------- */
.chp-roles { width: 100%; }
.chp-role { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 0.5rem var(--chp-gouttiere); align-items: center; padding: 1.5rem 0; border-top: 1px solid var(--chp-bordure); }
.chp-role:last-child { border-bottom: 1px solid var(--chp-bordure); }
.chp-role__noms { display: flex; flex-direction: column; gap: 0.875rem; }
.chp-partenaire { display: flex; align-items: center; gap: 1.25rem; }
.chp-partenaire__logo { display: flex; flex: none; align-items: center; justify-content: center; width: 9rem; height: 4.5rem; padding: 0.625rem 0.875rem; border: 1px solid var(--chp-bordure); background: #FFFFFF; }
.chp-partenaire__logo img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.chp-partenaire__nom { font-family: var(--chp-titres); font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem); font-weight: 500; line-height: 1.2; color: var(--chp-encre); }
.chp-partenaire__nom a { text-decoration: none; }
.chp-partenaire__nom a:hover { color: var(--chp-rouge); text-decoration: underline; text-underline-offset: 3px; }
.chp-partenaire__precision { display: block; margin-top: 0.15rem; font-family: var(--chp-texte); font-size: 0.875rem; font-weight: 400; line-height: 1.4; color: var(--chp-brun); }
.chp-justificatif { display: flex; align-items: flex-start; gap: 0.875rem; font-family: var(--chp-titres); font-size: clamp(1.15rem, 1.08rem + 0.3vw, 1.3rem); font-weight: 500; line-height: 1.3; color: var(--chp-encre); }
.chp-justificatif svg { flex: none; width: 24px; height: 24px; margin-top: 0.05rem; fill: none; stroke: var(--chp-rouge); stroke-width: 1.75; }

/* ---------- Techniques (bande sable) ---------- */
.chp-techniques__liste { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem var(--chp-gouttiere); }
.chp-technique { display: flex; flex-direction: column; gap: 0.875rem; }
.chp-technique__cadre { aspect-ratio: 2 / 1; overflow: hidden; background: var(--chp-creme); }
.chp-technique__cadre img { width: 100%; height: 100%; object-fit: cover; }
.chp-technique__numero { padding-top: 1rem; border-top: 1px solid rgba(79, 47, 23, 0.35); font-family: var(--chp-titres); font-size: 2.25rem; font-weight: 500; line-height: 1; color: var(--chp-rouge); font-variant-numeric: tabular-nums; }
.chp-technique .chp-h3 { font-family: var(--chp-titres); font-size: clamp(1.375rem, 1.25rem + 0.5vw, 1.625rem); font-weight: 500; line-height: 1.15; letter-spacing: 0.01em; color: var(--chp-encre); }
.chp-technique p { font-size: 1rem; line-height: 1.65; }

/* ---------- Projets liés (boucle Elementor) et pagination ---------- */
.chp-lies-groupe:not(:has(.chp-carte)) { display: none; }
.chp-carte-cadre:not(:has(img[src]:not([src=""]))) { display: none; }
.chp-carte-cadre:has(img[src]:not([src=""])) + .chp-carte-vide { display: none; }
.chp-carte-image { transition: transform 0.5s ease; }
.chp-carte:hover .chp-carte-image { transform: scale(1.03); }
.chp-carte:hover .chp-carte-titre { color: var(--chp-rouge); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.chp-carte .chp-badge { margin-top: 0.25rem; }
.chp-carte .elementor-widget-shortcode { width: auto; }
.chp-pagination { display: flex; justify-content: space-between; gap: var(--chp-gouttiere); margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--chp-bordure); }
.chp-contenu:not(:has(.chp-carte)) .chp-pagination { margin-top: 0; }
.chp-pagination a { display: flex; flex-direction: column; gap: 0.25rem; max-width: 45%; text-decoration: none; color: var(--chp-encre); }
.chp-pagination .chp-pagination__suivant { margin-left: auto; text-align: right; align-items: flex-end; }
.chp-pagination__sens { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chp-rouge); }
.chp-pagination__titre { font-family: var(--chp-titres); font-size: 1.3rem; font-weight: 500; line-height: 1.2; }
.chp-pagination a:hover .chp-pagination__titre { color: var(--chp-rouge); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Tablettes (≤ 1199 px, comme le kit) ---------- */
@media (max-width: 1199px) {
	.chp-minicarte { width: 9rem; }
	.chp-techniques__liste { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
	.chp-chiffre { flex: 1 1 40%; padding-bottom: 1.5rem; }
	.chp-chiffre:nth-child(odd) { padding-left: 0; border-left: 0; }
}

/* ---------- Mobiles (≤ 767 px) ---------- */
@media (max-width: 767px) {
	.chp-galerie__scene { aspect-ratio: 4 / 3; max-height: none; }
	.chp-galerie__fleche { width: 2.75rem; height: 2.75rem; margin-top: -1.375rem; }
	.chp-galerie__fleche--prec { left: 0.5rem; }
	.chp-galerie__fleche--suiv { right: 0.5rem; }
	.chp-galerie__credit { left: auto; right: 0.5rem; bottom: 0.5rem; max-width: calc(100% - 8.5rem); font-size: 0.75rem; }
	.chp-galerie__barre { left: 0.5rem; bottom: 0.5rem; }
	.chp-galerie__vignette { width: 5.5rem; }
	.chp-donnees__grille { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-flow: row; gap: 1.25rem var(--chp-gouttiere); }
	.chp-role { grid-template-columns: minmax(0, 1fr); padding: 1.25rem 0; }
	.chp-partenaire__logo { width: 7rem; height: 3.75rem; }
	.chp-techniques__liste { grid-template-columns: minmax(0, 1fr); }
	.chp-chiffre { flex: 1 1 100%; padding-left: 0 !important; border-left: 0 !important; border-top: 1px solid var(--chp-filet-clair); padding-top: 1.25rem; }
	.chp-chiffre:first-child { border-top: 0; padding-top: 0.5rem; }
	.chp-pagination { flex-direction: column; }
	.chp-pagination a { max-width: none; }
}
@media (max-width: 520px) {
	.chp-donnees__grille { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
	.chp-galerie__vue, .chp-galerie__vue.est-active, .chp-carte-image, .chp-galerie__vignette::after { transition: none; }
}
