/* Alto contraste do Portal Institucional: só age com a classe em <html>, ligada pelo botão de includes/header.php.
   Mesmas cores da Transparência: fundo preto, texto branco e ações em amarelo.
   Vale em todo o body, porque há páginas sem <main>, e fica fora da impressão, para não gastar tinta com o fundo preto.
   :not(#pt-ac) vence as regras de cada página, que também usam !important. */
@media screen {
html.a11y-alto-contraste { color-scheme: dark; background: #000 !important; }
html.a11y-alto-contraste body { background: #000 !important; color: #fff !important; }

/* Base: nada depende da cor original nem de imagem de fundo. Os controles do Bootstrap que desenham o ícone no fundo ficam de fora. */
html.a11y-alto-contraste body *:not(img, video, iframe, svg, svg *):not(#pt-ac) { color: #fff !important; background-color: #000 !important; border-color: #fff !important; text-shadow: none !important; box-shadow: none !important; -webkit-text-fill-color: currentColor !important; }
html.a11y-alto-contraste body *:not(.form-select, .form-check-input, .btn-close, .navbar-toggler-icon, .carousel-control-prev-icon, .carousel-control-next-icon):not(#pt-ac) { background-image: none !important; }
/* Ícones e enfeites feitos com ::before e ::after seguem a cor do elemento e não cobrem o texto. */
html.a11y-alto-contraste body *:not(.accordion-button):not(#pt-ac)::before, html.a11y-alto-contraste body *:not(.accordion-button):not(#pt-ac)::after { color: inherit !important; background-color: transparent !important; background-image: none !important; box-shadow: none !important; }
html.a11y-alto-contraste body *:not(.accordion-button, .dropdown-toggle, .destaque-ponto):not(#pt-ac)::before, html.a11y-alto-contraste body *:not(.accordion-button, .dropdown-toggle, .destaque-ponto):not(#pt-ac)::after { border-color: currentColor !important; }
html.a11y-alto-contraste img { filter: grayscale(100%) contrast(1.3); }
/* A logomarca é feita para fundo claro: sem o fundo branco, o que for escuro nela desapareceria. */
html.a11y-alto-contraste .brand-logo img:not(#pt-ac), html.a11y-alto-contraste img.brand-logo:not(#pt-ac), html.a11y-alto-contraste img.sf-logo:not(#pt-ac) { background-color: #fff !important; padding: 2px; border-radius: 4px; }

/* Links e botões em amarelo, com sublinhado ou borda: a ação não depende só da cor. */
html.a11y-alto-contraste body :is(a, a *, button, button *, .btn, .btn *):not(#pt-ac), html.a11y-alto-contraste body input:is([type="submit"], [type="button"], [type="reset"]):not(#pt-ac) { color: #ffe000 !important; }
html.a11y-alto-contraste body a:not(#pt-ac) { text-decoration: underline !important; }
html.a11y-alto-contraste body :is(a.btn, .nav-link, .dropdown-item, .page-link, .navbar-brand):not(#pt-ac) { text-decoration: none !important; }
html.a11y-alto-contraste body :is(button, .btn, input[type="submit"], input[type="button"], input[type="reset"]):not(.btn-close, .btn-link, .accordion-button, .destaque-ponto):not(#pt-ac) { border: 2px solid #ffe000 !important; }
html.a11y-alto-contraste body ::file-selector-button { background: #000 !important; color: #ffe000 !important; border: 2px solid #ffe000 !important; }

/* Selecionado, ao passar o ponteiro e com foco: cores invertidas. */
html.a11y-alto-contraste body :is(a, button, .btn, input[type="submit"], input[type="button"], input[type="reset"]):is(:hover, :focus-visible):not(#pt-ac), html.a11y-alto-contraste body :is(a, button, .btn):is(:hover, :focus-visible) *:not(#pt-ac), html.a11y-alto-contraste body :is(.nav-link.active, .page-item.active .page-link, .dropdown-item.active, .list-group-item.active, .btn.active, [aria-expanded="true"].dropdown-toggle):not(#pt-ac), html.a11y-alto-contraste body :is(.nav-link.active, .page-item.active .page-link, .dropdown-item.active, .list-group-item.active, .btn.active) *:not(#pt-ac), html.a11y-alto-contraste body [aria-pressed="true"]:not(#pt-ac), html.a11y-alto-contraste body [aria-pressed="true"] *:not(#pt-ac) { color: #000 !important; background-color: #ffe000 !important; border-color: #ffe000 !important; }
html.a11y-alto-contraste body :focus-visible:not(#pt-ac) { outline: 3px solid #fff !important; outline-offset: 2px !important; }

/* Campos de formulário: mantêm o desenho do controle, em cores legíveis. */
html.a11y-alto-contraste body :is(.form-control, .form-select, .form-check-input, input, select, textarea):not([type="submit"], [type="button"], [type="reset"]):not(#pt-ac) { border: 2px solid #fff !important; }
html.a11y-alto-contraste body :is(input, textarea)::placeholder { color: #fff !important; opacity: 1; font-style: italic; }
html.a11y-alto-contraste body .form-select:not(#pt-ac) { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important; }
html.a11y-alto-contraste body .form-check-input[type="checkbox"]:checked:not(#pt-ac) { background-color: #ffe000 !important; border-color: #ffe000 !important; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important; }
html.a11y-alto-contraste body .form-check-input[type="radio"]:checked:not(#pt-ac) { background-color: #ffe000 !important; border-color: #ffe000 !important; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23000'/%3e%3c/svg%3e") !important; }
html.a11y-alto-contraste body :is(input:not(.form-check-input), textarea, select, button, .btn):is(:disabled, .disabled):not(#pt-ac) { border-style: dashed !important; opacity: 1 !important; }

/* Ícones do Bootstrap desenhados na imagem de fundo. */
html.a11y-alto-contraste body .navbar-toggler-icon:not(#pt-ac) { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffe000' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important; }
html.a11y-alto-contraste body .btn-close:not(#pt-ac) { filter: brightness(0) invert(1); opacity: 1; }
html.a11y-alto-contraste body .accordion-button:not(#pt-ac)::after { filter: brightness(0) invert(1); background-color: transparent !important; }
html.a11y-alto-contraste body .accordion-button:not(#pt-ac)::before { background-color: transparent !important; }
html.a11y-alto-contraste body :is(.accordion-button:hover, .accordion-button:focus-visible):not(#pt-ac)::after { filter: brightness(0); }

/* Barras e indicadores: sem a cor original, precisam continuar visíveis. */
html.a11y-alto-contraste body .progress:not(#pt-ac) { border: 1px solid #fff !important; }
html.a11y-alto-contraste body .progress-bar:not(#pt-ac) { background-color: #ffe000 !important; color: #000 !important; }
html.a11y-alto-contraste body :is(.badge, .pill):not(a, button, .btn):not(#pt-ac) { border: 1px solid #fff !important; }
html.a11y-alto-contraste body .carousel-indicators [data-bs-target]:not(#pt-ac) { background-color: #fff !important; border: 1px solid #fff !important; }
html.a11y-alto-contraste body .carousel-indicators .active:not(#pt-ac) { background-color: #ffe000 !important; }
html.a11y-alto-contraste body .destaque-ponto:not(#pt-ac) { border: 0 !important; }
html.a11y-alto-contraste body .destaque-ponto:not(#pt-ac)::before { border: 2px solid #ffe000 !important; }
html.a11y-alto-contraste body .destaque-ponto[aria-current="true"]:not(#pt-ac)::before { background-color: #ffe000 !important; }
}
