/* ==========================================================================
   AV Diagnostico v4 — hero (seccion 1) · rev.2 (correcciones Mateo)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 3px; border-radius: 2px; }

/* ============================================================ NAV (una barra) */
.nav {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-nav);
  width: max-content;
  max-width: 94vw;
}
.nav__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 62px;
  padding: 0 12px 0 18px;
  /* casi transparente: el blur mantiene las letras legibles sobre cualquier foto */
  background: rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: var(--r-pill);
  box-shadow: 0 1px 1px rgba(14,26,31,.03), 0 10px 34px rgba(14,26,31,.08);
}
/* logo AV dentro de la barra — mas grande y distinguible */
.nav__brand { display: inline-flex; align-items: center; height: 100%; padding-right: 6px; }
.nav__brand img { height: 34px; width: auto; }
.nav__div { width: 1px; height: 24px; background: rgba(14,26,31,.16); margin: 0 8px; }

.nav__links { display: flex; align-items: center; gap: 2px; }
.nav__link {
  position: relative;
  padding: 9px 14px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-2);
  transition: color .25s ease;
}
.nav__link span { position: relative; display: inline-block; }
/* subrayado suave que se dibuja (hover) */
.nav__link span::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -5px;
  height: 1.5px;
  background: var(--teal);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .32s cubic-bezier(.2,.7,.2,1);
}
.nav__link:hover { color: var(--ink); }
.nav__link:hover span::after { transform: scaleX(1); }
/* seccion activa: la PALABRA se ILUMINA (teal brillante + glow), sin placa ni circulos */
.nav__link.is-active { color: var(--teal); font-weight: 700; text-shadow: 0 0 16px rgba(23,184,198,.9), 0 0 5px rgba(23,184,198,.6); }
.nav__link.is-active span::after { transform: scaleX(1); height: 2px; background: var(--teal); box-shadow: 0 0 10px rgba(23,184,198,.95); }

