/*
 * Derniers articles (accueil, avant le pied de page) : trois planches de bureau d'étude posées sur
 * un fond gris clair. Image en bichromie bleu nuit encadrée de repères de coupe, titre, chapô, puis
 * un cartouche (thème, lecture, flèche) dessiné comme celui du pied de page. Survol : couleurs,
 * repères qui s'écartent en orange, flèche orange, planche qui se soulève. Tout en CSS.
 */

.cp-main > .cp-news-part { margin-block: 0; }

.cp-news {
	--cp-news-navy: var(--wp--preset--color--navy, #000033);
	--cp-news-blueprint: #1C2F8F;
	--cp-news-orange: var(--wp--preset--color--orange, #FF9900);
	--cp-news-mute: var(--wp--preset--color--mute, #555B6B);
	--cp-news-mist: var(--wp--preset--color--mist, #F3F4F8);
	--cp-news-line: #D9DCE6;
	--cp-news-ease: cubic-bezier(.65, 0, .25, 1);
	margin: 0 !important;
	padding-block: clamp(72px, 9vw, 120px);
	background: var(--cp-news-mist);
}
.cp-news,
.cp-news * { box-sizing: border-box; }
.cp-news > *,
.cp-news__head > * { margin-block: 0 !important; }

.cp-news .cp-news__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; margin-bottom: clamp(32px, 4vw, 52px) !important; }
.cp-news .cp-news__heading { color: var(--cp-news-navy); font-size: clamp(30px, 3.4vw, 50px); line-height: 1.08; font-weight: 700; letter-spacing: -.01em; }
.cp-news__all a { display: inline-flex; align-items: center; gap: 10px; padding-bottom: 4px; border-bottom: 2px solid var(--cp-news-orange); color: var(--cp-news-navy); font-weight: 700; text-decoration: none; }
.cp-news__all a::after {
	content: "";
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M2 8h11M9 4l4 4-4 4' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M2 8h11M9 4l4 4-4 4' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform .2s;
}
.cp-news__all a:hover::after { transform: translateX(3px); }
.cp-news__all a:focus-visible { outline: 2px solid var(--cp-news-orange); outline-offset: 4px; }

/* ---------- Planches (bloc acf/latest-posts) ---------- */
.cp-news .cp-news__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 36px); margin: 0; padding: 0; list-style: none; }
.cp-news__item { display: flex; min-width: 0; margin: 0; }
.cp-news .cp-news__sheet { display: flex; flex-direction: column; width: 100%; border: 1px solid var(--cp-news-line); border-radius: 8px; background: #fff; color: inherit; text-decoration: none; box-shadow: 0 1px 0 rgba(0, 0, 51, .04); transition: box-shadow .5s var(--cp-news-ease), transform .5s var(--cp-news-ease); }
.cp-news__sheet:hover { box-shadow: 0 30px 60px -30px rgba(0, 0, 51, .35); transform: translateY(-4px); }
.cp-news__sheet:focus-visible { outline: 2px solid var(--cp-news-orange); outline-offset: 4px; }

/* Image en bichromie (gris + calque bleu en mode « couleur » + trame), repères de coupe aux angles. */
.cp-news__fig { position: relative; display: block; margin: 18px 18px 0; }
.cp-news__img { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 8px; background: var(--cp-news-navy); }
.cp-news .cp-news__img img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.08) brightness(1.06); transform: scale(1.04); transition: filter .7s var(--cp-news-ease), transform 1.2s var(--cp-news-ease); }
.cp-news__img::after { content: ""; position: absolute; inset: 0; background: var(--cp-news-blueprint); mix-blend-mode: color; pointer-events: none; transition: opacity .7s var(--cp-news-ease); }
.cp-news__img::before { content: ""; position: absolute; inset: 0; z-index: 1; background-image: linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 24px 24px; pointer-events: none; transition: opacity .7s var(--cp-news-ease); }
.cp-news__sheet:hover .cp-news__img img,
.cp-news__sheet:focus-visible .cp-news__img img { filter: none; transform: none; }
.cp-news__sheet:hover .cp-news__img::after,
.cp-news__sheet:hover .cp-news__img::before,
.cp-news__sheet:focus-visible .cp-news__img::after,
.cp-news__sheet:focus-visible .cp-news__img::before { opacity: 0; }
.cp-news__fig i { position: absolute; width: 14px; height: 14px; border: 0 solid var(--cp-news-navy); transition: transform .5s var(--cp-news-ease), border-color .3s; }
.cp-news__fig i:nth-of-type(1) { left: -8px; top: -8px; border-left-width: 1.5px; border-top-width: 1.5px; }
.cp-news__fig i:nth-of-type(2) { right: -8px; top: -8px; border-right-width: 1.5px; border-top-width: 1.5px; }
.cp-news__fig i:nth-of-type(3) { left: -8px; bottom: -8px; border-left-width: 1.5px; border-bottom-width: 1.5px; }
.cp-news__fig i:nth-of-type(4) { right: -8px; bottom: -8px; border-right-width: 1.5px; border-bottom-width: 1.5px; }
.cp-news__sheet:hover .cp-news__fig i { border-color: var(--cp-news-orange); }
.cp-news__sheet:hover .cp-news__fig i:nth-of-type(1) { transform: translate(-4px, -4px); }
.cp-news__sheet:hover .cp-news__fig i:nth-of-type(2) { transform: translate(4px, -4px); }
.cp-news__sheet:hover .cp-news__fig i:nth-of-type(3) { transform: translate(-4px, 4px); }
.cp-news__sheet:hover .cp-news__fig i:nth-of-type(4) { transform: translate(4px, 4px); }

