/* =================================================================
   CABECERA + MENÚ MÓVIL
   En portada, Invest y Health toma el color del hero hasta hacer scroll.
   ================================================================ */

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 10001;
    background: var(--ink, #0b0d14);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
}
.skip-link:focus { top: 12px; }

.header {
    --h-bg: rgba(255, 255, 255, .9);
    --h-fg: var(--ink, #0b0d14);
    --h-chip-bg: var(--ink, #0b0d14);
    --h-chip-fg: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: var(--h-bg);
    color: var(--h-fg);
    transition: transform .4s cubic-bezier(.22, 1, .36, 1), background .3s ease, color .3s ease, box-shadow .3s ease;
}
.header.is-scrolled {
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 0 var(--line, #e0e4ec);
}
.header.header-hidden { transform: translateY(-101%); }
.header.menu-open { --h-bg: #fff; transform: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.header:focus-within { transform: none; }

/* Arriba del todo: mismo color que el hero */
.field--cobalt .header:not(.is-scrolled):not(.menu-open) { --h-bg: var(--cobalt); --h-fg: #fff; --h-chip-bg: #fff; --h-chip-fg: var(--cobalt); }
.field--green .header:not(.is-scrolled):not(.menu-open) { --h-bg: var(--green); --h-fg: var(--green-ink); --h-chip-bg: var(--green-ink); }
.field--sky .header:not(.is-scrolled):not(.menu-open) { --h-bg: var(--sky); --h-fg: #06173d; --h-chip-bg: #06173d; }

.header__inner {
    max-width: var(--container, 1320px);
    margin: 0 auto;
    height: 76px;
    padding: 0 var(--gutter, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 800 20px var(--body, Manrope, Arial, sans-serif);
    letter-spacing: -.05em;
    color: inherit;
    position: relative;
    z-index: 2;
}
.brand b {
    padding: 5px 7px 4px;
    border-radius: 6px;
    background: var(--h-chip-bg, currentColor);
    color: var(--h-chip-fg, #fff);
    font: 500 13px "DM Mono", monospace;
    letter-spacing: -1.5px;
    transition: background .3s ease, color .3s ease;
}

.nav {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2vw, 28px);
    font: 600 14.5px var(--body, Manrope, Arial, sans-serif);
}
.nav > a:not(.button) { position: relative; padding: 6px 0; }
.nav > a:not(.button)::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.nav > a:not(.button):hover::after,
.nav > a[aria-current="page"]::after { transform: scaleX(1); }

.nav .button {
    min-height: 44px;
    padding: 10px 20px;
    background: var(--h-chip-bg);
    border-color: var(--h-chip-bg);
    color: var(--h-chip-fg);
    font-size: 14px;
    gap: 8px;
}
.nav .button:hover { background: var(--cobalt, #1b34f5); border-color: var(--cobalt, #1b34f5); color: #fff; }
.field--cobalt .header:not(.is-scrolled):not(.menu-open) .nav .button:hover { background: var(--ink); border-color: var(--ink); }
.field--green .header .nav .button:hover { background: #000; border-color: #000; }

/* Menú móvil */
.menu-toggle {
    display: none;
    position: relative;
    z-index: 2;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    background: none;
    border: 0;
    cursor: pointer;
    color: inherit;
}
.menu-toggle span {
    position: absolute;
    left: 11px;
    width: 22px;
    height: 2.5px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .3s ease, opacity .2s ease;
}
.menu-toggle span:nth-child(1) { top: 14px; }
.menu-toggle span:nth-child(2) { top: 21px; }
.menu-toggle span:nth-child(3) { top: 28px; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 1000px) {
    .header__inner { height: 66px; }
    .menu-toggle { display: block; }
    .header.is-scrolled { -webkit-backdrop-filter: none; backdrop-filter: none; --h-bg: #fff; }

    .nav {
        position: fixed;
        inset: 66px 0 auto 0;
        height: calc(100dvh - 66px);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px var(--gutter, 20px) calc(28px + env(safe-area-inset-bottom));
        background: #fff;
        color: var(--ink, #0b0d14);
        overflow-y: auto;
        font: 700 30px var(--display, Manrope, sans-serif);
        letter-spacing: -.03em;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .25s ease, transform .3s ease, visibility 0s linear .3s;
    }
    .nav.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .25s ease, transform .3s ease; }
    .nav > a:not(.button) { padding: 14px 0; border-bottom: 1px solid var(--line, #e0e4ec); }
    .nav > a:not(.button)::after { display: none; }
    .nav .button { margin-top: 26px; min-height: 56px; font-size: 16px; letter-spacing: 0; }
}

body.no-scroll { overflow: hidden; }
