/* Acessibilidade (WCAG 2.2 AA): base, contraste e botão flutuante.
   Servido direto, sem build. Carregado por includes/meta.php e pelas LPs. */

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.skip-link { position: fixed; left: 12px; top: -80px; z-index: 10001; padding: 12px 18px; background: #0F172A; color: #fff; border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 12px; }

/* Foco visível, inclusive onde havia outline:none */
html :focus-visible { outline: 3px solid #2563eb !important; outline-offset: 2px; }
#conteudo:focus { outline: none !important; }

/* clip (e não hidden) não quebra position:sticky; segura o deslocamento das animações em 320px */
#conteudo { overflow-x: clip; }

/* Elemento focado não fica sob o cabeçalho fixo nem escondido na barra de topo recolhida */
html { scroll-padding-top: 110px; }
.header-sticky.scrolled .top-bar-wrap:focus-within { max-height: 36px; opacity: 1; }
/* WhatsApp focado pelo teclado passa à frente do aviso de cookies */
html .whatsapp-fab:focus-visible { z-index: 10000; }

/* Menu aberto por cima do aviso de cookies */
#header { z-index: 1002; }

/* No celular o botão do WhatsApp cobria o "Aceitar" dos cookies */
@media (max-width: 768px) { html .cookie-consent-card { z-index: 9999; } }
body:has(#mobileMenu.open) .cookie-consent-card { visibility: hidden; }

/* Botão do WhatsApp cobria o link LGPD no fim da página */
html .ga-foot-wrap { padding-bottom: 96px; }

/* Menu mobile fechado sai da ordem de Tab */
.mobile-menu { visibility: hidden; transition: max-height .35s ease, visibility .35s; }
.mobile-menu.open { visibility: visible; }

/* Bloco com revelação no scroll aparece assim que recebe foco */
html .fade-up:focus-within, html .reveal:focus-within { opacity: 1 !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-delay: 0s !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Contraste (1.4.3) ===== */
html .text-primary,
html .hover\:text-primary:hover,
html .group:hover .group-hover\:text-primary { color: #2f7a1c; }
html .bg-dark .text-primary { color: #54B435; }
html .bg-dark .text-body-light { color: #94a3b8; }
html .bg-primary.text-white { background-color: #2f7a1c; }
html .text-green-600 { color: #15803d; }
html .text-amber-600 { color: #b45309; }
html .text-orange-600 { color: #c2410c; }
html .btn-gradient { background: linear-gradient(135deg, #2f7a1c 0%, #276a17 100%); }
html .btn-gradient::before { background: linear-gradient(135deg, #276a17 0%, #1d5210 100%); }
html .chat-window-header, html .chat-send-btn { background: linear-gradient(135deg, #2f7a1c, #276a17); }
html .message-time { color: #64748b; }
html .\!bg-primary { background-color: #2f7a1c !important; }
html .bg-primary-light.text-primary-dark { color: #2f7a1c; }
/* links no corpo do artigo: contraste e distinção além da cor */
html .article-content a:not([class]) { color: #2f7a1c; text-decoration: underline; }

.chat-close { border: 0; padding: 0; }

/* ===== Botão flutuante ===== */
.a11y-widget { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 9997; }
.a11y-widget.aberto { z-index: 10000; }
body:has(#mobileMenu.open) .a11y-widget { display: none; }
.a11y-widget button { font-family: inherit; cursor: pointer; }
.a11y-toggle { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; background: #0F172A; color: #fff; border: 2px solid #fff; border-right: 0; border-radius: 8px 0 0 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.a11y-toggle svg { width: 30px; height: 30px; }
.a11y-panel { position: absolute; right: 56px; top: 50%; transform: translateY(-50%); width: 260px; max-width: calc(100vw - 72px); max-height: 90vh; overflow: auto; padding: 16px; background: #fff; color: #0F172A; border: 1px solid #cbd5e1; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); font-size: 15px; line-height: 1.4; }
.a11y-panel[hidden] { display: none; }
.a11y-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.a11y-panel button { min-height: 40px; background: #fff; color: #0F172A; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; }
.a11y-panel .a11y-close { width: 40px; font-size: 22px; line-height: 1; }
.a11y-zoom { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.a11y-zoom span { grid-column: 1 / -1; }
.a11y-panel .a11y-switch, .a11y-panel .a11y-reset { display: block; width: 100%; margin-top: 8px; padding: 8px 12px; text-align: left; }
.a11y-panel .a11y-switch[aria-pressed="true"] { background: #0F172A; border-color: #0F172A; color: #fff; }
.a11y-panel .a11y-switch[aria-pressed="true"]::after { content: "✓"; float: right; }
.a11y-panel .a11y-reset { text-align: center; }

/* Sublinhar links */
html.a11y-sublinhar a { text-decoration: underline !important; }

/* Parar animações */
html.a11y-parar *, html.a11y-parar *::before, html.a11y-parar *::after {
    animation-delay: 0s !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
}

/* Alto contraste: tudo transparente sobre preto; só o que flutua recebe fundo próprio */
html.a11y-contraste, html.a11y-contraste body { background: #000 !important; }
html.a11y-contraste *:not(img):not(svg *) {
    background-color: transparent !important;
    background-image: none !important;
    color: #fff !important;
    -webkit-text-fill-color: currentColor !important;
    border-color: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
html.a11y-contraste #header,
html.a11y-contraste #mainNav,
html.a11y-contraste .nav-dropdown-menu,
html.a11y-contraste .mobile-menu,
html.a11y-contraste .chat-bubble,
html.a11y-contraste .chat-window,
html.a11y-contraste .whatsapp-fab,
html.a11y-contraste .cookie-consent-card,
html.a11y-contraste .a11y-toggle,
html.a11y-contraste .a11y-panel { background-color: #000 !important; }
html.a11y-contraste.a11y-contraste a, html.a11y-contraste.a11y-contraste a * { color: #ff0 !important; }
html.a11y-contraste button, html.a11y-contraste a[class*="btn"], html.a11y-contraste .chat-bubble, html.a11y-contraste .chat-window, html.a11y-contraste .cookie-consent-card { border: 2px solid #fff !important; }
html.a11y-contraste :focus-visible { outline-color: #0ff !important; }
html.a11y-contraste *::before, html.a11y-contraste *::after { background-image: none !important; }
/* Logo escuro ganha fundo claro; vídeo e fundos decorativos encobrem o texto */
html.a11y-contraste #header img { background-color: #fff !important; padding: 2px 6px; border-radius: 4px; }
html.a11y-contraste video, html.a11y-contraste .home-hero-overlay { display: none; }
html.a11y-contraste .a11y-panel .a11y-switch[aria-pressed="true"] { outline: 3px solid #ff0; }

/* Zoom por CSS cria rolagem lateral em telas menores; no celular vale o zoom do navegador */
@media (max-width: 1199px) { .a11y-zoom { display: none; } }
@media print { .a11y-widget, .skip-link { display: none; } }
