/*
    /tools/lib/scdu/assets/css/scdu-header.css

    Cabeçalho institucional público do SCDU.

    Desktop:
    - marca;
    - navegação horizontal;
    - pesquisa;
    - acesso e conta.

    Mobile:
    - marca;
    - botão hambúrguer;
    - menu fechado por padrão;
    - painel de navegação em tela cheia quando aberto.
*/

/* =========================================================
   BASE
========================================================= */

.scdu-header,
.scdu-header *,
.scdu-header *::before,
.scdu-header *::after,
.scdu-skip {
    box-sizing: border-box;
}

html.scdu-mobile-menu-open,
body.scdu-mobile-menu-open {
    overflow: hidden;
}

.scdu-header {
    --scdu-azul-base: #10243A;
    --scdu-azul-superficie: #17344A;
    --scdu-azul-elevado: #1F4763;

    --scdu-azul-principal: #95BFDD;
    --scdu-azul-titulo: #C4E1F2;

    --scdu-texto: #DDEAF2;
    --scdu-texto-suave: #AFC4D4;

    --scdu-borda:
        rgba(149, 191, 221, 0.42);

    --scdu-borda-suave:
        rgba(149, 191, 221, 0.20);

    --scdu-roxo-assinatura: #7668D9;

    position: sticky;
    top: 0;
    z-index: 5000;

    width: 100%;

    color: var(--scdu-texto);

    background:
        linear-gradient(
            1deg,
            #558DBB 0%,
            #254E70 44%,
            #091426 100%
        );

    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.10);

    box-shadow:
        0 2px 8px
        rgba(0, 0, 0, 0.24);

    backdrop-filter:
        saturate(140%)
        blur(10px);

    -webkit-backdrop-filter:
        saturate(140%)
        blur(10px);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.scdu-header__shell {
    width:
        min(
            calc(100% - 32px),
            1240px
        );

    margin-inline: auto;
}

.scdu-header__row {
    display: flex;

    min-height: 66px;

    align-items: center;

    gap: 28px;
}

/* =========================================================
   ACESSIBILIDADE
========================================================= */

.scdu-skip {
    position: fixed;
    z-index: 99999;

    top: 8px;
    left: 8px;

    padding:
        10px
        15px;

    border:
        1px solid
        rgba(255, 255, 255, 0.20);

    border-radius: 8px;

    color: #FFFFFF;
    background: #10243A;

    font-size: 0.82rem;
    font-weight: 700;

    text-decoration: none;

    transform:
        translateY(-160%);

    transition:
        transform
        160ms ease;
}

.scdu-skip:focus {
    transform:
        translateY(0);
}

/* =========================================================
   MARCA
========================================================= */

.scdu-brand {
    display: inline-flex;

    min-width: 0;
    flex: 0 0 auto;

    align-items: center;

    gap: 10px;

    color: var(--scdu-texto);

    text-decoration: none;
}

.scdu-brand__logo {
    display: block;

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    padding: 3px;

    object-fit: contain;

    border:
        1px solid
        rgba(196, 225, 242, 0.30);

    border-radius: 12px;

    background:
        rgba(16, 36, 58, 0.34);

    box-shadow:
        inset 0 1px 0
        rgba(255, 255, 255, 0.08),
        0 5px 16px
        rgba(0, 0, 0, 0.14);
}

.scdu-brand__logo--fallback {
    display: grid;

    place-items: center;

    padding: 0;

    color: #FFFFFF;

    background:
        linear-gradient(
            145deg,
            var(--scdu-azul-elevado),
            var(--scdu-azul-base)
        );

    font-size: 1rem;
    font-weight: 800;
}

.scdu-brand__text {
    display: grid;

    min-width: 0;

    line-height: 1.08;
}

.scdu-brand__title {
    overflow: hidden;

    color: #FFFFFF;

    font-size: 0.98rem;
    font-weight: 760;
    letter-spacing: -0.015em;

    text-overflow: ellipsis;
    white-space: nowrap;

    text-shadow:
        0 2px 8px
        rgba(0, 0, 0, 0.20);
}

