/* ============================================================
   WM DIGITAL — ANIMATIONS.CSS
   Premium motion layer para wmdigital.pt
   Compatível: Chrome, Firefox, Safari, Edge (modern)
   Respeita: prefers-reduced-motion
   ============================================================ */

/* ── VARIÁVEIS DE ANIMAÇÃO ────────────────────────────────── */
:root {
  --ease-out-expo:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-premium:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out:     cubic-bezier(0.4, 0, 0.2, 1);
  --motion-fast:     0.2s;
  --motion-base:     0.4s;
  --motion-slow:     0.8s;
}

/* ============================================================
   PRELOADER
   ============================================================ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0a14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  transition: opacity 0.6s var(--ease-in-out), visibility 0.6s ease;
}
#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: preloader-breathe 1.8s ease-in-out infinite;
}
.preloader-logo-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(79, 70, 229, 0.5);
  box-shadow: 0 0 40px rgba(79, 70, 229, 0.4),
              0 0 80px rgba(124, 58, 237, 0.2);
  animation: preloader-glow 1.8s ease-in-out infinite alternate;
}
.preloader-wordmark {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #4f46e5, #7c3aed, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.preloader-bar-track {
  width: 180px;
  height: 2px;
  background: rgba(79, 70, 229, 0.12);
  border-radius: 2px;
  overflow: hidden;
}
.preloader-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #4f46e5, #a855f7);
  animation: preloader-fill 1.3s var(--ease-out-expo) forwards;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.6);
}
@keyframes preloader-fill {
  0%   { width: 0%; }
  40%  { width: 55%; }
  100% { width: 100%; }
}
@keyframes preloader-breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}
@keyframes preloader-glow {
  0%   { box-shadow: 0 0 30px rgba(79,70,229,0.4), 0 0 60px rgba(124,58,237,0.2); }
  100% { box-shadow: 0 0 50px rgba(79,70,229,0.7), 0 0 100px rgba(124,58,237,0.4); }
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #a855f7);
  z-index: 9998;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.7);
  pointer-events: none;
}

/* ============================================================
   CUSTOM CURSOR (apenas desktop com pointer fino)
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  body.custom-cursor-enabled * { cursor: none !important; }

  #cursor-dot {
    position: fixed;
    width: 7px;
    height: 7px;
    background: #4f46e5;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10001;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    box-shadow: 0 0 12px rgba(79, 70, 229, 0.9);
    will-change: left, top;
  }
  #cursor-ring {
    position: fixed;
    width: 36px;
    height: 36px;
    border: 1.5px solid rgba(79, 70, 229, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.35s var(--ease-spring),
                height 0.35s var(--ease-spring),
                border-color 0.3s ease,
                background-color 0.3s ease,
                opacity 0.3s ease;
    will-change: left, top;
  }
  #cursor-ring.hovering {
    width: 54px;
    height: 54px;
    border-color: rgba(79, 70, 229, 0.85);
    background-color: rgba(79, 70, 229, 0.07);
  }
  #cursor-ring.clicking {
    width: 26px;
    height: 26px;
    background-color: rgba(79, 70, 229, 0.2);
  }
  #cursor-dot.hidden-cursor,
  #cursor-ring.hidden-cursor {
    opacity: 0;
  }
}

/* ============================================================
   HERO — ANIMAÇÕES DE FUNDO E ORBS
   ============================================================ */

/* Gradient de fundo animado */
.hero-bg {
  animation: hero-bg-breathe 14s ease-in-out infinite alternate;
}
@keyframes hero-bg-breathe {
  0%   {
    background:
      radial-gradient(ellipse at 18% 52%, rgba(79, 70, 229, 0.18) 0%, transparent 62%),
      radial-gradient(ellipse at 82% 18%, rgba(124, 58, 237, 0.18) 0%, transparent 62%),
      var(--hero-base);
  }
  100% {
    background:
      radial-gradient(ellipse at 32% 42%, rgba(79, 70, 229, 0.22) 0%, transparent 60%),
      radial-gradient(ellipse at 68% 32%, rgba(168, 85, 247, 0.18) 0%, transparent 60%),
      var(--hero-base);
  }
}

