/* ====================================================
   1. CONFIGURAÇÕES BASE E DESKTOP (UI MODERNA)
   ==================================================== */
.site-header-css {
    position: relative;
    width: 100%;
    height: 165px;
    background-color: #002776;
    /* Azul Brasil */
    font-family: 'Montserrat', sans-serif;
    z-index: 1001;
    transition: height 0.3s ease;
}

.faixa-branca {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 52px;
    background-color: #ffffff;
    z-index: 1;
}

.faixa-verde {
    position: absolute;
    top: 52px;
    left: 0;
    width: 100%;
    height: 7px;
    background-color: #009c3b;
    /* Verde Brasil */
    z-index: 1;
}

/* UX/UI - Recorte perfeito com suporte cross-browser (-webkit-) */
.caixa-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 260px;
    height: 165px;
    background-color: #ffffff;
    -webkit-clip-path: polygon(0 0, 75% 0, 100% 45%, 70% 100%, 0 100%);
    clip-path: polygon(0 0, 75% 0, 100% 45%, 70% 100%, 0 100%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 20px;
    transition: all 0.3s ease;
}

.caixa-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
}

.caixa-logo img {
    height: 110px;
    width: auto;
    transition: height 0.3s ease;
}

.header-conteudo {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Redes Sociais */
.linha-icones {
    height: 52px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 5%;
    gap: 20px;
}

.linha-icones a {
    font-size: 1.4rem;
    color: #565657;
    transition: all 0.3s ease;
    padding: 5px;
}

.linha-icones a:hover {
    color: #002776;
    transform: translateY(-2px);
}

/* Menu Principal - Desktop */
.linha-menu {
    height: 106px;
    margin-top: 7px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 10%;
}

ul.menu-first {
    display: flex;
    list-style: none;
    gap: 1.8rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

ul.menu-first>li {
    position: relative;
    display: flex;
    align-items: center;
}

ul.menu-first>li>a {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

ul.menu-first>li>a:hover {
    color: #ffdf00 !important;
}


/* ====================================================
   2. REGRAS EXCLUSIVAS PARA DESKTOP (>= 993px)
   ==================================================== */
@media (min-width: 993px) {

    /* BLINDAGEM: Esconde o menu de celular (Sanduíche) na tela do PC */
    .navboard,
    .container-cover,
    #icon-menu {
        display: none !important;
    }

    .menu-item-has-children-first {
        position: relative;
    }

    /* Dropdowns (Submenus) do Desktop */
    ul.sub-menu-first {
        display: none !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        background: #fff !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
        padding: 10px 0 !important;
        min-width: 270px !important; /* Levemente ampliado para acomodar títulos maiores com conforto */
        border-radius: 0 0 8px 8px !important;
        border-top: 4px solid #009c3b !important;
        list-style: none !important;
        z-index: 9999 !important;
        flex-direction: column !important;
    }

    .menu-item-has-children-first:hover>ul.sub-menu-first {
        display: flex !important;
        flex-direction: column;
    }

    ul.sub-menu-first li {
        width: 100% !important;
        display: block !important;
    }

    ul.sub-menu-first li a {
        color: #002776 !important;
        padding: 10px 20px !important; /* Ajustado proporcionalmente para caber a nova lista rica em itens */
        display: block !important;
        font-family: 'Montserrat', sans-serif !important;
        font-size: 13.5px !important; 
        font-weight: 600 !important;
        text-transform: none !important;
        transition: all 0.2s !important;
        text-decoration: none !important;
        line-height: 1.4 !important;
        white-space: normal !important;
    }

    ul.sub-menu-first li a:hover {
        background: #f0f4ff !important;
        color: #009c3b !important;
        padding-left: 25px !important;
    }
}


/* ====================================================
   3. TELAS MÉDIAS (<= 1200px) E CELULAR (<= 992px)
   ==================================================== */

/* Telas até 1200px: logo e espaçamento do menu menores */
@media (max-width: 1200px) {
    .caixa-logo {
        width: 200px;
    }

    .caixa-logo img {
        height: 100px;
    }

    ul.menu-first {
        gap: 1rem;
    }

    ul.menu-first>li>a {
        font-size: 0.8rem;
    }
}

@media (max-width: 992px) {
    .site-header-css {
        height: 80px !important;
    }

    /* BLINDAGEM: Esconde Menu Desktop, Redes e Faixas na tela do Celular */
    .faixa-branca,
    .faixa-verde,
    .linha-icones,
    .linha-menu {
        display: none !important;
    }

    /* Logo adaptada para mobile */
    .caixa-logo {
        height: 80px;
        width: 140px;
        -webkit-clip-path: polygon(0 0, 80% 0, 100% 40%, 75% 100%, 0 100%);
        clip-path: polygon(0 0, 80% 0, 100% 40%, 75% 100%, 0 100%);
        padding-left: 10px;
    }

    .caixa-logo img {
        height: 60px;
    }

    /* O Botão Sanduíche */
    .container-cover {
        display: flex !important;
        position: absolute !important;
        right: 0 !important;
        top: 0 !important;
        height: 80px !important;
        align-items: center !important;
        z-index: 10005 !important;
    }

    .btn-menu {
        position: absolute !important;
        right: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
    }

    #icon-menu {
        position: absolute !important;
        right: 0 !important;
        width: 35px !important;
        height: 35px !important;
        filter: brightness(0) invert(1) !important;
        cursor: pointer !important;
        display: block !important;
    }

    /* NAVBOARD: Estrutura do App Mobile com rolagem fluida */
    .navboard {
        position: fixed; 
        top: 0; 
        right: -100%; 
        width: 80%; 
        max-width: 300px; 
        height: 100vh;
        background-color: #002776; 
        display: flex !important; 
        flex-direction: column;
        padding-top: 80px; 
        padding-bottom: 40px;
        z-index: 10004;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 15px rgba(0,0,0,0.3);
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* ESTILIZAÇÃO DA BARRA DE ROLAGEM DO MENU MOBILE */
    .navboard::-webkit-scrollbar {
        width: 6px;
    }
    .navboard::-webkit-scrollbar-track {
        background-color: #001a4f;
    }
    .navboard::-webkit-scrollbar-thumb {
        background-color: #009c3b;
        border-radius: 10px;
    }
    .navboard::-webkit-scrollbar-thumb:hover {
        background-color: #ffdf00;
    }

    .navboard.grid-display {
        right: 0 !important;
    }

    .navboard a,
    .dropbtn {
        color: white !important;
        width: 100%;
        text-align: left !important;
        padding: 15px 25px !important;
        font-size: 1.05rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-decoration: none;
        display: block;
    }

    .dropdownmenu {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .dropbtn {
        background-color: transparent !important;
        font-family: 'Montserrat', sans-serif;
        border: none !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
    }

    .dropbtn:hover,
    .navboard a:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }

    /* O Accordion do Mobile */
    .dropdown-content {
        display: none;
        background-color: #001a4f !important;
        flex-direction: column;
        width: 100%;
        box-shadow: inset 0px 5px 10px rgba(0, 0, 0, 0.2) !important;
    }

    .dropdown-content.show {
        display: flex !important;
    }

    .dropdown-content a {
        padding: 12px 25px 12px 40px !important;
        font-size: 0.9rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
        background-color: transparent !important;
    }

    .dropdown-content a:hover {
        color: #ffdf00 !important;
        background-color: transparent !important;
    }
}

/* Smartphones bem pequenos */
@media (max-width: 380px) {
    .caixa-logo {
        width: 120px;
    }

    .caixa-logo img {
        height: 50px;
    }

    .navboard {
        width: 85%;
    }
}


/* ====================================================
   4. ACESSIBILIDADE DOS MENUS (#108)
   Os submenus do computador abrem com o mouse (hover, como antes) E com o
   botão (clique, Enter ou Espaço): o menu-site.js põe a classe "aberto" no
   <li> e atualiza o aria-expanded. O botão do celular virou <button>.
   ==================================================== */

/* Botão INSTITUCIONAL/GOVERNANÇA: mesma aparência dos links do menu, sem o
   fundo e a borda que todo <button> ganha do navegador */
ul.menu-first>li>button.menu-topo-botao {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    color: #ffffff;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: color 0.3s ease;
}

/* Mouse por cima ou submenu aberto: o botão fica dourado, como os links */
ul.menu-first>li>button.menu-topo-botao:hover,
ul.menu-first>li.aberto>button.menu-topo-botao {
    color: #ffdf00;
}

/* Seta do botão (antes era CSS inline): gira para cima quando o submenu abre */
.menu-seta {
    margin-left: 2px;
    margin-bottom: -2px;
    transition: transform 0.2s ease;
}
.menu-item-has-children-first:hover .menu-seta,
.menu-item-has-children-first.aberto .menu-seta {
    transform: rotate(180deg);
}

/* Sem regra de letra menor até 1200px: o estilo-global.css (carregado depois)
   deixa os links do menu em 0.9rem em qualquer largura, e o botão acompanha. */

/* Computador: submenu aberto pelo botão (teclado ou clique) aparece como no hover */
@media (min-width: 993px) {
    .menu-item-has-children-first.aberto>ul.sub-menu-first {
        display: flex !important;
        flex-direction: column;
    }
}

/* Celular: o botão sanduíche agora é um <button>; tira o fundo e a borda padrão */
.btn-menu {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: 0;
    color: inherit;
    line-height: 0;
    cursor: pointer;
}

/* #107: área de toque do botão ☰ com 48x48px (antes media 20x20, porque o ícone ficava
   "solto" com position absolute). Agora o ícone fica dentro do botão, no mesmo lugar. */
@media (max-width: 992px) {
    .btn-menu {
        width: 48px !important;
        height: 48px !important;
        padding: 0 !important;
        right: 6px !important;
    }
    #icon-menu {
        position: static !important;
    }
}

/* ====================================================
   6. REGRAS QUE VIERAM DO estilo-global.css (#195)
   Antes ficavam no estilo-global.css, que carrega DEPOIS deste arquivo e por isso
   vencia onde os dois discordavam (ex.: links do menu em 0.9rem em qualquer largura).
   Ficam aqui, no FIM, para continuar vencendo as regras de cima: o visual não muda.
   ==================================================== */
/* ====================================================
   2. HEADER E NAVEGAÇÃO (DESKTOP E MOBILE)
   ==================================================== */
.site-header-css {
    position: relative;
    width: 100%;
    height: 165px;
    background-color: var(--cor-azul-cbsa);
    z-index: 1001;
    transition: height 0.3s ease;
}

.faixa-branca {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 52px;
    background-color: var(--cor-fundo-branco);
    z-index: 1;
}

.faixa-verde {
    position: absolute;
    top: 52px;
    left: 0;
    width: 100%;
    height: 7px;
    background-color: var(--cor-verde-cbsa);
    z-index: 1;
}

.caixa-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 260px;
    height: 165px;
    background-color: var(--cor-fundo-branco);
    -webkit-clip-path: polygon(0 0, 75% 0, 100% 45%, 70% 100%, 0 100%);
    clip-path: polygon(0 0, 75% 0, 100% 45%, 70% 100%, 0 100%);
    z-index: 3;
    display: flex;
    align-items: center;
    padding-left: 20px;
}

