/*
 * Painel de acessibilidade (inc/acessibilidade.php), igual nos sites da rede.
 *
 * O painel não depende das cores do tema: usa --a11y-cor quando o tema
 * define, e o vinho dos Mercedários quando não.
 */

.a11y {
	--a11y-marca: var(--a11y-cor, #7a0f12);
	font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.a11y-abre {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 99990;
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 3px solid #fff;
	border-radius: 50%;
	background: var(--a11y-marca);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	color: #fff;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.a11y-abre:hover,
.a11y-abre:focus-visible {
	transform: scale(1.06);
}

.a11y-abre:focus-visible {
	outline: 3px solid #ffb700;
	outline-offset: 2px;
}

.a11y-abre svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
}

/* Com alguma escolha ligada, um ponto amarelo avisa. */
.a11y-abre.is-ativo::after {
	content: '';
	position: absolute;
	top: -2px;
	right: -2px;
	width: 14px;
	height: 14px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #ffb700;
}

.a11y-painel {
	position: fixed;
	right: 16px;
	bottom: 80px;
	z-index: 99991;
	box-sizing: border-box;
	width: 330px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 110px);
	overflow-y: auto;
	padding: 18px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
	color: #222;
	font-size: 15px;
	line-height: 1.4;
}

.a11y-painel[hidden] {
	display: none;
}

.a11y-painel__topo {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.a11y-painel h2 {
	margin: 0;
	color: var(--a11y-marca);
	font-family: inherit;
	font-size: 18px;
	font-weight: 800;
}

.a11y-fecha {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: #f3efe9;
	color: #222;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.a11y-texto {
	display: grid;
	grid-template-columns: 1fr auto auto auto;
	gap: 6px;
	align-items: center;
	margin-bottom: 12px;
	padding: 10px 12px;
	border-radius: 12px;
	background: #f6f2ec;
	font-weight: 700;
}

.a11y-texto button {
	min-width: 44px;
	height: 40px;
	border: 2px solid var(--a11y-marca);
	border-radius: 10px;
	background: #fff;
	color: var(--a11y-marca);
	font: inherit;
	font-weight: 800;
	cursor: pointer;
}

.a11y-texto button:disabled {
	opacity: 0.4;
	cursor: default;
}

.a11y-texto__valor {
	min-width: 48px;
	font-size: 14px;
	text-align: center;
}

.a11y-opcoes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.a11y-opcoes button {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 78px;
	padding: 10px 8px;
	border: 2px solid #ebe4da;
	border-radius: 12px;
	background: #fff;
	color: #222;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.a11y-opcoes button svg {
	width: 22px;
	height: 22px;
	fill: var(--a11y-marca);
}

.a11y-opcoes button:hover {
	border-color: var(--a11y-marca);
}

.a11y-opcoes button[aria-pressed="true"] {
	border-color: var(--a11y-marca);
	background: var(--a11y-marca);
	color: #fff;
}

.a11y-opcoes button[aria-pressed="true"] svg {
	fill: #fff;
}

.a11y-zera {
	width: 100%;
	min-height: 44px;
	border: 0;
	border-radius: 12px;
	background: #f3efe9;
	color: #222;
	font: inherit;
	font-weight: 800;
	cursor: pointer;
}

.a11y-nota {
	margin: 10px 0 0;
	color: #5b5651;
	font-size: 12px;
}

.a11y button:focus-visible {
	outline: 3px solid #ffb700;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* As escolhas                                                                 */
/* -------------------------------------------------------------------------- */

/* Tamanho do texto: a página inteira cresce junto, sem quebrar o desenho. */
html[data-a11y-texto="-2"] #page { zoom: 0.8; }
html[data-a11y-texto="-1"] #page { zoom: 0.9; }
html[data-a11y-texto="1"] #page { zoom: 1.125; }
html[data-a11y-texto="2"] #page { zoom: 1.25; }
html[data-a11y-texto="3"] #page { zoom: 1.375; }
html[data-a11y-texto="4"] #page { zoom: 1.5; }

/* Alto contraste: fundo preto, texto branco, links amarelos. */
html.a11y-contraste,
html.a11y-contraste body,
html.a11y-contraste #page *:not(img):not(svg):not(path):not(video):not(iframe):not(picture):not(source) {
	border-color: #fff !important;
	background-color: #000 !important;
	background-image: none !important;
	box-shadow: none !important;
	color: #fff !important;
	text-shadow: none !important;
}

html.a11y-contraste #page a,
html.a11y-contraste #page a *:not(img) {
	color: #ff0 !important;
}

html.a11y-contraste #page a svg,
html.a11y-contraste #page a svg path {
	fill: #ff0 !important;
}

html.a11y-contraste #page button,
html.a11y-contraste #page input,
html.a11y-contraste #page select,
html.a11y-contraste #page textarea {
	border: 2px solid #fff !important;
}

html.a11y-contraste #page img {
	filter: contrast(1.1);
}

/* Tons de cinza. */
html.a11y-cinza {
	filter: grayscale(1);
}

/* Links destacados: sublinhados e em negrito. */
html.a11y-links #page a {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 3px !important;
	font-weight: 800 !important;
}

html.a11y-links #page a:focus,
html.a11y-links #page a:hover {
	outline: 3px solid #ffb700 !important;
	outline-offset: 2px;
}

/* Fonte mais legível: letras sem serifa, mais abertas. */
html.a11y-fonte #page,
html.a11y-fonte #page *:not(svg):not(path) {
	font-family: Verdana, Tahoma, Arial, sans-serif !important;
	letter-spacing: 0.02em !important;
}

/* Mais espaço entre linhas, parágrafos e palavras. */
html.a11y-espaco #page p,
html.a11y-espaco #page li,
html.a11y-espaco #page td,
html.a11y-espaco #page dd,
html.a11y-espaco #page blockquote {
	line-height: 2 !important;
	word-spacing: 0.12em !important;
}

html.a11y-espaco #page p {
	margin-bottom: 1.5em !important;
}

/* Sem animações nem transições. */
html.a11y-sem-animacao *,
html.a11y-sem-animacao *::before,
html.a11y-sem-animacao *::after {
	scroll-behavior: auto !important;
	transition: none !important;
	animation: none !important;
}

@media (max-width: 575.98px) {
	.a11y-abre {
		width: 48px;
		height: 48px;
	}

	.a11y-painel {
		right: 12px;
		left: 12px;
		width: auto;
		max-width: none;
	}
}

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