/* =========================================================
   NEXUS LAB - RESPONSIVE STYLESHEET
   Mobile-First & Breakpoint Optimization Module
   ========================================================= */

/* Adaptabilidad Base & Prevención de Overflow Global */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* =========================================================
   1. Breakpoint: Laptop / Tablet Horizontal (<= 1080px)
   ========================================================= */
@media (max-width: 1080px) {
  .hero-container {
    grid-template-columns: minmax(0, 1fr);
    text-align: center;
    gap: 3rem;
  }

  .hero-content {
    width: 100%;
    min-width: 0;
  }

  .hero-subtitle {
    margin: 0 auto 2rem auto;
  }

  .hero-gateway-compact {
    margin: 0 auto 2rem auto;
    width: 100%;
  }

  .hero-cta-group {
    justify-content: center;
  }

  .hero-stats {
    justify-content: center;
  }

  .hero-visual {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    min-width: 0;
  }

  .solutions-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .interactive-box {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
    padding: 2.5rem 2rem;
  }

  .features-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-wrapper {
    grid-template-columns: minmax(0, 1fr);
    padding: 2.5rem 2rem;
  }

  .contact-info,
  .contact-form-container {
    min-width: 0;
    width: 100%;
  }

  .footer-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
  }
}

/* =========================================================
   2. Breakpoint: Tablet Mediana / Componentes de Rama (<= 992px)
   ========================================================= */
@media (max-width: 992px) {
  .hero-dual-gateway {
    grid-template-columns: minmax(0, 1fr);
  }

  .nav-branch-pill {
    display: none;
  }

  .services-cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-interactive,
  .section-features,
  .section-trust,
  .section-contact {
    padding: 70px 0;
  }
}

/* =========================================================
   3. Breakpoint: Tablet Vertical & Mobile Landscape (<= 768px)
   ========================================================= */