.cp-news__body { flex: 1; padding: 24px 22px 26px; }
.cp-news__body > * { margin: 0; }
.cp-news .cp-news__title { color: var(--cp-news-navy); font-size: clamp(20px, 1.6vw, 24px); line-height: 1.22; font-weight: 700; text-wrap: balance; }
.cp-news .cp-news__excerpt { margin-top: 12px; color: var(--cp-news-mute); font-size: 15px; line-height: 1.55; }

/* Cartouche : même dessin que celui du pied de page. */
.cp-news__tb { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; border-top: 1px solid var(--cp-news-line); }
.cp-news__cell { min-width: 0; padding: 12px 16px; border-right: 1px solid var(--cp-news-line); color: var(--cp-news-navy); font-size: 15px; font-weight: 600; line-height: 1.35; }
.cp-news__cell small { display: block; margin-bottom: 2px; color: var(--cp-news-mute); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.cp-news__cell--time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-news__go { display: grid; place-items: center; background: #fff; color: var(--cp-news-navy); transition: background .4s var(--cp-news-ease); }
.cp-news__go svg { width: 20px; height: 20px; transition: transform .4s var(--cp-news-ease); }
.cp-news__sheet:hover .cp-news__go { background: var(--cp-news-orange); }
.cp-news__sheet:hover .cp-news__go svg { transform: translateX(3px); }

/* Tablette : une planche par ligne, image à gauche (3 cartes ne remplissent pas 2 colonnes). */
@media (max-width: 1000px) {
	.cp-news .cp-news__list { grid-template-columns: minmax(0, 1fr); }
	.cp-news .cp-news__sheet { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); grid-template-rows: 1fr auto; }
	.cp-news__fig { grid-row: 1 / 3; margin: 18px 0 18px 18px; }
	.cp-news__img { height: 100%; min-height: 200px; aspect-ratio: auto; }
}
@media (max-width: 600px) {
	.cp-news .cp-news__sheet { display: flex; }
	.cp-news__fig { margin: 14px 14px 0; }
	.cp-news__img { height: auto; min-height: 0; aspect-ratio: 3 / 2; }
	.cp-news__body { padding: 20px 18px 22px; }
	.cp-news__cell { padding: 10px 12px; }
}
/* Écrans tactiles : pas de survol, les images sont directement en couleurs. */
@media (hover: none) {
	.cp-news .cp-news__img img { filter: none; transform: none; }
	.cp-news__img::after,
	.cp-news__img::before { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.cp-news__sheet,
	.cp-news .cp-news__img img,
	.cp-news__fig i,
	.cp-news__go svg { transition: none; }
	.cp-news__sheet:hover { transform: none; }
}