/* ---- nav sobre seccion OSCURA (veterinario): texto claro para que se lea ---- */
.nav--dark .nav__bar { background: rgba(12, 23, 27, .5); border-color: rgba(255,255,255,.14); }
.nav--dark .nav__link { color: #B9C9CA; }
.nav--dark .nav__link:hover { color: #EAF2F1; }
.nav--dark .nav__link.is-active { color: #2FD3E0; }
.nav--dark .nav__div { background: rgba(255,255,255,.22); }
.nav--dark .nav__burger span,
.nav--dark .nav__burger span::before,
.nav--dark .nav__burger span::after { background: #EAF2F1; }

/* ---- logo iluminado cuando estas en el HOME (hero/datos) ----
   Se ilumina el TRAZO del logo, no su caja: drop-shadow() lee el canal alfa del
   PNG (verificado: 87.8% de sus pixeles son transparentes) y el arte no tiene
   ningun anillo, asi que el glow sigue la forma de la "AV".
   OJO con el radio del blur: la "AV" es un monograma compacto y un drop-shadow
   ancho (el viejo 7px) desparrama los dos brazos hasta que los halos se fusionan
   en una NUBE REDONDA alrededor de la marca — se lee como un circulo pegado
   atras, que es justo lo que no queremos. Verificado a 4x: con 7px hay disco,
   con 1.5px el glow abraza el trazo. Por eso la iluminacion viene sobre todo de
   brightness+saturate (levanta el propio color del logo) y el drop-shadow queda
   apenas como filo.
   El estado base declara las MISMAS funciones en el MISMO orden con valores
   neutros: filter solo interpola pareja si las listas coinciden. */
.nav__brand { border-radius: 0; }
/* el area tocable del logo daba 30px de ancho; en pantalla tactil se lleva al minimo */
@media (pointer: coarse) {
  .nav__brand { min-width: 44px; justify-content: center; padding-right: 0; }
}
.nav__brand img {
  filter: brightness(1) saturate(1) drop-shadow(0 0 0 rgba(23,184,198,0));
  transition: filter .4s cubic-bezier(.2,.7,.2,1);
}
.nav__brand.is-home img {
  filter: brightness(1.10) saturate(1.30) drop-shadow(0 0 1.5px rgba(23,184,198,.9));
}

/* ============================================================ WHATSAPP FLOAT */
.wsp {
  position: fixed;
  right: 26px; bottom: 26px;
  z-index: var(--z-nav);
  display: grid;
  grid-template-columns: 0fr auto;   /* 0fr -> 1fr en hover, ancho real sin medir */
  align-items: center;
  height: 60px;
  background: #25D366;               /* verde WhatsApp oficial */
  color: #fff;
  border-radius: var(--r-pill);
  box-shadow: 0 10px 28px rgba(37,211,102,.38), 0 2px 6px rgba(14,26,31,.15);
  transition: grid-template-columns .45s cubic-bezier(.2,.7,.2,1), box-shadow .3s ease, transform .3s ease;
  overflow: hidden;
}
.wsp:hover { grid-template-columns: 1fr auto; box-shadow: 0 14px 34px rgba(37,211,102,.46); transform: translateY(-1px); }
.wsp:focus-visible { grid-template-columns: 1fr auto; }
.wsp__label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  padding-left: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  transition: opacity .3s ease .06s, padding-left .45s cubic-bezier(.2,.7,.2,1);
}
.wsp:hover .wsp__label, .wsp:focus-visible .wsp__label { opacity: 1; padding-left: 20px; }
.wsp__icon { width: 60px; height: 60px; display: grid; place-items: center; flex: none; }
.wsp__icon svg { width: 30px; height: 30px; }

/* ============================================================ VOLVER ARRIBA
   Vidrio como la isla de nav, no verde: no tiene que competir con el CTA de
   WhatsApp, que es la accion principal. Se apila JUSTO ENCIMA de el (26 de
   base + 60 de alto + 12 de aire = 98) para no taparlo ni desalinearse. */
.totop {
  position: fixed;
  right: 26px;
  bottom: 98px;
  z-index: var(--z-nav);
  width: 48px; height: 48px;
  display: grid; place-items: center;
  color: var(--ink);
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-pill);
  box-shadow: 0 6px 20px rgba(14,26,31,.12);
  /* oculto hasta pasar el primer viewport. Se anima opacity+transform y NO
     display, para que la transicion corra en el compositor; pointer-events
     apagado para que no capture clicks mientras esta invisible. */
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s cubic-bezier(.2,.7,.2,1),
              color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.totop.is-in { opacity: 1; transform: none; pointer-events: auto; }
.totop svg { width: 18px; height: 18px; }
.totop:hover {
  color: var(--teal-deep);
  border-color: var(--teal);
  box-shadow: 0 10px 26px rgba(14,26,31,.16);
}

/* el panel del menu mobile no existe en desktop */
.nav-menu { display: none; }

/* ============================================================ HERO */
.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.hero__slides { position: absolute; inset: 0; z-index: -2; }
.hero__slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  /* grade sutil: baja la saturacion para un clima mas premium, sin perder detalle */
  filter: saturate(.9) brightness(1.03) contrast(1.02);
  transition: opacity 1.2s ease;
}
/* will-change SOLO en las capas que estan animando. Antes estaba fijo en las 4
   diapositivas: cuatro capas de pantalla completa promovidas a GPU y sostenidas
   para siempre, que en un telefono es memoria de video tirada al pasto. */
.hero__slide.is-active,
.hero__slide.is-leaving { will-change: opacity, transform; }

/* El kenburns tiene que seguir corriendo MIENTRAS la foto se desvanece.
   Si la animacion se corta al salir .is-active, el transform vuelve de un saque
   al scale(1.06) del estado base con la foto todavia en pantalla, y se ve como
   un tiron. Medido: scale(1.0156) -> scale(1.06) con opacity todavia en .99.
   Declarar la MISMA animacion (mismo nombre, duracion y posicion en la lista)
   en las dos clases la deja correr sin reiniciar: al pasar de .is-active a
   .is-leaving el navegador la continua. .is-leaving lo saca el JS recien cuando
   la foto ya es invisible, asi el salto ocurre a opacity 0 y no se ve. */
.hero__slide.is-active,
.hero__slide.is-leaving { animation: kenburns 7s ease-out forwards; }
.hero__slide.is-active { opacity: 1; }
@keyframes kenburns { from { transform: scale(1.06); } to { transform: scale(1); } }

/* Las fotos viven aca y no en un style="" del HTML para poder servir una
   version liviana en telefono. Las originales son 2200x1470 (3.2 MP cada una,
   1.1 MB las cuatro) para una pantalla de 390px: ese sobrante se paga tres
   veces, en descarga, en decodificacion y en memoria de la capa. Las -m son de
   1200px (0.96 MP, 444 KB las cuatro). */
/* SOLO la primera esta en el CSS: es la unica que se ve al abrir, y es la que
   entra en el camino critico. Las otras tres las carga hero.js -> loadSlides()
   despues del load, leyendo data-bg / data-bg-m del HTML. Medido antes: las 4
   se pedian juntas a los ~950ms (1101 KB) cuando la 2 no se ve hasta los 5s,
   la 3 a los 10 y la 4 a los 15. */
.hero__slide--1 { background-image: url('../assets/img/hero/hero-1.webp'); }
/* 700px y no 900: a 700 de ancho con pantalla retina harian falta 1400px y la
   version chica se veria blanda. Los telefonos reales miden 360-430. */
@media (max-width: 700px) {
  .hero__slide--1 { background-image: url('../assets/img/hero/hero-1-m.webp'); }
}

/* wash profesional: la imagen se atenua de forma UNIFORME (opacidad pequeña,
   pareja) para leerse como un fondo calmo, no como un corte mitad-si-mitad-no.
   Solo un susurro extra de luz detras del texto (diferencia minima, no un split). */
/* El velo anterior era una capa PLANA de blanco al 50% sobre toda la foto, mas
   un brillo central. El resultado: la foto quedaba en una bruma gris pareja —
   ni se leia la foto ni el texto ganaba contraste, porque el blanco subia el
   negro del texto y el fondo por igual.
   Ahora el blanco se concentra donde REALMENTE hace falta (detras del bloque de
   texto, centro) y se abre hacia los bordes, asi las esquinas de la foto vuelven
   a tener imagen. Mismo contraste de lectura en el centro, mucho mas rango. */
.hero__wash {
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Radial y CENTRADO, acompañando al bloque de texto. No es el velo original:
     aquel era una capa plana de blanco al 50% sobre TODA la foto y la dejaba en
     una bruma gris pareja. Este concentra el blanco detras del texto y se abre
     hacia los bordes, asi las esquinas de la foto vuelven a tener imagen. */
  background:
    radial-gradient(122% 88% at 50% 50%,
      rgba(255,255,255,.88) 0%,
      rgba(255,255,255,.66) 34%,
      rgba(255,255,255,.24) 68%,
      rgba(255,255,255,.06) 100%),
    linear-gradient(180deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,0) 26%);
}

.hero__inner {
  position: relative;
  width: var(--container);
  margin-inline: auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* centrado vertical */
  align-items: center;       /* CENTRADO horizontal — decision de Mateo */
  text-align: center;
  padding-block: 150px 96px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--fs-label);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 26px;
}
/* lineas simetricas a ambos lados (eyebrow centrado) */
.hero__eyebrow::before, .hero__eyebrow::after { content: ""; width: 34px; height: 1px; background: var(--teal-deep); display: inline-block; flex: none; }

