/* ==================================================
   MENU PRINCIPAL — LCC-UFMG

   Referência:
   Design System Gov.br

   Objetivos:
   - Alinhamento com os cards da página inicial
   - Largura máxima de 1170px
   - Menu sem quadro externo
   - Fundo branco permanente
   - Layout responsivo
   - Submenus acessíveis
   ================================================== */


/* ==================================================
   1. VARIÁVEIS
   ================================================== */

.lcc-menu {

    --lcc-menu-primary: #1351b4;
    --lcc-menu-dark: #0c326f;

    --lcc-menu-background: #ffffff;

    --lcc-menu-hover: #f2f6fb;
    --lcc-menu-hover-strong: #e8f1ff;

    --lcc-menu-border: #dfe5ec;

    --lcc-menu-max-width: 1170px;

    --lcc-menu-height: 70px;

}


/* ==================================================
   2. BARRA EXTERNA
   ================================================== */

.lcc-menu {

    position: sticky;

    top: 0;

    z-index: 900;

    isolation: isolate;

    display: block;

    width: 100%;

    margin: 0 auto 1rem;

    padding: 0;

    background: #ffffff;

    background-color: #ffffff;

    border: 0;

    border-radius: 0;

    box-shadow: none;

}


/* Reset exclusivo do menu. */

.lcc-menu,
.lcc-menu *,
.lcc-menu *::before,
.lcc-menu *::after {

    box-sizing: border-box;

}


/* ==================================================
   3. CONTÊINER PRINCIPAL

   Mesma largura dos cards da página inicial.
   ================================================== */

.lcc-menu > .lcc-menu-container {

    display: flex;

    align-items: center;

    justify-content: space-between;

    flex-wrap: nowrap;

    gap: 20px;

    width: calc(100% - 32px);

    max-width: var(--lcc-menu-max-width);

    min-height: var(--lcc-menu-height);

    margin-left: auto;

    margin-right: auto;

    padding: 0;

    background: #ffffff;

    border: 0;

    border-radius: 0;

    box-shadow: none;

}


/* ==================================================
   4. RESET DAS LISTAS
   ================================================== */

.lcc-menu-list,
.lcc-submenu {

    list-style: none;

    margin: 0;

    padding: 0;

}


/* ==================================================
   5. LOGOTIPO
   ================================================== */

.lcc-menu-brand {

    display: inline-flex;

    align-items: center;

    justify-content: flex-start;

    flex: 0 0 auto;

    min-height: var(--lcc-menu-height);

    margin: 0;

    padding: 0;

    color: var(--lcc-menu-dark);

    background: transparent;

    text-decoration: none;

    white-space: nowrap;

}


/* Imagem do logotipo. */

.lcc-menu-logo {

    display: block;

    width: 180px;

    height: 60px;

    max-width: 100%;

    object-fit: contain;

    object-position: left center;

}


/* Estados do logotipo. */

.lcc-menu-brand:hover,
.lcc-menu-brand:focus-visible {

    color: var(--lcc-menu-dark);

    background: transparent;

    text-decoration: none;

    box-shadow: none;

}


/* ==================================================
   6. LISTA PRINCIPAL — DESKTOP
   ================================================== */

.lcc-menu-list {

    display: flex;

    align-items: stretch;

    justify-content: flex-end;

    flex: 0 1 auto;

    gap: 0;

    min-width: 0;

    margin: 0 0 0 auto;

    padding: 0;

}


/* Item principal. */

.lcc-menu-item {

    position: relative;

    flex: 0 1 auto;

    min-width: 0;

    margin: 0;

    padding: 0;

}


/* Linha de cada item. */

.lcc-menu-item-row {

    display: flex;

    align-items: stretch;

    height: 100%;

    min-width: 0;

}


/* ==================================================
   7. LINKS E BOTÕES PRINCIPAIS
   ================================================== */

.lcc-menu-link,
.lcc-menu-toggle,
.lcc-submenu-toggle {

    display: inline-flex;

    align-items: center;

    font-family: inherit;

    font-weight: 600;

    color: var(--lcc-menu-dark);

    text-decoration: none;

}


/* Link principal. */

