/* ==========================================================================
   Actualités : liste (index.php), archives, recherche, article seul (singular.php)
   Cartes .a-card reprises de l'accueil (style.css), en grille régulière sur la liste.
   ========================================================================== */

/* ---------- Liste ---------- */
/* Introduction réduite au titre : grand mot éditorial, la barre d'outils suit de près */
.news-page .page-hero { padding-bottom: clamp(28px, 4vh, 48px); }
.news-page:not(.news-page--search) .page-hero__title { font-size: clamp(48px, 8.6vw, 136px); line-height: .95; letter-spacing: -.035em; }
.news-page:not(.news-page--search) .page-hero__title .sec-title__muted { font-size: .42em; letter-spacing: -.01em; margin-top: .3em; }

.news {
	--a-bg: var(--b-creme); /* encoche des cartes = fond de la section */
	padding: 0 0 var(--section-y);
}

/* Barre d'outils : filtre par thème + recherche */
.news-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 32px;
	margin: 0 0 36px;
	padding-top: 24px;
	border-top: 1px solid var(--ink-line-strong);
}
.news-toolbar .search-bar { flex: 0 1 380px; margin: 0; }

/* Filtre par thème */
.filter { margin: 0; }
.filter__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.filter__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 0 18px;
	border-radius: 999px;
	border: 1px solid var(--ink-line-strong);
	font-family: var(--font-brand);
	font-weight: 500;
	font-size: 15px;
	color: var(--b-encre);
	transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
.filter__link:hover,
.filter__link:focus { color: var(--b-encre); border-color: var(--b-encre); }
.filter__link[aria-current="page"] { background: var(--b-encre); border-color: var(--b-encre); color: var(--b-creme); }
.filter__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--ink-fill);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}
.filter__link[aria-current="page"] .filter__count { background: var(--cream-fill); color: var(--b-creme); }

/* Grille régulière : toutes les cartes ont la même taille (3 / 2 / 1 colonnes) */
.news-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
}
.news-grid > .a-card { min-height: clamp(420px, 56vh, 500px); min-height: clamp(420px, 56svh, 500px); }
/* style.css étire chaque 3e carte en pleine largeur sous 991px (accueil) : pas ici. */
.news-grid > .a-card:nth-child(n),
.related__grid > .a-card:nth-child(n) { grid-column: auto; }

/* Pagination */
.pager-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-top: 48px; }
.pager { margin: 0; }
.pager__status { margin: 0; font-family: var(--font-brand); font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pager .nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pager .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	height: 48px;
	padding: 0 12px;
	border-radius: 16px;
	border: 1px solid var(--ink-line-strong);
	font-family: var(--font-brand);
	font-weight: 500;
	font-size: 16px;
	font-variant-numeric: tabular-nums;
	color: var(--b-encre);
	transition: background-color .25s ease, border-color .25s ease;
}
.pager a.page-numbers:hover,
.pager a.page-numbers:focus { color: var(--b-encre); border-color: var(--b-encre); }
.pager .page-numbers.current { background: var(--b-encre); border-color: var(--b-encre); color: var(--b-creme); }
.pager .page-numbers.dots { border-color: transparent; }
.pager .prev,
.pager .next { border: 0; background: var(--btn-icon); color: #fff; }
.pager .prev:hover, .pager .prev:focus,
.pager .next:hover, .pager .next:focus { color: #fff; background: var(--btn-label-to); }
.pager .next .icon { transform: rotate(180deg); }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 920px; }
.result {
	position: relative;
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 24px 24px 24px 28px;
	border-radius: 24px;
	background: var(--sable);
	transition: transform .3s var(--ease-out), background-color .3s ease;
}
.result:hover,
.result:focus-within { transform: translateY(-2px); background: #eedcc0; }
.result:focus-within { outline: 2px solid var(--b-encre); outline-offset: 3px; }
.result__link { flex: 1; display: flex; flex-direction: column; gap: 6px; color: var(--b-encre); }
.result__link:hover, .result__link:focus { color: var(--b-encre); outline: none; }
.result__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.result__type { font-family: var(--font-brand); font-size: 13px; color: var(--ink-soft); }
.result__title { font-family: var(--font-brand); font-weight: 600; font-size: 21px; line-height: 1.3; text-wrap: balance; }
.result__excerpt { font-family: var(--font-brand-text); font-size: 16px; line-height: 1.5; color: var(--ink-text); }
.result__btn {
	flex-shrink: 0;
	display: flex;
	padding: 14px;
	border-radius: 16px;
	background: var(--btn-icon);
	transition: transform .3s var(--ease-out);
}
.result__btn img { width: 20px; height: 20px; }
.result:hover .result__btn,
.result:focus-within .result__btn { transform: rotate(45deg); }

/* ---------- Article seul ---------- */
.post__head,
.post__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr);
	column-gap: clamp(32px, 4vw, 64px);
}
.post__head {
	align-items: start;
	padding-top: clamp(40px, 8vh, 96px);
	padding-bottom: clamp(36px, 6vh, 64px);
}
.post__head > .back-link { grid-column: 1; justify-self: start; margin-top: 2px; }
.post__intro { grid-column: 2 / 4; }
.post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 0 0 24px; }
.post__date {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 10px;
	margin: 0;
	font-family: var(--font-brand);
	font-size: 15px;
	color: var(--ink-soft);
}
.post__title { font-size: clamp(34px, 4.2vw, 60px); line-height: 1.04; max-width: 22ch; }

