/* ==========================================================================
   VALER · ANIMACIONES Y EFECTOS DE SCROLL
   Todo está activo solo si <html> tiene la clase .js-anim (la pone animations.js).
   Sin JS o con "reducir movimiento" activado, la web se ve normal y completa.
   ========================================================================== */

:root {
  --anim-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --anim-dur: 0.85s;
}

/* ---------- Barra de progreso de lectura ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1000;
  background: linear-gradient(90deg, var(--color-accent, #f26522), #ff9a66);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
  will-change: transform;
}

/* ---------- Reveal on scroll ---------- */
@keyframes vUp    { from { opacity: 0; transform: translate3d(0, 44px, 0); } }
@keyframes vLeft  { from { opacity: 0; transform: translate3d(-56px, 0, 0); } }
@keyframes vRight { from { opacity: 0; transform: translate3d(56px, 0, 0); } }
@keyframes vZoom  { from { opacity: 0; transform: scale(0.92); } }
@keyframes vClip  { from { opacity: 0; clip-path: inset(0 0 100% 0 round 24px); transform: translate3d(0, 30px, 0); } }

.js-anim [data-reveal] {
  opacity: 0;
}

.js-anim [data-reveal].is-visible {
  opacity: 1;
  animation: vUp var(--anim-dur) var(--anim-ease) backwards;
  animation-delay: var(--reveal-delay, 0ms);
}
.js-anim [data-reveal="left"].is-visible  { animation-name: vLeft; }
.js-anim [data-reveal="right"].is-visible { animation-name: vRight; }
.js-anim [data-reveal="zoom"].is-visible  { animation-name: vZoom; }
.js-anim [data-reveal="clip"].is-visible  { animation-name: vClip; animation-duration: 1.1s; }

