/* ============================================================
   BERATIEL — styles_rp/navbar.css  v2.0
   Glass-morphism dark navbar · Full responsive
   Breakpoints cubiertos:
     iPhone SE 3a gen   → 375px
     iPhone 12 mini     → 375px
     iPhone 12 Pro      → 390px
     iPhone 14          → 390px
     iPhone 14 Pro      → 393px
     iPhone XR          → 414px
     iPhone 14 Plus     → 428px
     iPhone 14 Pro Max  → 430px
     Tablets            → 768px
     Desktop            → 1024px+
   ============================================================ */


/* ============================================================
   1. VARIABLES LOCALES (heredan el :root del head.php)
   ============================================================ */
.navbar {
    --nb-height-desktop: 72px;
    --nb-height-mobile: 60px;
    --nb-bg: rgba(10, 18, 35, 0.82);
    --nb-bg-scrolled: rgba(8, 15, 28, 0.97);
    --nb-border: rgba(56, 189, 248, 0.12);
    --nb-border-scrolled: rgba(56, 189, 248, 0.28);
    --nb-blur: 18px;
    --nb-transition: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ============================================================
   2. NAVBAR BASE
   ============================================================ */
.navbar {
    position: fixed;
    inset-inline: 0;
    top: 0;
    width: 100%;
    height: var(--nb-height-desktop);
    z-index: var(--z-navbar, 500);
    background: var(--nb-bg);
    backdrop-filter: blur(var(--nb-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--nb-blur)) saturate(180%);
    border-bottom: 1px solid var(--nb-border);
    transition: height var(--nb-transition),
        background var(--nb-transition),
        border-color var(--nb-transition),
        transform var(--nb-transition),
        box-shadow var(--nb-transition);
    overflow: visible;
}

/* Estado: usuario hizo scroll */
.navbar--scrolled {
    height: calc(var(--nb-height-desktop) - 10px);
    background: var(--nb-bg-scrolled);
    border-color: var(--nb-border-scrolled);
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.45);
}

/* Estado: ocultarse al bajar — solo en móvil */
@media (max-width: 1023px) {
    .navbar--hidden {
        transform: translateY(-110%);
    }
}


/* ============================================================
   3. INNER CONTAINER
   ============================================================ */
.navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--container-max, 1280px);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 3rem);
    gap: 1rem;
}


/* ============================================================
   4. LOGO
   ============================================================ */
.navbar__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
}

.navbar__logo-img {
    height: clamp(28px, 4vw, 38px);
    width: auto;
    object-fit: contain;
    transition: opacity 0.2s ease, transform 0.3s ease;
    filter: brightness(1);
}

.navbar__logo:hover .navbar__logo-img {
    opacity: 0.85;
    transform: scale(0.97);
}


/* ============================================================
   5. MENÚ DESKTOP — Links
   ============================================================ */
.navbar__menu {
    display: flex;
    align-items: center;
    gap: clamp(0.25rem, 2vw, 0.5rem);
    list-style: none;
}

.navbar__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.45rem clamp(0.6rem, 1.2vw, 1rem);
    font-family: var(--font-display, 'Poppins', sans-serif);
    font-size: clamp(0.78rem, 1.1vw, 0.9rem);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    letter-spacing: 0.03em;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.navbar__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