.caixa-logo img {
    height: 110px;
    width: auto;
}

.linha-icones {
    height: 52px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 5%;
    gap: 20px;
    position: relative;
    z-index: 5;
}

.linha-icones a {
    color: var(--cor-texto-cinza);
    font-size: 1.4rem;
    transition: all 0.3s ease;
}

.linha-icones a:hover {
    color: var(--cor-azul-cbsa);
    transform: translateY(-2px);
}

.linha-menu {
    height: 106px;
    margin-top: 7px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 10%;
    position: relative;
    z-index: 5;
}

ul.menu-first {
    display: flex;
    list-style: none;
    gap: 1.8rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

ul.menu-first>li>a {
    color: var(--cor-fundo-branco) !important;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

ul.menu-first>li>a:hover {
    color: var(--cor-amarelo-cbsa) !important;
}

/* Submenu Desktop */
@media (min-width: 993px) {
    .navboard, .container-cover, #icon-menu {
        display: none !important;
    }

    .menu-item-has-children-first {
        position: relative;
    }

    ul.sub-menu-first {
        display: none !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        background: var(--cor-fundo-branco) !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
        padding: 10px 0 !important;
        min-width: 250px !important;
        border-radius: 0 0 8px 8px !important;
        border-top: 4px solid var(--cor-verde-cbsa) !important;
        list-style: none !important;
        z-index: 9999 !important;
        flex-direction: column !important;
    }

    .menu-item-has-children-first:hover>ul.sub-menu-first {
        display: flex !important;
    }

    ul.sub-menu-first li a {
        color: var(--cor-azul-cbsa) !important;
        padding: 12px 20px !important;
        font-family: var(--fonte-titulos) !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        text-decoration: none !important;
        transition: all 0.2s !important;
        display: block !important;
    }

    ul.sub-menu-first li a:hover {
        background: #f0f4ff !important;
        color: var(--cor-verde-cbsa) !important;
        padding-left: 25px !important;
    }
}

/* Menu Mobile */
@media (max-width: 992px) {
    .site-header-css {
        height: 80px !important;
    }

    .faixa-branca, .faixa-verde, .linha-icones, .linha-menu {
        display: none !important;
    }

    .caixa-logo {
        height: 80px;
        width: 140px;
        padding-left: 10px;
        clip-path: polygon(0 0, 80% 0, 100% 40%, 75% 100%, 0 100%);
    }

    .caixa-logo img {
        height: 60px;
    }

    .container-cover {
        display: flex !important;
        position: absolute !important;
        right: 0 !important;
        top: 0 !important;
        height: 80px !important;
        align-items: center !important;
        z-index: 10005 !important;
    }

    #icon-menu {
        width: 35px !important;
        height: 35px !important;
        cursor: pointer !important;
        filter: brightness(0) invert(1) !important;
        /* !important: o style.css antigo (#icon-menu { margin: 5px }) carrega depois deste arquivo */
        margin-right: 15px !important;
    }

    .navboard {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--cor-azul-cbsa);
        display: flex !important;
        flex-direction: column;
        padding-top: 80px;
        z-index: 10004;
        transition: right 0.4s ease;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .navboard.grid-display {
        right: 0 !important;
    }

    .navboard a {
        color: var(--cor-fundo-branco) !important;
        padding: 15px 25px !important;
        font-size: 1.1rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-decoration: none;
        display: block;
    }

    .navboard a:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
}

/* #207 (WCAG 2.4.1): link "Pular para o conteúdo". Fora da tela até receber o foco do teclado;
   com o foco, aparece no canto de cima, azul CBSA com contorno ouro, por cima de tudo. */
.pular-conteudo {
    position: absolute;
    left: 12px;
    top: -100px;
    z-index: 10000;
    padding: 12px 18px;
    border-radius: 0 0 8px 8px;
    background-color: #002776;
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-decoration: none;
}
.pular-conteudo:focus {
    top: 0;
    color: #ffffff;
    outline: 3px solid #ffdf00;
    outline-offset: 2px;
}
