/**
 * Base : normalisation, éléments HTML, formulaires, accessibilité.
 */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--ww-header-height) + 1rem);
}

body {
	margin: 0;
	background: var(--ww-color-body);
	color: var(--ww-color-text);
	font-family: var(--ww-font-sans);
	font-size: var(--ww-text-base);
	line-height: var(--ww-leading-normal);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 var(--ww-space-4);
	font-family: var(--ww-font-display);
	font-weight: var(--ww-heading-weight);
	line-height: var(--ww-leading-tight);
	letter-spacing: var(--ww-tracking-tight);
	color: var(--ww-color-heading);
	text-wrap: balance;
}

h1 { font-size: var(--ww-text-3xl); }
h2 { font-size: var(--ww-text-2xl); }
h3 { font-size: var(--ww-text-xl); }
h4 { font-size: var(--ww-text-lg); }
h5 { font-size: var(--ww-text-md); }
h6 { font-size: var(--ww-text-sm); text-transform: uppercase; letter-spacing: 0.08em; }

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

:where(p, li):last-child {
	margin-bottom: 0;
}

a {
	color: var(--ww-color-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color var(--ww-duration) var(--ww-ease);
}

a:hover {
	color: var(--ww-color-highlight);
}

img, svg, video, canvas, iframe {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

img {
	border-radius: inherit;
}

figure img {
	border-radius: var(--ww-radius);
}

figcaption {
	margin-top: var(--ww-space-2);
	font-size: var(--ww-text-sm);
	color: var(--ww-color-muted);
}

blockquote {
	margin-inline: 0;
	padding: var(--ww-space-4) var(--ww-space-5);
	border-left: 4px solid var(--ww-color-primary);
	background: var(--ww-color-surface);
	border-radius: 0 var(--ww-radius) var(--ww-radius) 0;
	font-size: var(--ww-text-lg);
}

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

code, kbd, pre, samp {
	font-family: var(--ww-font-mono);
	font-size: 0.92em;
}

code {
	padding: 0.15em 0.4em;
	background: var(--ww-color-surface);
	border-radius: var(--ww-radius-sm);
}

pre {
	padding: var(--ww-space-4);
	overflow-x: auto;
	background: var(--ww-color-dark);
	color: var(--ww-color-light);
	border-radius: var(--ww-radius);
}

pre code {
	background: none;
	padding: 0;
	color: inherit;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--ww-text-sm);
}

th, td {
	padding: var(--ww-space-3);
	border-bottom: var(--ww-border);
	text-align: left;
}

th {
	font-weight: 700;
	background: var(--ww-color-surface);
}

ul, ol {
	padding-left: 1.25em;
}

li + li {
	margin-top: var(--ww-space-1);
}

/* Formulaires --------------------------------------------------------- */

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

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
textarea,
select {
	width: 100%;
	padding: 0.7em 0.9em;
	background: var(--ww-color-light);
	border: 1px solid var(--ww-color-border);
	border-radius: var(--ww-radius-sm);
	transition: border-color var(--ww-duration) var(--ww-ease), box-shadow var(--ww-duration) var(--ww-ease);
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--ww-color-dark);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ww-color-primary) 55%, transparent);
}

textarea {
	min-height: 9em;
	resize: vertical;
}

label {
	display: block;
	margin-bottom: var(--ww-space-2);
	font-size: var(--ww-text-sm);
	font-weight: 600;
}

button,
input[type="submit"] {
	cursor: pointer;
}

::placeholder {
	color: var(--ww-color-muted);
	opacity: 1;
}

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

:focus-visible {
	outline: 3px solid var(--ww-color-focus);
	outline-offset: 2px;
	border-radius: 3px;
}

.ww-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ww-skip-link {
	position: absolute;
	left: -9999px;
	z-index: var(--ww-z-modal);
	padding: var(--ww-space-3) var(--ww-space-5);
	background: var(--ww-color-dark);
	color: var(--ww-color-light);
	border-radius: 0 0 var(--ww-radius-sm) 0;
	text-decoration: none;
}

.ww-skip-link:focus {
	left: 0;
	top: 0;
	color: var(--ww-color-light);
}

/* Sélection et défilement ---------------------------------------------- */

::selection {
	background: var(--ww-color-primary);
	color: var(--ww-on-primary);
}

@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;
	}
}
