/*
Feuille dédiée aux pages d'article, chargée uniquement sur les articles.

Séparée de `style.css` pour deux raisons : le serveur FTP d'O2switch tronque
les transferts au-delà d'environ 16 Ko, et ce CSS n'a aucune raison de peser
sur l'accueil ou les archives.

Les jetons (`--gpc-*`) sont définis dans `style.css`, toujours chargée.
*/

/* ==========================================================================
   ARTICLE
   Les sélecteurs sont volontairement portés par `.single .entry-content` :
   le « CSS additionnel » du site est imprimé après cette feuille, ses règles
   `h2 {}` / `table {}` / `blockquote {}` gagneraient à spécificité égale.
   ========================================================================== */

/* --- Lisibilité du hero -------------------------------------------------- */

/* L'image de fond passait sous le titre blanc, avec une coupure nette au
   bord du bloc de texte. Un voile dégradé rend le titre lisible sur toute
   photo, sans toucher à l'Élément GP qui produit ce hero. */
.single .page-hero-block {
	position: relative;
}

/* L'image était en `contain`, calée à droite : elle laissait une coupure
   verticale nette au milieu du hero. En `cover`, elle remplit le bloc et le
   voile ci-dessous porte seul la lisibilité.
   Uniquement à partir de 769px : en dessous, le hero n'a volontairement pas
   d'image de fond, elle est affichée dans un bloc séparé. */
@media (min-width: 769px) {
	.single .page-hero-block::before {
		background-size: cover;
		background-position: center right;
	}
}

/* Remplace le voile discret de GenerateBlocks sur ce même pseudo-élément. */
.single .page-hero-block::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background: linear-gradient(
		90deg,
		rgba(23, 0, 79, 0.94) 0%,
		rgba(23, 0, 79, 0.90) 45%,
		rgba(23, 0, 79, 0.72) 75%,
		rgba(23, 0, 79, 0.35) 100%
	);
	pointer-events: none;
}

.single .page-hero-block > .gb-inside-container {
	position: relative;
	z-index: 1;
}

/* Sur les articles, l'en-tête se superpose au hero : le titre du site, en
   violet (`.main-title a { color: var(--accent) }`), devenait illisible sur la
   photo. Il passe en blanc ici seulement — sur l'accueil l'en-tête est sur
   fond blanc et le violet reste le bon choix. */
.single .site-header .main-title a,
.single .site-header .main-title a:hover,
.single .site-header .main-title a:focus {
	color: var(--gpc-white);
}

/* --- Colonne de lecture -------------------------------------------------- */

.single .entry-content {
	font-family: var(--gpc-sans);
	font-size: 1.0625rem;
	font-weight: 300;
	line-height: 1.75;
	color: var(--gpc-ink);
}

@media (min-width: 768px) {
	.single .entry-content {
		font-size: 1.125rem;
	}
}

.single .entry-content > * + * {
	margin-top: 1.35em;
}

.single .entry-content p {
	margin-bottom: 0;
	max-width: 68ch;
}

.single .entry-content strong {
	font-weight: 600;
	color: var(--gpc-ink);
}

.single .entry-content a:not(.gb-button) {
	color: var(--gpc-violet);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: text-decoration-thickness 160ms var(--gpc-ease);
}

.single .entry-content a:not(.gb-button):hover,
.single .entry-content a:not(.gb-button):focus-visible {
	text-decoration-thickness: 2px;
}

.single .entry-content a:not(.gb-button):focus-visible,
.single .entry-meta a:focus-visible,
.single .entry-content > ol:has(a[href^="#"]) > li > a:focus-visible {
	outline: 3px solid var(--gpc-violet);
	outline-offset: 2px;
}

/* Le JSON-LD est enveloppé dans un <p> par l'éditeur : il laissait un blanc. */
.single .entry-content p:has(> script) {
	display: none;
}

/* --- Titres -------------------------------------------------------------- */

/* Filet or au-dessus des h2 : même repère que les intertitres de l'accueil. */
.single .entry-content h2 {
	margin: 3.25rem 0 1.1rem;
	padding-top: 1.5rem;
	font-family: var(--gpc-display);
	font-size: clamp(1.35rem, 2.6vw, 1.75rem);
	font-weight: 400;
	line-height: 1.25;
	color: var(--gpc-ink);
	border-top: 2px solid transparent;
	background-image: linear-gradient(var(--gpc-or), var(--gpc-or));
	background-repeat: no-repeat;
	background-position: 0 0;
	background-size: 2.5rem 2px;
}

.single .entry-content h3 {
	margin: 2.25rem 0 0.75rem;
	font-family: var(--gpc-sans);
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--gpc-ink);
}

.single .entry-content h2 + h3 {
	margin-top: 1.5rem;
}

/* --- Encadré « L'essentiel à retenir » ----------------------------------- */

/* L'éditeur pose `style="background: lightblue"` en inline : seul !important
   peut le reprendre. */
.single .entry-content p[style*="lightblue"] {
	max-width: none;
	margin-top: 0;
	margin-bottom: 2rem;
	padding: 1.4rem 1.5rem 1.4rem 1.65rem !important;
	border-left: 3px solid var(--gpc-violet);
	border-radius: 0 var(--gpc-radius-sm) var(--gpc-radius-sm) 0;
	background: var(--gpc-paper) !important;
	font-size: 1rem;
	line-height: 1.7;
	color: var(--gpc-ink);
}

/* --- Sommaire ------------------------------------------------------------ */

/* Cible la liste ordonnée dont les puces pointent vers des ancres : c'est le
   sommaire, jamais une énumération de contenu. */
