/* ===========================================================
   CSS MODERNO - Header com glassmorphism aprimorado (AJUSTADO)
   =========================================================== */

/* ---------- variáveis e base (ajuste a altura do header aqui) ---------- */
:root {
    --site-header-height: 72px;
    --site-header-h-padding: 20px;
    --site-inner-maxwidth: min(1180px, 96%);
    --inner-horizontal-gap: 40px;
    --card-radius: 50px;
    --nav-gap: 24px;
}

/* ---------- reset e base ---------- */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

/* ---------- header fixo com altura controlada ---------- */
.site-header {
    position: fixed;
    margin-top: 30px;
    inset: 0 0 auto 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: var(--site-header-height);
    padding: 0 var(--site-header-h-padding);
    border-bottom: 1px solid rgba(10, 14, 20, 0.04);
    background: transparent;
    transition: padding .22s cubic-bezier(.2, .9, .25, 1),
                box-shadow .22s cubic-bezier(.2, .9, .25, 1),
                background .28s cubic-bezier(.2, .9, .25, 1);
}

/* container interno com largura controlada e ocupando 100% da altura do header */
.sh-inner {
    height: 100%;
    width: var(--site-inner-maxwidth);
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: var(--inner-horizontal-gap);
    padding: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    transition: background .28s cubic-bezier(.2, .9, .25, 1),
                backdrop-filter .28s cubic-bezier(.2, .9, .25, 1),
                color .18s cubic-bezier(.2, .9, .25, 1),
                box-shadow .28s cubic-bezier(.2, .9, .25, 1),
                transform .18s cubic-bezier(.2, .9, .25, 1);
}

/* quando NÃO scrolled -> fundo branco (leitura padrão) */
.site-header:not(.scrolled) .sh-inner {
    color: #0b1220;
    backdrop-filter: none;
}

/* quando scrolled -> fundo bem transparente + blur (glass) */
.site-header.scrolled .sh-inner {
    background: rgba(221, 117, 117, 0); /* mantém transparente por padrão */
    color: #0b1220;
    transition: background .28s cubic-bezier(.2, .9, .25, 1),
                backdrop-filter .28s cubic-bezier(.2, .9, .25, 1),
                color .18s cubic-bezier(.2, .9, .25, 1);
}

/* se o JS detectar que o fundo por baixo é escuro, adicionamos .dark-backdrop para garantir contraste */
.site-header.scrolled.dark-backdrop .sh-inner {
    background: rgba(0, 0, 0, 0.36);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
}

/* ---------- Pills (cards internos) ---------- */
.sh-cont,
.sh-right,
.sh-left,
.sh-center {
    height: 100%;
    display: flex;
    align-items: center;
    min-height: 0;
    box-shadow: 0 6px 18px rgba(12, 16, 32, 0.04);
    transition: transform .22s cubic-bezier(.2, .9, .25, 1),
                background .28s cubic-bezier(.2, .9, .25, 1),
                box-shadow .28s cubic-bezier(.2, .9, .25, 1),
                backdrop-filter .28s cubic-bezier(.2, .9, .25, 1),
                padding .18s cubic-bezier(.2, .9, .25, 1);
}

/* cartão base com glass effect leve */
.sh-cont {
    background: #ffffff02;
    border-radius: var(--card-radius);
    padding: 0 48px;
    display: flex;
    align-items: center;
    box-shadow: 0 6px 18px rgba(12, 16, 32, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px) saturate(115%);
    -webkit-backdrop-filter: blur(16px) saturate(115%);
}

/* ---------- sh-left (logo) ---------- */
.sh-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 140px;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.site-logo {
    height: 60%;
    display: block;
    max-width: 220px;
    object-fit: contain;
}

/* ---------- sh-center/sh-right ---------- */
.sh-center {
    justify-content: center;
    gap: 16px;
    padding: 0 48px;
}

