/* Widget d'accessibilité — Mairie de Mons-en-Pévèle */

:root {
	--a11y-zoom: 1;
	--a11y-teal: #006d78;
	--a11y-teal-dark: #004e56;
	--a11y-ink: #1c2b2e;
	--a11y-muted: #5c6d70;
	--a11y-line: #d5e2e3;
	--a11y-soft: #f3f7f7;
	--a11y-focus: #ffbf47;
}

html.a11y-zoomed {
	zoom: var(--a11y-zoom);
}

/* Contraste élevé */
html.a11y-contrast,
html.a11y-contrast body {
	background-color: #000 !important;
	color: #fff !important;
}

html.a11y-contrast .body,
html.a11y-contrast .body * {
	background-color: transparent !important;
	color: #fff !important;
	border-color: #fff !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

html.a11y-contrast .body,
html.a11y-contrast .body div,
html.a11y-contrast .body section,
html.a11y-contrast .body article,
html.a11y-contrast .body header,
html.a11y-contrast .body footer,
html.a11y-contrast .body nav,
html.a11y-contrast .body main,
html.a11y-contrast .body aside,
html.a11y-contrast .body ul,
html.a11y-contrast .body ol,
html.a11y-contrast .body li,
html.a11y-contrast .body table,
html.a11y-contrast .body thead,
html.a11y-contrast .body tbody,
html.a11y-contrast .body tr,
html.a11y-contrast .body td,
html.a11y-contrast .body th,
html.a11y-contrast .body form,
html.a11y-contrast .body p,
html.a11y-contrast .body h1,
html.a11y-contrast .body h2,
html.a11y-contrast .body h3,
html.a11y-contrast .body h4,
html.a11y-contrast .body h5,
html.a11y-contrast .body h6,
html.a11y-contrast .body figure,
html.a11y-contrast .body figcaption,
html.a11y-contrast .body blockquote,
html.a11y-contrast .body dl,
html.a11y-contrast .body dt,
html.a11y-contrast .body dd {
	background-color: #000 !important;
	background-image: none !important;
}

html.a11y-contrast .body a,
html.a11y-contrast .body a * {
	color: #ffe14a !important;
	background-color: transparent !important;
}

html.a11y-contrast .body .btn,
html.a11y-contrast .body a.btn,
html.a11y-contrast .body button,
html.a11y-contrast .body input[type="button"],
html.a11y-contrast .body input[type="submit"],
html.a11y-contrast .body input[type="reset"] {
	background-color: #ffe14a !important;
	color: #000 !important;
	border: 2px solid #ffe14a !important;
}

html.a11y-contrast .body .btn *,
html.a11y-contrast .body a.btn *,
html.a11y-contrast .body button * {
	color: #000 !important;
	background-color: transparent !important;
}

html.a11y-contrast .body input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]),
html.a11y-contrast .body textarea,
html.a11y-contrast .body select {
	background-color: #fff !important;
	color: #000 !important;
	border: 2px solid #fff !important;
}

html.a11y-contrast .body input::placeholder,
html.a11y-contrast .body textarea::placeholder {
	color: #333 !important;
}

html.a11y-contrast .body img,
html.a11y-contrast .body video,
html.a11y-contrast .body svg,
html.a11y-contrast .body canvas,
html.a11y-contrast .body iframe {
	background-color: transparent !important;
	background-image: none !important;
}

html.a11y-contrast .body a:focus,
html.a11y-contrast .body button:focus,
html.a11y-contrast .body input:focus,
html.a11y-contrast .body select:focus,
html.a11y-contrast .body textarea:focus,
html.a11y-contrast .body [tabindex]:focus {
	outline: 3px solid #ffe14a !important;
	outline-offset: 3px !important;
}

/* Niveaux de gris et inversion — sur <html> pour ne pas casser le positionnement fixe */
html.a11y-gray {
	filter: grayscale(1);
}

html.a11y-invert {
	filter: invert(1) hue-rotate(180deg);
}

html.a11y-gray.a11y-invert {
	filter: grayscale(1) invert(1) hue-rotate(180deg);
}

html.a11y-invert .a11y-widget {
	filter: invert(1) hue-rotate(180deg);
}

/* Souligner les liens */
html.a11y-underline .body a {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 0.18em !important;
}

/* Police plus lisible (Atkinson Hyperlegible, conçue pour la basse vision) */
html.a11y-readable .body,
html.a11y-readable .body *:not(i):not(.fa):not(.fas):not(.far):not(.fab):not(.fal):not(.fad):not([class*="fa-"]):not([class*="icon-"]) {
	font-family: "Atkinson Hyperlegible", Verdana, "Trebuchet MS", sans-serif !important;
}

html.a11y-readable .body p,
html.a11y-readable .body li,
html.a11y-readable .body td,
html.a11y-readable .body dd,
html.a11y-readable .body blockquote {
	letter-spacing: 0.01em;
	line-height: 1.65 !important;
}