.single .entry-content > ol:has(a[href^="#"]) {
	max-width: 34rem;
	margin: 2rem 0;
	padding: 1.5rem 1.75rem 1.6rem;
	border: 1px solid var(--gpc-line);
	border-radius: var(--gpc-radius-sm);
	background: var(--gpc-white);
	list-style: none;
	counter-reset: gpc-toc;
}

.single .entry-content > ol:has(a[href^="#"])::before {
	content: "Sommaire";
	display: block;
	margin-bottom: 1rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--gpc-or-text);
}

.single .entry-content > ol:has(a[href^="#"]) > li {
	counter-increment: gpc-toc;
	position: relative;
	margin: 0;
	padding: 0.45rem 0 0.45rem 2.15rem;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.single .entry-content > ol:has(a[href^="#"]) > li::before {
	content: counter(gpc-toc, decimal-leading-zero);
	position: absolute;
	left: 0;
	top: 0.5rem;
	font-size: 0.75rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--gpc-violet);
}

.single .entry-content > ol:has(a[href^="#"]) > li > a {
	text-decoration: none;
	color: var(--gpc-ink);
}

.single .entry-content > ol:has(a[href^="#"]) > li > a:hover,
.single .entry-content > ol:has(a[href^="#"]) > li > a:focus-visible {
	color: var(--gpc-violet);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Les articles d'ancien format ont déjà un vrai titre « Sommaire » juste avant
   la liste : on n'en ajoute pas un second. */
.single .entry-content > h2 + ol:has(a[href^="#"])::before,
.single .entry-content > h3 + ol:has(a[href^="#"])::before {
	content: none;
}

/* L'ancre ne doit pas atterrir sous l'en-tête collant. */
.single .entry-content h2[id],
.single .entry-content h3[id] {
	scroll-margin-top: 6rem;
}

/* --- Listes de contenu --------------------------------------------------- */

.single .entry-content > ul,
.single .entry-content > ol:not(:has(a[href^="#"])) {
	max-width: 66ch;
	/* GeneratePress pose `ol,ul{margin:0 0 1.5em 3em}` : sans redéclaration, les
	   listes se retrouvaient indentées de 74px au lieu de 20px, et leur marge
	   basse cassait le rythme de `> * + *`. */
	margin-left: 0;
	margin-bottom: 0;
	padding-left: 1.25rem;
}

.single .entry-content > ul li,
.single .entry-content > ol:not(:has(a[href^="#"])) li {
	margin-bottom: 0.55em;
	padding-left: 0.35rem;
}

.single .entry-content > ul li::marker {
	color: var(--gpc-violet);
}

.single .entry-content > ol:not(:has(a[href^="#"])) li::marker {
	font-weight: 600;
	color: var(--gpc-violet);
}

/* --- Tableau ------------------------------------------------------------- */

.single .entry-content table {
	width: 100%;
	margin: 2rem 0;
	border: 1px solid var(--gpc-line);
	border-radius: var(--gpc-radius-sm);
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
	font-size: 0.9375rem;
}

/* La plupart des tableaux sont enveloppés dans un <div style="overflow:auto">.
   Ce conteneur crée un contexte de formatage : la marge du tableau ne fusionne
   pas avec celle du conteneur et l'écart doublait (56px contre 32px). */
.single .entry-content > div:has(> table) {
	margin: 2rem 0;
}

.single .entry-content > div:has(> table) > table {
	margin: 0;
}

.single .entry-content th {
	padding: 0.9rem 1rem;
	border: 0;
	background: var(--gpc-violet);
	font-family: var(--gpc-sans);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-align: left;
	color: var(--gpc-white);
}

.single .entry-content td {
	padding: 0.85rem 1rem;
	border: 0;
	border-top: 1px solid var(--gpc-line);
	line-height: 1.6;
	vertical-align: top;
}

.single .entry-content tbody tr:nth-child(even) td {
	background: var(--gpc-paper);
}

/* Deux générations de balisage coexistent : certains tableaux n'ont pas de
   <thead> et logent la ligne d'en-tête dans <tbody>. `:nth-child` la compte,
   le zébrage se décalait d'une ligne. */
.single .entry-content tbody:has(> tr:first-child > th) tr:nth-child(odd) td {
	background: var(--gpc-paper);
}

.single .entry-content tbody:has(> tr:first-child > th) tr:nth-child(even) td {
	background: none;
}

/* --- Citation ------------------------------------------------------------ */

.single .entry-content blockquote {
	max-width: 60ch;
	margin: 2.25rem 0;
	padding: 0.25rem 0 0.25rem 1.5rem;
	border-left: 3px solid var(--gpc-or);
	border-radius: 0;
	background: none;
	font-size: 1.0625rem;
	font-weight: 400;
	font-style: normal;
	line-height: 1.7;
	color: var(--gpc-ink);
}

.single .entry-content blockquote p {
	max-width: none;
}

/* --- Pied d'article ------------------------------------------------------ */

.single .entry-meta {
	margin-top: 2.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--gpc-line);
	font-family: var(--gpc-sans);
	font-size: 0.8125rem;
	color: var(--gpc-ink-soft);
}

.single .entry-meta a {
	color: var(--gpc-violet);
	text-decoration: none;
}

.single .entry-meta a:hover,
.single .entry-meta a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* --- Colonne latérale ---------------------------------------------------- */

.single .sidebar .widget {
	font-family: var(--gpc-sans);
	font-size: 0.9375rem;
	font-weight: 300;
	line-height: 1.65;
	color: var(--gpc-ink-soft);
}

.single .sidebar .widget .widget-title {
	/* C'est un <h2> : sans marge déclarée ici, il récupérait
	   `h2 { margin: 40px 0 25px }` du CSS additionnel, soit 70px de vide
	   autour d'un surtitre de 11px. */
	margin: 0 0 1rem;
	font-family: var(--gpc-sans);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--gpc-or-text);
}
