/* Skip links */
.esic-a11y-skip {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 1000001;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 4px;
}
.esic-a11y-skip__link {
	position: absolute;
	left: -9999px;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
	background: #0d47a1;
	color: #fff;
	padding: 10px 14px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 4px;
}
.esic-a11y-skip__link:focus {
	position: fixed;
	left: 8px;
	top: 8px;
	width: auto;
	height: auto;
	overflow: visible;
	clip: auto;
	z-index: 1000002;
	outline: 3px solid #ffcc00;
	outline-offset: 2px;
}

/* Botão flutuante */
.esic-a11y-fab {
	position: fixed;
	left: max(12px, env(safe-area-inset-left, 0px));
	top: 50%;
	transform: translateY(-50%);
	z-index: 999990;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
	background: #0d47a1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, transform 0.15s ease;
}
.esic-a11y-fab:hover,
.esic-a11y-fab:focus {
	background: #1565c0;
	outline: 3px solid #ffcc00;
	outline-offset: 2px;
}
.esic-a11y-fab:active {
	transform: translateY(-50%) scale(0.96);
}
.esic-a11y-fab__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}
.esic-a11y-fab__label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Painel */
.esic-a11y-panel-wrap {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999991;
	align-items: stretch;
	justify-content: flex-start;
}
.esic-a11y-panel-wrap.is-open {
	display: flex;
}
.esic-a11y-panel-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}
.esic-a11y-panel {
	position: relative;
	margin: 12px 12px 12px 76px;
	max-width: min(420px, calc(100vw - 88px));
	width: 100%;
	max-height: calc(100vh - 24px);
	overflow: auto;
	background: #fff;
	color: #111;
	border-radius: 10px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
}
@media (max-width: 520px) {
	.esic-a11y-panel {
		margin-left: 72px;
		max-width: calc(100vw - 84px);
	}
}
.esic-a11y-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 16px;
	border-bottom: 1px solid #e0e0e0;
	background: #0d47a1;
	color: #fff;
	border-radius: 10px 10px 0 0;
}
.esic-a11y-panel__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
}
.esic-a11y-panel__close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 4px;
}
.esic-a11y-panel__close:hover,
.esic-a11y-panel__close:focus {
	background: rgba(255, 255, 255, 0.15);
	outline: 2px solid #ffcc00;
}
.esic-a11y-panel__body {
	padding: 12px 16px 20px;
	overflow: auto;
}
.esic-a11y-section {
	margin-bottom: 16px;
}
.esic-a11y-section__title {
	margin: 0 0 8px;
	font-size: 0.95rem;
	color: #0d47a1;
}
.esic-a11y-links {
	margin: 0;
	padding-left: 1.1rem;
}
.esic-a11y-links a {
	color: #0d47a1;
	text-decoration: underline;
}
.esic-a11y-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.esic-a11y-btns--row {
	flex-wrap: nowrap;
}
.esic-a11y-btn {
	flex: 1 1 auto;
	min-height: 40px;
	padding: 6px 10px;
	font-size: 13px;
	border: 1px solid #bdbdbd;
	border-radius: 6px;
	background: #f5f5f5;
	cursor: pointer;
	color: #111;
}
.esic-a11y-btns--row .esic-a11y-btn {
	flex: 1;
}
.esic-a11y-btn:hover,
.esic-a11y-btn:focus {
	border-color: #0d47a1;
	background: #e3f2fd;
	outline: none;
	box-shadow: 0 0 0 2px #90caf9;
}
.esic-a11y-btn[aria-pressed="true"] {
	background: #0d47a1;
	color: #fff;
	border-color: #0a3a82;
}
.esic-a11y-btn--primary {
	background: #0d47a1;
	color: #fff;
	border-color: #0a3a82;
	font-weight: 600;
}
.esic-a11y-btn--primary:hover,
.esic-a11y-btn--primary:focus {
	background: #1565c0;
	color: #fff;
}
.esic-a11y-btn--danger {
	background: #b71c1c;
	color: #fff;
	border-color: #7f0000;
	font-weight: 600;
}
.esic-a11y-btn--danger:hover,
.esic-a11y-btn--danger:focus {
	background: #c62828;
	color: #fff;
}
.esic-a11y-note {
	font-size: 13px;
	line-height: 1.45;
	margin: 0 0 10px;
	color: #333;
}
.esic-a11y-actions {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid #eee;
}

/* Modos no elemento raiz */
html.esic-a11y-contrast-dark body {
	background: #000 !important;
	color: #fff !important;
}
html.esic-a11y-contrast-dark body a,
html.esic-a11y-contrast-dark body a:link {
	color: #ffeb3b !important;
}
html.esic-a11y-contrast-light body {
	background: #fff !important;
	color: #000 !important;
}
html.esic-a11y-contrast-light body a,
html.esic-a11y-contrast-light body a:link {
	color: #0000ee !important;
	text-decoration: underline !important;
}

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

html.esic-a11y-sat-low body {
	filter: saturate(0.45);
}
html.esic-a11y-sat-high body {
	filter: saturate(1.6);
}

html.esic-a11y-links body a {
	text-decoration: underline !important;
	outline: 1px dotted currentColor;
}

html.esic-a11y-headings body h1,
html.esic-a11y-headings body h2,
html.esic-a11y-headings body h3,
html.esic-a11y-headings body h4 {
	border-left: 4px solid #0d47a1 !important;
	padding-left: 8px !important;
}

/*
 * Modo leitura: reduz peso visual só em imagens decorativas do cabeçalho.
 * Não aplicar opacity no #faixa inteiro — isso escurecia os links de texto e piorava o contraste (WCAG).
 */
html.esic-a11y-reading #cabecalho #faixa img,
html.esic-a11y-reading #cabecalho #logo img,
html.esic-a11y-reading #cabecalho #esic img,
html.esic-a11y-reading #cabecalho #menu-principal img {
	opacity: 0.38;
	filter: grayscale(0.25);
}

/* Âncora de skip (#conteudo-principal): não aplicar zoom aqui (fica fora do miolo visível). */
.esic-a11y-miolo-anchor {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.esic-a11y-miolo-anchor:focus {
	position: fixed;
	left: 8px;
	top: 48px;
	z-index: 1000000;
	width: auto;
	height: auto;
	clip: auto;
	overflow: visible;
	padding: 8px 12px;
	background: #fff;
	border: 2px solid #0d47a1;
	outline: 3px solid #ffcc00;
}

/* Miolo real: irmãos do header dentro de #principal (exclui só a âncora de skip). */
#principal > header.page-header ~ *:not(.esic-a11y-miolo-anchor) {
	line-height: var(--esic-lh, 1.35) !important;
	letter-spacing: var(--esic-ls, normal) !important;
}
@supports (zoom: 1) {
	#principal > header.page-header ~ *:not(.esic-a11y-miolo-anchor) {
		zoom: var(--esic-zoom, 1);
	}
}
@supports not (zoom: 1) {
	#principal > header.page-header ~ *:not(.esic-a11y-miolo-anchor) {
		font-size: calc(12px * var(--esic-fs, 1)) !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.esic-a11y-fab,
	.esic-a11y-panel {
		transition: none !important;
	}
}