/* Orbs flutuantes */
.orb-1 { animation: orb-drift-1 9s ease-in-out infinite alternate; }
.orb-2 { animation: orb-drift-2 11s ease-in-out infinite alternate; animation-delay: -4s; }
@keyframes orb-drift-1 {
  0%   { transform: translate(0px,   0px)   scale(1);    }
  33%  { transform: translate(25px, -18px)  scale(1.06); }
  66%  { transform: translate(-15px, 12px)  scale(0.97); }
  100% { transform: translate(18px, -28px)  scale(1.03); }
}
@keyframes orb-drift-2 {
  0%   { transform: translate(0px,   0px)   scale(1);    }
  33%  { transform: translate(-22px, 17px)  scale(1.05); }
  66%  { transform: translate(12px, -8px)   scale(0.98); }
  100% { transform: translate(-26px, 22px)  scale(1.04); }
}

/* ============================================================
   HERO — TEXT REVEAL (word by word)
   ============================================================ */
.hero-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.1; /* evitar corte */
}
.hero-word-inner {
  display: inline-block;
  transform: translateY(110%);
  opacity: 0;
  transition: transform var(--motion-slow) var(--ease-out-expo),
              opacity 0.5s ease;
}
.hero-word-inner.revealed {
  transform: translateY(0);
  opacity: 1;
}

/* Subheadline e CTAs — reveal via classe JS */
.hero-fade-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s ease, transform 0.75s var(--ease-out-expo);
}
.hero-fade-in.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   GENERIC SCROLL REVEALS
   ============================================================ */
.fade-up-on-scroll,
.fade-right-on-scroll,
.fade-left-on-scroll,
.fade-down-on-scroll,
.zoom-in-on-scroll {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.72s ease, transform 0.72s var(--ease-out-expo);
  will-change: opacity, transform;
}
.fade-right-on-scroll { transform: translateX(-22px); }
.fade-left-on-scroll { transform: translateX(22px); }
.fade-down-on-scroll { transform: translateY(-22px); }
.zoom-in-on-scroll { transform: scale(0.95); }

.fade-up-on-scroll.revealed,
.fade-right-on-scroll.revealed,
.fade-left-on-scroll.revealed,
.fade-down-on-scroll.revealed,
.zoom-in-on-scroll.revealed {
  opacity: 1;
  transform: none;
}

/* ============================================================
   GRADIENT TEXT — ANIMADO
   ============================================================ */
h1 .gradient-text,
h2 .gradient-text {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 30%, #a855f7 60%, #7c3aed 80%, #4f46e5 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-text-shift 6s ease-in-out infinite;
}
@keyframes gradient-text-shift {
  0%, 100% { background-position: 0% 50%;   }
  50%       { background-position: 100% 50%; }
}

/* ============================================================
   BOTÕES — RIPPLE + GLOW BORDER ANIMADO
   ============================================================ */
.btn-primary {
  position: relative;
  overflow: hidden;
  /* Isolate z-index */
  isolation: isolate;
}
/* Ripple span gerado por JS */
.btn-ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transform: scale(0);
  animation: ripple-expand 0.65s linear forwards;
  pointer-events: none;
  z-index: 0;
}
@keyframes ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}
/* Borda gradient giratória no hover */
.btn-primary::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7, #6366f1);
  background-size: 300% 300%;
  border-radius: inherit;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  animation: btn-border-spin 3s linear infinite;
}
.btn-primary:hover::before { opacity: 1; }
@keyframes btn-border-spin {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}
/* Conteúdo acima do ::before */
.btn-primary > * { position: relative; z-index: 1; }
.btn-primary > i,
.btn-primary > span { position: relative; z-index: 1; }

/* ============================================================
   SERVICE CARDS — TILT 3D + GLOW DINÂMICO
   ============================================================ */
.service-card {
  transform-style: preserve-3d;
  will-change: transform;
  /* transition override quando JS controla */
}
.service-card.tilt-reset {
  transition: transform 0.6s var(--ease-out-expo),
              box-shadow 0.4s ease,
              border-color 0.3s ease,
              background 0.3s ease !important;
  transform: perspective(900px) rotateX(0deg) rotateY(0deg) translateY(0) scale(1);
}

/* ============================================================
   CARD GLOW BORDER — ao hover
   ============================================================ */