.hero__title {
  font-family: var(--serif);         /* Fraunces */
  font-weight: 460;
  font-size: var(--fs-hero);
  line-height: 1.03;
  letter-spacing: -0.022em;
  color: var(--ink);
  margin: 0 auto;
  /* Antes: white-space: nowrap para forzar UNA linea, y eso ataba el tamaño del
     titular al ancho del contenedor — por eso quedaba en 55px, mas chico que los
     H2 de seccion. Al soltar el nowrap el titular puede crecer de verdad y
     envuelve en dos lineas, que es lo que quiere una display serif.
     18ch fuerza el corte despues de "al", dejando "diagnostico." solo abajo.
     text-wrap: balance reparte las dos lineas en vez de dejar una huerfana. */
  max-width: 18ch;
  text-wrap: balance;
}
/* palabra de acento: Fraunces italica en teal */
.hero__title em { font-family: var(--serif); font-style: italic; font-weight: 420; color: var(--teal-deep); }
.hero__title .line { display: block; }
/* La mascara por linea que arma SplitText (mask:'lines') es un wrapper con la
   clase "<linesClass>-mask" -> aca "line-mask" (verificado en el DOM real, GSAP
   3.15: <div class="line-mask" style="...overflow: clip">). Su caja de recorte
   es el line box, y con line-height 1.03 Fraunces se pasa ~0.10em por abajo: la
   "g" de "diagnostico" quedaba cortada. overflow-clip-margin agranda SOLO la
   region de recorte, no la caja de layout -> no abre gap entre lineas ni corre
   el bloque, y sobrevive al re-split de autoSplit (depende de la clase, no de
   la instancia). Va apareado con el yPercent de hero.js -> setupTitle(): el
   arranque tiene que superar 100% + 0.14em/line-height (~114%), por eso 125. */
