/* ========================================
   FRANDE ONE · CABECERA ÚNICA DEL SITIO
   Misma navegación en todas las páginas: Inicio, Productos (4), Funcionalidades,
   Planes, Para Contables, Contacto y Empezar Gratis.
   Carga después de style.css, responsive.css y landing.css.
   ======================================== */

.header .navbar {
    gap: var(--fo-space-3, 0.75rem);
}

.header .nav-menu {
    gap: 0.25rem;
}

.header .nav-menu > li > a,
.header .nav-products-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--fo-radius-md, 10px);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9375rem;
    white-space: nowrap;
}

.header .nav-menu > li > a[aria-current="page"],
.header .nav-products-toggle.is-current {
    color: var(--fo-link, #0364aa);
    background-color: var(--bg-secondary);
    box-shadow: inset 0 -2px 0 var(--fo-link, #0364aa);
}

[data-theme="dark"] .header .nav-menu > li > a[aria-current="page"],
[data-theme="dark"] .header .nav-products-toggle.is-current {
    color: var(--fo-link, #6cc0fc);
    box-shadow: inset 0 -2px 0 var(--fo-link, #6cc0fc);
}

.header .nav-menu > li > a.btn-primary {
    color: #ffffff;
    background: var(--fo-primary, #0476c8);
    font-weight: 600;
    margin-left: 0.25rem;
}

.header .nav-menu > li > a.btn-primary[aria-current="page"],
[data-theme="dark"] .header .nav-menu > li > a.btn-primary[aria-current="page"] {
    color: #ffffff;
    background: var(--fo-primary-active, #035896);
    box-shadow: none;
}

.header .nav-menu > li > a.btn-primary:hover {
    background: var(--fo-primary-hover, #0364aa);
    color: #ffffff;
}

.header a:focus-visible,
.header button:focus-visible {
    outline: 3px solid var(--fo-focus, #0364aa);
    outline-offset: 2px;
}

/* ---------- Productos (desplegable) ---------- */
.nav-products {
    position: relative;
}

.nav-products-toggle {
    gap: 0.35rem;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.nav-products-toggle:hover {
    background-color: var(--bg-secondary);
    color: var(--fo-link, #0364aa);
}

.nav-products-toggle svg {
    width: 0.85rem;
    height: 0.85rem;
    transition: transform var(--fo-duration, 180ms) var(--fo-ease, ease);
}

.nav-products-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.nav-products-panel {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    width: 21rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--fo-radius-lg, 16px);
    box-shadow: var(--fo-shadow-lg, 0 24px 60px -20px rgba(15, 13, 63, 0.28));
    z-index: 1100;
    display: none;
}

.nav-products-toggle[aria-expanded="true"] + .nav-products-panel {
    display: grid;
    gap: 0.25rem;
}

.nav-products-panel a {
    display: grid;
    gap: 0.15rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--fo-radius-md, 10px);
    color: var(--text-primary);
    text-decoration: none;
    white-space: normal;
}

.nav-products-panel a:hover,
.nav-products-panel a[aria-current="page"] {
    background: var(--fo-primary-soft, #e2f2fd);
}

.nav-products-panel strong {
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-products-panel span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

[data-theme="dark"] .nav-products-panel span {
    color: #b9b8cc;
}

/* ---------- Menú en pantallas medianas y pequeñas ---------- */
@media (max-width: 1100px) {
    .header .navbar {
        padding: var(--spacing-md, 1rem) var(--container-padding, 1.5rem);
    }

    .header .nav-toggle {
        display: flex;
        z-index: 1001;
        order: 2;
    }

    .header .theme-toggle {
        order: 3;
    }

    .header .nav-brand {
        order: 1;
        flex: 1;
    }

    .header .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, calc(100vw - 2rem));
        height: 100vh;
        height: 100dvh;
        background-color: var(--bg-primary);
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: 4.5rem 1.25rem 1.5rem;
        box-shadow: var(--shadow-xl);
        display: none;
        overflow-y: auto;
        border-left: 1px solid var(--border-light);
        justify-content: flex-start;
        z-index: 1000;
    }

    .header .nav-menu.active {
        display: flex;
    }

    .header .nav-menu > li > a,
    .header .nav-products-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 0.75rem 0.85rem;
        font-size: 1rem;
    }

    .header .nav-menu > li > a.btn-primary {
        justify-content: center;
        margin: 0.75rem 0 0;
    }

    .nav-products-panel {
        position: static;
        transform: none;
        width: auto;
        box-shadow: none;
        border: 0;
        border-left: 2px solid var(--border-light);
        border-radius: 0;
        margin: 0 0 0.5rem 0.85rem;
        padding: 0 0 0 0.5rem;
    }

    .header .nav-menu-footer {
        display: block;
        margin-top: auto;
        padding-top: 1.25rem;
        border-top: 1px solid var(--border-light);
        width: 100%;
        list-style: none;
    }

    .header .nav-menu-footer-title {
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-secondary);
        margin-bottom: 0.5rem;
    }

    .header .nav-menu-footer-contact {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }

    .header .nav-menu-footer-contact a {
        display: flex;
        align-items: center;
        min-height: 2.25rem;
        padding: 0 !important;
        width: auto !important;
        font-size: 0.9rem;
        color: var(--text-secondary);
        text-decoration: none;
    }

    .header .nav-menu-footer-contact a:hover {
        color: var(--fo-link, #0364aa);
    }

    .header .nav-menu-footer-social {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.75rem;
    }

    .header .nav-menu-footer-social a {
        width: 2.75rem !important;
        height: 2.75rem;
        border-radius: 8px;
        background: var(--bg-secondary);
        color: var(--text-primary);
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: 600;
        padding: 0 !important;
    }

    .header .nav-menu-footer-social a:hover {
        background: var(--fo-primary, #0476c8);
        color: #ffffff;
    }
}

@media (min-width: 1101px) {
    .header .nav-toggle,
    .header .nav-menu-footer {
        display: none;
    }

    .header .nav-menu {
        display: flex;
        position: static;
        flex-direction: row;
        height: auto;
        width: auto;
        padding: 0;
        box-shadow: none;
        border: 0;
        background: transparent;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-products-toggle svg {
        transition: none;
    }
}

/* ---------- Saltar al contenido ---------- */
.skip-link {
    position: absolute;
    top: 0;
    left: 0.5rem;
    transform: translateY(-120%);
    z-index: 10000;
    padding: 0.75rem 1rem;
    background: var(--fo-primary, #0476c8);
    color: #ffffff;
    font-weight: 600;
    border-radius: 0 0 var(--fo-radius-md, 10px) var(--fo-radius-md, 10px);
    text-decoration: none;
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
    outline: 3px solid var(--fo-brand-navy, #0f0d3f);
    outline-offset: 0;
    color: #ffffff;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
