/* ==========================================================================
   ENF — Remise à zéro, typographie de base, accessibilité
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

/* L'attribut hidden doit gagner.
   Le navigateur ne le porte que par une règle de sa propre feuille, que
   n'importe quelle règle d'affichage du thème dépasse : un .enf-btn ou un
   display:flex posé sur un élément masqué le remet à l'écran. Le défaut est
   invisible à la relecture du balisage — l'attribut est bien là — et ne se
   voit qu'en regardant la page. Une seule règle ici, plutôt qu'une par
   composant à chaque fois qu'on se fait avoir. */
[hidden] {
	display: none !important;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Compense l'en-tête collant lors d'une navigation par ancre. */
	scroll-padding-top: calc(var(--enf-header-h) + var(--enf-space-5));
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

body {
	margin: 0;
	background-color: var(--enf-bg);
	color: var(--enf-body);
	font-family: var(--enf-font);
	font-size: var(--enf-fs-body);
	font-weight: var(--enf-fw-regular);
	line-height: var(--enf-lh-body);
	letter-spacing: var(--enf-ls-ui);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Aucun débordement horizontal, à aucune largeur. */
	overflow-x: hidden;
}

/* Les titres sont en Plus Jakarta Sans, le reste en Inter. */
h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0;
	color: var(--enf-ink);
	font-family: var(--enf-font-display);
	font-weight: var(--enf-fw-bold);
	line-height: var(--enf-lh-heading);
	letter-spacing: var(--enf-ls-h3);
	text-wrap: balance;
}

h1 {
	font-size: var(--enf-fs-h1);
	line-height: var(--enf-lh-tight);
	letter-spacing: var(--enf-ls-h1);
}

h2 {
	font-size: var(--enf-fs-h2);
	line-height: var(--enf-lh-tight);
	letter-spacing: var(--enf-ls-h2);
}

h3 {
	font-size: var(--enf-fs-h3);
	font-weight: var(--enf-fw-semibold);
}

h4,
h5,
h6 {
	font-size: var(--enf-fs-h4);
	font-weight: var(--enf-fw-semibold);
}

p,
ul,
ol,
dl,
figure,
blockquote,
pre,
table {
	margin: 0 0 var(--enf-space-4);
}

p:last-child,
ul:last-child,
ol:last-child {
	margin-bottom: 0;
}

/* Une ligne de texte courant ne dépasse pas ~70 caractères : au-delà,
   l'œil perd la ligne suivante. */
p {
	max-width: 70ch;
	text-wrap: pretty;
}

a {
	color: var(--enf-blue);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color var(--enf-transition);
}

a:hover {
	color: var(--enf-orange);
}

strong,
b {
	font-weight: var(--enf-fw-bold);
}

small {
	font-size: var(--enf-fs-small);
}

img,
picture,
video,
canvas,
svg,
iframe {
	display: block;
	max-width: 100%;
	height: auto;
}

svg {
	fill: currentColor;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

hr {
	height: 1px;
	margin: var(--enf-space-8) 0;
	border: 0;
	background-color: var(--enf-line);
}

blockquote {
	padding-left: var(--enf-space-5);
	border-left: 3px solid var(--enf-orange);
	color: var(--enf-ink);
}

code,
kbd,
pre {
	font-family: var(--enf-font-mono);
	font-size: 0.9em;
}

table {
	width: 100%;
	border-collapse: collapse;
}

th,
td {
	padding: var(--enf-space-3) var(--enf-space-4);
	border-bottom: 1px solid var(--enf-line);
	text-align: left;
}

th {
	color: var(--enf-ink);
	font-weight: var(--enf-fw-semibold);
}

/* --------------------------------------------------------------------------
   Accessibilité
   -------------------------------------------------------------------------- */

/* Anneau de focus visible partout, jamais supprimé. */
:focus-visible {
	outline: var(--enf-focus);
	outline-offset: var(--enf-focus-offset);
	border-radius: var(--enf-radius-sm);
}

/* Sur fond sombre, l'anneau bleu ne ressort pas : on passe en orange vif,
   qui y dépasse largement les 3:1 exigés d'un indicateur de focus. */
.enf-section--dark :focus-visible,
.enf-card--filled :focus-visible {
	outline-color: var(--enf-orange-vif);
}

/* Pot de miel des formulaires.
   Cette règle vit ici, dans la feuille toujours chargée, et non avec le reste
   des styles de formulaire : un champ « ne pas remplir » resté visible n'est
   pas un défaut d'apparence, c'est un formulaire qui invite une personne à se
   faire prendre pour un robot. La protection ne doit pas dépendre du
   chargement d'une feuille annexe. */
.enf-form__miel {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.enf-visually-hidden,
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Le lien d'évitement reste atteignable au clavier et devient visible
   dès qu'il prend le focus. */
.enf-skip-link {
	position: absolute;
	top: var(--enf-space-2);
	left: var(--enf-space-2);
	z-index: 200;
	padding: var(--enf-space-3) var(--enf-space-5);
	transform: translateY(-200%);
	background-color: var(--enf-blue);
	color: var(--enf-on-dark);
	font-weight: var(--enf-fw-semibold);
	text-decoration: none;
	border-radius: var(--enf-radius-sm);
	transition: transform var(--enf-transition);
}

.enf-skip-link:focus-visible {
	transform: translateY(0);
	color: var(--enf-on-dark);
}

/* --------------------------------------------------------------------------
   Classes de WordPress à ne pas oublier
   -------------------------------------------------------------------------- */

.alignleft {
	float: left;
	margin: 0 var(--enf-space-5) var(--enf-space-4) 0;
}

.alignright {
	float: right;
	margin: 0 0 var(--enf-space-4) var(--enf-space-5);
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.wp-caption-text,
figcaption {
	margin-top: var(--enf-space-2);
	color: var(--enf-muted);
	font-size: var(--enf-fs-small);
}

.sticky,
.gallery-caption,
.bypostauthor {
	/* Exigées par le contrôle de thème de WordPress. */
	display: block;
}