.post__media {
	width: 100%;
	height: auto;
	aspect-ratio: 12 / 5;
	max-height: 72vh;
	max-height: 72svh;
}

.post__layout {
	align-items: start;
	row-gap: 48px;
	padding-top: clamp(48px, 7vh, 88px);
	padding-bottom: var(--section-y);
}
.post__content { grid-column: 2; grid-row: 1; }
.post__aside { grid-column: 1; grid-row: 1; position: sticky; top: 32px; justify-self: start; }
.post__foot { grid-column: 2; padding-top: 32px; border-top: 1px solid var(--ink-line-strong); }

/* Partage */
.share__label { margin: 0 0 12px; font-family: var(--font-brand); font-size: 13px; color: var(--ink-soft); }
.share__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.share__btn {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	padding: 0;
	border: 0;
	background: none;
	font-family: var(--font-brand);
	font-size: 15px;
	color: var(--b-encre);
	cursor: pointer;
}
.share__btn[hidden] { display: none; }
.share__btn .icon {
	box-sizing: content-box;
	padding: 10px;
	border-radius: 14px;
	background: var(--ink-fill);
	transition: background-color .25s ease, color .25s ease;
}
.share__btn:hover,
.share__btn:focus { color: var(--b-encre); }
.share__btn:hover .icon,
.share__btn:focus-visible .icon { background: var(--btn-icon); color: #fff; }
.share__status { min-height: 1.4em; margin: 8px 0 0; font-family: var(--font-brand); font-size: 14px; color: var(--b-encre); }

/* « À lire aussi » */
.related {
	--a-bg: var(--sable);
	padding: var(--section-y) 0;
	background: var(--sable);
}
.related__head {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	justify-content: space-between;
	gap: 24px 48px;
	margin-bottom: 44px;
}
.related__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
}
.related .a-card { min-height: clamp(380px, 52vh, 500px); min-height: clamp(380px, 52svh, 500px); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.post__head,
	.post__layout { grid-template-columns: minmax(0, 1fr); }
	.post__head > .back-link,
	.post__intro,
	.post__content,
	.post__aside,
	.post__foot { grid-column: 1; grid-row: auto; }
	.post__intro { margin-top: 28px; }
	.post__aside { position: static; }
	.post__content, .post__foot, .post__aside { max-width: var(--measure); }
	.share__list { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }
}
@media (max-width: 991px) {
	.news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.news-toolbar .search-bar { flex: 1 1 100%; max-width: 560px; }
}
@media (max-width: 767px) {
	.post__media { aspect-ratio: 2 / 1; --ring-w: 7px; }
	.share__list { gap: 8px; }
	.share__btn .share__text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	.share__btn .icon { padding: 12px; }
	.related__head .related__all { display: none; }
	.result { padding: 20px; gap: 16px; }
	.result__title { font-size: 19px; }
}
@media (max-width: 640px) {
	.news-grid,
	.related__grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
	.news-grid > .a-card { min-height: 440px; }
	.filter__list { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
	.filter__link, .pager .page-numbers, .result, .result__btn, .share__btn .icon { transition: none; }
}

/* Barre de progression de lecture (créée par page-actualites.js, décorative) */
.read-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 60;
	height: 3px;
	background: linear-gradient(90deg, var(--b-lumiere), var(--b-corail));
	transform: scaleX(0);
	transform-origin: 0 50%;
	pointer-events: none;
}
.admin-bar .read-progress { top: 32px; }
@media (max-width: 782px) { .admin-bar .read-progress { top: 46px; } }

