/* Wise Acessibilidade */

/* ---------- Botão flutuante e painel ---------- */

#wa-root {
    /* Vektra: accent configurável, superfícies cinza #f5f5f5 / #f0f0f0. */
    --wa-color: #2E7EF0;
    --wa-bg: #ffffff;
    --wa-text: #0c0c0c;
    --wa-muted: #6b6b6b;
    --wa-line: #e6e6e6;
    --wa-soft: #f5f5f5;
    --wa-inner: #f0f0f0;
    position: fixed;
    z-index: 2147483000;
    font-family: "Lufga", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color: var(--wa-text);
}
#wa-root *, #wa-root *::before, #wa-root *::after { box-sizing: border-box; }
#wa-root.wa-pos-bottom-right { right: 20px; bottom: 20px; }
#wa-root.wa-pos-bottom-left { left: 20px; bottom: 20px; }
#wa-root.wa-pos-middle-right { right: 16px; top: 50%; transform: translateY(-50%); }
#wa-root.wa-pos-middle-left { left: 16px; top: 50%; transform: translateY(-50%); }

#wa-root button { font: inherit; cursor: pointer; margin: 0; }
#wa-root button:focus-visible,
#wa-root select:focus-visible {
    outline: 3px solid #ffbf00;
    outline-offset: 2px;
}
#wa-root svg { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }

.wa-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: var(--wa-color);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 8px 30px rgba(12, 12, 12, .22);
    transition: transform .2s ease, filter .2s ease;
    padding: 0;
}
.wa-toggle svg { width: 30px; height: 30px; }
.wa-toggle:hover { filter: brightness(1.08); transform: scale(1.04); }
.wa-is-reading .wa-toggle { animation: wa-pulse 1.6s ease-in-out infinite; }
@keyframes wa-pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, .3), 0 0 0 0 color-mix(in srgb, var(--wa-color) 60%, transparent); }
    50% { box-shadow: 0 4px 14px rgba(0, 0, 0, .3), 0 0 0 10px transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .wa-is-reading .wa-toggle { animation: none; }
}

/* Pausa rápida, visível só durante a leitura com o painel fechado. */
.wa-quick {
    display: none;
    position: absolute;
    top: -6px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #1d1d1f;
    color: #fff;
    place-items: center;
    padding: 0;
}
.wa-pos-bottom-right .wa-quick, .wa-pos-middle-right .wa-quick { left: -14px; }
.wa-pos-bottom-left .wa-quick, .wa-pos-middle-left .wa-quick { right: -14px; }
.wa-is-reading .wa-quick { display: grid; }
.wa-quick svg { width: 16px; height: 16px; }

.wa-panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    width: min(340px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - 110px));
    overflow: hidden;
    background: var(--wa-bg);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(12, 12, 12, .18);
    border: 0;
    animation: wa-panel-in .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes wa-panel-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.wa-pos-middle-right .wa-panel, .wa-pos-middle-left .wa-panel { animation: none; }
@media (prefers-reduced-motion: reduce) { .wa-panel { animation: none; } }
.wa-panel[hidden] { display: none; }
.wa-pos-bottom-right .wa-panel { right: 0; bottom: 68px; }
.wa-pos-bottom-left .wa-panel { left: 0; bottom: 68px; }
.wa-pos-middle-right .wa-panel { right: 68px; top: 50%; transform: translateY(-50%); }
.wa-pos-middle-left .wa-panel { left: 68px; top: 50%; transform: translateY(-50%); }

.wa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 6px 20px;
    background: var(--wa-bg);
    color: var(--wa-text);
    border-radius: 20px 20px 0 0;
    flex: none;
}
#wa-root .wa-head h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--wa-text); }
.wa-close { color: var(--wa-text) !important; }

.wa-body { padding: 4px 20px 18px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.wa-section { padding: 12px 0; border-bottom: 1px solid var(--wa-line); }
#wa-root .wa-section h3 {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--wa-muted);
}

