/* ═══════════════════════════════════════════════════════════
   MODERNIZED ANIMATIONS & INTERACTIONS
   ═══════════════════════════════════════════════════════════ */

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── PAGE LOAD FADE-IN ─── */
body {
  animation: bodyFadeIn 0.8s ease 0s both;
}

@keyframes bodyFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ─── HERO SECTION LOAD ANIMATIONS ─── */
.hero-badge {
  animation: heroElementFadeInUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both !important;
}

.hero-title {
  animation: heroElementFadeInUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both !important;
}

.hero-subtitle {
  animation: heroElementFadeInUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both !important;
}

.hero-actions {
  animation: heroElementFadeInUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both !important;
}

.hero-visual {
  animation: heroVisualFadeInScale 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both !important;
}

@keyframes heroElementFadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroVisualFadeInScale {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── PAGE-WIDE BACKGROUND ─── */
/* Grid decorativo estático — sin animación continua para mejor rendimiento */
body {
  background: var(--white);
}


/* ─── BACKGROUND SUBTLE ANIMATIONS ─── */
#hero {
  position: relative;
  background: var(--navy);
}


/* ─── SCROLL ANIMATIONS - FADE IN + SLIDE UP ─── */
.scroll-animate {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children inside cards/lists */
.scroll-animate.stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.scroll-animate.stagger.in-view > * {
  opacity: 1;
  transform: translateY(0);
}

.scroll-animate.stagger > *:nth-child(1) { transition-delay: 0.05s; }
.scroll-animate.stagger > *:nth-child(2) { transition-delay: 0.1s; }
.scroll-animate.stagger > *:nth-child(3) { transition-delay: 0.15s; }
.scroll-animate.stagger > *:nth-child(4) { transition-delay: 0.2s; }
.scroll-animate.stagger > *:nth-child(5) { transition-delay: 0.25s; }
.scroll-animate.stagger.in-view > *:nth-child(1) { transition-delay: 0.05s; }
.scroll-animate.stagger.in-view > *:nth-child(2) { transition-delay: 0.1s; }
.scroll-animate.stagger.in-view > *:nth-child(3) { transition-delay: 0.15s; }
.scroll-animate.stagger.in-view > *:nth-child(4) { transition-delay: 0.2s; }
.scroll-animate.stagger.in-view > *:nth-child(5) { transition-delay: 0.25s; }

/* ─── CARD HOVER EFFECTS ─── */
.eco-card,
.metric-card,
.pain-item {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              background-color 0.2s ease;
}

.eco-card:hover,
.metric-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 40px rgba(28, 43, 94, 0.15);
}

.pain-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(28, 43, 94, 0.12);
}

/* ─── BUTTON HOVER & ACTIVE EFFECTS ─── */
.btn-primary,
.btn-ghost,
.nav-cta,
.eco-link {
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn-primary:hover,
.nav-cta:hover {
  transform: translateY(-2px);
}

.btn-primary:active,
.nav-cta:active {
  transform: scale(0.96) translateY(0);
}

.eco-link {
  position: relative;
  display: inline-block;
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.eco-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--cyan);
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.eco-link:hover::after {
  width: 100%;
}

/* ─── LINK UNDERLINE DRAW ANIMATION ─── */
.nav-links a {
  position: relative;
  text-decoration: none;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--cyan);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* ─── ICON EFFECTS ─── */
.eco-icon {
  transition: transform 0.3s ease, filter 0.3s ease;
  margin-bottom: 1rem;
}

.eco-card:hover .eco-icon {
  transform: rotate(8px) scale(1.1);
  filter: drop-shadow(0 4px 12px rgba(0, 174, 239, 0.3));
}

.pulse .eco-icon:hover {
  animation: iconPulse 0.6s ease infinite;
}

@keyframes iconPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ─── CAROUSEL SCROLL ANIMATIONS ─── */
/* scrollLeft y scrollRight keyframes definidos en styles.css */

.shape .eco-icon:hover {
  animation: iconRotate 0.6s ease infinite;
}

@keyframes iconRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── NAVIGATION BLUR & FADE ON SCROLL ─── */
nav {
  transition: backdrop-filter 0.3s ease, background-color 0.3s ease;
}

nav.scrolled {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
}

/* Active nav link highlight */
.nav-links a.active {
  color: var(--cyan);
  font-weight: 600;
}

.nav-links a.active::after {
  width: 100%;
}

/* ─── FORM INPUT FOCUS ANIMATION ─── */
input[type="text"],
input[type="email"],
textarea {
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(28, 43, 94, 0.1);
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.1), inset 0 0 0 1px var(--cyan);
  animation: focusPulse 0.4s ease;
}

@keyframes focusPulse {
  from {
    box-shadow: 0 0 0 0 rgba(0, 174, 239, 0.4), inset 0 0 0 1px var(--cyan);
  }
  to {
    box-shadow: 0 0 0 4px rgba(0, 174, 239, 0.1), inset 0 0 0 1px var(--cyan);
  }
}