/* ==========================================================================
   Respiration : introduction → barre d'outils → grille → pagination,
   article → « À lire aussi » séparés par un vrai rythme vertical.
   ========================================================================== */
.news-page .page-hero { padding-bottom: clamp(48px, 7vh, 80px); }
.news-toolbar { margin-bottom: clamp(48px, 6vh, 72px); padding-top: 32px; gap: 20px 40px; }
.news-grid { gap: clamp(24px, 2.6vw, 40px); }
.pager-row { margin-top: clamp(64px, 8vh, 96px); padding-top: 32px; border-top: 1px solid var(--ink-line-strong); }
.results { gap: 20px; }

.post__head { padding-top: clamp(56px, 9vh, 112px); padding-bottom: clamp(48px, 7vh, 88px); }
.post__meta { margin-bottom: 32px; }
.post__layout { padding-top: clamp(72px, 10vh, 128px); padding-bottom: var(--sec-pad); row-gap: 72px; }
.post__foot { padding-top: 40px; }
.share__list { gap: 8px; }

.related { padding: var(--sec-pad) 0; }
.related__head { margin-bottom: clamp(48px, 6vh, 72px); }
.related__grid { gap: clamp(24px, 2.6vw, 40px); }

@media (max-width: 640px) {
	.news-grid,
	.related__grid { gap: 24px; }
	.news-toolbar { gap: 16px; }
}

/* Audit UX : premier paragraphe de l'article en chapeau (lecture plus confortable) */
.post__content > p:first-child {
	font-size: clamp(19px, 1.5vw, 22px);
	line-height: 1.6;
	color: var(--b-encre);
}
/* Tablette (colonne unique) : même mesure de lecture qu'au bureau (~75 caractères par ligne) */
@media (max-width: 1100px) {
	.post__content, .post__foot, .post__aside { max-width: 54ch; }
}

/* ---------- Grille selon le nombre d'articles : 1 = pleine largeur, 2 = deux colonnes, 3+ = trois colonnes max ---------- */
.news-grid:has(> :only-child),
.related__grid:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.news-grid:has(> :nth-child(2):last-child),
.related__grid:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.news-grid > .a-card:only-child .a-card__body { max-width: 640px; }

