/**
 * Fichier : assets/css/content.css
 * Rôle :
 * Styles éditoriaux des contenus singular du thème ClicAccess.
 *
 * Principes :
 * - portée limitée au contenu principal
 * - unités relatives privilégiées
 * - accessibilité et lisibilité
 * - compatibilité avec les blocs Gutenberg principaux
 * - sélecteurs volontairement peu spécifiques pour rester maintenables
 */

/* ------------------------------------ */
/* 1. Portée générale du contenu        */
/* ------------------------------------ */

.site-main {
	font-size: 1rem;
	line-height: 1.7;
}

.site-main :where(.entry-content, .page-content, .post-content) {
	color: inherit;
}

.site-main :where(.entry-content, .page-content, .post-content) > *:first-child {
	margin-top: 0;
}

.site-main :where(.entry-content, .page-content, .post-content) > *:last-child {
	margin-bottom: 0;
}

/*
 * Rythme vertical principal :
 * on garde des espacements réguliers pour faciliter la lecture.
 */
.site-main :where(.entry-content, .page-content, .post-content) > * {
	margin-top: 0;
	margin-bottom: 1.5rem;
}

/* ------------------------------------ */
/* 2. Titres                            */
/* ------------------------------------ */

.site-main :where(h1, h2, h3, h4, h5, h6) {
	margin-top: 2rem;
	margin-bottom: 1rem;
	line-height: 1.3;
	font-weight: 700;
	overflow-wrap: break-word;
	word-break: normal;
}

.site-main :where(h1) {
	font-size: 2.25rem;
}

.site-main :where(h2) {
	font-size: 1.875rem;
}

.site-main :where(h3) {
	font-size: 1.5rem;
}

.site-main :where(h4) {
	font-size: 1.25rem;
}

.site-main :where(h5) {
	font-size: 1.125rem;
}

.site-main :where(h6) {
	font-size: 1rem;
	letter-spacing: 0.02em;
}

.site-main :where(h1, h2, h3, h4, h5, h6) + :where(p, ul, ol, dl, blockquote, table, pre, figure) {
	margin-top: 0;
}

/* ------------------------------------ */
/* 3. Paragraphes et textes simples     */
/* ------------------------------------ */

.site-main :where(p) {
	margin-top: 0;
	margin-bottom: 1.5rem;
	overflow-wrap: break-word;
}

.site-main :where(strong, b) {
	font-weight: 700;
}

.site-main :where(em, i) {
	font-style: italic;
}

.site-main :where(mark) {
	padding: 0.125em 0.2em;
}

.site-main :where(small) {
	font-size: 0.875rem;
}

.site-main :where(abbr[title]) {
	text-decoration: underline dotted;
	text-underline-offset: 0.14em;
	cursor: help;
}

/* ------------------------------------ */
/* 4. Liens                             */
/* ------------------------------------ */

.site-main :where(a) {
	color: inherit;
	text-decoration-line: underline;
	text-decoration-thickness: 0.1em;
	text-underline-offset: 0.16em;
	word-break: break-word;
}

.site-main :where(a:hover) {
	text-decoration-thickness: 0.14em;
}

.site-main :where(a:focus-visible) {
	outline: 0.1875rem solid currentColor;
	outline-offset: 0.1875rem;
	text-decoration: none;
}

.site-main :where(a:active) {
	position: relative;
	top: 0;
}

/*
 * Les liens transformés en boutons par les blocs
 * ne doivent pas rester visuellement de simples liens soulignés.
 */
.site-main :where(.wp-block-button__link, .button, button, input[type="button"], input[type="submit"], input[type="reset"]) {
	text-decoration: none;
}

/* ------------------------------------ */
/* 5. Listes                            */
/* ------------------------------------ */

.site-main :where(ul, ol) {
	padding-left: 1.5rem;
}

.site-main :where(ul, ol, dl) {
	margin-top: 0;
	margin-bottom: 1.5rem;
}

.site-main :where(li) {
	margin-bottom: 0.5rem;
}

.site-main :where(li > ul, li > ol) {
	margin-top: 0.5rem;
	margin-bottom: 0.75rem;
}

.site-main :where(dl) {
	padding-left: 0;
}

.site-main :where(dt) {
	font-weight: 700;
	margin-top: 1rem;
}

.site-main :where(dd) {
	margin-left: 1.5rem;
	margin-top: 0.375rem;
}

/* ------------------------------------ */
/* 6. Citations                         */
/* ------------------------------------ */

.site-main :where(blockquote) {
	margin: 2rem 0;
	padding: 1rem 1.25rem;
	border-left: 0.25rem solid currentColor;
}

.site-main :where(blockquote p:last-child) {
	margin-bottom: 0;
}

.site-main :where(cite) {
	font-style: normal;
}

/*
 * Bloc citation Gutenberg.
 */
.site-main :where(.wp-block-quote) {
	margin: 2rem 0;
	padding: 1rem 1.25rem;
	border-left: 0.25rem solid currentColor;
}

.site-main :where(.wp-block-quote.has-text-align-right) {
	border-left: 0;
	border-right: 0.25rem solid currentColor;
}

