/* ============================================
   HEADER & FOOTER IMPROVEMENTS - C&C
   Version: 2.1 - Corregido y completo
   ============================================ */

/* ========== HEADER BASE ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #050814;   /* 🔹 color sólido oscuro */
    background-image: none;      /* 🔹 por si quedaba algún degradado */
    border-bottom: 3px solid #FFEA2A;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.header--scrolled {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Nos aseguramos que cualquier variante del header use el mismo fondo */
.site-header,
.site-header.site-header--scrolled,
.site-header.site-header--mobile-open,
.main-header {
    background-color: #050814 !important;
    background-image: none !important;
}

/* Asegurar que el logo mantenga proporción */
.header__logo img,
.nav__logo img {
    height: auto;          /* dejamos que tome la altura desde .logo-icon */
    max-height: 80px;      /* límite superior, puedes subirlo a 90 si quieres */
    width: auto;
    object-fit: contain;
}

/* ========== NAVIGATION ========== */
.nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav__logo {
    display: inline-block;
    transition: transform 0.3s ease;
}

.logo-icon {
    height: 100px;
    width: auto;
    transition: all 0.3s ease;
}

.header--scrolled .logo-icon {
    height: 80px;
}

.nav__logo:hover {
    transform: scale(1.05);
}

.nav__logo:focus {
    outline: 2px solid #FFEA2A;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ========== MENU ========== */
.nav__menu {
    display: flex;
    align-items: center;
}

.nav__list {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav__item {
    position: relative;
}

.nav__link {
    position: relative;
    display: inline-block;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.35rem 0.8rem; /* menos padding lateral */
    white-space: nowrap;     /* evita que el texto se rompa en varias líneas */
    transition: color 0.3s ease;
}

@media (max-width: 1120px) {
    .header__nav,
    .nav {
        justify-content: space-between;
    }

    /* Opcional: puedes hacer que en este ancho ya se active el menú hamburguesa,
       si tu header está montado así. Depende de tu estructura actual. */
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #FFEA2A;
    transition: width 0.3s ease;
}

.nav__link:hover,
.nav__link.active {
    color: white;
}

.nav__link:hover::after,
.nav__link.active::after {
    width: 100%;
}

/* ========== CTA BUTTON ========== */
.nav__cta {
    background: #91D754 !important;
    color: white !important;
    padding: 0.7rem 1.5rem !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 15px rgba(145, 215, 84, 0.3) !important;
    transition: all 0.3s ease !important;
}

.nav__cta::after {
    display: none !important;
}

.nav__cta:hover {
    background: #7BC045 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(145, 215, 84, 0.4) !important;
}

/* ========== MOBILE TOGGLE ========== */
.nav__toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    color: white;
    font-size: 1.5rem;
}

.nav__toggle:focus {
    outline: 2px solid #FFEA2A;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ========== FOOTER ========== */
.footer {
    background: linear-gradient(135deg, #0F1823 0%, #1a2332 100%);
    color: rgba(255, 255, 255, 0.9);
    padding: 4rem 0 2rem;
    border-top: 3px solid #FFEA2A;
}

.footer .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer__content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer__section {
    min-width: 0;
}

.footer__section--brand {
    max-width: 400px;
}

.footer__logo-img {
    max-width: 200px;
    height: auto;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.footer__logo-img:hover {
    transform: scale(1.05);
}

.footer__description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.footer__title {
    color: #91D754;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.footer__title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background: #FFEA2A;
    border-radius: 2px;
}

.footer__links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer__links li {
    margin-bottom: 0.75rem;
}

.footer__links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer__links a:hover {
    color: #FFEA2A;
    transform: translateX(4px);
}

.footer__contact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer__contact li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer__contact i {
    color: #91D754;
    font-size: 1.1rem;
    min-width: 20px;
}

.footer__contact a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer__contact a:hover {
    color: #FFEA2A;
}

.footer__contact span {
    color: rgba(255, 255, 255, 0.8);
}

/* ========== SOCIAL ICONS ========== */
.footer__social {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.footer__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.footer__social-link:hover {
    background: #91D754;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(145, 215, 84, 0.3);
}

/* ========== FOOTER BOTTOM ========== */
.footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.footer__bottom p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

.footer__legal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer__legal a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer__legal a:hover {
    color: #FFEA2A;
}

.footer__legal span {
    color: rgba(255, 255, 255, 0.3);
}

/* ========== WHATSAPP FLOAT ========== */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px; /* ✅ CORREGIDO de 100px */
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #1DA851 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-float::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.whatsapp-float:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-float i {
    position: relative;
    z-index: 1;
}

/* ========== RESPONSIVE ========== */

/* Tablet */
@media (max-width: 991px) {
    .nav__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav__menu {
        position: fixed;
        top: 83px; /* Altura del header */
        left: -100%;
        width: 100%;
        height: calc(100vh - 83px);
        background: rgba(15, 24, 35, 0.98);
        backdrop-filter: blur(20px);
        padding: 2rem;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .nav__menu.show-menu {
        left: 0;
    }
    
    .nav__list {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }
    
    .nav__link {
        font-size: 1.1rem;
        width: 100%;
        padding: 0.75rem 0;
    }
    
    .nav__cta {
        margin-top: 1rem;
        display: block;
        text-align: center;
        width: 100%;
    }
    
    .footer__content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .footer__section--brand {
        grid-column: 1 / -1;
        max-width: 100%;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .nav {
        padding: 0.75rem 1rem;
    }
    
    .logo-icon {
        height: 70px;
    }
    
    .header--scrolled .logo-icon {
        height: 60px;
    }
    
    .footer {
        padding: 3rem 0 1.5rem;
    }
    
    .footer__content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer__logo-img {
        max-width: 160px;
    }
    
    .footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .whatsapp-float {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .logo-icon {
        height: 60px;
    }
    
    .header--scrolled .logo-icon {
        height: 50px;
    }
    
    .footer__logo-img {
        max-width: 140px;
    }
}

/* Forzamos el header oscuro también en mobile */
@media (max-width: 768px) {
    header,
    .site-header,
    .main-header {
        background: #050814 !important; /* mismo tono oscuro que usas en el sitio */
        border-bottom: 2px solid #FFEA2A; /* si quieres mantener la línea amarilla */
        color: #ffffff;
    }

    /* Si el menú móvil despliega un panel con fondo blanco, lo oscurecemos también */
    .nav,
    .main-nav,
    .header__nav,
    .mobile-menu {
        background: #050814 !important;
    }
}

/* ===========================
   BOTÓN VOLVER ARRIBA
   =========================== */

   .back-to-top {
    position: fixed;
    right: 1.6rem;
    bottom: 5.5rem;             /* un poco encima del botón de WhatsApp */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0b3b4a, #158f9a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    z-index: 999;
}

.back-to-top i {
    font-size: 0.9rem;
}

/* Estado visible (coincide con la clase que pone el JS: .show) */
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Hover/focus */
.back-to-top:hover,
.back-to-top:focus-visible {
    background: linear-gradient(135deg, #11a4b3, #3cd8a5);
    outline: none;
}

    /* Si el menú móvil despliega un panel con fondo blanco, lo oscurecemos también */
    .nav,
    .main-nav,
    .header__nav,
    .mobile-menu {
        background: #050814 !important;
    }

/* Fix: header siempre oscuro (desktop y mobile) */
.site-header,
.site-header.site-header--scrolled,
.site-header.site-header--mobile-open {
    background-color: #0F1823 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ====== ARREGLOS HEADER ESCRITORIO ====== */

/* 1. Logo: no deformarlo */
.site-header .header__logo img,
.header .header__logo img {
    max-height: 72px;   /* ajusta si lo quieres un pelín más grande o pequeño */
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Evitar que el contenedor del logo se estire raro */
.header__logo {
    flex: 0 0 auto;
}

/* 2. Menú: que no se rompa en varias líneas */
.header__menu,
.main-nav__list,
.nav__list {
    display: flex;
    align-items: center;
    gap: 1.5rem;         /* separa los items */
    flex-wrap: nowrap;   /* 👈 clave: que NO se haga wrap */
}

/* 3. Links: que no se corten en varias líneas */
.header__menu a,
.main-nav__link,
.nav__link {
    white-space: nowrap; /* 👈 “Casos de éxito” siempre en una línea */
}

/* ==== Ajustes finales header 2025 ==== */

/* Logo un poco más grande en escritorio */
.site-header .header__logo img,
.header__logo img {
    height: 64px;          /* antes era más chico */
    max-height: 64px;
}

/* Que los ítems del menú no se corten en varias líneas */
.main-nav__link,
.header-nav__link {
    white-space: nowrap;
}

/* Un poco de espacio pero sin exagerar para que quepa todo */
.main-nav__list,
.header-nav__list {
    gap: 2rem;
}

/* Fuerza un solo color parejo en todo el header */
.site-header,
.main-header {
    background-color: #020617;   /* mismo color que el resto del header */
    background-image: none !important;
    background: #020617 !important;
}

.header-inner,
.header-wrapper {
    background: #020617 !important;
}

/* Skip Link (accesibilidad) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--secondary-green, #91D754);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Hamburguesa animada */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 24px;
    height: 20px;
}

.hamburger__line {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Animación X cuando está abierto */
.nav__toggle[aria-expanded="true"] .hamburger__line:nth-child(1) {
    transform: rotate(45deg) translateY(10px);
}
.nav__toggle[aria-expanded="true"] .hamburger__line:nth-child(2) {
    opacity: 0;
}
.nav__toggle[aria-expanded="true"] .hamburger__line:nth-child(3) {
    transform: rotate(-45deg) translateY(-10px);
}

/* Solo lector de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible */
.nav__link:focus-visible {
    outline: 2px solid var(--primary-yellow, #FFEA2A);
    outline-offset: 4px;
    border-radius: 4px;
}

.nav__toggle:focus-visible {
    outline: 2px solid var(--primary-yellow, #FFEA2A);
    outline-offset: 4px;
    border-radius: 4px;
}

/* CTA con icono */
.nav__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.nav__cta i {
    transition: transform 0.3s ease;
}
.nav__cta:hover i {
    transform: translateX(4px);
}

/* CTA en mobile */
@media (max-width: 991px) {
    .nav__item--cta {
        margin-top: 1rem;
    }

    .nav__cta {
        display: block;
        text-align: center;
        width: 100%;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .nav__link {
        font-weight: 700;
    }
    .skip-link {
        border: 2px solid white;
    }
}

/* Menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .hamburger__line,
    .nav__cta i,
    .skip-link {
        transition: none;
    }
}

/* =============================
   BUSCADOR HEADER – ESTILO PASTILLA v2
   ============================= */

   .site-header .nav__item--search,
   .header .nav__item--search {
     display: flex;
     align-items: center;
   }
   
   /* Contenedor del buscador */
   .site-header .nav__search-form,
   .header .nav__search-form {
     display: flex;
     align-items: center;
     gap: 0.4rem;
     padding: 0.25rem 0.25rem 0.25rem 1rem;
     border-radius: 999px;                  /* esquinas bien ovaladas */
     background: rgba(7, 12, 23, 0.96);
     border: 1px solid rgba(148, 163, 184, 0.45);
     max-width: 320px;
   }
   
   /* Input dentro de la pastilla */
   .site-header .nav__search-input,
   .header .nav__search-input {
     border: none;
     background: transparent;
     color: #f9fafb;
     font-size: 0.9rem;
     padding: 0.4rem 0.25rem 0.4rem 0;
     width: 180px;
   }
   
   .site-header .nav__search-input::placeholder,
   .header .nav__search-input::placeholder {
     color: rgba(148, 163, 184, 0.9);
   }
   
   .site-header .nav__search-input:focus,
   .header .nav__search-input:focus {
     outline: none;
   }
   
   /* Botón de la lupa */
   .site-header .nav__search-button,
   .header .nav__search-button {
     width: 36px;
     height: 36px;
     border-radius: 50%;
     border: none;
     background: #f9fafb;
     color: #020617;
     display: flex;
     align-items: center;
     justify-content: center;
     cursor: pointer;
     box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.85);
     transition: transform 0.15s ease, box-shadow 0.15s ease;
   }
   
   .site-header .nav__search-button i,
   .header .nav__search-button i {
     font-size: 0.95rem;
   }
   
   .site-header .nav__search-button:hover,
   .header .nav__search-button:hover {
     transform: translateY(-1px);
     box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
   }
   
   /* Versión móvil: buscador a lo ancho del menú desplegado */
   @media (max-width: 900px) {
     .site-header .nav__item--search,
     .header .nav__item--search {
       width: 100%;
       margin-top: 0.75rem;
     }
   
     .site-header .nav__search-form,
     .header .nav__search-form {
       width: 100%;
       max-width: 100%;
     }
   
     .site-header .nav__search-input,
     .header .nav__search-input {
       width: 100%;
     }
   }

   /* === Ajuste fondo header y menú en MOBILE === */
    @media (max-width: 768px) {

        /* Barra superior (donde va el logo y el ícono del menú) */
        .header {
        background-color: #050816;          /* mismo tono oscuro que escritorio */
        background-image: none;             /* por si había algún gradiente raro */
        }
    
        /* Panel desplegable del menú en mobile */
        .nav__menu {
        background-color: #050816;
        border-top: 1px solid rgba(255,255,255,0.06);
        }
    
        /* Links en blanco para buen contraste */
        .nav__link {
        color: #ffffff;
        }
    
        .nav__link:hover,
        .nav__link.active {
        color: var(--primary, #FFEA2A);
        }
    }

    /* ====== ARREGLO: MENÚ HAMBURGUESA OSCURO EN MOBILE ====== */
    @media (max-width: 991px) {
        .nav__menu.show-menu {
            display: block;
            position: fixed;
            top: 85px;
            left: 0;
            right: 0;
            background: #050814; /* 💡 Fondo oscuro como el header */
            padding: 1.25rem 1.5rem 1.75rem;
            box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
            max-height: calc(100vh - 85px);
            overflow-y: auto;
            z-index: 999;
        }

        /* Que la lista se vea como menú vertical */
        .nav__list {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.75rem;
        }

        /* Aseguramos que las letras sean blancas y legibles */
        .nav__link {
            color: rgba(255, 255, 255, 0.95);
        }

        .nav__link::after {
            background: #FFEA2A;
        }

        /* El buscador también, que no quede blanco sobre blanco */
        .nav__search-form {
            background: #050814;
            border-color: rgba(255, 255, 255, 0.25);
        }
    }

    /* ==== FIX DEFINITIVO MENÚ MOBILE OSCURO ==== */
@media (max-width: 991px) {

    /* Panel del menú hamburguesa */
    .nav__menu {
      position: fixed !important;
      top: 80px !important;      /* altura del header, ajusta a 83/85 si ves un pequeño salto */
      left: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      background: #050814 !important;   /* fondo oscuro */
      padding: 1.5rem 1.5rem 2rem !important;
      display: none !important;
      z-index: 1000 !important;
      overflow-y: auto !important;
    }
  
    /* Cuando se abre (clase .show-menu la pone el JS) */
    .nav__menu.show-menu {
      display: block !important;
    }
  
    /* La lista como menú vertical */
    .nav__list {
      flex-direction: column !important;
      align-items: flex-start !important;
      gap: 1rem !important;
    }
  
    /* Enlaces bien visibles en blanco */
    .nav__link {
      color: #ffffff !important;
      font-size: 1.1rem !important;
      padding: 0.6rem 0 !important;
    }
  
    .nav__link::after {
      background: #FFEA2A !important;
    }
  
    /* El buscador dentro del menú, también oscuro */
    .nav__search-form {
      background: #050814 !important;
      border-color: rgba(255, 255, 255, 0.25) !important;
      width: 100% !important;
      max-width: 100% !important;
      margin-top: 0.75rem !important;
    }
  
    .nav__search-input {
      color: #f9fafb !important;
    }
  }
    .nav__link--highlight {
        font-weight: 700;
    }

    /* ============================
   HEADER - PÁGINA METODOLOGÍA
   ============================ */
    body[data-page="metodologia"] .site-header,
    body[data-page="metodologia"] .main-header,
    body[data-page="metodologia"] header.site-header {
    background: rgba(0, 15, 30, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    }

    /* Estado activo del menú para Metodología */
    body[data-page="metodologia"] nav a[href*="metodologia"],
    body[data-page="metodologia"] .main-nav a[href*="metodologia"],
    body[data-page="metodologia"] .header-nav a[href*="metodologia"] {
    position: relative;
    color: var(--yellow-bright, #FFEA2A);
    }

    /* Subrayado / barra inferior como en el index */
    body[data-page="metodologia"] nav a[href*="metodologia"]::after,
    body[data-page="metodologia"] .main-nav a[href*="metodologia"]::after,
    body[data-page="metodologia"] .header-nav a[href*="metodologia"]::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.3rem;
    transform: translateX(-50%);
    width: 1.8rem;
    height: 2px;
    border-radius: 999px;
    background: var(--yellow-bright, #FFEA2A);
    }