.hero__title .line-mask { overflow-clip-margin: .14em; }

.hero__deck {
  margin: 28px auto 0;
  max-width: 52ch;
  font-family: var(--sans);          /* Inter */
  font-size: var(--fs-deck);
  line-height: 1.55;
  color: var(--ink-2);
}

.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 38px; }
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  height: 56px;
  padding: 0 30px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  border-radius: 0;              /* cuadrado, sin bordes redondos */
  cursor: pointer;
  overflow: hidden;
  transition: color .3s ease, border-color .3s ease;
}
.btn svg { width: 18px; height: 18px; position: relative; z-index: 2; }
.btn span { position: relative; z-index: 2; }
/* capa que "pinta" el boton: barre de izquierda a derecha en hover */
.btn::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .42s cubic-bezier(.2,.7,.2,1);
}
.btn:hover::before { transform: scaleX(1); }

/* primario: color del logo (gradiente teal), texto blanco; al pintar, tono mas profundo */
.btn--primary { background: linear-gradient(120deg, #17B8C6, #0E8A9A); color: #fff; border: 0; text-shadow: 0 1px 2px rgba(8,40,45,.3); }
.btn--primary::before { background: linear-gradient(120deg, #0E8A9A, #0A6C7A); }

/* fantasma: boton blanco solido VISIBLE, texto tinta; al pintar se llena de teal y el texto pasa a blanco */
.btn--ghost { background: rgba(255,255,255,.92); color: var(--ink); border: 1px solid rgba(14,26,31,.16); box-shadow: 0 6px 18px rgba(14,26,31,.08); }
.btn--ghost::before { background: linear-gradient(120deg, #17B8C6, #0E8A9A); }
.btn--ghost:hover { color: #fff; border-color: transparent; }

/* fila inferior anclada al fondo del hero */
.hero__foot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  width: var(--container);
  display: flex;
  align-items: flex-end;
  justify-content: center;   /* ticks centrados abajo */
  gap: 24px;
}
.hero__addr {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--ink-2);
}
.hero__addr svg { width: 14px; height: 14px; color: var(--teal-deep); }

/* AREA TACTIL DE LOS TICKS.
   La barra mide 2px de alto: medido en la auditoria, el objetivo tactil era de
   34x2 px, o sea imposible de acertar en un telefono. El boton pasa a 34x44
   (el minimo recomendado) con fondo transparente, y la barra visible se dibuja
   CENTRADA adentro con ::before + el span. El aspecto no cambia; lo que cambia
   es cuanto hay para tocar. */
.hero__ticks { display: flex; align-items: center; gap: 8px; }
.hero__tick {
  width: 34px; height: 44px;
  background: none; border: 0; padding: 0; cursor: pointer;
  position: relative;
}
.hero__tick::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px; background: rgba(14,26,31,.2);
}
.hero__tick span {
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  background: var(--ink); transform: scaleX(0); transform-origin: left center;
}
.hero__tick.is-active span { transform: scaleX(1); transition: transform 5s linear; }

/* ============================================================ MOBILE */
.nav__burger { display: none; }

@media (max-width: 1023px) {
  .nav { top: 14px; left: 16px; right: 16px; transform: none; width: auto; max-width: none; }
  .nav__bar { justify-content: space-between; padding: 0 8px 0 16px; background: rgba(255,255,255,.42); }
  .nav__brand img { height: 24px; }
  .nav__div, .nav__links { display: none; }
  .nav__burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; background: transparent; border: 0; cursor: pointer;
  }
  .nav__burger span { width: 20px; height: 2px; background: var(--ink); position: relative; display: block; }
  .nav__burger span::before, .nav__burger span::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--ink); }
  .nav__burger span::before { top: -6px; transition: transform .3s ease, top .3s ease; }
  .nav__burger span::after { top: 6px; transition: transform .3s ease, top .3s ease; }
  /* burger -> X cuando el menu esta abierto */
  .nav--open .nav__burger span { background: transparent; }
  .nav--open .nav__burger span::before { top: 0; transform: rotate(45deg); }
  .nav--open .nav__burger span::after { top: 0; transform: rotate(-45deg); }

  /* panel del menu mobile */
  .nav-menu {
    position: fixed; inset: 0; z-index: 190;   /* debajo de la barra (200): la barra y la X quedan visibles */
    background: rgba(255,255,255,.97);
    -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
    display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
    padding: 96px 28px 48px;
    clip-path: inset(0 0 100% 0);
    visibility: hidden;
    transition: clip-path .5s cubic-bezier(.7,0,.15,1), visibility .5s;
  }
  .nav-menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; }
  .nav-menu__links { display: flex; flex-direction: column; gap: 2px; width: 100%; }
  .nav-menu__links a {
    font-family: var(--serif);
    font-size: clamp(2rem, 9vw, 2.9rem);
    font-weight: 400;
    color: var(--ink);
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    transition: color .2s ease, padding-left .3s cubic-bezier(.2,.7,.2,1);
  }
  .nav-menu__links a:hover, .nav-menu__links a:focus-visible { color: var(--teal-deep); padding-left: 10px; }
  .nav-menu__cta { margin-top: 34px; width: 100%; justify-content: center; height: 56px; }

  .wsp { right: 18px; bottom: 18px; height: 56px; }
  .wsp__icon { width: 56px; height: 56px; }
  /* mismo apilado que en desktop, con las medidas de mobile: 18 + 56 + 10 */
  .totop { right: 18px; bottom: 84px; width: 44px; height: 44px; }
  .totop svg { width: 17px; height: 17px; }

  .hero__inner { padding-block: 118px 108px; }
  .hero__title { max-width: 16ch; white-space: normal; font-size: clamp(2.1rem, 8vw, 2.9rem); }
  .hero__wash {
    background:
      linear-gradient(0deg, rgba(255,255,255,.5), rgba(255,255,255,.5)),
      radial-gradient(130% 80% at 50% 46%, rgba(255,255,255,.34) 0%, rgba(255,255,255,0) 62%);
  }
  .hero__deck { max-width: 40ch; }
  .hero__actions { flex-direction: column; gap: 10px; width: 100%; }
  .hero__actions .btn { width: 100%; justify-content: center; white-space: nowrap; }
  .hero__foot { width: 90vw; bottom: 6px; justify-content: center; }
}

/* ============================================================ REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .hero__slide, .hero__slide.is-active { animation: none; transition: opacity .3s ease; }
  .hero__title .line { overflow: visible; }
  .nav__brand img { transition: none; }
  .wsp { transition: none; }
  .totop { transition: none; }
}
