/**
 * Gov Moderno — painel "Mais recursos de acessibilidade" e efeitos de cada recurso.
 * Markup em inc/acessibilidade.php; lógica em assets/js/a11y-tools.js.
 */

/* Painel ------------------------------------------------------------- */

.gm-a11y-panel {
	position: fixed;
	top: 48px;
	right: 16px;
	z-index: 100000;
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100vh - 64px);
	overflow-y: auto;
	padding: 16px;
	border: 1px solid var(--gm-border, #e6e6e6);
	border-radius: var(--gm-radius, 12px);
	background: var(--gm-surface, #fff);
	box-shadow: var(--gm-shadow-lg, 0 18px 40px rgba(7, 29, 65, .14));
	color: var(--gm-text, #333);
	font-family: var(--gm-font, sans-serif);
	font-size: 16px;
	line-height: 1.4;
}

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

.gm-a11y-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 12px;
}

.gm-a11y-panel__title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 1.1rem;
	color: var(--gm-primary-dark, #071d41);
}

.gm-a11y-panel button {
	font: inherit;
	cursor: pointer;
}

.gm-a11y-panel__close {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
}

.gm-a11y-panel__close:hover,
.gm-a11y-panel__close:focus-visible {
	background: var(--gm-surface-muted, #f5f7fb);
}

.gm-a11y-panel__speak {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	border: 0;
	border-radius: var(--gm-radius-sm, 6px);
	background: var(--gm-primary, #1351b4);
	color: #fff;
	font-weight: 700;
}

.gm-a11y-panel__speak:hover,
.gm-a11y-panel__speak:focus-visible {
	background: var(--gm-primary-hover, #0c326f);
}

.gm-a11y-panel__hint {
	margin: 6px 0 12px;
	font-size: .85rem;
	color: var(--gm-text-muted, #636363);
}

.gm-a11y-panel__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.gm-a11y-panel__toggle {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	min-height: 76px;
	padding: 8px 6px;
	border: 2px solid var(--gm-border, #e6e6e6);
	border-radius: var(--gm-radius-sm, 6px);
	background: var(--gm-surface, #fff);
	color: inherit;
	font-size: .875rem;
	text-align: center;
}

.gm-a11y-panel__toggle i {
	font-size: 1.25rem;
	color: var(--gm-primary, #1351b4);
}

.gm-a11y-panel__toggle:hover,
.gm-a11y-panel__toggle:focus-visible {
	border-color: var(--gm-primary, #1351b4);
}

.gm-a11y-panel__toggle[aria-pressed="true"] {
	border-color: var(--gm-primary, #1351b4);
	background: var(--gm-primary-soft, #edf5ff);
	font-weight: 700;
}

.gm-a11y-panel__reset {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 40px;
	border: 1px solid var(--gm-border, #e6e6e6);
	border-radius: var(--gm-radius-sm, 6px);
	background: transparent;
	color: inherit;
}

.gm-a11y-panel__reset:hover,
.gm-a11y-panel__reset:focus-visible {
	background: var(--gm-surface-muted, #f5f7fb);
}

.gm-a11y-panel__status {
	margin: 8px 0 0;
	min-height: 1em;
	font-size: .8rem;
	color: var(--gm-text-muted, #636363);
}

.gm-a11y-panel :focus-visible {
	outline: 3px solid var(--gm-accent, #ffcd07);
	outline-offset: 2px;
}

/* Celular: volta para 2 colunas. */
@media (max-width: 575px) {
	.gm-a11y-panel__grid {
		grid-template-columns: 1fr 1fr;
	}
}

/* Espaçamento do texto (WCAG 1.4.12) --------------------------------- */

.gm-a11y-spacing #page p,
.gm-a11y-spacing #page li,
.gm-a11y-spacing #page td,
.gm-a11y-spacing #page th,
.gm-a11y-spacing #page dd,
.gm-a11y-spacing #page blockquote,
.gm-a11y-spacing #page figcaption {
	line-height: 1.8 !important;
	letter-spacing: .12em !important;
	word-spacing: .16em !important;
}

.gm-a11y-spacing #page p {
	margin-bottom: 2em !important;
}

/* Fonte mais legível -------------------------------------------------- */

.gm-a11y-font #page,
.gm-a11y-font #page *:not(i):not([class*="fa-"]) {
	font-family: Verdana, Tahoma, "Atkinson Hyperlegible", Arial, sans-serif !important;
}

/* Destacar links ------------------------------------------------------ */

.gm-a11y-links #page a {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 3px !important;
	outline: 2px dashed currentColor;
	outline-offset: 2px;
}

/* Escala de cinza ---------------------------------------------------- */
/* Aplicado no #page (não no <html>) para não quebrar elementos fixos. */

.gm-a11y-gray #page {
	filter: grayscale(1);
}

/* Pausar animações --------------------------------------------------- */

.gm-a11y-motion *,
.gm-a11y-motion *::before,
.gm-a11y-motion *::after {
	animation-duration: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0s !important;
	scroll-behavior: auto !important;
}

/* Cursor ampliado ---------------------------------------------------- */

.gm-a11y-cursor,
.gm-a11y-cursor * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l16 10-7 1.5L9.5 21z' fill='%23000' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, auto !important;
}

.gm-a11y-cursor a,
.gm-a11y-cursor a *,
.gm-a11y-cursor button,
.gm-a11y-cursor button *,
.gm-a11y-cursor [role="button"],
.gm-a11y-cursor label,
.gm-a11y-cursor summary {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l16 10-7 1.5L9.5 21z' fill='%231351b4' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, pointer !important;
}

/* Guia de leitura ---------------------------------------------------- */

.gm-a11y-guide {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 99999;
	height: 40px;
	pointer-events: none;
	border-top: 3px solid var(--gm-primary, #1351b4);
	border-bottom: 3px solid var(--gm-primary, #1351b4);
	background: rgba(255, 205, 7, .18);
	box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .25);
}

.gm-a11y-guide__hint {
	position: absolute;
	right: 12px;
	bottom: -30px;
	padding: 2px 8px;
	border-radius: 4px;
	background: var(--gm-primary-dark, #071d41);
	color: #fff;
	font-size: 12px;
	white-space: nowrap;
}

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

/* Alto contraste: painel também fica escuro (o CSS de contraste já força cores). */
.is-contrast-mode .gm-a11y-guide {
	background: transparent !important;
	border-color: rgb(255, 145, 0) !important;
}
