/* ── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:  #1B4F8A;
  --blue-mid:   #2A7FC1;
  --teal:       #1A9E8F;
  --white:      #FFFFFF;
  --bg-dark:    #1A1A2E;
  --bg-light:   #F4F6FA;
  --bg-darkest: #0D0D1A;
  --gray:       #8892A4;
  --grad: linear-gradient(135deg, #2A7FC1, #1A9E8F);
  --grad-text: linear-gradient(90deg, #2A7FC1, #1A9E8F);
  /* Alineación logo hero ↔ wordmark del nav */
  --nav-pad-x: 64px;
  --nav-pad-y: 24px;
  --nav-wordmark-w: 179px;
}

html {
  scroll-behavior: smooth;
  /* Anclas bajo la barra fija: Servicios, Proceso, Equipo, Hablemos (#cta), etc. */
  scroll-padding-top: calc(var(--nav-pad-y) * 2 - 10px);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-dark);
  color: var(--white);
  overflow-x: hidden;
  cursor: none;
}

/* ── CURSOR ─── */
#cursor {
  width: 10px; height: 10px;
  background: var(--teal);
  border-radius: 50%;
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  /* Fallback sin GSAP; con GSAP el inline transform lo sustituye */
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s;
  mix-blend-mode: screen;
}
#cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px solid rgba(26,158,143,0.5);
  border-radius: 50%;
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.25s, height 0.25s, border-color 0.25s;
}

/* ── UTILITIES ─── */
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.reveal {
  opacity: 0;
  transform: translateY(36px);
  /* Animación vía GSAP (script.js); sin transition para evitar conflicto con tweens */
}
.reveal.visible { opacity: 1; transform: translateY(0); }
/* Clases reveal-delay-*: el desfase lo aplica GSAP en script.js */