/* ---------- Mobile : la recherche passe au-dessus des catégories ---------- */
@media (max-width: 767px) {
	.news-toolbar { display: flex; flex-direction: column; align-items: stretch; }
	.news-toolbar .search-bar { order: -1; flex: 1 1 auto; max-width: none; width: 100%; }
}
@media (max-width: 640px) {
	.news-grid:has(> :nth-child(2):last-child),
	.related__grid:has(> :nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Audit mobile (2026-11-13)
   ========================================================================== */
/* Liste : le titre est la seule information de la carte, on le laisse respirer (3 lignes coupaient le titre). */
.news-grid .a-card__title,
.related .a-card__title { -webkit-line-clamp: 5; line-clamp: 5; }

/* Tablette : dès que la barre d'outils passe sur deux rangées, la recherche vient en premier (comme sur mobile). */
@media (max-width: 991px) {
	.news-toolbar .search-bar { order: -1; }
}
/* Tablette (2 colonnes) : un dernier article seul occupe toute la ligne au lieu d'une demi-case vide. */
@media (min-width: 641px) and (max-width: 991px) {
	.news-grid > .a-card:last-child:nth-child(odd):not(:only-child) { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
	/* Thèmes : une seule rangée qui défile au doigt, bord à bord, au lieu de deux ou trois rangées de pastilles.
	   (nowrap : en colonne multi-lignes, la largeur de la ligne suivrait le contenu et déborderait.) */
	.news-toolbar { flex-wrap: nowrap; }
	.filter {
		position: relative; /* bloc conteneur des textes masqués (.screen-reader-text) : sinon ils s'échappent et élargissent la page */
		margin: -6px calc(var(--gutter) * -1); /* l'espace vertical laisse passer l'anneau de focus */
		overflow-x: auto;
		overflow-y: hidden;
		overscroll-behavior-x: contain;
		scroll-snap-type: x proximity;
		scroll-padding-inline: var(--gutter);
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.filter::-webkit-scrollbar { display: none; }
	.filter__list { flex-wrap: nowrap; width: max-content; padding: 6px var(--gutter); }
	.filter__list > li { flex: 0 0 auto; scroll-snap-align: start; }
	.filter__link { white-space: nowrap; }

	/* Article : moins de vide entre texte, partage et lien retour. */
	.post__layout { row-gap: 48px; padding-top: clamp(48px, 8vh, 72px); }
	.post__foot { padding-top: 28px; }
	.share__label { font-size: 14px; }

	/* Résultats : le texte prend toute la largeur, la flèche passe en bas à droite. */
	.result { flex-direction: column; align-items: stretch; gap: 12px; padding: 20px 20px 16px; border-radius: 22px; }
	.result__btn { align-self: flex-end; padding: 12px; border-radius: 14px; }
	.result__type { font-size: 14px; }
}
/* Écrans tactiles (tablette, paysage) : pastilles de catégorie à 44px. */
@media (pointer: coarse) {
	.post__meta .tag { min-height: 44px; padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
	.filter { scroll-behavior: auto; }
}

/* ==========================================================================
   iOS Safari (2026-11-13)
   ========================================================================== */
/* Écrans tactiles : le :hover reste « collé » après un tapotement (carte décalée, flèche tournée, icône corail). */
@media (hover: none) {
	.filter__link:not([aria-current="page"]):hover { border-color: var(--ink-line-strong); }
	.pager a.page-numbers:not(.current):hover:not(:focus-visible) { border-color: var(--ink-line-strong); }
	.pager .prev:hover:not(:focus-visible),
	.pager .next:hover:not(:focus-visible) { background: var(--btn-icon); }
	.result:hover:not(:focus-within) { transform: none; background: var(--sable); }
	.result:hover:not(:focus-within) .result__btn { transform: none; }
	.share__btn:hover:not(:focus-visible) .icon { background: var(--ink-fill); color: inherit; }
}

/* Bureau (3 colonnes) : la dernière rangée est toujours pleine.
   Grille sur 6 pistes : 1 carte = 2 pistes ; 1 carte seule en fin de liste = toute la ligne ; 2 cartes = moitié chacune. */
@media (min-width: 992px) {
	.news-grid:has(> :nth-child(3)) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.news-grid:has(> :nth-child(3)) > .a-card { grid-column: span 2; }
	.news-grid > .a-card:last-child:nth-child(3n+1) { grid-column: 1 / -1; }
	.news-grid > .a-card:nth-last-child(2):nth-child(3n+1),
	.news-grid > .a-card:last-child:nth-child(3n+2) { grid-column: span 3; }
	.news-grid > .a-card:last-child:nth-child(3n+1) .a-card__body { max-width: 640px; }
}

/* Article : texte plus large (la colonne de droite restait vide). Bureau : colonnes 2 à 3 comme le titre,
   plafonné à 860 px (~85 caractères) ; tablette et mobile : toute la largeur du conteneur. */
.post__content, .post__foot { grid-column: 2 / 4; max-width: 860px; }
@media (max-width: 1100px) {
	.post__content, .post__foot, .post__aside { grid-column: 1; max-width: none; }
}
