/* services-intro-animations.css */

/* ===== ANIMAÇÕES DE ENTRADA PRINCIPAL ===== */

/* Efeito de revelação para o contêiner principal */
@keyframes servicesReveal {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Efeito de morphing suave para os blobs de fundo */
@keyframes blobMorph {
  0%,
  100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    transform: scale(1) translate(0, 0);
  }
  25% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    transform: scale(1.05) translate(10px, -10px);
  }
  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    transform: scale(0.95) translate(0, -15px);
  }
  75% {
    border-radius: 40% 60% 30% 70% / 60% 40% 60% 30%;
    transform: scale(1.05) translate(-10px, -10px);
  }
}

/* Efeito de revelação do grid */
@keyframes gridReveal {
  0% {
    opacity: 0;
    transform: scale(1.1);
    background-size: 30px 30px;
  }
  100% {
    opacity: 0.3;
    transform: scale(1);
    background-size: 40px 40px;
  }
}

/* Efeito de digitação para o subtítulo */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes cursorBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Efeito de revelação para caracteres individuais */
@keyframes charReveal {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Efeito para o card de serviço */
@keyframes cardReveal {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95) rotateX(10deg);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  60% {
    transform: translateY(0) scale(1) rotateX(5deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  }
}

/* Efeito para elementos internos do card */
@keyframes elementSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Efeito de linha de conexão crescendo */
@keyframes lineGrow {
  0% {
    height: 0;
    opacity: 0;
  }
  100% {
    height: 80px;
    opacity: 0.5;
  }
}

/* Efeito de pulso para o indicador de expand */
@keyframes expandPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* ===== APLICAÇÃO DE ANIMAÇÕES ===== */

/* Seção principal */
.services-section {
  position: relative;
  perspective: 1000px;
}

.services-section.animate-in {
  animation: servicesReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Elementos de fundo */
.services-blob {
  transform-style: preserve-3d;
  transform-origin: center center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.services-section.animate-in .services-blob {
  animation: blobMorph 25s ease-in-out infinite;
  opacity: 0.05;
}

.services-blob-1 {
  transition-delay: 0.5s;
}

.services-blob-2 {
  transition-delay: 0.8s;
}

.services-grid {
  opacity: 0;
  transform: scale(1.05);
}

.services-section.animate-in .services-grid {
  animation: gridReveal 1.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

/* Header da seção */
.services-header {
  opacity: 0;
  transform: translateY(20px);
}

.services-section.animate-in .services-header {
  animation: servicesReveal 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

/* Subtítulo com efeito de digitação */
.services-subtitle-wrapper {
  position: relative;
  display: inline-block;
  width: fit-content;
  margin: 0 auto;
}

.services-subtitle-inner {
  white-space: nowrap;
  overflow: hidden;
  width: 0;
}

.services-section.animate-in .services-subtitle-inner {
  animation: typewriter 1s steps(20, end) 0.5s forwards;
}

.services-gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: gradientShift 5s ease infinite;
}

/* Ajustar a animação para a nova classe */
.services-gradient-text .char {
  display: inline-block;
  opacity: 0;
  background: inherit;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.services-section.animate-in .services-gradient-text .char {
  animation: charReveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.services-subtitle-wrapper::after {
  content: "|";
  position: absolute;
  right: -2px;
  top: 0;
  color: var(--primary);
  animation: cursorBlink 0.8s infinite;
}

/* Título com caracteres revelados */
.services-title .char {
  display: inline-block;
  opacity: 0;
}

.services-section.animate-in .services-title .char {
  animation: charReveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Descrição */
.services-description {
  opacity: 0;
  transform: translateY(20px);
}

.services-section.animate-in .services-description {
  animation: servicesReveal 1s cubic-bezier(0.22, 1, 0.36, 1) 1s forwards;
}

/* Linha de conexão entre seções */
.services-connection {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), transparent);
  transform: translateX(-50%);
  opacity: 0;
  height: 0;
}

.services-section.animate-in .services-connection {
  animation: lineGrow 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* Cards de serviço */
.service-item {
  opacity: 0;
  transform: translateY(40px) rotateX(10deg);
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.services-section.animate-in .service-item {
  animation: cardReveal 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Timing sequencial para os cards */
.services-section.animate-in .service-item:nth-child(1) {
  animation-delay: 0.8s;
}

.services-section.animate-in .service-item:nth-child(2) {
  animation-delay: 1s;
}

.services-section.animate-in .service-item:nth-child(3) {
  animation-delay: 1.2s;
}

.services-section.animate-in .service-item:nth-child(4) {
  animation-delay: 1.4s;
}

/* Elementos internos do card */

.services-section.animate-in .service-item.animated .service-number {
  animation: elementSlideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.2s;
}

.services-section.animate-in .service-item.animated .service-title {
  animation: elementSlideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.3s;
}

.services-section.animate-in .service-item.animated .service-tags {
  animation: elementSlideIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.4s;
}

/* Indicador de expand */
.expand-indicator {
  opacity: 0;
}

.services-section.animate-in .service-item.animated .expand-indicator {
  opacity: 0.8;
  animation: expandPulse 2s infinite;
  animation-delay: 0.6s;
}


@media (max-width: 768px) {
  .services-section.animate-in .service-item {
    animation-delay: 0.4s;
  }

  @keyframes cardReveal {
    0% {
      opacity: 0;
      transform: translateY(20px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Adicionar ao services-animations.css para otimizar performance */

/* Pausar animações quando seção não está visível */
.services-section.out-of-view .services-blob,
.services-section.out-of-view .services-grid,
.services-section.out-of-view .char,
.services-section.out-of-view .services-subtitle-inner,
.services-section.out-of-view .service-item {
  animation-play-state: paused !important;
  transition: none !important;
}

/* Usar will-change apenas onde necessário */
.services-blob,
.services-grid {
  will-change: transform;
  transform: translate3d(0, 0, 0); /* Forçar aceleração GPU */
}

/* Otimizações específicas para cada tipo de dispositivo */
@media (max-width: 768px), (prefers-reduced-motion: reduce) {
  /* Simplificar animações em dispositivos móveis */
  .services-section .char,
  .services-section .services-subtitle-inner,
  .services-section .service-item {
    transition-duration: 0.5s !important;
    animation-duration: 0.5s !important;
  }

  /* Reduzir a complexidade visual */
  .services-blob {
    opacity: 0.03 !important;
    filter: blur(60px) !important; /* Blur mais suave */
  }

  /* Simplificar efeitos de hover em cards */
  .service-card:hover .service-icon,
  .service-card:hover .service-number,
  .service-card:hover .service-title,
  .service-card:hover .service-tag {
    animation: none !important;
    transform: none !important;
  }

  /* Desativar efeitos de pulsação *
  /* Simplificar animação de serviços */
  @keyframes cardReveal {
    0% {
      opacity: 0;
      transform: translateY(20px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Novo conjunto de classes para optimização de desempenho */
.services-optimized .services-blob,
.services-optimized .services-grid {
  transition: transform 0.3s ease-out !important;
  animation-duration: 0.5s !important;
}

.services-optimized .service-card-inner {
  transition: padding 0.3s ease-out !important;
}

.services-optimized .service-content {
  transition: max-height 0.3s ease-out !important;
  opacity: 0.3s ease-out !important;
}

/* Otimizar transições específicas */
.service-number,
.service-title,
.service-tags,
.expand-indicator,
.service-description,
.service-visual,
.service-cta {
  backface-visibility: hidden; /* Reduzir problemas de renderização */
  -webkit-font-smoothing: subpixel-antialiased; /* Melhorar renderização de texto */
}

/* Limitar height máximo para reduzir reflow */
.service-card:hover .service-content {
  max-height: 800px; /* Altura fixa, evita cálculos dinâmicos pesados */
}

/* Otimizações para dispositivos de baixo desempenho */
/* @media (prefers-reduced-motion: reduce) {
  .services-section,
  .services-section *,
  .service-card,
  .service-card * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .services-description,
  .services-title,
  .services-subtitle,
  .service-item {
    opacity: 1 !important;
    transform: none !important;
  }
} */

/* Fallback para garantir visibilidade */
.services-section.services-visible .services-description,
.services-section.services-visible .services-title,
.services-section.services-visible .services-subtitle {
  opacity: 1 !important;
  transform: none !important;
}