/*
 * Blog : liste des articles, thématiques, article.
 * Chargé seulement sur ces pages. La carte d'article et sa grille sont dans components.css (elles servent
 * aussi sur les catégories produit).
 */

/* ─── Liste des articles et thématiques ─────────────────────────────────────── */
.jmb-blog__title {
	margin: var(--wp--preset--spacing--30) 0 0;
}

/* Texte limité à 48rem par une marge intérieure : une largeur maximale le centrerait (mise en page contrainte). */
.jmb-blog__intro {
	margin-top: var(--wp--preset--spacing--20);
	box-sizing: border-box;
	/* La marge se calcule sur la largeur du bloc lui-même (au plus celle du contenu), pas sur celle de la page. */
	padding-right: max(0px, calc(min(100%, var(--wp--style--global--content-size)) - 48rem));
}

.jmb-blog-topics {
	margin-top: var(--wp--preset--spacing--40);
}

.jmb-blog-topics ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.jmb-blog-topics a,
.jmb-post-meta__topic {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 2.75rem;
	padding: 0.4rem 1rem;
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.jmb-blog-topics a:hover,
.jmb-blog-topics a:focus,
.jmb-blog-topics a[aria-current],
.jmb-post-meta__topic:hover,
.jmb-post-meta__topic:focus {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

.jmb-blog-topics a:is(:hover, :focus, [aria-current]) .jmb-topic-picto,
.jmb-post-meta__topic:is(:hover, :focus) .jmb-topic-picto {
	color: inherit;
}

.jmb-blog__list {
	margin-top: var(--wp--preset--spacing--50);
}

.jmb-blog__list .wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--50);
}

/* ─── Article ───────────────────────────────────────────────────────────────── */
.jmb-article__body {
	margin-top: var(--wp--preset--spacing--40);
}

.jmb-article__title {
	margin: 0;
}

.jmb-post-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--slate);
}

.jmb-post-meta__topic {
	min-height: 2.25rem;
	font-weight: 700;
}

.jmb-article__lead {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
	line-height: 1.5;
	color: var(--wp--preset--color--primary);
}

.jmb-article__lead p {
	margin: 0;
}

.jmb-article__image img {
	display: block;
	width: 100%;
	border-radius: var(--wp--custom--radius--large);
}

/* Sommaire */
.jmb-post-toc {
	padding: 1.25rem 1.5rem;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--surface);
}

.jmb-post-toc__title {
	margin: 0 0 0.5rem;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

.jmb-post-toc ol {
	margin: 0;
	padding-left: 1.25rem;
}

.jmb-post-toc li {
	padding-block: 0.3rem;
}

.jmb-post-toc a {
	text-decoration: none;
}

.jmb-post-toc a:hover,
.jmb-post-toc a:focus {
	text-decoration: underline;
}

/* Texte de l'article */
.jmb-article__content {
	line-height: 1.7;
}

.jmb-article__content h2 {
	margin-top: var(--wp--preset--spacing--50);
	font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);
	scroll-margin-top: 1.5rem;
}

.jmb-article__content h3 {
	margin-top: var(--wp--preset--spacing--40);
	font-family: var(--wp--preset--font-family--body);
	font-size: 1.125rem;
	line-height: 1.35;
	text-transform: none;
}

.jmb-article__content li + li {
	margin-top: 0.35rem;
}

.jmb-article__content .wp-block-image img {
	border-radius: var(--wp--custom--radius--large);
}

/* Tableaux : lisibles sur mobile (défilement horizontal plutôt que colonnes écrasées). */
.jmb-article__content .wp-block-table {
	overflow-x: auto;
}

.jmb-article__content .wp-block-table table {
	min-width: 30rem;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}

.jmb-article__content .wp-block-table :is(th, td) {
	padding: 0.6rem 0.75rem;
	border: 1px solid #d9dbe6;
	text-align: left;
	vertical-align: top;
}

.jmb-article__content .wp-block-table thead th {
	border-color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	font-weight: 700;
}

.jmb-article__content .wp-block-table tbody tr:nth-child(even) {
	background: var(--wp--preset--color--surface);
}

.jmb-article__content .wp-block-table figcaption {
	margin-top: 0.5rem;
	color: var(--wp--preset--color--slate);
}
