/*
Theme Name: Tema FVS 2.0
Author: Fredson Santana
Version: 2.0.4
Description: Tema WordPress profissional com personalização avançada de cores, acessibilidade, leitor de áudio nativo e rodapé customizável.
*/

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fff;
    color: var(--font-color, #222);
    line-height: 1.7;
    font-size: 18px;
}
a { color: var(--link-color, #0073aa); text-decoration: none; }
a:hover, a:focus { color: #005177; text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* === CSS VARIABLES === */
:root {
    --header-bg: #000000;
    --header-title-color: #ffffff;
    --footer-bg: #2e2e2e;
    --footer-color: #f1f1f1;
    --site-title-font-size: 32px;
    --menu-font-size: 16px;
    --article-font-size: 18px;
    --font-color: #222222;
    --link-color: #0073aa;
}

/* === HEADER === */
.site-header {
    background: var(--header-bg);
    padding: 8px 20px 12px;
    position: relative;
    z-index: 100;
}
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}
.site-title-container { margin: 0; padding: 0; }
.site-title { margin: 0; padding: 0; font-size: var(--site-title-font-size); line-height: 1.2; }
.site-title a { color: var(--header-title-color) !important; text-decoration: none; display: inline-block; }
.site-title a:hover { opacity: 0.85; text-decoration: none; }

/* === NAV === */
.menu-wrapper { position: relative; }
.menu-toggle { display: none; background: none; border: none; font-size: 1.8rem; color: var(--header-title-color); cursor: pointer; padding: 5px; }
#menu-close { display: none; font-size: 24px; font-weight: bold; color: var(--header-title-color); background: transparent; border: none; position: absolute; top: 8px; left: 12px; z-index: 1001; cursor: pointer; }
.main-navigation { display: block; }
.main-navigation ul.menu { display: flex; list-style: none; gap: 5px; padding: 0; margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.main-navigation ul.menu li { display: inline-block; }
.main-navigation ul.menu li a { color: var(--header-title-color) !important; display: block; padding: 8px 14px; text-decoration: none; font-size: var(--menu-font-size); font-weight: 600; border-radius: 4px; }
.main-navigation ul.menu li a:hover { opacity: 0.75; text-decoration: none; }

/* === SEARCH === */
.top-search-bar { background: #f1f1f1; padding: 8px 10px; text-align: center; }
.top-search-bar form { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 600px; margin: 0 auto; }
.top-search-bar input[type="search"] { padding: 6px 10px; width: 70%; border: 1px solid #ccc; border-radius: 4px; font-size: 15px; }
.top-search-bar input[type="submit"] { padding: 6px 14px; background: #0056b3; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 15px; }
.top-search-bar input[type="submit"]:hover { background: #003d80; }
#search-below-header { text-align: center; padding: 10px 0; }

/* === MAIN === */
.site-main, .content-area, .site-content { max-width: 960px; margin: 30px auto; padding: 20px 30px; }
.entry-content, .post-content { font-size: var(--article-font-size); line-height: 1.8; }
.entry-content p { margin-bottom: 1.5em; text-align: justify; }
.entry-title { font-size: 2.5rem; font-weight: 800; line-height: 1.2; margin: 20px 0 30px; }
h1 { font-size: 2.8rem; } h2 { font-size: 2.2rem; } h3 { font-size: 1.9rem; } h4 { font-size: 1.6rem; } h5 { font-size: 1.3rem; } h6 { font-size: 1.1rem; }
.single h1, .page h1 { font-size: 3rem; text-align: center; margin-top: 0; }

/* === GRID === */
.feupress-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px 24px; margin: 30px 0; }
.feupress-grid article { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.08); transition: box-shadow .3s; }
.feupress-grid article:hover { box-shadow: 0 4px 14px rgba(0,0,0,.14); }
.feupress-grid .entry-title { font-size: 1.2em; margin: 0 0 12px; text-align: left; }

/* === META === */
.post-meta, .post-meta-small { font-size: 0.82em; color: #595959; margin-bottom: 18px; }
.post-meta a { color: #003366; font-weight: bold; text-decoration: underline; }
.tempo-leitura { font-size: 14px; color: #555555; margin-bottom: 10px; }

/* === PAGINATION === */
.paginacao-numerada { text-align: center; margin: 30px 0; }
.paginacao-numerada .page-numbers { display: inline-block; padding: 8px 14px; margin: 0 4px; background: #eee; color: #333; border-radius: 4px; text-decoration: none; font-weight: 600; }
.paginacao-numerada .current { background: #0073aa; color: #fff; }
.paginacao-numerada .page-numbers:hover { background: #003d80; color: #fff; }

/* === FOOTER === */
footer.site-footer { background: var(--footer-bg); color: var(--footer-color); padding: 30px 20px 0; margin-top: 40px; }
.footer-custom-columns { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; max-width: 1200px; margin: 0 auto 20px; padding-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,.15); }
.footer-custom-column { flex: 1 1 180px; color: var(--footer-color); font-size: .95em; }
.footer-custom-column h3 { color: #fff; font-size: 1rem; margin: 0 0 10px; border-bottom: 2px solid rgba(255,255,255,.2); padding-bottom: 6px; }
.footer-nav-row { background: #1a1a1a; text-align: center; padding: 12px 20px; }
.footer-menu { list-style: none; padding: 0; margin: 0; display: inline-flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.footer-menu li a { padding: 8px 14px; display: inline-block; font-size: 15px; color: #f1f1f1; background: #2e2e2e; border-radius: 3px; text-decoration: none; }
.footer-menu li a:hover { background: #444; color: #fff; text-decoration: none; }
.site-info { text-align: center; padding: 12px 10px; background: #2e2e2e; color: #f1f1f1; font-size: 15px; }
.site-info a { color: #f1f1f1; }
.footer-credit { width: 100%; text-align: center; font-size: .85em; background: #f0f0f0; color: #000; padding: 12px 10px; display: block; }
.footer-credit a { color: #003366; font-weight: bold; text-decoration: underline; }

/* === ACCESSIBILITY TOOLS === */
.accessibility-tools { display: inline-flex; gap: 8px; margin: 20px 0 10px; align-items: center; flex-wrap: wrap; }
.accessibility-label { font-weight: 600; font-size: 15px; margin: 0; padding: 0; line-height: 1; color: inherit; }
.accessibility-tools button, #btn-dark-mode {
    background: #121212; color: #e0e0e0; border: none; padding: 6px 12px; border-radius: 5px; cursor: pointer; font-size: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: background .3s; white-space: nowrap;
}
.accessibility-tools button:hover, #btn-dark-mode:hover { background: #333; }

/* === DARK MODE — !important em tudo para sobrescrever CSS dinâmico do Customizer === */
body.dark-mode { background-color: #121212 !important; }
/* Cor de texto global no dark mode */
body.dark-mode,
body.dark-mode p,
body.dark-mode li,
body.dark-mode span:not(.accessibility-label),
body.dark-mode td,
body.dark-mode div { color: #e0e0e0 !important; }
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 { color: #f0f0f0 !important; }
body.dark-mode a, body.dark-mode a:visited { color: #bb86fc !important; }
/* Cabeçalho */
body.dark-mode .site-header { background: #1a1a1a !important; background-image: none !important; }
body.dark-mode .site-title a,
body.dark-mode .main-navigation ul.menu li a,
body.dark-mode .menu-toggle { color: #ffffff !important; }
/* Busca */
body.dark-mode .top-search-bar,
body.dark-mode #search-below-header { background: #1e1e1e !important; }
body.dark-mode input[type="search"] { background: #2a2a2a !important; color: #e0e0e0 !important; border-color: #555 !important; }
/* Conteúdo */
body.dark-mode .site-main,
body.dark-mode .content-area,
body.dark-mode main { background-color: #121212 !important; }
body.dark-mode .feupress-grid article { background: #1e1e1e !important; border-color: #333 !important; }
body.dark-mode .entry-title { color: #f0f0f0 !important; }
body.dark-mode .post-meta,
body.dark-mode .post-meta-small,
body.dark-mode .tempo-leitura { color: #999 !important; }
/* Índice */
body.dark-mode .indice-conteudo { background: #1e1e1e !important; border-color: #444 !important; }
body.dark-mode .indice-conteudo a { color: #bb86fc !important; }
/* Rodapé */
body.dark-mode footer.site-footer { background-color: #0d0d0d !important; background-image: none !important; }
body.dark-mode .footer-nav-row { background-color: #111 !important; }
body.dark-mode .site-info { background-color: #111 !important; }
body.dark-mode .footer-credit { background: #1a1a1a !important; color: #aaa !important; }
/* Botões de acessibilidade */
body.dark-mode .accessibility-tools button,
body.dark-mode #btn-dark-mode { background: #444 !important; color: #fff !important; }
/* Cookie banner */
body.dark-mode #cookie-banner { background: #1a1a1a !important; }

/* === AUDIO READER === */
#fvs-audio-reader { all: initial; display: flex; flex-direction: row; align-items: center; gap: 6px; background: #fff; border: 1px solid #ccc; border-radius: 999px; padding: 5px 12px; margin: 0 0 20px; box-shadow: 0 2px 8px rgba(0,0,0,.12); width: fit-content; font-family: sans-serif; box-sizing: border-box; position: relative; z-index: 9999; }
#fvs-audio-reader button { all: initial; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #222; flex-shrink: 0; }
#fvs-audio-reader button:hover { background: #f0f0f0; }
#fvs-audio-reader button svg { width: 16px; height: 16px; display: block; pointer-events: none; }
#fvs-audio-reader button.fvs-ar-active { color: #c0392b; }
#fvs-audio-reader .fvs-sep { width: 1px; height: 20px; background: #ddd; flex-shrink: 0; }
#fvs-audio-reader select { all: initial; font-family: sans-serif; font-size: 11px; font-weight: 700; color: #666; cursor: pointer; padding: 2px; background: transparent; }
#fvs-audio-reader .fvs-bar { width: 70px; height: 4px; background: #e0e0e0; border-radius: 2px; cursor: pointer; position: relative; flex-shrink: 0; }
#fvs-audio-reader .fvs-fill { height: 100%; background: #c0392b; border-radius: 2px; width: 0%; transition: width .3s; pointer-events: none; }
.fvs-hl { background: #fff9c4 !important; border-radius: 3px; }
#fvs-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #333; color: #fff; padding: 8px 20px; border-radius: 99px; font-size: 13px; font-family: sans-serif; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; z-index: 999999; white-space: nowrap; }
#fvs-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === TOC === */
.indice-conteudo { margin: 20px 0; padding: 15px; border: 1px solid #ccc; background: #f9f9f9; border-radius: 6px; font-size: .9em; }
.indice-conteudo ul { list-style: none; padding: 0; margin: 8px 0 0; }
.indice-conteudo li a { display: block; padding: 8px 10px; font-size: 16px; min-height: 44px; text-decoration: none; color: #0073aa; border-radius: 4px; line-height: 1.4; }
.indice-conteudo li a:hover { background: rgba(0,115,170,.08); }

/* === ADS === */
.ads-custom, .ads-below-search { display: block !important; margin: 20px auto !important; text-align: center !important; clear: both; float: none !important; width: 100%; }
.adsbygoogle, ins.adsbygoogle { display: block; margin-left: auto !important; margin-right: auto !important; }

/* === SCROLL TOP === */
.scroll-to-top { position: fixed; bottom: 30px; right: 30px; display: none; font-size: 22px; background: #444; color: #fff; padding: 10px 14px; border-radius: 50%; z-index: 1000; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.scroll-to-top:hover { background: #000; text-decoration: none; }

/* === COOKIE BANNER === */
#cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #222; color: #fff; padding: 14px 20px; z-index: 9999; text-align: center; font-size: 14px; }
#cookie-banner a { color: #0ff; text-decoration: underline; margin-left: 5px; }
#cookie-banner button { margin-left: 12px; padding: 5px 12px; cursor: pointer; border: none; border-radius: 4px; background: #fff; color: #222; font-weight: 600; }

/* === RESPONSIVE === */
@media (max-width: 1024px) { .feupress-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
    .feupress-grid { grid-template-columns: 1fr; }
    .site-main, .content-area, .site-content { padding: 15px; margin: 15px auto; }
    .entry-title { font-size: 1.8rem; }
    .header-flex { flex-direction: column; align-items: center; text-align: center; }
    .site-title-container { margin-bottom: 6px; }
    /* O site-header precisa de position:relative para o menu absoluto ser relativo a ele */
    .site-header { position: relative; }
    .menu-wrapper { width: 100%; }
    .menu-toggle { display: block; width: 100%; text-align: center; font-size: 2rem; padding: 8px 0; }
    /* Menu mobile — largura total do viewport */
    .main-navigation {
        display: none;
        background: var(--header-bg, #000);
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding: 0;
        box-shadow: 0 8px 20px rgba(0,0,0,.45);
        z-index: 9999;
        box-sizing: border-box;
    }
    .main-navigation.menu-open { display: block; }
    .main-navigation ul.menu {
        display: block !important;
        list-style: none;
        width: 100%;
        padding: 8px 0 16px;
        margin: 0;
        box-sizing: border-box;
    }
    .main-navigation ul.menu li {
        display: block !important;
        width: 100%;
        box-sizing: border-box;
        border-bottom: 1px solid rgba(255,255,255,.12);
    }
    .main-navigation ul.menu li:last-child { border-bottom: none; }
    .main-navigation ul.menu li a {
        display: block !important;
        width: 100%;
        padding: 16px 24px !important;
        font-size: 1.05rem !important;
        font-weight: 600;
        text-align: left;
        box-sizing: border-box;
        color: #ffffff !important;
        white-space: normal;
        word-break: break-word;
    }
    .main-navigation ul.menu li a:hover { opacity: 0.8; background: rgba(255,255,255,.08); }
    .footer-custom-columns { flex-direction: column; }
}
@media (max-width: 480px) { .entry-title { font-size: 1.5rem; } }

/* === SKIP LINK — visível apenas para leitores de tela === */
.skip-link.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.skip-link.screen-reader-text:focus {
    position: fixed !important;
    top: 6px !important;
    left: 6px !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    overflow: visible !important;
    z-index: 99999 !important;
    background: #000;
    color: #fff;
    padding: 8px 16px !important;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

/* === ANÚNCIOS — centralizados e sem duplicação === */
.ads-custom,
.ads-topo,
.ads-below-search,
.ads-before-title,
.ads-after-content {
    display: block !important;
    width: 100%;
    text-align: center !important;
    margin: 16px auto !important;
    clear: both;
    float: none !important;
    box-sizing: border-box;
}
.ads-custom *,
.ads-topo *,
.ads-below-search * {
    display: inline-block !important;
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
}
ins.adsbygoogle {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