.wa-player { display: flex; gap: 6px; align-items: center; }
.wa-play {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 30px;
    border: 0;
    background: var(--wa-color);
    color: #fff;
    font-weight: 600 !important;
}
.wa-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--wa-inner);
    color: var(--wa-text);
    display: grid;
    place-items: center;
    padding: 0;
}
.wa-icon-btn:disabled { opacity: .4; cursor: not-allowed !important; }
.wa-head .wa-icon-btn { background: var(--wa-inner); width: 36px; height: 36px; }
.wa-head .wa-icon-btn:hover { background: var(--wa-line); }

.wa-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.wa-field[hidden] { display: none; }
#wa-root .wa-field label { font-size: 14px; color: var(--wa-text); margin: 0; }
#wa-root .wa-field select {
    max-width: 200px;
    min-height: 36px;
    padding: 4px 12px;
    border: 0;
    border-radius: 30px;
    background: var(--wa-inner);
    color: var(--wa-text);
    font-size: 14px;
}
#wa-root .wa-status { margin: 10px 0 0; font-size: 14px; color: var(--wa-text); min-height: 1em; }
#wa-root .wa-status:empty { display: none; }
#wa-root .wa-hint { margin: 10px 0 0; font-size: 13px; color: var(--wa-muted); }

.wa-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wa-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: 16px;
    border: 1.5px solid transparent;
    background: var(--wa-soft);
    transition: border-color .18s ease, background-color .18s ease;
    color: var(--wa-text);
    font-size: 14px !important;
    text-align: left;
}
.wa-mode[aria-pressed="true"] { border-color: var(--wa-color); background: color-mix(in srgb, var(--wa-color) 8%, #fff); font-weight: 600 !important; }
.wa-swatch {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid #d4d4d4;
    flex: none;
}
.wa-mode-default .wa-swatch { background: #fff; color: #333; }
.wa-mode-dark .wa-swatch { background: #1e1e22; color: #e8e8e8; }
.wa-mode-contrast .wa-swatch { background: #000; color: #ff0; border-color: #fff; }
.wa-mode-contrast_light .wa-swatch { background: #fff; color: #000; border: 2px solid #000; }

.wa-font { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wa-font-btn {
    min-width: 64px;
    height: 44px;
    border-radius: 30px;
    border: 0;
    background: var(--wa-inner);
    color: var(--wa-text);
    font-weight: 700 !important;
    font-size: 16px !important;
}
.wa-font-big { font-size: 21px !important; }
.wa-scale { font-weight: 700; font-size: 17px; }

.wa-reset {
    width: 100%;
    margin-top: 14px !important;
    min-height: 40px;
    border-radius: 30px;
    border: 0;
    background: var(--wa-inner);
    color: var(--wa-text);
    font-weight: 500 !important;
}
.wa-reset:hover, .wa-icon-btn:hover:not(:disabled), .wa-font-btn:hover { background: var(--wa-line); }
#wa-root .wa-keys {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    margin: 0;
    font-size: 13px;
}
#wa-root .wa-keys dt { margin: 0; color: var(--wa-text); font-weight: 400; font-size: 13px; line-height: 1.3; }
#wa-root .wa-keys dd { margin: 0; display: flex; justify-content: flex-end; align-items: center; gap: 3px; white-space: nowrap; }
#wa-root .wa-plus { color: var(--wa-muted); font-size: 11px; }
#wa-root kbd {
    display: inline-block;
    min-width: 24px;
    padding: 3px 6px;
    font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
    color: var(--wa-text);
    background: #fff;
    border: 1px solid var(--wa-line);
    border-bottom-width: 2px;
    border-radius: 6px;
}


/* Os temas estilizam button:hover/:focus; o painel mantém as próprias cores. */
#wa-root .wa-mode:is(:hover, :focus, :active) { background: var(--wa-soft); color: var(--wa-text); border-color: var(--wa-line); }
#wa-root .wa-reset:is(:hover, :focus, :active) { background: var(--wa-line); color: var(--wa-text); }
#wa-root .wa-mode[aria-pressed="true"]:is(:hover, :focus, :active) { background: color-mix(in srgb, var(--wa-color) 8%, #fff); border-color: var(--wa-color); }
#wa-root .wa-font-btn:is(:hover, :focus, :active),
#wa-root .wa-icon-btn:not(.wa-close):is(:hover, :focus, :active) { background: var(--wa-line); color: var(--wa-text); }
#wa-root .wa-close:is(:hover, :focus, :active) { background: var(--wa-line); color: var(--wa-text); }
#wa-root .wa-play:is(:hover, :focus, :active),
#wa-root .wa-toggle:is(:hover, :focus, :active) { background: var(--wa-color); color: #fff; }
#wa-root .wa-quick:is(:hover, :focus, :active) { background: #1d1d1f; color: #fff; }

/* Trecho sendo lido */
.wa-reading {
    background-color: rgba(255, 213, 79, .45) !important;
    outline: 2px solid #f5b400 !important;
    outline-offset: 2px;
    border-radius: 3px;
    scroll-margin: 120px;
}

/* ---------- Modo escuro ----------
 * As cores são ajustadas elemento a elemento pelo JS; aqui só o fundo da
 * página, para não "piscar" branco enquanto a página carrega. */
html.wa-dark { color-scheme: dark; background-color: #121316 !important; }
html.wa-dark body { background-color: #121316 !important; }
html.wa-dark .wa-reading { background-color: rgba(255, 213, 79, .18) !important; }

/* ---------- Alto contraste (fundo preto) ----------
 * Os seletores carregam ids (via :not) para vencer regras !important dos temas;
 * os :not(.wa-x):not(.wa-y) só dão peso extra às regras específicas. */
html.wa-contrast,
html.wa-contrast body,
html.wa-contrast body *:not(#wa-root):not(#wa-root *):not(img):not(video):not(.leaflet-tile-pane *) {
    background-color: #000 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
html.wa-contrast body a:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y),
html.wa-contrast body a:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) * {
    color: #ff0 !important;
    text-decoration: underline !important;
}
html.wa-contrast body :is(button, input, select, textarea, .button):not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) {
    border: 2px solid #fff !important;
}
html.wa-contrast body svg:not(#wa-root):not(#wa-root *) { fill: currentColor; }
html.wa-contrast body :focus-visible:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) { outline: 3px solid #0ff !important; }
html.wa-contrast body .wa-reading:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) { outline: 3px solid #0ff !important; background-color: #000 !important; }

/* ---------- Alto contraste (fundo branco) ----------
 * Os seletores carregam ids (via :not) para vencer regras !important dos temas;
 * os :not(.wa-x):not(.wa-y) só dão peso extra às regras específicas. */
html.wa-contrast-light,
html.wa-contrast-light body,
html.wa-contrast-light body *:not(#wa-root):not(#wa-root *):not(img):not(video):not(.leaflet-tile-pane *) {
    background-color: #fff !important;
    background-image: none !important;
    color: #000 !important;
    border-color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
html.wa-contrast-light body a:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y),
html.wa-contrast-light body a:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) * {
    color: #0000c8 !important;
    text-decoration: underline !important;
}
html.wa-contrast-light body :is(button, input, select, textarea, .button):not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) {
    border: 2px solid #000 !important;
}
html.wa-contrast-light body svg:not(#wa-root):not(#wa-root *) { fill: currentColor; }
html.wa-contrast-light body :focus-visible:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) { outline: 3px solid #c80000 !important; }
html.wa-contrast-light body .wa-reading:not(#wa-root):not(#wa-root *):not(.wa-x):not(.wa-y) { outline: 3px solid #c80000 !important; background-color: #ffff9c !important; }

@media print {
    #wa-root { display: none !important; }
}

/* Vektra: botões de leitura um pouco menores, para "Ouvir a página" caber em
   uma linha; os temas não mudam a caixa dos atalhos. */
#wa-root .wa-player .wa-icon-btn { width: 40px; height: 40px; }
#wa-root .wa-play { white-space: nowrap; font-size: 14px; padding: 8px 12px; }
#wa-root .wa-keys dt { text-transform: none; letter-spacing: normal; }