.scdu-brand__sub {
    margin-top: 3px;

    color: var(--scdu-texto-suave);

    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* =========================================================
   NAVEGAÇÃO DESKTOP
========================================================= */

.scdu-header__navigation {
    display: flex;

    min-width: 0;
    flex: 1 1 auto;

    align-items: center;
    justify-content: space-between;

    gap: 24px;
}

.scdu-nav {
    display: flex;

    min-width: 0;

    align-items: center;

    gap: 4px;
}

.scdu-nav__item {
    position: relative;
}

.scdu-nav__link,
.scdu-nav__trigger {
    position: relative;

    display: inline-flex;

    min-height: 40px;

    align-items: center;
    justify-content: center;

    gap: 7px;

    padding:
        0
        13px;

    border: 0;
    border-radius: 8px;

    color: var(--scdu-texto);

    background: transparent;

    appearance: none;

    font: inherit;
    font-size: 0.78rem;
    font-weight: 560;
    line-height: 1;

    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;

    transition:
        color 160ms ease,
        background 160ms ease,
        box-shadow 160ms ease;
}

.scdu-nav__link:hover,
.scdu-nav__trigger:hover,
.scdu-nav__item.is-open
.scdu-nav__trigger {
    color: #FFFFFF;

    background:
        rgba(196, 225, 242, 0.12);

    box-shadow:
        inset 0 1px 0
        rgba(255, 255, 255, 0.06);
}

.scdu-nav__link.is-active,
.scdu-nav__item.is-active
.scdu-nav__trigger {
    color: #FFFFFF;

    font-weight: 720;
}

.scdu-nav__link.is-active::after,
.scdu-nav__item.is-active
.scdu-nav__trigger::after {
    position: absolute;

    right: 13px;
    bottom: 3px;
    left: 13px;

    height: 2px;

    border-radius: 999px;

    content: "";

    background:
        linear-gradient(
            90deg,
            var(--scdu-azul-principal),
            var(--scdu-roxo-assinatura)
        );
}

.scdu-nav__trigger svg {
    width: 10px;
    height: 7px;

    fill: none;

    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.4;

    transition:
        transform
        160ms ease;
}

.scdu-nav__item.is-open
.scdu-nav__trigger svg {
    transform:
        rotate(180deg);
}

/* =========================================================
   DROPDOWNS
========================================================= */

.scdu-nav__dropdown {
    position: absolute;

    top:
        calc(100% + 9px);

    left: 0;

    width: 330px;

    padding: 8px;

    border:
        1px solid
        rgba(149, 191, 221, 0.55);

    border-radius: 14px;

    background:
        rgba(244, 248, 251, 0.99);

    box-shadow:
        0 24px 56px
        rgba(0, 0, 0, 0.25);

    animation:
        scduHeaderDropdownEnter
        180ms
        ease
        both;
}

.scdu-nav__dropdown[hidden] {
    display: none !important;
}

.scdu-nav__dropdown-link {
    display: grid;

    gap: 4px;

    padding:
        12px
        13px;

    border-radius: 10px;

    color: var(--scdu-azul-base);

    text-decoration: none;

    transition:
        background 150ms ease,
        transform 150ms ease,
        box-shadow 150ms ease;
}

.scdu-nav__dropdown-link:hover {
    background: #E4EFF6;

    box-shadow:
        inset 3px 0 0
        var(--scdu-azul-elevado);

    transform:
        translateX(2px);
}

.scdu-nav__dropdown-link.is-active {
    background:
        rgba(149, 191, 221, 0.28);

    box-shadow:
        inset 3px 0 0
        var(--scdu-roxo-assinatura);
}

.scdu-nav__dropdown-link strong {
    color: var(--scdu-azul-base);

    font-size: 0.79rem;
    font-weight: 720;
    line-height: 1.25;
}

.scdu-nav__dropdown-link span {
    color:
        rgba(16, 36, 58, 0.66);

    font-size: 0.69rem;
    line-height: 1.42;
}

/* =========================================================
   AÇÕES
========================================================= */

.scdu-header__actions {
    display: flex;

    flex: 0 0 auto;

    align-items: center;

    gap: 6px;
}

.scdu-header__search-button,
.scdu-header__access {
    display: inline-flex;

    min-height: 38px;

    align-items: center;
    justify-content: center;

    gap: 7px;

    padding:
        0
        10px;

    border: 0;
    border-radius: 8px;

    color: var(--scdu-texto);
    background: transparent;

    appearance: none;

    font: inherit;
    font-size: 0.76rem;
    font-weight: 560;

    text-decoration: none;

    cursor: pointer;

    transition:
        color 160ms ease,
        background 160ms ease;
}

.scdu-header__search-button:hover,
.scdu-header__access:hover {
    color: #FFFFFF;

    background:
        rgba(196, 225, 242, 0.12);
}

.scdu-header__search-button svg {
    width: 18px;
    height: 18px;

    fill: none;

    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.6;
}

.scdu-header__avatar {
    display: grid;

    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    place-items: center;

    border:
        1px solid
        rgba(196, 225, 242, 0.75);

    border-radius: 50%;

    color: #FFFFFF;

    background:
        rgba(16, 36, 58, 0.42);

    font-size: 0.72rem;
    font-weight: 720;

    text-decoration: none;
}

/* =========================================================
   PESQUISA
========================================================= */

.scdu-header__search {
    padding:
        0
        0
        14px;
}

.scdu-header__search[hidden] {
    display: none !important;
}

.scdu-header__search-form {
    display: grid;

    grid-template-columns:
        20px
        minmax(0, 1fr)
        auto
        34px;

    align-items: center;

    gap: 10px;

    padding:
        8px
        9px
        8px
        14px;

    border:
        1px solid
        rgba(196, 225, 242, 0.34);

    border-radius: 12px;

    background:
        rgba(9, 20, 38, 0.96);

    box-shadow:
        0 15px 34px
        rgba(0, 0, 0, 0.24);
}

.scdu-header__search-form > svg {
    width: 19px;
    height: 19px;

    fill: none;

    stroke: var(--scdu-azul-principal);
    stroke-linecap: round;
    stroke-width: 1.6;
}

.scdu-header__search-label {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;

    clip:
        rect(
            0,
            0,
            0,
            0
        );
}

.scdu-header__search-form input {
    width: 100%;
    min-width: 0;

    padding:
        7px
        3px;

    border: 0;
    outline: 0;

    color: #FFFFFF;
    background: transparent;

    font: inherit;
    font-size: 0.82rem;
}

.scdu-header__search-form input::placeholder {
    color: var(--scdu-texto-suave);
}

.scdu-header__search-form
button[type="submit"] {
    min-height: 34px;

    padding:
        0
        17px;

    border: 0;
    border-radius: 8px;

    color: var(--scdu-azul-base);
    background: var(--scdu-azul-titulo);

    font: inherit;
    font-size: 0.73rem;
    font-weight: 750;

    cursor: pointer;
}

.scdu-header__search-close {
    display: grid;

    width: 34px;
    height: 34px;

    place-items: center;

    border: 0;
    border-radius: 8px;

    color: var(--scdu-texto);
    background: transparent;

    font-size: 1.25rem;

    cursor: pointer;
}

/* =========================================================
   BOTÃO HAMBÚRGUER
========================================================= */

.scdu-header__burger {
    position: relative;
    z-index: 2;

    display: none;

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    margin-left: auto;
    padding: 0;

    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 5px;

    border:
        1px solid
        rgba(196, 225, 242, 0.42);

    border-radius: 10px;

    color: var(--scdu-texto);

    background:
        rgba(16, 36, 58, 0.34);

    appearance: none;

    box-shadow:
        inset 0 1px 0
        rgba(255, 255, 255, 0.08);

    cursor: pointer;
}

.scdu-header__burger span {
    display: block !important;

    width: 20px !important;
    height: 2px !important;

    flex: 0 0 2px;

    border: 0;
    border-radius: 999px;

    opacity: 1;

    background:
        var(--scdu-texto) !important;

    transform-origin: center;

    transition:
        transform 180ms ease,
        opacity 180ms ease;
}

.scdu-header__burger[aria-expanded="true"]
span:nth-child(1) {
    transform:
        translateY(7px)
        rotate(45deg);
}

.scdu-header__burger[aria-expanded="true"]
span:nth-child(2) {
    opacity: 0;
}

.scdu-header__burger[aria-expanded="true"]
span:nth-child(3) {
    transform:
        translateY(-7px)
        rotate(-45deg);
}

/* =========================================================
   MOBILE E TABLET
========================================================= */

@media screen and (max-width: 980px) {
    .scdu-header {
        z-index: 9000;
    }

    .scdu-header__shell {
        width:
            min(
                calc(100% - 20px),
                1240px
            );
    }

    .scdu-header__row {
        min-height: 62px;

        gap: 12px;
    }

    .scdu-brand {
        max-width:
            calc(100% - 58px);
    }

    .scdu-header__burger {
        display: flex !important;
    }

    /*
     * O menu mobile deve começar obrigatoriamente fechado.
     */

    header.scdu-header
    .scdu-header__navigation {
        position: fixed !important;

        top: 62px !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;

        display: none !important;

        width: 100% !important;
        height:
            calc(100dvh - 62px);

        max-height:
            calc(100dvh - 62px);

        flex-direction: column;

        align-items: stretch;
        justify-content: flex-start;

        gap: 14px;

        overflow-x: hidden;
        overflow-y: auto;

        padding:
            15px
            16px
            24px;

        border-top:
            1px solid
            rgba(255, 255, 255, 0.08);

        background:
            linear-gradient(
                180deg,
                rgba(31, 71, 99, 0.99) 0%,
                rgba(16, 36, 58, 0.995) 45%,
                rgba(9, 20, 38, 1) 100%
            );

        box-shadow:
            0 24px 44px
            rgba(0, 0, 0, 0.32);

        backdrop-filter:
            blur(18px);

        -webkit-backdrop-filter:
            blur(18px);
    }

    /*
     * Somente esta classe abre o menu.
     */

    header.scdu-header
    .scdu-header__navigation.is-open {
        display: flex !important;
    }

    .scdu-nav {
        display: flex;

        width: 100%;

        flex-direction: column;

        align-items: stretch;

        gap: 5px;
    }

    .scdu-nav__item {
        width: 100%;
    }

    .scdu-nav__link,
    .scdu-nav__trigger {
        width: 100%;

        min-height: 46px;

        justify-content: space-between;

        padding:
            0
            14px;

        border:
            1px solid
            transparent;

        border-radius: 10px;

        font-size: 0.82rem;
    }

    .scdu-nav__link:hover,
    .scdu-nav__trigger:hover,
    .scdu-nav__item.is-open
    .scdu-nav__trigger {
        border-color:
            rgba(149, 191, 221, 0.18);

        background:
            rgba(196, 225, 242, 0.10);
    }

    .scdu-nav__link.is-active::after,
    .scdu-nav__item.is-active
    .scdu-nav__trigger::after {
        right: 14px;
        bottom: 5px;
        left: 14px;
    }

    .scdu-nav__dropdown {
        position: static;

        width: 100%;

        margin:
            4px
            0
            7px;

        border-radius: 10px;

        background:
            rgba(244, 248, 251, 0.99);

        box-shadow: none;
    }

    .scdu-header__actions {
        display: grid;

        width: 100%;

        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            auto;

        gap: 8px;

        margin-top: auto;
        padding-top: 14px;

        border-top:
            1px solid
            rgba(196, 225, 242, 0.14);
    }

    .scdu-header__search-button,
    .scdu-header__access {
        width: 100%;

        min-height: 44px;

        border:
            1px solid
            rgba(149, 191, 221, 0.18);

        background:
            rgba(196, 225, 242, 0.07);
    }

    .scdu-header__avatar {
        width: 44px;
        height: 44px;

        flex-basis: 44px;
    }

    /*
     * Pesquisa mobile separada do menu.
     */

    .scdu-header__search {
        position: fixed;

        top: 62px;
        right: 0;
        left: 0;

        padding:
            12px
            14px;

        background:
            linear-gradient(
                180deg,
                rgba(31, 71, 99, 0.99),
                rgba(16, 36, 58, 0.99)
            );

        box-shadow:
            0 18px 35px
            rgba(0, 0, 0, 0.28);
    }
}

/* =========================================================
   MOBILE PEQUENO
========================================================= */

@media screen and (max-width: 560px) {
    .scdu-brand__logo {
        width: 38px;
        height: 38px;

        flex-basis: 38px;
    }

    .scdu-brand__title {
        font-size: 0.88rem;
    }

    .scdu-brand__sub {
        font-size: 0.60rem;
    }

    .scdu-header__burger {
        width: 40px;
        height: 40px;

        flex-basis: 40px;
    }

    .scdu-header__actions {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            44px;
    }

    .scdu-header__search-form {
        grid-template-columns:
            18px
            minmax(0, 1fr)
            34px;
    }

    .scdu-header__search-form
    button[type="submit"] {
        grid-column:
            1
            /
            -1;

        width: 100%;
    }

    .scdu-header__search-close {
        grid-column: 3;
        grid-row: 1;
    }
}

/* =========================================================
   ANIMAÇÕES
========================================================= */

@keyframes scduHeaderDropdownEnter {
    from {
        opacity: 0;

        transform:
            translateY(-5px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}

/* =========================================================
   MOVIMENTO REDUZIDO
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .scdu-header *,
    .scdu-header *::before,
    .scdu-header *::after,
    .scdu-skip {
        animation: none !important;
        transition: none !important;
    }
}

/* =========================================================
   IMPRESSÃO
========================================================= */

@media print {
    .scdu-header,
    .scdu-skip {
        display: none !important;
    }
}