/* ====== PILL DIREITO (accent) - sempre vermelho com blur ====== */
.sh-right {
    flex: 0 0 auto;
    background: linear-gradient(180deg, rgba(255, 0, 0, 0.584), rgba(255, 0, 0, 0.622));
    color: #fff;
    padding: 0 42px;
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(245, 25, 25, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform .22s cubic-bezier(.2, .9, .25, 1),
                box-shadow .28s cubic-bezier(.2, .9, .25, 1),
                background .28s cubic-bezier(.2, .9, .25, 1);
    backdrop-filter: blur(16px) saturate(115%);
    -webkit-backdrop-filter: blur(16px) saturate(115%);
}

/* Garantir que o pill direito NÃO seja afetado pela mudança .scrolled:
   regras com maior especificidade que sobrescrevem qualquer cor/fundo definido por .sh-inner/.sh-cont */
.site-header.scrolled .sh-right,
.site-header.scrolled.dark-backdrop .sh-right,
.site-header:not(.scrolled) .sh-right {
    /* reafirmar o visual accent mesmo no scrolled/dark-backdrop */
    background: linear-gradient(180deg, rgba(255, 0, 0, 0.584), rgba(255, 0, 0, 0.622)) !important;
    color: #fff !important;
    box-shadow: 0 10px 30px rgba(245, 25, 25, 0.10) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(16px) saturate(115%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(115%) !important;
}

/* sh-cont quando header scrolled: mais translúcido e blur aumentado (mantém comportamento) */
.site-header.scrolled .sh-cont {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
}

/* ---------- navegação ---------- */
.nav {
    display: flex;
    gap: var(--nav-gap);
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 100%;
}

.nav-link {
    position: relative;
    display: inline-block;
    padding: 8px 20px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    border-radius: 28px;
    cursor: pointer;
    user-select: text;
    transition: color .18s cubic-bezier(.2, .9, .25, 1),
                transform .18s cubic-bezier(.2, .9, .25, 1),
                background .18s cubic-bezier(.2, .9, .25, 1),
                box-shadow .18s cubic-bezier(.2, .9, .25, 1);
    backface-visibility: hidden;
    line-height: 1;
}

.nav-link::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(199, 12, 12, 0.98), rgba(188, 31, 31, 0.98));
    z-index: -1;
    opacity: 0;
    transform: scaleX(.98);
    transition: opacity .16s cubic-bezier(.2, .9, .25, 1),
                transform .16s cubic-bezier(.2, .9, .25, 1);
}

.nav-link:hover {
    transform: translateY(-2px);
    color: rgb(245, 25, 25);
}

.nav-link:active {
    transform: translateY(0);
}

.nav-link.active,
.nav-link[aria-current="true"],
.nav-link:focus {
    color: #fff;
    background: transparent;
    outline: none;
}

.nav-link.active::after,
.nav-link[aria-current="true"]::after,
.nav-link:focus::after {
    opacity: 1;
    transform: scaleX(1);
    border-radius: 99px;
    background: linear-gradient(90deg, rgba(185, 185, 185, 0.047), rgba(255, 255, 255, 0.096));
    margin: -4px;
}

.nav-link::selection,
.nav-link::-moz-selection {
    background: rgba(10, 14, 20, 0.9);
    color: #fff;
}

.github-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    transition: transform .18s cubic-bezier(.2, .9, .25, 1),
                box-shadow .22s cubic-bezier(.2, .9, .25, 1),
                opacity .2s cubic-bezier(.2, .9, .25, 1);
    will-change: transform;
}

.github-btn svg {
    display: block;
    height: 26px;
    width: auto;
    fill: currentColor;
}

.github-logo {
    height: 26px;
    display: block;
    filter: none;
}

/* fallback quando backdrop-filter não suportado */
@supports not (backdrop-filter: blur(1px)) {
    .site-header.scrolled .sh-cont {
        background: rgba(255, 255, 255, 0.72);
        border: 1px solid rgba(10, 14, 20, 0.04);
    }

    /* garantir cor do pill direito mesmo sem backdrop-filter */
    .sh-right {
        background: linear-gradient(180deg, rgba(255, 0, 0, 0.584), rgba(255, 0, 0, 0.622));
        color: #fff;
        box-shadow: 0 10px 30px rgba(245, 25, 25, 0.10);
    }
}

/* foco acessível */
.nav-link:focus-visible {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

/* responsividade */
@media (max-width:860px) {
    :root {
        --site-header-height: 64px;
        --inner-horizontal-gap: 12px;
    }

    .sh-inner {
        gap: var(--inner-horizontal-gap);
    }

    .sh-cont {
        padding: 0 18px;
        border-radius: 28px;
    }

    .sh-right {
        padding: 0 18px;
        border-radius: 22px;
    }

    .nav {
        gap: 8px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 14px;
        border-radius: 20px;
    }

    .site-logo {
        height: 56%;
    }

    .sh-left {
        padding-left: 12px;
        padding-right: 8px;
        min-width: 80px;
    }
}

/* garantir que o main não fique coberto pelo header */
main {
    padding-top: var(--site-header-height);
}

/* utilitários */
.sh-right.shrink {
    padding-left: 18px;
    padding-right: 18px;
}
