/*
Theme Name: Corentin Beaufort
Theme URI: https://corentinbeaufort.fr
Description: Thème enfant de Zeen pour corentinbeaufort.fr — cuisine, marketing digital, seconde main.
Author: Corentin Beaufort
Author URI: https://corentinbeaufort.fr
Template: zeen
Version: 1.10.0
Requires PHP: 8.0
Text Domain: zeen-child
*/

/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
	/* Palette « encre et papier » : fond papier, grandes surfaces à l'encre, bleu en touches */
	--cb-bg: #FAF8F3;
	--cb-paper: #FAF8F3;
	--cb-tint: #F1EDE3;
	--cb-surface: #FFFFFF;
	--cb-ink: #14172A;
	--cb-ink-soft: #4B5068;
	--cb-line: #E3E1DA;
	--cb-blue: #1738BA;
	--cb-blue-dark: #0F2A94;
	--cb-blue-tint: #EEF1FB;
	--cb-font-sans: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
	--cb-font-serif: "Newsreader", Georgia, "Times New Roman", serif;
}

/* ==========================================================================
   Base
   ========================================================================== */
body {
	background-color: var(--cb-bg);
	color: var(--cb-ink);
}

.entry-content,
.entry-content p,
.entry-content li {
	font-family: var(--cb-font-serif);
	line-height: 1.65;
}

.entry-content h2,
.entry-content h3 {
	letter-spacing: -0.015em;
}

.entry-content h2 {
	margin-top: 2em;
}