/* ---------- Entrada del hero al cargar ---------- */
@keyframes heroIn {
  from { opacity: 0; transform: translate3d(0, 34px, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes heroImgIn {
  from { opacity: 0; transform: translate3d(40px, 0, 0) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.js-anim .hero-main > *,
.js-anim .hero-mark {
  opacity: 0;
}
.js-anim.is-loaded .hero-main > * {
  animation: heroIn 0.9s var(--anim-ease) forwards;
  animation-delay: calc(var(--i, 0) * 110ms + 150ms);
}
.js-anim.is-loaded .hero-mark {
  animation: heroImgIn 1.1s var(--anim-ease) 0.35s forwards;
}

.js-anim .hero-proof li {
  opacity: 0;
}
.js-anim.is-loaded .hero-proof li {
  animation: heroIn 0.8s var(--anim-ease) forwards;
  animation-delay: calc(0.85s + var(--k, 0) * 120ms);
}

/* Resplandor del hero que respira */
.hero-container {
  position: relative;
  overflow: hidden;
}
.js-anim .hero-container::before,
.js-anim .hero-container::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  z-index: 0;
}
.js-anim .hero-container::before {
  width: 380px; height: 380px;
  right: -80px; top: -90px;
  background: rgba(242, 101, 34, 0.22);
  animation: orbA 14s ease-in-out infinite alternate;
}
.js-anim .hero-container::after {
  width: 320px; height: 320px;
  left: -90px; bottom: -110px;
  background: rgba(25, 68, 223, 0.22);
  animation: orbB 17s ease-in-out infinite alternate;
}
.hero-inner { position: relative; z-index: 1; }

@keyframes orbA { to { transform: translate3d(-70px, 60px, 0) scale(1.15); } }
@keyframes orbB { to { transform: translate3d(90px, -50px, 0) scale(1.2); } }

/* ---------- Parallax (el JS actualiza --py) ---------- */
.js-anim .hero-stock-image {
  transform: translate3d(0, var(--py, 0px), 0) scale(1.14);
  will-change: transform;
}
.js-anim .institutional-photo-frame img {
  transform: translate3d(0, var(--py, 0px), 0) scale(1.14);
  will-change: transform;
}
.js-anim .hero-mark-card {
  animation: floatCard 6s ease-in-out 1.6s infinite alternate;
}
@keyframes floatCard {
  to { transform: translate3d(0, -8px, 0); }
}

/* ---------- Línea de tiempo "Cómo trabajamos" ---------- */
.js-anim .process-timeline::before {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.6s var(--anim-ease) 0.2s;
}
.js-anim .process-timeline.is-drawn::before {
  transform: scaleX(1);
}
@keyframes nodePop {
  0%   { opacity: 0; transform: scale(0.3); }
  70%  { transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
.js-anim .process-step .process-node { opacity: 0; }
.js-anim .process-timeline.is-drawn .process-node {
  opacity: 1;
  animation: nodePop 0.7s var(--anim-ease) backwards;
  animation-delay: calc(var(--i, 0) * 260ms + 250ms);
}
.process-node { transition: transform 0.35s var(--anim-ease), box-shadow 0.35s ease, background-color 0.35s ease; }
.process-step:hover .process-node {
  transform: translateY(-5px) scale(1.06);
  background: var(--color-accent, #f26522);
  color: #fff;
}
.process-step:hover .process-step-num {
  background: var(--color-primary, #0d1127);
}

/* ---------- Microinteracciones de hover ---------- */
.service-card { overflow: hidden; }
.service-stock-image { transition: transform 0.7s var(--anim-ease); }
.service-card:hover .service-stock-image { transform: scale(1.07); }
.service-card-icon,
.diff-icon,
.resource-icon,
.team-avatar { transition: transform 0.45s var(--anim-ease); }
.client-card:hover .service-card-icon,
.service-card:hover .service-card-icon,
.diff-item:hover .diff-icon,
.resource-card:hover .resource-icon,
.team-card:hover .team-avatar {
  transform: translateY(-3px) rotate(-6deg) scale(1.08);
}

.client-card,
.resource-card,
.team-card,
.testimonial-card,
.indicator-card,
.alliance-slot,
.blog-card {
  transition: transform 0.4s var(--anim-ease), box-shadow 0.4s ease, border-color 0.3s ease;
}
.client-card:hover,
.resource-card:hover,
.team-card:hover,
.testimonial-card:hover,
.indicator-card:hover,
.alliance-slot:hover,
.blog-card:hover {
  transform: translateY(-6px);
}

/* Destello en botones principales */
.btn-primary-finsta::after {
  content: "";
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}
.btn-primary-finsta:hover::after {
  left: 130%;
  transition: left 0.8s ease;
}

/* Flecha del botón secundario */
.btn-secondary i { transition: transform 0.3s ease; display: inline-block; }
.btn-secondary:hover i { transform: translateY(4px); }

/* Pulso del botón de WhatsApp */
.js-anim .whatsapp-float-btn { animation: waPulse 2.8s ease-out infinite; }
@keyframes waPulse {
  0%   { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.38), 0 0 0 0 rgba(37, 211, 102, 0.45); }
  70%  { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.38), 0 0 0 18px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 6px 20px rgba(37, 211, 102, 0.38), 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Subrayado animado bajo los títulos de sección */
.section-title-wrap.centered-heading h2 {
  position: relative;
  padding-bottom: 14px;
}

.js-anim .section-title-wrap.centered-heading h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 58px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-accent, #f26522), #ff9a66);
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.85s var(--anim-ease) 0.25s;
}

.js-anim .section-title-wrap.centered-heading.is-visible h2::after {
  transform: translateX(-50%) scaleX(1);
}

/* Flotado suave de insignia institucional */
.js-anim .hero-mark-caption {
  animation: floatCaption 5.5s ease-in-out 1.4s infinite alternate;
}

@keyframes floatCaption {
  to { transform: translate3d(0, -6px, 0); }
}

/* Indicadores: cuando llega el dato, aparece con un fade */
.indicator-value { transition: opacity 0.4s ease; }
.indicator-value.is-loading { opacity: 0.55; }

/* Contadores sin saltos de ancho */
[data-count] { font-variant-numeric: tabular-nums; }

/* ---------- Reducir movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  html:not(.force-anim).js-anim [data-reveal],
  html:not(.force-anim).js-anim .hero-main > *,
  html:not(.force-anim).js-anim .hero-mark,
  html:not(.force-anim).js-anim .hero-proof li,
  html:not(.force-anim).js-anim .process-step .process-node {
    opacity: 1 !important;
    animation: none !important;
  }
  html:not(.force-anim).js-anim .process-timeline::before { transform: none; }
  html:not(.force-anim).js-anim .hero-stock-image,
  html:not(.force-anim).js-anim .institutional-photo-frame img { transform: none; }
  html:not(.force-anim) .scroll-progress { display: none; }
}