.service-card {
  position: relative;
}
.service-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, #4f46e5, #7c3aed, #10b981, #4f46e5);
  background-size: 400% 400%;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s ease;
  animation: card-border-spin 5s linear infinite;
  border-radius: 16px; /* match rounded-2xl */
}
.service-card:hover::after { opacity: 0.7; }
@keyframes card-border-spin {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

/* ============================================================
   ÍCONES — FLOAT, PULSE, ROTATE
   ============================================================ */
.icon-float {
  display: inline-block;
  animation: icon-float-anim 3.2s ease-in-out infinite;
}
.icon-pulse {
  display: inline-block;
  animation: icon-pulse-anim 2.4s ease-in-out infinite;
}
@keyframes icon-float-anim {
  0%, 100% { transform: translateY(0px);  }
  50%       { transform: translateY(-7px); }
}
@keyframes icon-pulse-anim {
  0%, 100% { transform: scale(1);    opacity: 1;    }
  50%       { transform: scale(1.15); opacity: 0.82; }
}
/* Hover rotate em ícones nos card icons */
.service-card .icon-wrap {
  transition: transform 0.4s var(--ease-spring), background-color 0.3s ease;
}
.service-card:hover .icon-wrap {
  transform: rotate(6deg) scale(1.1);
}

/* ============================================================
   NAVBAR — SCROLL SPY ACTIVE LINK
   ============================================================ */
.nav-link {
  position: relative;
  transition: color 0.25s ease;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out-expo);
}
.nav-link.active {
  color: #ffffff !important;
}
.nav-link.active::after {
  transform: scaleX(1);
}

/* ============================================================
   PROCESSO — CONNECTOR LINE ANIMADO
   ============================================================ */
.process-step {
  position: relative;
}
/* Linha entre steps (apenas lg+) */
.process-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 31px; /* centro da box 64px */
  left: calc(50% + 32px);
  width: calc(100% - 32px);
  height: 2px;
  background: linear-gradient(90deg, rgba(79,70,229,0.7), rgba(79,70,229,0.1));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1s var(--ease-out-expo);
  z-index: 0;
}
.process-step:not(:last-child).line-active::after {
  transform: scaleX(1);
}
@media (max-width: 1023px) {
  .process-step::after { display: none !important; }
}

/* ============================================================
   STATS — CONTAINER POP
   ============================================================ */
.stat-item {
  transition: transform 0.3s var(--ease-spring);
}
.stat-item:hover {
  transform: scale(1.04);
}

/* ============================================================
   TESTEMUNHOS — HOVER ELEVAÇÃO
   ============================================================ */
.testimonial-card {
  transition: transform 0.45s var(--ease-spring),
              box-shadow 0.4s ease,
              border-color 0.3s ease !important;
}
.testimonial-card:hover {
  transform: translateY(-8px) scale(1.01) !important;
  box-shadow: 0 28px 52px rgba(79, 70, 229, 0.16) !important;
  border-color: rgba(79, 70, 229, 0.35) !important;
}

/* ============================================================
   FORMULÁRIO — FOCUS ENHANCED + VALIDAÇÃO VISUAL
   ============================================================ */
.form-input {
  transition: border-color 0.3s ease,
              box-shadow 0.3s ease,
              background-color 0.3s ease !important;
}
.form-input:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15),
              0 0 24px rgba(79, 70, 229, 0.08) !important;
}
.form-input.input-valid {
  border-color: rgba(16, 185, 129, 0.5) !important;
}
.form-input.input-error {
  border-color: rgba(248, 113, 113, 0.7) !important;
  animation: input-shake 0.4s var(--ease-spring);
}
@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

/* ============================================================
   LOGO — HOVER MICROINTERAÇÃO
   ============================================================ */
.logo-link {
  transition: transform 0.35s var(--ease-spring);
  display: inline-flex;
  align-items: center;
}
.logo-link:hover {
  transform: scale(1.04);
}
.logo-link img {
  transition: box-shadow 0.35s ease, transform 0.35s var(--ease-spring);
}
.logo-link:hover img {
  box-shadow: 0 0 22px rgba(79, 70, 229, 0.6);
  transform: rotate(-5deg);
}

/* ============================================================
   FLOATING BADGE (Sobre Nós)
   ============================================================ */
.floating-badge {
  animation: badge-bob 4.5s ease-in-out infinite;
}
@keyframes badge-bob {
  0%, 100% { transform: translateY(0px);  }
  50%       { transform: translateY(-9px); }
}

/* ============================================================
   LINKS DO FOOTER — UNDERLINE ANIMADO
   ============================================================ */
footer a:not(.logo-link):not([aria-label]) {
  position: relative;
  transition: color 0.25s ease;
}
footer a:not(.logo-link):not([aria-label])::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 1px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  transition: width 0.35s var(--ease-out-expo);
}
footer a:not(.logo-link):not([aria-label]):hover::after {
  width: 100%;
}