/* ── NAV ─── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: var(--nav-pad-y) var(--nav-pad-x);
  display: flex; align-items: center; justify-content: space-between;
  transition: background 0.4s, padding 0.4s, box-shadow 0.4s;
}
nav:not(.scrolled) .nav-links a {
  font-size: 15px;
}
nav.scrolled {
  background: rgba(13,13,26,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 16px var(--nav-pad-x);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.nav-logo {
  display: flex; align-items: center;
  gap: 0;
  text-decoration: none;
  transition: gap 0.4s cubic-bezier(.22,1,.36,1);
}
nav.nav-show-logo .nav-logo { gap: 12px; }
.nav-logo-mark {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(26,158,143,0.3));
  opacity: 0;
  transform: scale(0.82);
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    opacity 0.4s cubic-bezier(.22,1,.36,1),
    transform 0.4s cubic-bezier(.22,1,.36,1),
    max-width 0.4s cubic-bezier(.22,1,.36,1);
}
nav.nav-show-logo .nav-logo-mark {
  opacity: 1;
  transform: scale(1);
  max-width: 36px;
  pointer-events: auto;
}
.nav-logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 20px;
  color: var(--white); letter-spacing: -0.02em;
  width: var(--nav-wordmark-w);
}
.nav-links { display: flex; align-items: center; gap: 40px; }
.nav-links a {
  font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none; letter-spacing: 0.02em;
  transition: color 0.2s, font-size 0.4s ease;
}
.nav-links a:hover { color: var(--white); }
.btn-primary {
  background: var(--grad); color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600; font-size: 14px;
  padding: 12px 28px; border-radius: 50px;
  text-decoration: none; border: none; cursor: none;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s, font-size 0.4s ease;
  display: inline-block;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 8px 32px rgba(26,158,143,0.35); }
.btn-ghost {
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.85);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500; font-size: 14px;
  padding: 12px 28px; border-radius: 50px;
  text-decoration: none; cursor: none;
  transition: border-color 0.2s, background 0.2s;
  display: inline-block;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.06); }

/* ── HERO ─── */
#hero {
  position: relative; height: 100vh; min-height: 700px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
  background: var(--bg-dark);
  /* Duración base del ciclo logo (~5.33s); antes 8s → 2/3 */
  --nexo-hero-logo-dur: calc(8s * 2 / 3);
}
#hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.5;
}
.hero-logo-wrap {
  position: absolute;
  z-index: 3;
  left: calc(var(--nav-pad-x) + var(--nav-wordmark-w) / 2);
  top: calc(2 * var(--nav-pad-y) + 22px + 12px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.hero-logo-wrap svg.nexo-logo-anim {
  width: 110px;
  height: 113px;
  display: block;
}
/* Disco en el hueco del anillo: tapa líneas (color = fondo del hero) */
#hero .hero-logo-wrap .nexo-hero-node-hole-fill {
  fill: var(--bg-dark);
}
/* Gira rombo + líneas + anillos; el círculo central queda fuera de este grupo */
#hero .hero-logo-wrap .nexo-hero-rotates {
  transform-box: view-box;
  transform-origin: 50% 50%;
}
/* Primera carga: un solo ciclo completo */
#hero .hero-logo-wrap.nexo-first-run .nexo-hero-rotates {
  animation: nexoHeroRotateLogo var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) 1 linear forwards;
}
#hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-1 {
  animation: nexoHeroMoveCircle1 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) 1 cubic-bezier(0.45, 0.02, 0.55, 0.98) forwards;
}
#hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-2 {
  animation: nexoHeroMoveCircle2 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) 1 cubic-bezier(0.45, 0.02, 0.55, 0.98) forwards;
}
#hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-3 {
  animation: nexoHeroMoveCircle3 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) 1 cubic-bezier(0.45, 0.02, 0.55, 0.98) forwards;
}
#hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-4 {
  animation: nexoHeroMoveCircle4 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) 1 cubic-bezier(0.45, 0.02, 0.55, 0.98) forwards;
}
/* Tras el primer ciclo: reposo en el último frame (540° = 1,5 vueltas ≡ 180°) */
#hero .hero-logo-wrap.nexo-first-done:not(:hover) .nexo-hero-rotates {
  animation: none;
  transform: rotate(180deg);
}
#hero .hero-logo-wrap.nexo-first-done:not(:hover) .nexo-hero-node-1 {
  animation: none;
  transform: translate(250px, 425px);
}
#hero .hero-logo-wrap.nexo-first-done:not(:hover) .nexo-hero-node-2 {
  animation: none;
  transform: translate(75px, 250px);
}
#hero .hero-logo-wrap.nexo-first-done:not(:hover) .nexo-hero-node-3 {
  animation: none;
  transform: translate(250px, 75px);
}
#hero .hero-logo-wrap.nexo-first-done:not(:hover) .nexo-hero-node-4 {
  animation: none;
  transform: translate(425px, 250px);
}
/* Hover: bucle infinito */
#hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-rotates {
  animation: nexoHeroRotateLogo var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) infinite linear;
}
#hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-1 {
  animation: nexoHeroMoveCircle1 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) infinite cubic-bezier(0.45, 0.02, 0.55, 0.98);
}
#hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-2 {
  animation: nexoHeroMoveCircle2 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) infinite cubic-bezier(0.45, 0.02, 0.55, 0.98);
}
#hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-3 {
  animation: nexoHeroMoveCircle3 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) infinite cubic-bezier(0.45, 0.02, 0.55, 0.98);
}
#hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-4 {
  animation: nexoHeroMoveCircle4 var(--nexo-hero-logo-dur, calc(8s * 2 / 3)) infinite cubic-bezier(0.45, 0.02, 0.55, 0.98);
}
/* Movimiento hasta 22%; giro 1,5 vueltas desde ~14% (solapa el final del 2.º tramo → sin “parada” en el nodo) */
@keyframes nexoHeroMoveCircle1 {
  0%  { transform: translate(250px, 75px); }
  11% { transform: translate(425px, 250px); }
  22%, 100% { transform: translate(250px, 425px); }
}
@keyframes nexoHeroMoveCircle2 {
  0%  { transform: translate(425px, 250px); }
  11% { transform: translate(250px, 425px); }
  22%, 100% { transform: translate(75px, 250px); }
}
@keyframes nexoHeroMoveCircle3 {
  0%  { transform: translate(250px, 425px); }
  11% { transform: translate(75px, 250px); }
  22%, 100% { transform: translate(250px, 75px); }
}
@keyframes nexoHeroMoveCircle4 {
  0%  { transform: translate(75px, 250px); }
  11% { transform: translate(250px, 75px); }
  22%, 100% { transform: translate(425px, 250px); }
}
/* Giro 0°→540° desde el 14%; últimos ~60° un ~30 % más lentos para un cierre algo más suave */
@keyframes nexoHeroRotateLogo {
  0%, 14% { transform: rotate(0deg); }
  34.85% { transform: rotate(480deg); }
  38.375% { transform: rotate(540deg); }
  100% { transform: rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) {
  #hero .hero-logo-wrap.nexo-first-run .nexo-hero-rotates,
  #hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-rotates {
    animation: none !important;
  }
  #hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-1,
  #hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-2,
  #hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-3,
  #hero .hero-logo-wrap.nexo-first-run .nexo-hero-node-4,
  #hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-1,
  #hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-2,
  #hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-3,
  #hero .hero-logo-wrap.nexo-first-done:hover .nexo-hero-node-4 {
    animation: none !important;
  }
  #hero .hero-logo-wrap .nexo-hero-rotates {
    transform: rotate(0deg) !important;
  }
  #hero .hero-logo-wrap .nexo-hero-node-1 { transform: translate(250px, 75px) !important; }
  #hero .hero-logo-wrap .nexo-hero-node-2 { transform: translate(425px, 250px) !important; }
  #hero .hero-logo-wrap .nexo-hero-node-3 { transform: translate(250px, 425px) !important; }
  #hero .hero-logo-wrap .nexo-hero-node-4 { transform: translate(75px, 250px) !important; }
}
.hero-content {
  position: relative; z-index: 2;
  max-width: 900px; padding: 0 24px;
  margin-top: clamp(72px, 14vh, 140px);
  width: 742px; height: 322px;
}
.hero-intro {
  transform: translateY(-66px);
}
.hero-pill {
  display: inline-block;
  border: 1px solid var(--teal); color: var(--teal);
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 8px 20px;
  border-radius: 50px; margin-bottom: 32px;
}
.hero h1 {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: clamp(58px, 8vw, 102px);
  line-height: 1.04; letter-spacing: -0.03em;
  color: var(--white); margin-bottom: 24px;
}
.hero-sub {
  font-size: clamp(16px, 1.5vw, 19px);
  color: rgba(255,255,255,0.6); line-height: 1.65;
  max-width: 580px; margin: 0 auto 44px;
}
#hero .hero-intro .hero-sub {
  padding-top: 1.65em;
  width: 513px;
}
.hero-ctas { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
#hero .hero-ctas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  margin-top: -40px;
  width: 100%;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  justify-items: stretch;
}
#hero .hero-ctas > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.btn-primary-lg {
  background: var(--grad); color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600; font-size: 15px;
  padding: 15px 34px; border-radius: 50px;
  text-decoration: none; border: none; cursor: none;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  display: inline-block;
  box-shadow: 0 4px 24px rgba(26,158,143,0.3);
}
.btn-primary-lg:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 12px 36px rgba(26,158,143,0.4); }
.btn-ghost-lg {
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.85);
  font-family: 'DM Sans', sans-serif;
  font-weight: 500; font-size: 15px;
  padding: 15px 34px; border-radius: 50px;
  text-decoration: none; cursor: none;
  transition: border-color 0.2s, background 0.2s;
  display: inline-block;
}
.btn-ghost-lg:hover { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.06); }
.scroll-indicator {
  position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 2;
}
.scroll-line {
  width: 1px; height: 52px;
  background: linear-gradient(to bottom, rgba(26,158,143,0.8), transparent);
  animation: scrollLineAnim 2s ease-in-out infinite;
}
.scroll-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.3); }
@keyframes scrollLineAnim {
  0%,100% { transform: scaleY(0.7); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ── NUMBERS ─── */
#numeros {
  background: var(--bg-dark);
  padding: 64px 64px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.section-overline {
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 64px;
}
.numbers-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  max-width: 960px;
  margin: 0 auto 72px;
  align-items: stretch;
}
.number-item {
  padding: 0 48px;
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100%;
  box-sizing: border-box;
}
.number-item:last-child { border-right: none; }
.number-value {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: clamp(72px, 8vw, 108px); line-height: 1;
  background: var(--grad-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  display: block;
  align-self: center;
}
.number-label {
  font-size: 16px; color: rgba(255,255,255,0.55); line-height: 1.5;
  width: 100%;
  max-width: 100%;
  margin: 0;
  flex: 1;
}
.numbers-close {
  font-style: italic; color: var(--teal); font-size: 17px;
  max-width: 600px; margin: 0 auto; line-height: 1.65;
}

/* ══════════════════════════════════════════
   HAMBURGER BUTTON (oculto en escritorio)
   ══════════════════════════════════════════ */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: none; border: none;
  border-radius: 8px; padding: 4px;
  cursor: pointer; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.ham-bar {
  display: block;
  width: 22px; height: 2px;
  background: rgba(255,255,255,0.88);
  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;
}
nav.nav-open .ham-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.nav-open .ham-bar:nth-child(2) { opacity: 0; width: 0; }
nav.nav-open .ham-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════
   TABLET ≤ 980px — ajuste de nav
   ══════════════════════════════════════════ */
@media (max-width: 980px) {
  :root { --nav-pad-x: 32px; }
  nav .nav-links {
    padding-left: 16px !important;
    gap: 18px !important;
    width: auto !important;
  }
  nav .nav-links a[href="#servicios"] { padding-left: 0 !important; }
  nav .nav-links a[href="#porque"]    { width: auto !important; }
}

/* ══════════════════════════════════════════
   MOBILE ≤ 767px
   ══════════════════════════════════════════ */
@media (max-width: 767px) {
  /* Cursor personalizado → desactivado en táctil */
  #cursor, #cursor-ring { display: none !important; }
  body { cursor: auto; }
  .btn-primary, .btn-ghost, .btn-primary-lg, .btn-ghost-lg { cursor: pointer !important; }

  :root {
    --nav-pad-x: 20px;
    --nav-pad-y: 14px;
    --nav-wordmark-w: 150px;
  }

  /* ── NAV ── */
  .nav-hamburger { display: flex; }

  nav:not(.nav-open) .nav-links { display: none; }

  nav.nav-open {
    bottom: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px !important;
    background: rgba(13,13,26,0.98) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    box-shadow: none !important;
  }
  nav.nav-open .nav-logo {
    position: absolute;
    top: 16px; left: 20px;
  }
  nav.nav-open .nav-hamburger {
    position: absolute;
    top: 10px; right: 16px;
  }
  nav.nav-open .nav-links {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 28px !important;
    width: auto !important;
    padding: 0 !important;
    animation: navLinksAppear 0.22s ease forwards;
  }
  @keyframes navLinksAppear {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
  }
  nav.nav-open .nav-links a {
    font-size: 26px !important;
    font-weight: 500 !important;
    color: rgba(255,255,255,0.88) !important;
    letter-spacing: -0.01em;
    width: auto !important;
    padding-left: 0 !important;
  }
  nav.nav-open .nav-links a:hover { color: var(--white) !important; }
  nav.nav-open .nav-links .btn-primary {
    font-size: 16px !important;
    padding: 14px 44px !important;
    cursor: pointer !important;
    margin-top: 14px;
  }

  /* ── HERO ── */
  .hero-logo-wrap {
    left: 50% !important;
    top: 108px !important;
    transform: translateX(-50%) !important;
  }
  .hero-logo-wrap svg.nexo-logo-anim { width: 130px; height: 134px; }

  .hero-content {
    width: 100% !important;
    height: auto !important;
    max-width: 420px;
    padding: 0 20px;
    margin-top: clamp(152px, 31vh, 192px);
  }
  .hero-intro { transform: none !important; }
  #hero .hero-intro .hero-sub { width: auto !important; max-width: 100%; }
  .hero h1 { font-size: clamp(36px, 10vw, 56px); }

  #hero .hero-ctas {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    max-width: 100% !important;
    margin-top: 4px !important;
  }

  .scroll-indicator { display: none; }

  /* ── NÚMEROS ── */
  #numeros { padding: 52px 20px; }
  .section-overline { margin-bottom: 36px; }
  .numbers-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 44px;
  }
  .number-item {
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding: 0 0 32px;
    margin-bottom: 0;
  }
  .number-item:nth-child(n+2) { padding-top: 32px; }
  .number-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .number-label { max-width: 220px; margin-left: auto; margin-right: auto; }
  .numbers-close { font-size: 15px; }
}