/* Panneau */
.a11y-widget {
	position: fixed;
	z-index: 1000001;
	left: max(16px, env(safe-area-inset-left));
	bottom: max(16px, env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column-reverse;
	align-items: flex-start;
	gap: 10px;
	color: var(--a11y-ink);
	font-family: "Open Sans", "Segoe UI", Verdana, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	letter-spacing: 0;
	text-align: left;
}

.a11y-widget *,
.a11y-widget *::before,
.a11y-widget *::after {
	box-sizing: border-box;
	font-family: inherit;
}

.a11y-widget button {
	margin: 0;
	font: inherit;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.a11y-widget button:focus {
	outline: none;
}

.a11y-widget button:focus-visible {
	outline: 3px solid var(--a11y-focus) !important;
	outline-offset: 2px;
}

.a11y-widget__toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 10px 16px 10px 12px;
	border: 0;
	border-radius: 999px;
	background: var(--a11y-teal);
	color: #fff;
	box-shadow: 0 8px 24px rgba(0, 45, 50, 0.28);
}

.a11y-widget__toggle:hover,
.a11y-widget__toggle[aria-expanded="true"] {
	background: var(--a11y-teal-dark);
}

.a11y-widget__icon {
	display: block;
	width: 26px;
	height: 26px;
	flex: 0 0 auto;
}

.a11y-widget__label {
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
}

.a11y-panel {
	width: min(340px, calc(100vw - 32px));
	max-height: min(72vh, 580px);
	overflow: auto;
	padding: 16px 16px 14px;
	border: 1px solid var(--a11y-line);
	border-radius: 16px;
	background: #fff;
	color: var(--a11y-ink);
	box-shadow: 0 18px 48px rgba(0, 40, 45, 0.2);
}

.a11y-panel[hidden] {
	display: none !important;
}

.a11y-panel__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 6px;
}

.a11y-panel__title {
	margin: 0;
	padding: 0;
	color: var(--a11y-teal-dark);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.a11y-panel__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: -6px -6px 0 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--a11y-ink);
	font-size: 24px;
	line-height: 1;
}

.a11y-panel__close:hover {
	background: var(--a11y-soft);
}

.a11y-panel__intro {
	margin: 0 0 14px;
	padding: 0;
	color: var(--a11y-muted);
	font-size: 13.5px;
	line-height: 1.45;
}

.a11y-field__label {
	display: block;
	margin: 0 0 8px;
	padding: 0;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.01em;
}

.a11y-text {
	display: grid;
	grid-template-columns: 64px 1fr 64px;
	gap: 8px;
	align-items: center;
	margin-bottom: 14px;
}

.a11y-text__btn {
	min-height: 44px;
	padding: 0 8px;
	border: 1px solid var(--a11y-teal);
	border-radius: 10px;
	background: #fff;
	color: var(--a11y-teal-dark);
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
}

.a11y-text__btn:hover:not(:disabled) {
	background: #e7f4f5;
}

.a11y-text__btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.a11y-text__value {
	display: block;
	color: var(--a11y-ink);
	font-size: 16px;
	font-weight: 700;
	text-align: center;
}

.a11y-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.a11y-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	border: 1px solid transparent;
	border-radius: 12px;
	background: var(--a11y-soft);
	color: var(--a11y-ink);
	text-align: left;
}

.a11y-option:hover {
	border-color: #b7d0d3;
}

.a11y-option[aria-pressed="true"] {
	border-color: var(--a11y-teal);
	background: #e5f4f5;
	color: var(--a11y-teal-dark);
}

.a11y-option__main {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.a11y-option__icon {
	display: block;
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
}

.a11y-option__label {
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.25;
}

.a11y-switch {
	position: relative;
	width: 42px;
	height: 24px;
	flex: 0 0 auto;
	border-radius: 999px;
	background: #c5d1d2;
}

.a11y-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: transform 0.18s ease;
}

.a11y-option[aria-pressed="true"] .a11y-switch {
	background: var(--a11y-teal);
}

.a11y-option[aria-pressed="true"] .a11y-switch::after {
	transform: translateX(18px);
}

.a11y-reset {
	display: block;
	width: 100%;
	min-height: 44px;
	margin-top: 14px;
	padding: 10px 14px;
	border: 1px solid var(--a11y-teal);
	border-radius: 12px;
	background: #fff;
	color: var(--a11y-teal-dark);
	font-size: 14.5px;
	font-weight: 700;
}

.a11y-reset:hover {
	background: var(--a11y-teal);
	color: #fff;
}

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

@media (max-width: 420px) {
	.a11y-widget__label {
		position: absolute !important;
		width: 1px !important;
		height: 1px !important;
		padding: 0 !important;
		margin: -1px !important;
		overflow: hidden !important;
		clip: rect(0, 0, 0, 0) !important;
		white-space: nowrap !important;
		border: 0 !important;
	}

	.a11y-widget__toggle {
		width: 52px;
		height: 52px;
		padding: 0;
		justify-content: center;
		border-radius: 50%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.a11y-switch::after {
		transition: none;
	}
}

@media print {
	.a11y-widget {
		display: none !important;
	}
}