/* ============================================================
   SOCIAL ICONS — HOVER
   ============================================================ */
.social-icon-link {
  transition: transform 0.35s var(--ease-spring),
              background-color 0.3s ease !important;
}
.social-icon-link:hover {
  transform: translateY(-4px) scale(1.12);
}

/* ============================================================
   CONTACTO CARDS — HOVER LIFT
   ============================================================ */
.contact-card {
  transition: transform 0.4s var(--ease-spring),
              box-shadow 0.4s ease,
              border-color 0.3s ease !important;
}
.contact-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.14) !important;
  border-color: rgba(79, 70, 229, 0.35) !important;
}

/* ============================================================
   SECTION BADGES — HOVER
   ============================================================ */
.section-badge {
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
  cursor: default;
}
.section-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.2);
}

/* ============================================================
   SCROLL INDICATOR — HERO BOTTOM
   ============================================================ */
.scroll-indicator {
  animation: scroll-cue 2.2s ease-in-out infinite !important;
}
@keyframes scroll-cue {
  0%, 100% { transform: translateY(0) translateX(-50%); opacity: 0.5; }
  50%       { transform: translateY(9px) translateX(-50%); opacity: 1;   }
}

/* ============================================================
   STAGGER — CHILDREN REVEAL
   ============================================================ */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s var(--ease-out-expo);
}
[data-stagger].staggered > * { opacity: 1; transform: translateY(0); }
[data-stagger].staggered > *:nth-child(1) { transition-delay: 0ms;   }
[data-stagger].staggered > *:nth-child(2) { transition-delay: 90ms;  }
[data-stagger].staggered > *:nth-child(3) { transition-delay: 180ms; }
[data-stagger].staggered > *:nth-child(4) { transition-delay: 270ms; }
[data-stagger].staggered > *:nth-child(5) { transition-delay: 360ms; }
[data-stagger].staggered > *:nth-child(6) { transition-delay: 450ms; }

/* ============================================================
   WHATSAPP FLOAT — HOVER GLOW EXTRA
   ============================================================ */
.whatsapp-float {
  transition: transform 0.35s var(--ease-spring), box-shadow 0.3s ease !important;
}
.whatsapp-float:hover {
  transform: scale(1.15) translateY(-3px) !important;
  box-shadow: 0 16px 40px rgba(37, 211, 102, 0.5) !important;
}

/* ============================================================
   WIZARD OPT-CARD — HOVER PREMIUM (orcamento.html)
   ============================================================ */
.opt-card {
  transition: transform 0.3s var(--ease-spring),
              border-color 0.3s ease,
              background-color 0.3s ease,
              box-shadow 0.3s ease !important;
}
.opt-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.12);
}
.opt-card.selected {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2),
              0 8px 24px rgba(79, 70, 229, 0.12) !important;
}

/* ============================================================
   HERO BADGE — PULSE DOT
   ============================================================ */
.badge-live-dot {
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { transform: scale(1); opacity: 1;   }
  50%       { transform: scale(1.5); opacity: 0.6; }
}

/* ============================================================
   CTA FINAL (orcamento.html) — GLOW DE FUNDO
   ============================================================ */
.cta-glow {
  position: relative;
  overflow: hidden;
}
.cta-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(79,70,229,0.15), transparent 70%);
  animation: cta-glow-breathe 4s ease-in-out infinite alternate;
}
@keyframes cta-glow-breathe {
  0%   { opacity: 0.5; transform: scale(0.95); }
  100% { opacity: 1;   transform: scale(1.05); }
}

/* ============================================================
   PREFERS-REDUCED-MOTION — ACESSIBILIDADE
   ============================================================ */
@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;
  }
  .orb-1, .orb-2,
  .floating-badge,
  .scroll-indicator,
  .badge-live-dot,
  .icon-float,
  .icon-pulse,
  h1 .gradient-text,
  h2 .gradient-text,
  .hero-bg,
  .preloader-logo {
    animation: none !important;
  }
  #cursor-dot, #cursor-ring { display: none !important; }
  * { cursor: auto !important; }
  .hero-word-inner { transform: none; opacity: 1; }
  .hero-fade-in { opacity: 1; transform: none; }
  [data-stagger] > * { opacity: 1; transform: none; }
}