.lcc-menu-link {

    appearance: none;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 0.4rem;

    min-height: var(--lcc-menu-height);

    margin: 0;

    padding: 0 0.7rem;

    background: transparent;

    border: 0;

    border-radius: 6px;

    color: var(--lcc-menu-dark);

    cursor: pointer;

    font-size: 0.91rem;

    font-weight: 600;

    line-height: 1.35;

    text-decoration: none;

    white-space: nowrap;

}


/* Botões dos submenus. */

.lcc-menu-link--button {

    justify-content: space-between;

    text-align: left;

}


/* Conteúdo interno do link. */

.lcc-menu-link-content {

    display: inline-flex;

    align-items: center;

    justify-content: flex-start;

    gap: 0.4rem;

    min-width: 0;

}


/* ==================================================
   8. ÍCONES PRINCIPAIS
   ================================================== */

/* Oculta os ícones internos no desktop. */

.lcc-menu-link-content > .bi {

    display: none;

}


/* Mantém o ícone de Início. */

.lcc-menu-list
> .lcc-menu-item:first-child
.lcc-menu-link-content
> .bi {

    display: inline-block;

    color: var(--lcc-menu-primary);

    font-size: 1rem;

}


/* Seta dos submenus. */

.lcc-submenu-chevron {

    display: inline-block;

    flex: 0 0 auto;

    margin-left: 0.15rem;

    color: #4a6282;

    font-size: 0.7rem;

    transition: transform 160ms ease;

}


/* Seta ao abrir. */

.lcc-menu-item.is-open
.lcc-submenu-chevron {

    transform: rotate(180deg);

}


/* ==================================================
   9. HOVER E PÁGINA ATUAL
   ================================================== */

.lcc-menu-link:hover,
.lcc-menu-link:focus-visible {

    background: var(--lcc-menu-hover);

    color: var(--lcc-menu-primary);

    text-decoration: none;

}


/* Página atual: destaque azul inferior. */

.lcc-menu
.lcc-menu-item.is-current
> .lcc-menu-item-row
> .lcc-menu-link {

    background: transparent;

    color: var(--lcc-menu-primary);

    box-shadow: inset 0 -4px 0 var(--lcc-menu-primary);

}


/* Página atual com hover. */

.lcc-menu
.lcc-menu-item.is-current
> .lcc-menu-item-row
> .lcc-menu-link:hover {

    background: var(--lcc-menu-hover);

}


/* Link marcado como página atual. */

.lcc-menu-link[aria-current="page"] {

    color: var(--lcc-menu-primary);

    box-shadow: inset 0 -4px 0 var(--lcc-menu-primary);

}


/* Foco acessível. */

.lcc-menu a:focus-visible,
.lcc-menu button:focus-visible {

    outline: 3px solid var(--lcc-menu-primary);

    outline-offset: -3px;

}


/* ==================================================
   10. BOTÃO MOBILE
   ================================================== */

.lcc-menu-toggle,
.lcc-submenu-toggle {

    appearance: none;

    background: transparent;

    border: 0;

    cursor: pointer;

}


/* Oculto no desktop. */

.lcc-menu-toggle {

    display: none;

    align-items: center;

    justify-content: center;

    gap: 0.45rem;

    min-height: var(--lcc-menu-height);

    margin-left: auto;

    padding: 0 0.75rem;

    color: var(--lcc-menu-primary);

}


/* Ícone mobile. */

.lcc-menu-toggle .bi {

    font-size: 1.45rem;

}


/* ==================================================
   11. SUBMENUS — DESKTOP
   ================================================== */

.lcc-submenu {

    position: absolute;

    top: 100%;

    left: 0;

    z-index: 920;

    display: none;

    min-width: 285px;

    max-width: min(360px, calc(100vw - 32px));

    margin: 0;

    padding: 0.4rem 0;

    background: #ffffff;

    border: 1px solid var(--lcc-menu-border);

    border-top: 3px solid var(--lcc-menu-primary);

    border-radius: 8px;

    box-shadow: 0 10px 28px rgb(0 0 0 / 12%);

}


/* Abertura pelo JavaScript existente. */