.site-main :where(.wp-block-quote cite) {
	display: block;
	margin-top: 0.75rem;
	font-size: 0.9375rem;
}

/*
 * Pullquote : distinction visuelle sans exagération.
 */
.site-main :where(.wp-block-pullquote) {
	margin: 2.5rem 0;
	padding: 1.5rem 1rem;
	text-align: center;
	border-top: 0.125rem solid currentColor;
	border-bottom: 0.125rem solid currentColor;
}

.site-main :where(.wp-block-pullquote blockquote) {
	margin: 0;
	padding: 0;
	border: 0;
}

.site-main :where(.wp-block-pullquote p) {
	font-size: 1.25rem;
	line-height: 1.5;
}

/* ------------------------------------ */
/* 7. Images et médias                  */
/* ------------------------------------ */

.site-main :where(img) {
	max-width: 100%;
	height: auto;
}

.site-main :where(figure) {
	margin: 0 0 1.5rem;
}

.site-main :where(figcaption) {
	margin-top: 0.5rem;
	font-size: 0.9375rem;
	line-height: 1.5;
}

.site-main :where(.wp-block-image) {
	margin: 0 0 1.5rem;
}

.site-main :where(.wp-block-image img) {
	display: block;
	max-width: 100%;
	height: auto;
}

.site-main :where(.wp-block-image figcaption) {
	margin-top: 0.5rem;
}

.site-main :where(.alignleft) {
	float: left;
	margin-right: 1.5rem;
	margin-bottom: 1rem;
}

.site-main :where(.alignright) {
	float: right;
	margin-left: 1.5rem;
	margin-bottom: 1rem;
}

.site-main :where(.aligncenter) {
	display: block;
	margin-right: auto;
	margin-left: auto;
	text-align: center;
}

.site-main :where(.wp-caption, .gallery-caption) {
	max-width: 100%;
}

.site-main :where(video, iframe, embed, object) {
	max-width: 100%;
}

.site-main :where(.wp-block-embed, .wp-block-video, .wp-block-audio) {
	margin-bottom: 1.5rem;
}

/* ------------------------------------ */
/* 8. Séparateurs et règles             */
/* ------------------------------------ */

.site-main :where(hr) {
	border: 0;
	border-top: 0.0625rem solid currentColor;
	margin: 2rem 0;
	opacity: 0.4;
}

.site-main :where(.wp-block-separator) {
	margin: 2rem auto;
}

.site-main :where(.wp-block-separator:not(.is-style-wide):not(.is-style-dots)) {
	max-width: 8rem;
}

.site-main :where(.wp-block-separator.is-style-dots) {
	border: 0;
	text-align: center;
}

.site-main :where(.wp-block-separator.is-style-dots::before) {
	content: "* * *";
	letter-spacing: 0.4em;
	font-size: 1rem;
}

/* ------------------------------------ */
/* 9. Code, préformaté, clavier         */
/* ------------------------------------ */

.site-main :where(pre, code, kbd, samp) {
	font-family: Consolas, Monaco, "Courier New", Courier, monospace;
	font-size: 0.95em;
}

.site-main :where(code, kbd, samp) {
	padding: 0.125em 0.3em;
}

.site-main :where(kbd) {
	border: 0.0625rem solid currentColor;
	border-radius: 0.25rem;
	box-shadow: 0 0.0625rem 0 0 currentColor;
}

.site-main :where(pre) {
	overflow-x: auto;
	padding: 1rem;
	line-height: 1.6;
	white-space: pre-wrap;
	word-break: break-word;
}

.site-main :where(pre code) {
	padding: 0;
	border: 0;
	background: transparent;
}

/*
 * Blocs Gutenberg associés au code.
 */
.site-main :where(.wp-block-code, .wp-block-preformatted, .wp-block-verse) {
	margin-bottom: 1.5rem;
}