/* ─── SMOOTH SCROLL FOR ANCHOR LINKS ─── */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

/* ─── STAT NUMBERS COUNT ANIMATION ─── */
.stat-number {
  transition: color 0.3s ease;
}

.stat-item:hover .stat-number {
  color: var(--white);
  text-shadow: 0 0 20px rgba(0, 174, 239, 0.5);
}

/* ─── CLIENT LOGO HOVER ─── */
.hero-client-logo img,
.carousel-logo img {
  transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

.hero-client-logo:hover img,
.carousel-logo:hover img {
  opacity: 1;
  filter: brightness(1.2) drop-shadow(0 0 8px rgba(0, 174, 239, 0.3));
  transform: scale(1.05);
}

/* ─── SECTION LABEL ANIMATIONS ─── */
.section-label {
  animation: labelSlideIn 0.6s ease both;
  position: relative;
}

.section-label::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  height: 2px;
  background: var(--cyan);
  width: 0;
  animation: underlineExpand 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes labelSlideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes underlineExpand {
  from {
    width: 0;
  }
  to {
    width: 40px;
  }
}

/* ─── SECTION TITLE ANIMATIONS ─── */
.section-title {
  position: relative;
  animation: titleFadeInUp 0.7s ease both;
}

@keyframes titleFadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── BUTTON PRESS FEEDBACK ─── */
button,
a[class*="btn"],
.eco-link {
  transform-origin: center;
}

button:active,
a[class*="btn"]:active,
.eco-link:active {
  animation: buttonPress 0.15s ease;
}

@keyframes buttonPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.98); }
  100% { transform: scale(1); }
}


/* ─── AVATAR/CHARACTER FLOAT ANIMATION ─── */
.brand-illustration,
.clients-character-wrap img,
.problema-visual img {
  animation: characterFloat 3s ease-in-out infinite;
}

@keyframes characterFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ─── DECORATIVE ACCENT ANIMATIONS ─── */
.hero-char-wrap svg {
  animation: accentPulse 2s ease-in-out infinite;
}

.hero-char-wrap svg:nth-child(1) {
  animation-delay: 0.2s;
}

.hero-char-wrap svg:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes accentPulse {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

/* ─── CTA ELEMENTS ─── */
.cta-quote,
.cta-sub {
  animation: ctaFadeIn 0.8s ease 0.3s both;
}

@keyframes ctaFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ─── STAGGERED PILLAR ANIMATIONS ─── */
.pillar {
  animation: pillarStagger 0.6s ease both;
}

.pillar:nth-child(1) { animation-delay: 0.2s; }
.pillar:nth-child(2) { animation-delay: 0.4s; }
.pillar:nth-child(3) { animation-delay: 0.6s; }

@keyframes pillarStagger {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pillar:hover {
  transform: translateY(-4px);
}

/* ─── CAROUSEL SMOOTH SCROLL ─── */
/* Animations for .track-left and .track-right are defined in styles.css */

/* ─── MICRO-INTERACTION: SUCCESS STATE ─── */
.form-success {
  animation: successBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successBounce {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── LOADING STATE ─── */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading {
  animation: shimmer 2s infinite;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  background-size: 1000px 100%;
}

/* ─── TRANSITIONS FOR SMOOTH INTERACTIONS ─── */
a {
  transition: color 0.2s ease;
}

/* Smooth color transitions */
.eco-card {
  color: inherit;
}

.eco-card h3,
.eco-card p {
  transition: color 0.3s ease;
}

.eco-card:hover h3,
.eco-card:hover p {
  color: inherit;
}

/* ─── MOBILE OPTIMIZATIONS ─── */
@media (max-width: 768px) {
  .hero-title {
    animation-delay: 0.3s !important;
  }

  .hero-subtitle {
    animation-delay: 0.5s !important;
  }

  .hero-visual {
    animation-delay: 0.4s !important;
  }

  .eco-card:hover {
    transform: translateY(-4px) scale(1.01);
  }

  /* Reduce animation complexity on mobile */
  @media (prefers-reduced-motion: no-preference) {
    .scroll-animate {
      animation: none;
    }

    .scroll-animate.in-view {
      animation: none;
    }
  }
}

/* ─── ACCESSIBILITY: FOCUS VISIBLE ─── */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ─── PRINT MEDIA ─── */
@media print {
  .scroll-animate,
  .scroll-animate.in-view {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ─── PARTICLE NETWORK CANVAS ─── */
/* El canvas va de fondo. El hero ya tiene position:relative en styles.css.
   NO añadimos overflow:hidden aquí para no cortar el clients-band ni los stats
   que tienen position:absolute dentro del hero. */
#particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  display: block;
}