.entry-content a {
	color: var(--cb-blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.entry-content a:hover {
	color: var(--cb-blue-dark);
}

.entry-content strong {
	font-weight: 600;
}

::selection {
	background: var(--cb-blue);
	color: #fff;
}

/* Titres : gras et serrés */
.block-title,
.title-wrap .entry-title,
.entry-title,
.entry-content h2 {
	font-weight: 800;
	letter-spacing: -0.025em;
}

.entry-content h3,
.title-wrap .title {
	font-weight: 700;
	letter-spacing: -0.015em;
}

/* Titres de sections de l'accueil : le <h2> hérite du style du titre de bloc */
.block-title h2 {
	margin: 0;
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
}

/* Accroche de la page d'accueil (H1) */
.cb-home-title {
	max-width: 820px;
	margin: 0 auto 0.4em;
	font-family: var(--cb-font-sans);
	font-size: clamp(2rem, 4.5vw, 3.2rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.035em;
	text-align: center;
	color: var(--cb-ink);
}

.cb-home-intro {
	max-width: 680px;
	margin: 0 auto;
	font-family: var(--cb-font-serif);
	font-size: 1.15em;
	line-height: 1.6;
	text-align: center;
	color: var(--cb-ink-soft);
}

.cb-home-intro a {
	color: var(--cb-blue);
	font-weight: 600;
}

/* Logo et menu */
.logo-main .logo-title,
.site-title,
.logo a {
	font-weight: 800;
	letter-spacing: -0.03em;
}

.main-navigation .menu > li > a {
	font-weight: 700;
	letter-spacing: 0.04em;
}

/* ==========================================================================
   Articles : mise en page éditoriale
   ========================================================================== */

/* En-tête : image élargie, titre plus grand, méta plus lisible */
.single-post .hero-wrap .hero {
	border-radius: 6px;
	overflow: hidden;
}

.single-post .hero-meta .entry-title.title {
	font-size: clamp(2rem, 4vw, 3rem);
	line-height: 1.08;
	letter-spacing: -0.035em;
}

.single-post .hero-meta .byline {
	font-family: var(--cb-font-sans);
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--cb-ink-soft);
}

.single-post .hero-meta .byline .cat {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 100px;
	background: var(--cb-tint);
	color: var(--cb-blue);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.single-post .hero-meta .byline .author a {
	color: var(--cb-ink);
	font-weight: 700;
}

/* Chapô : le premier paragraphe en plus grand */
.single-post .entry-content > p:first-of-type {
	font-size: 1.25em;
	line-height: 1.55;
	color: var(--cb-ink);
}

/* Sommaire */
.cb-toc {
	margin: 2.2em 0 2.6em;
	padding: 1.3em 1.5em;
	border: 1px solid var(--cb-line);
	border-radius: 6px;
	background: var(--cb-surface);
	font-family: var(--cb-font-sans);
}

.cb-toc summary {
	cursor: pointer;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cb-blue);
	list-style: none;
}

.cb-toc summary::-webkit-details-marker {
	display: none;
}

.cb-toc summary::after {
	content: "−";
	float: right;
	font-size: 1.1rem;
	line-height: 1;
}

.cb-toc details:not([open]) summary::after {
	content: "+";
}

.entry-content .cb-toc ol {
	margin: 0.9em 0 0;
	padding: 0;
	list-style: none;
	columns: 2;
	column-gap: 2em;
}

.entry-content .cb-toc li {
	margin: 0 0 0.5em;
	padding: 0;
	break-inside: avoid;
	font-family: var(--cb-font-sans);
	font-size: 0.9rem;
	line-height: 1.35;
}

.entry-content .cb-toc li::before {
	display: none;
}

.entry-content .cb-toc a {
	display: flex;
	gap: 0.6em;
	color: var(--cb-ink);
	text-decoration: none;
	font-weight: 600;
}

.entry-content .cb-toc a:hover {
	color: var(--cb-blue);
}

.cb-toc-num {
	flex: 0 0 auto;
	color: var(--cb-blue);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/* H2 numérotés, avec un filet bleu */
.single-post .entry-content {
	counter-reset: cb-h2;
}

.single-post .entry-content h2 {
	position: relative;
	margin-top: 2.4em;
	padding-top: 0.9em;
	border-top: 1px solid var(--cb-line);
	counter-increment: cb-h2;
	scroll-margin-top: 90px;
}

.single-post .entry-content .cb-toc + h2 {
	margin-top: 1.2em;
}

.single-post .entry-content h2::before {
	content: counter(cb-h2, decimal-leading-zero);
	display: block;
	margin-bottom: 0.35em;
	font-size: 0.8rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	color: var(--cb-blue);
}

.single-post .entry-content h2::after {
	content: "";
	position: absolute;
	top: -1px;
	left: 0;
	width: 48px;
	height: 3px;
	background: var(--cb-blue);
}

.single-post .entry-content h3 {
	margin-top: 1.8em;
	scroll-margin-top: 90px;
}

/* Étapes numérotées */
.entry-content h3.cb-step {
	display: grid;
	grid-template-columns: 44px 1fr;
	column-gap: 14px;
	align-items: center;
	margin-top: 2em;
}

.cb-step-num {
	grid-row: span 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--cb-blue);
	color: #fff;
	font-size: 1.1rem;
	font-weight: 800;
}

.cb-step-label {
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cb-blue);
}

/* Listes : puces carrées bleues */
.single-post .entry-content ul.wp-block-list {
	padding-left: 0;
	list-style: none;
}

.single-post .entry-content ul.wp-block-list > li {
	position: relative;
	margin-bottom: 0.6em;
	padding-left: 1.4em;
}

.single-post .entry-content ul.wp-block-list > li::before {
	content: "";
	position: absolute;
	top: 0.62em;
	left: 0.1em;
	width: 7px;
	height: 7px;
	background: var(--cb-blue);
}

.single-post .entry-content ol.wp-block-list > li::marker {
	color: var(--cb-blue);
	font-family: var(--cb-font-sans);
	font-weight: 800;
}

/* Encadrés de conseil */
.entry-content .cb-callout {
	margin: 1.8em 0;
	padding: 1.1em 1.3em 1.1em 1.4em;
	border-left: 4px solid var(--cb-blue);
	border-radius: 0 6px 6px 0;
	background: var(--cb-tint);
}

/* Tableaux : défilement horizontal sur mobile plutôt que colonnes écrasées */
.single-post .entry-content .wp-block-table {
	overflow-x: auto;
}

@media (max-width: 767px) {
	.entry-content .cb-toc ol {
		columns: 1;
	}

	.single-post .entry-content > p:first-of-type {
		font-size: 1.15em;
	}
}

/* ==========================================================================
   Cartes d'articles (accueil, rubriques) : image arrondie, titre fort,
   extrait sur 3 lignes, lien « Lire l'article »
   ========================================================================== */
.block-wrap-classic article .mask,
.block-wrap-classic article .mask img {
	border-radius: 8px;
	overflow: hidden;
}

.block-wrap-classic article .title-wrap .title {
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.block-wrap-classic article .read-more-wrap {
	margin-top: 0.8em;
}

.block-wrap-classic article .read-more,
.block-wrap-classic article .read-more a {
	font-family: var(--cb-font-sans);
	font-weight: 800;
	letter-spacing: 0.06em;
	color: var(--cb-ink);
}

.block-wrap-classic article .read-more {
	display: inline-block;
	padding-bottom: 2px;
	border-bottom: 2px solid var(--cb-blue);
}

.block-title p {
	margin: 0;
}

/* Accroche de l'accueil : la taille de Zeen pour les H1 du constructeur est écrasée */
.block-html-content h1.cb-home-title {
	font-size: clamp(2rem, 4.5vw, 3.2rem);
	line-height: 1.1;
}

/* ==========================================================================
   Mobile : lecture façon magazine (inspiration Atma)
   ========================================================================== */
@media (max-width: 767px) {

	/* Accueil */
	.block-html-content h1.cb-home-title {
		font-size: 30px;
		line-height: 1.12;
		text-align: left;
	}

	.cb-home-intro {
		font-size: 17px;
		text-align: left;
	}

	/* Titres de sections, alignés à gauche, sans filets latéraux */
	.block-title-area,
	.block-title-wrap .block-title {
		justify-content: flex-start;
		text-align: left;
	}

	.block-title:before,
	.block-title:after {
		display: none !important;
	}

	.block-title-wrap {
		margin-top: 12px;
	}

	.block-title,
	.page-title {
		font-size: 26px;
		letter-spacing: -0.03em;
	}

	/* Cartes : une colonne, image au-dessus, beaucoup d'air */
	.block-wrap-classic article {
		margin-bottom: 36px;
	}

	.block-wrap-classic article .title-wrap .title {
		font-size: 21px;
	}

	.block-wrap-classic article .excerpt {
		font-size: 16px;
		line-height: 1.55;
	}

	/* Article */
	.single-post .hero-meta .entry-title.title {
		font-size: 28px;
		line-height: 1.12;
	}

	.single-post .breadcrumbs {
		font-size: 12px;
	}

	.single-post .entry-content p,
	.single-post .entry-content li {
		line-height: 1.62;
	}

	.single-post .entry-content > p:first-of-type {
		font-size: 19px;
	}

	.single-post .entry-content h2 {
		font-size: 26px;
		line-height: 1.15;
		letter-spacing: -0.03em;
	}

	.single-post .entry-content h3 {
		font-size: 20px;
		line-height: 1.2;
	}

	.cb-toc,
	.entry-content .cb-callout {
		padding: 1em 1.1em;
	}

	/* Rubriques */
	.cb-cat-texte h2 {
		font-size: 24px;
	}
}

/* ==========================================================================
   Grand écran : la page occupe la largeur, le texte garde ~75 caractères par ligne
   ========================================================================== */

/* Sommaire latéral : masqué par défaut, affiché à partir de 1280 px */
.cb-toc-side {
	display: none;
}

@media (min-width: 1024px) {

	/* Couverture et en-tête élargis, alignés sur les planches */
	.single-post .hero-wrap,
	.single-post .hero-meta,
	.single-post .breadcrumbs-wrap {
		position: relative;
		left: 50%;
		width: min(1100px, calc(100vw - 64px));
		max-width: none;
		transform: translateX(-50%);
	}

	.single-post .hero-meta .entry-title.title {
		max-width: 900px;
	}

	/* Tableaux et encadrés un peu plus larges que le texte */
	.single-post .entry-content .wp-block-table,
	.single-post .entry-content .cb-callout {
		position: relative;
		left: 50%;
		width: min(820px, calc(100vw - 64px));
		max-width: none;
		transform: translateX(-50%);
	}
}

@media (min-width: 1280px) {

	.single-post .entry-content {
		position: relative;
	}

	/* Le sommaire passe dans la marge de gauche et suit la lecture */
	.single-post .entry-content .cb-toc {
		display: none;
	}

	/* Couverture, en-tête et planches à 1240 px : le bord gauche du sommaire s'aligne dessus */
	.single-post .hero-wrap,
	.single-post .hero-meta,
	.single-post .breadcrumbs-wrap,
	.single-post .entry-content .planche {
		width: min(1240px, calc(100vw - 64px));
	}

	/* Avec le sommaire à gauche, tableaux et encadrés ne débordent que vers la droite */
	.single-post .entry-content .wp-block-table,
	.single-post .entry-content .cb-callout {
		left: 0;
		transform: none;
	}

	/* Planches : du début du texte jusqu'au bord droit de la couverture,
	   pour ne pas passer sous le sommaire collant */
	.single-post .entry-content .planche {
		left: 0;
		width: min(975px, calc(50vw + 323px));
		transform: none;
	}

	.cb-toc-side {
		display: block;
		position: absolute;
		top: 0;
		right: calc(100% + 48px);
		bottom: 0;
		/* = marge gauche du texte − 48 px d'écart − marge de la couverture */
		width: min(217px, calc(50vw - 435px));
	}

	.cb-toc-side nav {
		position: sticky;
		top: 110px;
		max-height: calc(100vh - 140px);
		overflow-y: auto;
		padding-right: 8px;
	}

	.cb-toc-side-title {
		margin: 0 0 0.9em;
		font-family: var(--cb-font-sans);
		font-size: 0.72rem;
		font-weight: 800;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var(--cb-blue);
	}

	.entry-content .cb-toc-side ol {
		margin: 0;
		padding: 0;
		list-style: none;
		border-left: 2px solid var(--cb-line);
	}

	.entry-content .cb-toc-side li {
		margin: 0;
		padding: 0;
		font-family: var(--cb-font-sans);
		font-size: 0.82rem;
		line-height: 1.35;
	}

	.entry-content .cb-toc-side li::before {
		display: none;
	}

	.entry-content .cb-toc-side a {
		display: flex;
		gap: 0.6em;
		margin-left: -2px;
		padding: 0.45em 0 0.45em 0.9em;
		border-left: 2px solid transparent;
		color: var(--cb-ink-soft);
		font-weight: 600;
		text-decoration: none;
		transition: color 0.15s, border-color 0.15s;
	}

	.entry-content .cb-toc-side a:hover,
	.entry-content .cb-toc-side a.is-active {
		border-left-color: var(--cb-blue);
		color: var(--cb-ink);
	}

	.entry-content .cb-toc-side a.is-active .cb-toc-num {
		color: var(--cb-blue);
	}

	.entry-content .cb-toc-side .cb-toc-num {
		color: var(--cb-ink-soft);
		opacity: 0.7;
	}
}

/* ==========================================================================
   Rubriques : intro sous le H1 et texte long sous la liste
   ========================================================================== */
.term-description,
.title-box .block-subtitle,
.page-title + .block-subtitle {
	max-width: 760px;
}

.cb-cat-texte {
	margin-top: 40px;
	padding-top: 48px;
	padding-bottom: 64px;
	border-top: 1px solid var(--cb-line);
}

.cb-cat-texte .entry-content {
	max-width: 760px;
	margin: 0 auto;
	font-size: 1.05rem;
	text-align: left;
}

.cb-cat-texte p {
	margin: 0 0 1em;
	line-height: 1.65;
}

/* Intro de rubrique sous le H1 : lisible, pas grisée */
.archive .block-subtitle,
.archive .block-subtitle p {
	color: var(--cb-ink-soft);
	font-family: var(--cb-font-serif);
	font-size: 1.1rem;
	line-height: 1.55;
	opacity: 1;
}

.cb-cat-texte h2 {
	margin: 1.6em 0 0.5em;
	font-size: 1.6rem;
}

.cb-cat-texte h2:first-child {
	margin-top: 0;
}

.cb-cat-texte h3 {
	margin: 1.3em 0 0.4em;
	font-size: 1.2rem;
}

/* ==========================================================================
   Planches (croquis techniques) : pleine largeur, agrandissables au clic
   Usage : bloc Image avec la classe CSS « planche » + lien vers le fichier média
   ========================================================================== */
.entry-content .planche {
	position: relative;
	left: 50%;
	width: min(1100px, calc(100vw - 32px));
	max-width: none;
	margin: 2.5em 0;
	transform: translateX(-50%);
}

.entry-content .planche img {
	width: 100%;
	height: auto;
	border: 1px solid var(--cb-line);
	border-radius: 4px;
	cursor: zoom-in;
}

.entry-content .planche figcaption {
	font-family: var(--cb-font-sans);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cb-ink-soft);
	text-align: center;
}

/* ==========================================================================
   Croquis : les planches sont très pâles (traits gris clair, papier beige grisé).
   Rehausse non destructive, limitée aux fichiers nommés « croquis-… » :
   le papier blanchit légèrement, les traits et le lavis ressortent.
   ========================================================================== */
img[src*="croquis"],
img[srcset*="croquis"] {
	/* Gamma (filtre SVG du thème enfant) : traits plus foncés, papier blanc ; puis couleurs du lavis */
	filter: url(#cb-croquis) saturate(1.25);
}

/* Mosaïque de l'accueil : dégradé en bas (sous le texte) au lieu d'un voile sur toute l'image */
.preview-grid .mask-overlay {
	opacity: 1 !important;
	background: linear-gradient(to top, rgba(20, 23, 42, 0.82) 0%, rgba(20, 23, 42, 0.45) 35%, rgba(20, 23, 42, 0) 65%) !important;
	transition: background 0.2s;
}

.preview-grid:hover .mask-overlay {
	background: linear-gradient(to top, rgba(20, 23, 42, 0.9) 0%, rgba(20, 23, 42, 0.55) 45%, rgba(20, 23, 42, 0.05) 80%) !important;
}

/* ==========================================================================
   Tableaux
   ========================================================================== */
.entry-content .wp-block-table table {
	border-collapse: collapse;
	background: var(--cb-surface);
	font-size: 0.9em;
}

.entry-content .wp-block-table td,
.entry-content .wp-block-table th {
	border: 1px solid var(--cb-line);
	padding: 0.6em 0.8em;
	hyphens: none;
	word-break: normal;
	overflow-wrap: normal;
}

.entry-content .wp-block-table th {
	font-family: var(--cb-font-sans);
	font-weight: 700;
	text-align: left;
	background: var(--cb-tint);
	color: var(--cb-ink);
}

/* ==========================================================================
   Passages à compléter (anecdotes, photos, liens) : à supprimer avant publication
   ========================================================================== */
.entry-content mark.a-completer {
	background: #FFF1C2;
	color: var(--cb-ink);
	padding: 0 0.2em;
	font-family: var(--cb-font-sans);
	font-size: 0.8em;
}

.entry-content .a-completer-bloc {
	background: #FFF1C2;
	border-left: 4px solid #E0A800;
	padding: 0.8em 1em;
	font-family: var(--cb-font-sans);
	font-size: 0.8em;
}

/* ==========================================================================
   Vignette de secours (cb_vignette) : article sans image à la une,
   page de carnet quadrillée avec la rubrique et le titre
   ========================================================================== */
.cb-vignette {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 100%;
	height: 100%;
	min-height: 100%;
	padding: clamp(16px, 6%, 32px);
	background-color: var(--cb-tint);
	background-image:
		linear-gradient(rgba(23, 56, 186, 0.08) 1px, transparent 1px),
		linear-gradient(90deg, rgba(23, 56, 186, 0.08) 1px, transparent 1px);
	background-size: 22px 22px;
	color: var(--cb-ink);
	font-family: var(--cb-font-sans);
}

.cb-une__img .cb-vignette {
	position: absolute;
	inset: 0;
}

.cb-vignette__cat {
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cb-blue);
}

.cb-vignette__titre {
	max-width: 16ch;
	font-size: clamp(1.3rem, 2.4vw, 2.2rem);
	font-weight: 800;
	line-height: 1.02;
	letter-spacing: -0.035em;
}

.cb-vignette__star {
	position: absolute;
	top: clamp(14px, 5%, 28px);
	right: clamp(14px, 5%, 28px);
	width: 28px;
	height: 28px;
	fill: none;
	stroke: var(--cb-blue);
	stroke-width: 2.6;
	stroke-linecap: round;
}