@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  .navbar {
    height: 70px;
  }

  .hero-section {
    padding: 115px 0 65px 0;
    min-height: auto;
  }

  .hero-title {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .gradient-text-ed,
  .gradient-text-com {
    display: inline;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  .sub-badge {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.9rem;
    max-width: 100%;
    white-space: normal;
    line-height: 1.4;
    border-radius: 16px;
  }

  .section-title {
    font-size: 1.85rem;
    line-height: 1.25;
  }

  .section-header,
  .branch-section-header {
    margin-bottom: 2.5rem;
  }

  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    background: rgba(8, 11, 17, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    flex-direction: column;
    padding: 2rem 1.5rem;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    transform: translateY(-150%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  }

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

  .mobile-toggle {
    display: block;
  }

  .desktop-cta {
    display: none;
  }

  .mobile-cta {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 1rem;
  }

  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
  }

  .stat-divider {
    display: none;
  }

  .features-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .logos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
  }

  .logo-box {
    min-height: 185px;
    padding: 1.35rem 1rem 1.2rem 1rem;
  }

  .logo-crest-wrap {
    width: 76px;
    height: 76px;
    margin-bottom: 0.85rem;
  }

  .logo-crest-wrap img,
  .logo-box img {
    width: 100%;
    height: 100%;
    transform: scale(1.18);
  }

  .metrics-result-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-container {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  .bottom-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .floating-badge {
    padding: 0.6rem 0.85rem;
  }

  .badge-edtech {
    top: -10px;
    right: 5px;
  }

  .badge-commerce {
    bottom: -10px;
    left: 5px;
  }
}

/* =========================================================
   4. Breakpoint: Dispositivos Medianos a Pequeños (<= 640px)
   ========================================================= */
@media (max-width: 640px) {
  .team-card {
    flex: 1 1 100%;
    max-width: 100%;
    padding: 2rem 1.25rem;
  }

  .branch-filter-bar {
    width: 100%;
    border-radius: 18px;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.65rem;
  }

  .branch-filter-btn {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
  }

  .service-card {
    padding: 1.75rem 1.25rem;
  }
}

/* =========================================================
   5. Breakpoint: Smartphones Compactos (<= 480px)
   Corrección Integral de Desbordes y Recortes
   ========================================================= */
@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .navbar {
    height: 64px;
  }

  .brand-logo {
    gap: 0.5rem;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
  }

  .logo-text {
    font-size: 1.18rem;
  }

  /* Tipografía de Secciones */
  .sub-badge {
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.75rem;
  }

  .section-title {
    font-size: clamp(1.45rem, 6vw, 1.7rem);
    line-height: 1.25;
  }

  .section-description {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .services-branch-block,
  .section-interactive,
  .section-features,
  .section-trust,
  .section-contact {
    padding: 50px 0;
  }

  /* Hero Section Adaptativo */
  .hero-section {
    padding: 95px 0 45px 0;
  }

  .badge-pill {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
    margin-bottom: 1.2rem;
    gap: 0.45rem;
    word-break: break-word;
  }

  .hero-title {
    font-size: clamp(1.65rem, 6.8vw, 1.95rem);
    line-height: 1.22;
    letter-spacing: -0.02em;
    margin-bottom: 1.15rem;
  }

  .hero-subtitle {
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
  }

  /* Tarjetas Gateway Compactas en Mobile */
  .hero-gateway-compact {
    gap: 0.75rem;
    width: 100%;
  }

  .gateway-compact-card {
    padding: 0.85rem 0.9rem;
    gap: 0.75rem;
    border-radius: 14px;
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .gcc-icon {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .gcc-info {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .gcc-badge {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
  }

  .gcc-info h4 {
    font-size: 0.98rem;
    margin: 0.1rem 0;
    line-height: 1.25;
  }

  .gcc-info p {
    font-size: 0.775rem;
    line-height: 1.35;
  }

  .gcc-arrow {
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  /* Indicadores Métricos */
  .hero-stats {
    gap: 1.25rem;
    padding-top: 1.25rem;
  }

  .stat-item {
    align-items: center;
  }

  .stat-number {
    font-size: 1.7rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  /* Terminal de Código Dinámica en Mobile */
  .tech-card-showcase {
    padding: 0.5rem 0;
  }

  .card-header {
    padding: 0.75rem 0.85rem;
    flex-wrap: wrap;
    gap: 6px;
  }

  .card-title-mini {
    display: none;
  }

  .terminal-tabs {
    margin-left: 0.25rem;
    gap: 4px;
  }

  .terminal-tab {
    font-size: 0.68rem;
    padding: 0.25rem 0.5rem;
  }

  .code-preview {
    padding: 1rem 0.85rem;
    font-size: 0.75rem;
    line-height: 1.5;
  }

  /* Ocultar badges flotantes negativos en móviles muy estrechos para evitar desborde */
  .floating-badge {
    display: none;
  }

  /* Tarjetas de Servicios y Equipo */
  .service-card {
    padding: 1.4rem 1.15rem;
  }

  .service-card-title {
    font-size: 1.15rem;
  }

  .service-card-desc {
    font-size: 0.88rem;
  }

  .team-showcase-wrapper {
    margin-top: 3rem;
    padding-top: 2.5rem;
  }

  .member-role {
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  /* Simulador de Impacto */
  .interactive-box {
    padding: 1.5rem 1rem;
    border-radius: 20px;
    gap: 1.75rem;
  }

  .interactive-title {
    font-size: 1.45rem;
  }

  .vertical-toggle {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .toggle-btn {
    width: 100%;
    justify-content: center;
    font-size: 0.825rem;
    padding: 0.65rem 0.85rem;
  }

  .calculator-card {
    padding: 1.25rem 0.85rem;
    border-radius: 16px;
  }

  .range-val {
    font-size: 1.75rem;
  }

  /* Grilla de Instituciones: Escudos proporcionados sin solapar textos */
  .logos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .logo-box {
    min-height: 175px;
    padding: 1.2rem 0.75rem 1.1rem 0.75rem;
    border-radius: 16px;
    justify-content: flex-start;
  }

  .logo-crest-wrap {
    width: 68px;
    height: 68px;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
  }

  .logo-crest-wrap img,
  .logo-box img {
    width: 100%;
    height: 100%;
    transform: scale(1.15);
  }

  .logo-box:hover .logo-crest-wrap img,
  .logo-box:hover img {
    transform: scale(1.2);
  }

  .logo-inst-name {
    font-size: 0.8rem;
    line-height: 1.3;
    margin: 0 0 0.3rem 0;
    word-break: break-word;
  }

  .logo-inst-type {
    font-size: 0.64rem;
    line-height: 1.25;
  }

  /* Formulario de Contacto */
  .contact-wrapper {
    padding: 1.5rem 1rem;
    border-radius: 20px;
    gap: 1.75rem;
  }

  .contact-form-container {
    padding: 1.25rem 1rem;
    border-radius: 16px;
  }

  .contact-title {
    font-size: 1.55rem;
  }

  .contact-desc {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .c-point {
    gap: 0.75rem;
    font-size: 0.85rem;
    word-break: break-word;
  }

  .c-point i {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
    border-radius: 10px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.75rem 0.9rem;
    font-size: 0.86rem;
  }

  /* Botones Generales */
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.88rem;
  }
}

/* =========================================================
   6. Breakpoint: Ultra Compacto (<= 380px)
   (iPhone SE 1st gen / Smartphones < 380px)
   ========================================================= */
@media (max-width: 380px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .badge-pill {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  .gateway-compact-card {
    padding: 0.75rem 0.75rem;
    gap: 0.6rem;
  }

  .gcc-icon {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .gcc-info h4 {
    font-size: 0.92rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }

  .logo-box {
    min-height: 160px;
    padding: 1rem 0.5rem;
  }

  .logo-crest-wrap {
    width: 58px;
    height: 58px;
    margin-bottom: 0.65rem;
  }
}