.lcc-menu-item--has-submenu.is-open
> .lcc-submenu {

    display: block;

}


/* Divisórias internas. */

.lcc-submenu li + li {

    border-top: 1px solid #edf0f5;

}


/* Links do submenu. */

.lcc-submenu a {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 0.75rem;

    min-height: 46px;

    margin: 0;

    padding: 0.72rem 1rem;

    background: #ffffff;

    color: #333333;

    font-size: 0.94rem;

    font-weight: 400;

    line-height: 1.35;

    text-decoration: none;

}


/* Conteúdo do submenu. */

.lcc-submenu-label {

    display: inline-flex;

    align-items: center;

    gap: 0.65rem;

    min-width: 0;

}


/* Textos longos. */

.lcc-submenu-label > span {

    overflow-wrap: anywhere;

}


/* Ícones do submenu. */

.lcc-submenu-label .bi {

    flex: 0 0 auto;

    width: 1.15rem;

    color: var(--lcc-menu-primary);

    font-size: 1rem;

}


/* Hover e foco. */

.lcc-submenu a:hover,
.lcc-submenu a:focus-visible,
.lcc-submenu a[aria-current="page"] {

    background: var(--lcc-menu-hover-strong);

    color: var(--lcc-menu-primary);

    text-decoration: none;

}


/* Página atual no submenu. */

.lcc-submenu a[aria-current="page"] {

    border-left: 4px solid var(--lcc-menu-primary);

    font-weight: 700;

    padding-left: calc(1rem - 4px);

}


/* ==================================================
   12. POSICIONAMENTO DOS SUBMENUS
   ================================================== */

/* Evita que o submenu Institucional ultrapasse
   a lateral direita em telas intermediárias. */

.lcc-menu-list
> .lcc-menu-item:nth-last-child(2)
> .lcc-submenu {

    left: auto;

    right: 0;

}


/* Último submenu: Transparência. */

.lcc-menu-list
> .lcc-menu-item:last-child
> .lcc-submenu {

    left: auto;

    right: 0;

}


/* ==================================================
   13. NOTEBOOKS E TABLETS

   O menu passa para o formato recolhível antes
   que os itens fiquem apertados.
   ================================================== */

