/**
 * Focus Média — Styles de base.
 *
 * Éléments globaux, largeurs de lecture, grilles et aides d'accessibilité.
 */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Compense les en-têtes fixes lors du saut vers une ancre (sommaire). */
	scroll-padding-top: var(--space-16);
}

body {
	margin: 0;
	color: var(--color-ink);
	background-color: var(--color-paper);
	font-family: var(--font-body);
	font-size: var(--text-body);
	line-height: var(--line-height-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* --- Titres --- */
h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-heading);
	font-weight: var(--weight-bold);
	line-height: var(--line-height-heading);
	text-wrap: balance;
	margin-block: 0 var(--space-4);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* Réserve la zone d'ancrage sous un éventuel en-tête collant. */
:target { scroll-margin-top: var(--space-16); }

p { text-wrap: pretty; }

/* --- Liens --- */
a {
	color: var(--color-accent-text);
	text-underline-offset: 0.15em;
	transition: color var(--transition-fast);
}

a:hover {
	color: var(--color-ink);
}

/* --- Focus clavier visible pour tous les éléments interactifs --- */
:focus-visible {
	outline: 3px solid var(--color-focus-ring);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

/* Les séparateurs décoratifs ne sont pas annoncés par les lecteurs d'écran. */
hr {
	border: 0;
	border-top: var(--border-width) solid var(--color-border);
	margin-block: var(--space-8);
}

/* --- Médias --- */
img,
svg,
video {
	max-width: 100%;
	height: auto;
}

figure {
	margin-inline: 0;
}

/* --- Mise en page --- */
.container {
	width: min(calc(100% - 2 * var(--gutter)), var(--content-width));
	margin-inline: auto;
}

.article-content {
	width: min(100%, var(--reading-width));
	margin-inline: auto;
}

/* Grille responsive : 4 colonnes mobile, 12 colonnes desktop. */
.grid {
	display: grid;
	gap: var(--grid-gap);
	grid-template-columns: repeat(var(--grid-columns-mobile), minmax(0, 1fr));
}

@media (min-width: 48rem) {
	.grid {
		grid-template-columns: repeat(var(--grid-columns-desktop), minmax(0, 1fr));
	}
}

/* --- Utilitaires d'accessibilité --- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	overflow: visible;
	clip: auto;
	white-space: normal;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
	padding: var(--space-3) var(--space-4);
	background: var(--color-paper);
	color: var(--color-ink);
	text-decoration: underline;
}

.skip-link:focus {
	left: var(--space-4);
}

/* --- Préférence de mouvement réduit --- */
@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;
	}
}

/* --- Impression --- */
@media print {
	body {
		color: #000;
		background: #fff;
	}

	a[href]::after {
		content: " (" attr(href) ")";
		font-size: var(--text-xs);
	}
}