.site-main :where(.wp-block-code code) {
	display: block;
	padding: 1rem;
	overflow-x: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

/* ------------------------------------ */
/* 10. Tableaux                         */
/* ------------------------------------ */

.site-main :where(table) {
	width: 100%;
	margin-bottom: 1.5rem;
	border-collapse: collapse;
	border-spacing: 0;
}

.site-main :where(caption) {
	margin-bottom: 0.75rem;
	font-weight: 700;
	text-align: left;
}

.site-main :where(th, td) {
	padding: 0.75rem;
	border: 0.0625rem solid currentColor;
	text-align: left;
	vertical-align: top;
	overflow-wrap: anywhere;
}

.site-main :where(th) {
	font-weight: 700;
}

.site-main :where(thead th) {
	vertical-align: bottom;
}

.site-main :where(.wp-block-table) {
	margin-bottom: 1.5rem;
	overflow-x: auto;
}

.site-main :where(.wp-block-table table) {
	margin-bottom: 0;
}

.site-main :where(.wp-block-table figcaption) {
	margin-top: 0.5rem;
}

/* ------------------------------------ */
/* 11. Blocs de groupe et conteneurs    */
/* ------------------------------------ */

.site-main :where(.wp-block-group, .wp-block-columns, .wp-block-media-text, .wp-block-cover, .wp-block-buttons) {
	margin-bottom: 1.5rem;
}

.site-main :where(.wp-block-group) {
	padding: 0;
}

.site-main :where(.wp-block-group__inner-container) > *:first-child {
	margin-top: 0;
}

.site-main :where(.wp-block-group__inner-container) > *:last-child {
	margin-bottom: 0;
}

.site-main :where(.wp-block-columns) {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
}

.site-main :where(.wp-block-column) {
	flex: 1 1 16rem;
	min-width: 0;
}

.site-main :where(.wp-block-media-text) {
	align-items: start;
	gap: 1.5rem;
}

.site-main :where(.wp-block-cover) {
	padding: 2rem 1.5rem;
}

.site-main :where(.wp-block-cover__inner-container) > *:last-child {
	margin-bottom: 0;
}

/* ------------------------------------ */
/* 12. Boutons Gutenberg                */
/* ------------------------------------ */

.site-main :where(.wp-block-buttons) {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.site-main :where(.wp-block-button) {
	margin: 0;
}

.site-main :where(.wp-block-button__link) {
	display: inline-block;
	padding: 0.75rem 1.25rem;
	border: 0.125rem solid currentColor;
	border-radius: 0.375rem;
	line-height: 1.4;
	font-weight: 700;
	text-align: center;
}

.site-main :where(.wp-block-button__link:hover) {
	text-decoration: none;
}

.site-main :where(.wp-block-button__link:focus-visible) {
	outline: 0.1875rem solid currentColor;
	outline-offset: 0.1875rem;
}

/* ------------------------------------ */
/* 13. Fichiers téléchargeables         */
/* ------------------------------------ */

.site-main :where(.wp-block-file) {
	margin-bottom: 1.5rem;
}

.site-main :where(.wp-block-file a) {
	font-weight: 700;
}

.site-main :where(.wp-block-file .wp-block-file__button) {
	display: inline-block;
	margin-top: 0.75rem;
	padding: 0.625rem 1rem;
	border: 0.125rem solid currentColor;
	border-radius: 0.375rem;
	text-decoration: none;
}

/* ------------------------------------ */
/* 14. Détails / accordéons natifs      */
/* ------------------------------------ */

.site-main :where(details) {
	margin-bottom: 1.5rem;
}

.site-main :where(summary) {
	cursor: pointer;
	font-weight: 700;
}

.site-main :where(summary:focus-visible) {
	outline: 0.1875rem solid currentColor;
	outline-offset: 0.1875rem;
}

/* ------------------------------------ */
/* 15. Alignements large et pleine      */
/* largeur                              */
/* ------------------------------------ */

/*
 * Ces règles restent prudentes.
 * Elles supposent un contenu principal centré
 * sans imposer une largeur fixe au thème.
 */
.site-main :where(.alignwide) {
	width: 100%;
	max-width: 100%;
}

.site-main :where(.alignfull) {
	width: 100%;
	max-width: 100%;
}

/* ------------------------------------ */
/* 16. Utilitaires de lisibilité        */
/* ------------------------------------ */

.site-main :where(.has-text-align-left) {
	text-align: left;
}

.site-main :where(.has-text-align-center) {
	text-align: center;
}

.site-main :where(.has-text-align-right) {
	text-align: right;
}

.site-main :where(.screen-reader-text) {
	position: absolute;
	width: 0.0625rem;
	height: 0.0625rem;
	padding: 0;
	margin: -0.0625rem;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------ */
/* 17. Gestion des flottants            */
/* ------------------------------------ */

/*
 * On évite qu’un média aligné à gauche ou à droite
 * ne déborde sur les éléments suivants.
 */
.site-main :where(.entry-content, .page-content, .post-content)::after {
	content: "";
	display: block;
	clear: both;
}

/* ------------------------------------ */
/* 18. Responsive éditorial             */
/* ------------------------------------ */

@media (max-width: 50em) {
	.site-main :where(h1) {
		font-size: 2rem;
	}

	.site-main :where(h2) {
		font-size: 1.625rem;
	}

	.site-main :where(h3) {
		font-size: 1.375rem;
	}

	.site-main :where(.alignleft, .alignright) {
		float: none;
		display: block;
		margin-right: 0;
		margin-left: 0;
	}

	.site-main :where(.wp-block-columns) {
		gap: 1rem;
	}

	.site-main :where(.wp-block-cover) {
		padding: 1.5rem 1rem;
	}

	.site-main :where(.wp-block-pullquote p) {
		font-size: 1.125rem;
	}
}

@media (max-width: 37.5em) {
	.site-main :where(h1) {
		font-size: 1.75rem;
	}

	.site-main :where(h2) {
		font-size: 1.5rem;
	}

	.site-main :where(h3) {
		font-size: 1.25rem;
	}

	.site-main :where(blockquote, .wp-block-quote) {
		padding: 0.875rem 1rem;
	}

	.site-main :where(th, td) {
		padding: 0.625rem;
	}

	.site-main :where(.wp-block-button__link) {
		width: 100%;
	}
}