@media (max-width: 1199.98px) {

    .lcc-menu {

        width: 100%;

        margin-top: 0;

        margin-bottom: 0.75rem;

    }


    /* Contêiner continua alinhado aos cards. */

    .lcc-menu > .lcc-menu-container {

        display: flex;

        align-items: center;

        justify-content: space-between;

        flex-wrap: wrap;

        gap: 0;

        width: calc(100% - 32px);

        max-width: var(--lcc-menu-max-width);

        min-height: 70px;

        margin: 0 auto;

        padding: 0;

    }


    /* Logo compacto. */

    .lcc-menu-logo {

        width: 60px;

        height: 60px;

        object-fit: contain;

        object-position: left center;

    }


    .lcc-menu-brand {

        min-height: 70px;

        padding: 0;

    }


    /* Exibe botão mobile. */

    .lcc-menu-toggle {

        display: inline-flex;

        margin-left: auto;

        margin-right: 0;

        padding: 0 0.75rem;

    }


    /* Lista recolhida. */

    .lcc-menu
    .lcc-menu-list {

        display: none;

        flex: 0 0 100%;

        flex-direction: column;

        align-items: stretch;

        justify-content: flex-start;

        gap: 0;

        width: 100%;

        min-width: 0;

        max-height: calc(100vh - 70px);

        max-height: calc(100dvh - 70px);

        margin: 0;

        padding: 0;

        overflow-x: hidden;

        overflow-y: auto;

        background: #ffffff;

        border-top: 1px solid #e5e7eb;

    }


    /* Menu aberto pelo JavaScript. */

    .lcc-menu.is-open .lcc-menu-list {

        display: flex;

    }


    /* Item mobile. */

    .lcc-menu-item {

        width: 100%;

        border-bottom: 1px solid #edf0f5;

    }


    .lcc-menu-item:last-child {

        border-bottom: 0;

    }


    .lcc-menu-item-row {

        width: 100%;

        height: auto;

    }


    /* Links mobile. */

    .lcc-menu-link {

        display: flex;

        flex: 1 1 auto;

        justify-content: flex-start;

        width: 100%;

        min-width: 0;

        min-height: 49px;

        padding: 0.72rem 1rem;

        border-radius: 0;

        color: var(--lcc-menu-primary);

        font-size: 0.94rem;

        white-space: normal;

    }


    /* Botões com seta à direita. */

    .lcc-menu-link--button {

        justify-content: space-between;

    }


    .lcc-menu-link-content {

        min-width: 0;

    }


    /* Exibe ícones no mobile. */

    .lcc-menu-link-content > .bi {

        display: inline-block;

        flex: 0 0 auto;

        font-size: 1rem;

    }


    /* Evita estouro de texto. */

    .lcc-menu-link-content > span {

        overflow-wrap: anywhere;

    }


    /* Hover e foco mobile. */

    .lcc-menu-link:hover,
    .lcc-menu-link:focus-visible {

        background: var(--lcc-menu-hover-strong);

        color: var(--lcc-menu-primary);

    }


    /* Página atual no mobile:
       destaque vertical à esquerda. */

    .lcc-menu
    .lcc-menu-item.is-current
    > .lcc-menu-item-row
    > .lcc-menu-link {

        background: var(--lcc-menu-hover-strong);

        color: var(--lcc-menu-primary);

        box-shadow: inset 4px 0 0 var(--lcc-menu-primary);

    }


    .lcc-menu
    .lcc-menu-link[aria-current="page"] {

        box-shadow: inset 4px 0 0 var(--lcc-menu-primary);

    }


    /* ==========================================
       SUBMENU MOBILE
       ========================================== */

    .lcc-submenu {

        position: static;

        top: auto;

        left: auto;

        right: auto;

        display: none;

        width: 100%;

        min-width: 0;

        max-width: 100%;

        margin: 0;

        padding: 0;

        overflow: visible;

        background: #ffffff;

        border: 0;

        border-top: 1px solid #dddddd;

        border-radius: 0;

        box-shadow: none;

    }


    /* Corrige posicionamento dos últimos menus. */

    .lcc-menu-list
    > .lcc-menu-item:nth-last-child(2)
    > .lcc-submenu,

    .lcc-menu-list
    > .lcc-menu-item:last-child
    > .lcc-submenu {

        position: static;

        left: auto;

        right: auto;

    }


    /* Submenu aberto. */

    .lcc-menu-item--has-submenu.is-open
    > .lcc-submenu {

        display: block;

    }


    /* Links internos. */

    .lcc-submenu a {

        min-height: 46px;

        padding-left: 2rem;

        padding-right: 1rem;

    }


    /* Item atual. */

    .lcc-submenu a[aria-current="page"] {

        padding-left: calc(2rem - 4px);

    }

}


/* ==================================================
   14. CELULARES
   ================================================== */

@media (max-width: 575.98px) {

    .lcc-menu {

        width: 100%;

        margin-top: 0;

        margin-bottom: 0.65rem;

        border-radius: 0;

    }


    /* Margens iguais às páginas institucionais. */

    .lcc-menu > .lcc-menu-container {

        width: calc(100% - 32px);

        max-width: 100%;

        padding: 0;

    }


    /* Logotipo. */

    .lcc-menu-brand {

        padding: 0;

    }


    .lcc-menu-logo {

        width: 60px;

        height: 60px;

    }


    /* Botão mobile. */

    .lcc-menu-toggle {

        margin-right: 0;

        padding-left: 0.6rem;

        padding-right: 0.6rem;

    }


    /* Links principais. */

    .lcc-menu-link {

        font-size: 0.94rem;

    }


    /* Links dos submenus. */

    .lcc-submenu a {

        font-size: 0.9rem;

        padding-left: 1.5rem;

    }


    .lcc-submenu a[aria-current="page"] {

        padding-left: calc(1.5rem - 4px);

    }

}


/* ==================================================
   15. ALTO CONTRASTE
   ================================================== */

/* Barra principal. */

html.lcc-high-contrast .lcc-menu,
html[data-lcc-contrast="true"] .lcc-menu,
body.lcc-high-contrast .lcc-menu {

    background: #000000 !important;

    border-color: #ffffff !important;

    box-shadow: none !important;

}