/* Underline animado */
.navbar__link-underline {
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--beratiel-primary, #38bdf8);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar__link:hover .navbar__link-underline,
.navbar__link--active .navbar__link-underline {
    width: calc(100% - 1.2rem);
}

/* Estado activo */
.navbar__link--active {
    color: var(--beratiel-primary, #38bdf8);
    font-weight: 600;
}


/* ============================================================
   6. ACCIONES DERECHA (LinkedIn + CTA)
   ============================================================ */
.navbar__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Ícono social */
.navbar__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s;
}

.navbar__social:hover {
    color: var(--beratiel-primary, #38bdf8);
    border-color: var(--beratiel-primary, #38bdf8);
    background: rgba(56, 189, 248, 0.08);
    transform: translateY(-1px);
}

/* Botón CTA — azul sólido, sin degradado */
.navbar__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    font-family: var(--font-display, 'Poppins', sans-serif);
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    font-weight: 600;
    color: #040c18;
    background: var(--beratiel-primary, #38bdf8);
    border-radius: 100px;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.02em;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.navbar__cta:hover {
    background: #7dd3fc;
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 28px rgba(56, 189, 248, 0.45);
    color: #040c18;
}

.navbar__cta i {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.navbar__cta:hover i {
    transform: translateX(3px);
}


/* ============================================================
   7. LÍNEA NEÓN INFERIOR
   ============================================================ */
.navbar__neon-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--beratiel-primary, #38bdf8) 30%,
            rgba(56, 189, 248, 0.6) 70%,
            transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.navbar--scrolled .navbar__neon-line {
    opacity: 1;
}


/* ============================================================
   8. BOTÓN HAMBURGUESA
   ============================================================ */
.navbar__hamburger {
    display: none;
    /* oculto en desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.navbar__hamburger:hover {
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.06);
}

/* Las 3 barras */
.hamburger__bar {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s ease,
        width 0.25s ease;
    transform-origin: center;
}

/* Animación activo → X */
.hamburger--active .hamburger__bar--top {
    transform: translateY(7px) rotate(45deg);
}

.hamburger--active .hamburger__bar--mid {
    opacity: 0;
    width: 0;
}

.hamburger--active .hamburger__bar--bottom {
    transform: translateY(-7px) rotate(-45deg);
}


/* ============================================================
   9. MENÚ MÓVIL — Drawer lateral
   ============================================================ */

/* Overlay */
.mobile-menu__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s;
    z-index: calc(var(--z-navbar, 500) - 1);
}

.mobile-menu--open .mobile-menu__overlay {
    opacity: 1;
    visibility: visible;
}

/* Panel */
.mobile-menu__panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(85vw, 340px);
    height: 100dvh;
    /* dynamic viewport height (iOS safe) */
    height: 100vh;
    /* fallback */
    background: linear-gradient(160deg, #0b1628 0%, #0d1f3c 50%, #0b1628 100%);
    border-left: 1px solid rgba(56, 189, 248, 0.15);
    box-shadow: -10px 0 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-navbar, 500);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.mobile-menu--open .mobile-menu__panel {
    transform: translateX(0);
}

/* Cabecera del panel */
.mobile-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.mobile-menu__logo {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.mobile-menu__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu__close:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* Nav Links */
.mobile-menu__nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    flex: 1;
}

.mobile-menu__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.5rem;
    font-family: var(--font-display, 'Poppins', sans-serif);
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    letter-spacing: 0.02em;

    /* Animación de entrada escalonada */
    opacity: 0;
    transform: translateX(20px);
    transition: color 0.2s ease,
        background 0.2s ease,
        transform 0.35s ease calc(var(--delay, 0s)),
        opacity 0.35s ease calc(var(--delay, 0s));
}

.mobile-menu--open .mobile-menu__link {
    opacity: 1;
    transform: translateX(0);
}

.mobile-menu__link:hover {
    color: #fff;
    background: rgba(56, 189, 248, 0.07);
}

.mobile-menu__link--active {
    color: var(--beratiel-primary, #38bdf8);
    background: rgba(56, 189, 248, 0.08);
    font-weight: 600;
}

/* Borde izquierdo en activo */
.mobile-menu__link--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 3px;
    background: var(--beratiel-primary, #38bdf8);
    border-radius: 0 3px 3px 0;
}

/* Número decorativo */
.mobile-menu__num {
    font-family: var(--font-body, 'Quicksand', sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--beratiel-primary, #38bdf8);
    opacity: 0.6;
    letter-spacing: 0.05em;
    min-width: 20px;
}

/* Flecha decorativa */
.mobile-menu__arrow {
    margin-left: auto;
    font-size: 0.65rem;
    opacity: 0.35;
    transition: transform 0.2s, opacity 0.2s;
}

.mobile-menu__link:hover .mobile-menu__arrow {
    transform: translateX(3px);
    opacity: 0.7;
}

/* Footer del panel */
.mobile-menu__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;

    /* Safe area para iPhones con Home Bar */
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.mobile-menu__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.mobile-menu__social:hover {
    color: var(--beratiel-primary, #38bdf8);
    border-color: var(--beratiel-primary, #38bdf8);
    background: rgba(56, 189, 248, 0.08);
}

.mobile-menu__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    font-family: var(--font-display, 'Poppins', sans-serif);
    font-size: 0.85rem;
    font-weight: 600;
    color: #040c18;
    background: var(--beratiel-primary, #38bdf8);
    border-radius: 100px;
    text-decoration: none;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu__cta:hover {
    background: #7dd3fc;
    transform: scale(1.03);
    box-shadow: 0 6px 28px rgba(56, 189, 248, 0.5);
    color: #040c18;
}

/* Inicialmente oculto */
.mobile-menu {
    pointer-events: none;
}

.mobile-menu--open {
    pointer-events: auto;
}


/* ============================================================
   10. RESPONSIVIDAD — BREAKPOINTS
   ============================================================ */

/* ── 1024px+ → Desktop completo ──────────────────────────── */
@media (min-width: 1024px) {
    .navbar__hamburger {
        display: none !important;
    }

    .navbar__menu {
        display: flex;
    }

    .navbar__actions {
        display: flex;
    }
}

/* ── < 1024px → Tablet + Móvil: activar hamburguesa ──────── */
@media (max-width: 1023px) {

    .navbar {
        height: var(--nb-height-mobile);
    }

    .navbar--scrolled {
        height: calc(var(--nb-height-mobile) - 4px);
    }

    .navbar__menu {
        display: none;
        /* oculto; reemplazado por drawer */
    }

    .navbar__cta {
        display: none;
        /* se muestra en el drawer */
    }

    .navbar__social {
        display: none;
        /* se muestra en el drawer */
    }

    .navbar__hamburger {
        display: inline-flex;
        /* visible en móvil / tablet */
    }
}

/* ── Tablet 768px ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar__inner {
        padding-inline: 1.1rem;
    }
}

/* ── iPhone 14 Plus / Pro Max → 428–430px ────────────────── */
@media (max-width: 430px) {
    .navbar__inner {
        padding-inline: 1rem;
    }

    .navbar__logo-img {
        height: 26px;
    }

    .mobile-menu__panel {
        width: 88vw;
    }
}

/* ── iPhone XR / 14 Plus → 414px ─────────────────────────── */
@media (max-width: 414px) {
    .navbar__hamburger {
        width: 42px;
        height: 42px;
    }

    .mobile-menu__link {
        padding: 0.95rem 1.4rem;
        font-size: 0.95rem;
    }
}

/* ── iPhone 14 / 12 Pro / 14 Pro → 390–393px ─────────────── */
@media (max-width: 393px) {
    .navbar__inner {
        padding-inline: 0.9rem;
    }

    .navbar__logo-img {
        height: 24px;
    }

    .mobile-menu__panel {
        width: 90vw;
    }

    .mobile-menu__header {
        padding: 1rem 1.2rem;
    }

    .mobile-menu__link {
        padding: 0.9rem 1.2rem;
        font-size: 0.92rem;
    }

    .mobile-menu__footer {
        padding: 1rem 1.2rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ── iPhone SE 3a gen / 12 mini → 375px ──────────────────── */
@media (max-width: 375px) {
    .navbar {
        --nb-height-mobile: 56px;
    }

    .navbar__inner {
        padding-inline: 0.75rem;
        gap: 0.5rem;
    }

    .navbar__logo-img {
        height: 22px;
    }

    .navbar__hamburger {
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }

    .hamburger__bar {
        width: 20px;
    }

    .mobile-menu__panel {
        width: 92vw;
    }

    .mobile-menu__link {
        padding: 0.85rem 1.1rem;
        font-size: 0.9rem;
        gap: 0.7rem;
    }

    .mobile-menu__cta {
        padding: 0.6rem 1.1rem;
        font-size: 0.8rem;
    }
}

/* ── Muy pequeños < 320px ─────────────────────────────────── */
@media (max-width: 320px) {
    .navbar__logo-img {
        height: 20px;
    }

    .mobile-menu__panel {
        width: 100vw;
        border-left: none;
    }

    .mobile-menu__link {
        font-size: 0.88rem;
    }
}


/* ============================================================
   11. SAFE AREA — iPhone con notch y Dynamic Island
   ============================================================ */
@supports (padding: max(0px)) {

    /* Navbar respeta la isla dinámica en iPhone 14 Pro/Max */
    .navbar {
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(var(--nb-height-desktop) + env(safe-area-inset-top, 0px));
    }

    @media (max-width: 1023px) {
        .navbar {
            height: calc(var(--nb-height-mobile) + env(safe-area-inset-top, 0px));
        }

        .navbar--scrolled {
            height: calc(var(--nb-height-mobile) - 4px + env(safe-area-inset-top, 0px));
        }
    }
}


/* ============================================================
   12. ACCESIBILIDAD — Focus & Movimiento reducido
   ============================================================ */
.navbar__link:focus-visible,
.navbar__social:focus-visible,
.navbar__cta:focus-visible,
.navbar__hamburger:focus-visible,
.mobile-menu__link:focus-visible,
.mobile-menu__close:focus-visible,
.mobile-menu__cta:focus-visible {
    outline: 2px solid var(--beratiel-primary, #38bdf8);
    outline-offset: 3px;
}

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

    .navbar,
    .navbar__link,
    .navbar__link-underline,
    .navbar__cta,
    .navbar__logo-img,
    .hamburger__bar,
    .mobile-menu__panel,
    .mobile-menu__overlay,
    .mobile-menu__link {
        transition: none !important;
        animation: none !important;
    }
}