/* ---------- Effets des paramètres d'affichage (attributs posés sur <html>) ---------- */

/* Taille : tout le site est en rem, il suffit d'agrandir la racine. */
html[data-cw-texte="grand"] {
	font-size: 112.5%;
}

html[data-cw-texte="tres-grand"] {
	font-size: 125%;
}

/* Contraste renforcé : noir sur blanc, bordures franches, liens bleu foncé soulignés. */
html[data-cw-contraste="renforce"] {
	--cw-texte: #000000;
	--cw-texte-fond: #000000;
	--cw-texte-doux: #1f1f1f;
	--cw-fond: #ffffff;
	--cw-fond-doux: #f3f3f3;
	--cw-bordure: #000000;
	--cw-lien: #002a8a;
	--cw-lien-fond: #002a8a;
	--cw-focus: #000000;
	--cw-ombre: none;
}

html[data-cw-contraste="renforce"] a {
	text-decoration: underline;
}

html[data-cw-contraste="renforce"] img {
	filter: contrast(1.05);
}

/* Espacement : valeurs du critère WCAG 1.4.12. */
html[data-cw-espacement="aere"] :is(p, li, dd, dt, td, th, label, blockquote) {
	line-height: 1.8 !important;
	letter-spacing: 0.08em !important;
	word-spacing: 0.16em !important;
}

html[data-cw-espacement="aere"] p {
	margin-bottom: 1.5em;
}

/* Police adaptée à la lecture (Atkinson Hyperlegible, conçue pour les malvoyants). */
html[data-cw-police="lisible"] {
	--cw-police-titres: var(--cw-police-lisible, sans-serif);
	--cw-police-texte: var(--cw-police-lisible, sans-serif);
}

html[data-cw-police="lisible"] body,
html[data-cw-police="lisible"] :is(h1, h2, h3, h4, h5, h6, button, input, select, textarea) {
	font-family: var(--cw-police-lisible, sans-serif) !important;
	font-stretch: normal !important;
	font-style: normal !important;
}

html[data-cw-liens="soulignes"] a {
	text-decoration: underline !important;
	text-underline-offset: 0.18em;
}

html[data-cw-animations="reduites"] *,
html[data-cw-animations="reduites"] *::before,
html[data-cw-animations="reduites"] *::after {
	animation-duration: 0.001ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	scroll-behavior: auto !important;
}

/* ---------- Bouton et fenêtre ---------- */

.cw-affichage-bouton {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: var(--cw-epaisseur-bordure) solid var(--cw-bordure);
	border-radius: var(--cw-rayon-bouton);
	background: transparent;
	color: var(--cw-texte);
	cursor: pointer;
}

.cw-affichage-bouton[hidden],
.cw-affichage-lien[hidden] {
	display: none;
}

.cw-affichage-lien {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.cw-affichage {
	width: min(32rem, calc(100% - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: var(--cw-epaisseur-bordure) solid var(--cw-bordure);
	border-radius: var(--cw-rayon);
	background: var(--cw-fond);
	color: var(--cw-texte-fond);
	box-shadow: 0 24px 60px rgb(0 0 0 / 0.25);
}

.cw-affichage::backdrop {
	background: rgb(0 0 0 / 0.45);
}

.cw-affichage__formulaire {
	display: grid;
	gap: 1rem;
	padding: 1.5rem;
}

.cw-affichage__tete {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.cw-affichage__titre {
	margin: 0;
	font-size: var(--cw-taille-h4);
}

.cw-affichage__fermer {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--cw-fond-doux);
	color: inherit;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.cw-affichage__aide {
	margin: 0;
	color: var(--cw-texte-doux);
	font-size: var(--cw-taille-petit);
}

.cw-affichage__groupe {
	margin: 0;
	padding: 0;
	border: 0;
}

.cw-affichage__groupe legend {
	margin-bottom: 0.45rem;
	padding: 0;
	font-weight: 700;
}

.cw-affichage__choix {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.cw-affichage__option {
	position: relative;
	display: inline-flex;
}

.cw-affichage__option input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.cw-affichage__option span {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0.35rem 0.9rem;
	border: var(--cw-epaisseur-bordure) solid var(--cw-bordure);
	border-radius: var(--cw-rayon-bouton);
	font-size: var(--cw-taille-petit);
	font-weight: 600;
}

.cw-affichage__option input:checked + span {
	border-color: var(--cw-couleur-principale);
	background: var(--cw-couleur-principale);
	color: var(--cw-couleur-principale-texte);
}

.cw-affichage__option input:checked + span::before {
	content: "✓";
	margin-right: 0.4em;
}

.cw-affichage__option input:focus-visible + span {
	outline: 3px solid var(--cw-focus);
	outline-offset: 2px;
}

.cw-affichage__pied {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.75rem;
	padding-top: 0.5rem;
	border-top: var(--cw-epaisseur-bordure) solid var(--cw-bordure);
}