/* Contêiner. */

html.lcc-high-contrast
.lcc-menu > .lcc-menu-container,

html[data-lcc-contrast="true"]
.lcc-menu > .lcc-menu-container,

body.lcc-high-contrast
.lcc-menu > .lcc-menu-container {

    background: #000000 !important;

}


/* Textos dos links. */

html.lcc-high-contrast .lcc-menu :where(
    .lcc-menu-brand,
    .lcc-menu-link,
    .lcc-menu-toggle,
    .lcc-submenu-toggle
),

html[data-lcc-contrast="true"] .lcc-menu :where(
    .lcc-menu-brand,
    .lcc-menu-link,
    .lcc-menu-toggle,
    .lcc-submenu-toggle
),

body.lcc-high-contrast .lcc-menu :where(
    .lcc-menu-brand,
    .lcc-menu-link,
    .lcc-menu-toggle,
    .lcc-submenu-toggle
) {

    color: #ffff00 !important;

}


/* Ícones e setas do menu principal. */

html.lcc-high-contrast
.lcc-menu .lcc-menu-link-content > .bi,

html[data-lcc-contrast="true"]
.lcc-menu .lcc-menu-link-content > .bi,

body.lcc-high-contrast
.lcc-menu .lcc-menu-link-content > .bi,

html.lcc-high-contrast
.lcc-menu .lcc-submenu-chevron,

html[data-lcc-contrast="true"]
.lcc-menu .lcc-submenu-chevron,

body.lcc-high-contrast
.lcc-menu .lcc-submenu-chevron {

    color: #ffff00 !important;

}


/* Logotipo. */

html.lcc-high-contrast .lcc-menu-logo,
html[data-lcc-contrast="true"] .lcc-menu-logo,
body.lcc-high-contrast .lcc-menu-logo {

    background: #ffffff;

    border: 2px solid #ffff00;

}


/* Lista mobile. */

html.lcc-high-contrast .lcc-menu-list,
html[data-lcc-contrast="true"] .lcc-menu-list,
body.lcc-high-contrast .lcc-menu-list {

    background: #000000 !important;

}


/* Submenus. */

html.lcc-high-contrast .lcc-submenu,
html[data-lcc-contrast="true"] .lcc-submenu,
body.lcc-high-contrast .lcc-submenu {

    background: #000000 !important;

    border-color: #ffffff !important;

    box-shadow: none !important;

}


/* Links dos submenus. */

html.lcc-high-contrast .lcc-submenu a,
html[data-lcc-contrast="true"] .lcc-submenu a,
body.lcc-high-contrast .lcc-submenu a {

    background: #000000 !important;

    color: #ffff00 !important;

}


/* Hover, foco e página atual. */

html.lcc-high-contrast .lcc-submenu a:hover,
html.lcc-high-contrast .lcc-submenu a:focus-visible,
html.lcc-high-contrast .lcc-submenu a[aria-current="page"],

html[data-lcc-contrast="true"] .lcc-submenu a:hover,
html[data-lcc-contrast="true"] .lcc-submenu a:focus-visible,
html[data-lcc-contrast="true"] .lcc-submenu a[aria-current="page"],

body.lcc-high-contrast .lcc-submenu a:hover,
body.lcc-high-contrast .lcc-submenu a:focus-visible,
body.lcc-high-contrast .lcc-submenu a[aria-current="page"] {

    background: #ffff00 !important;

    color: #000000 !important;

}


/* Ícones dos submenus. */

html.lcc-high-contrast .lcc-submenu-label .bi,
html[data-lcc-contrast="true"] .lcc-submenu-label .bi,
body.lcc-high-contrast .lcc-submenu-label .bi {

    color: inherit !important;

}


/* ==================================================
   16. REDUÇÃO DE MOVIMENTO
   ================================================== */

@media (prefers-reduced-motion: reduce) {

    .lcc-submenu-chevron {

        transition: none;

    }

}


/* ==================================================
   17. IMPRESSÃO
   ================================================== */

@media print {

    .lcc-menu {

        display: none !important;

    }

}