/* ============================================================
   EFFECTS — Animations, transitions, scroll-reveal, polish
   AIWork-Inspired — Multi-colour glow system
   Respects prefers-reduced-motion.
   ============================================================ */

/* ========== KEYFRAMES ========== */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.90); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-36px) skewX(2deg); }
  to   { opacity: 1; transform: translateX(0) skewX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(36px) skewX(-2deg); }
  to   { opacity: 1; transform: translateX(0) skewX(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
  50%      { box-shadow: 0 0 0 10px rgba(168, 85, 247, 0); }
}

@keyframes pulseCyan {
  0%, 100% { box-shadow: 0 0 0 0 rgba(24, 224, 199, 0.4); }
  50%      { box-shadow: 0 0 0 10px rgba(24, 224, 199, 0); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-4px) rotate(0.5deg); }
  66%      { transform: translateY(3px) rotate(-0.5deg); }
}

@keyframes drawLine {
  from { transform: scaleX(0); opacity: 0; }
  10%  { opacity: 1; }
  to   { transform: scaleX(1); opacity: 1; }
}

@keyframes glowPulseMulti {
  0%, 100% {
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.2), 0 0 40px rgba(24, 224, 199, 0.08);
  }
  50% {
    box-shadow: 0 0 44px rgba(168, 85, 247, 0.38), 0 0 88px rgba(24, 224, 199, 0.16);
  }
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Clip-path line reveal (agiledigital-inspired) */
@keyframes clipRevealX {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

/* Word/text lift */
@keyframes wordLift {
  from { opacity: 0; transform: translateY(18px) skewY(1deg); }
  to   { opacity: 1; transform: translateY(0) skewY(0); }
}

/* Border trace */
@keyframes borderTrace {
  from { width: 0; opacity: 0; }
  5%   { opacity: 1; }
  to   { width: 100%; opacity: 1; }
}

/* Scan line sweep */
@keyframes scanLine {
  0%   { transform: translateX(-100%); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateX(200%); opacity: 0; }
}

/* Scroll progress bar grow */
@keyframes progressGrow {
  from { width: 0%; }
}

/* Spotlight scale on entrance */
@keyframes spotEntrance {
  from { opacity: 0; transform: scale(0.95) translateY(20px); filter: blur(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* Number count up visual */
@keyframes numberReveal {
  from { transform: translateY(30px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Subtle spin for decorative elements */
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


/* ========== SCROLL PROGRESS BAR ========== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--gradient-primary);
  z-index: 100;
  transform-origin: left;
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(24, 224, 199, 0.5), 0 0 16px rgba(168, 85, 247, 0.3);
  pointer-events: none;
}

/* Glowing dot at the end */
.scroll-progress::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-purple);
  box-shadow: 0 0 8px var(--color-purple), 0 0 16px var(--color-purple);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.scroll-progress.active::after {
  opacity: 1;
}


/* ========== SCROLL REVEAL SYSTEM ========== */

[data-reveal] {
  opacity: 0;
  will-change: transform, opacity, filter;
}

[data-reveal="up"] {
  transform: translateY(40px);
  filter: blur(6px);
}

[data-reveal="down"] {
  transform: translateY(-24px);
  filter: blur(4px);
}

[data-reveal="left"] {
  transform: translateX(-40px) skewX(1deg);
  filter: blur(4px);
}

[data-reveal="right"] {
  transform: translateX(40px) skewX(-1deg);
  filter: blur(4px);
}

[data-reveal="scale"] {
  transform: scale(0.87);
  filter: blur(8px);
}

[data-reveal="fade"] {
  filter: blur(4px);
}

[data-reveal="slide-up-clip"] {
  clip-path: inset(0 0 100% 0);
  transform: translateY(20px);
  opacity: 1; /* clip handles visibility */
  filter: none;
}

/* Revealed state — spring easing for that premium bounce */
[data-reveal].is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translate(0) scale(1) skewX(0) skewY(0);
  clip-path: inset(0 0 0% 0);
  transition:
    opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    clip-path 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stagger children in grids */
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(32px);
  filter: blur(5px);
  will-change: transform, opacity, filter;
}

[data-reveal-stagger].is-visible > * {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  transition:
    opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Refined stagger delays — more natural cascade */
[data-reveal-stagger].is-visible > *:nth-child(1)  { transition-delay: 0ms; }
[data-reveal-stagger].is-visible > *:nth-child(2)  { transition-delay: 80ms; }
[data-reveal-stagger].is-visible > *:nth-child(3)  { transition-delay: 160ms; }
[data-reveal-stagger].is-visible > *:nth-child(4)  { transition-delay: 240ms; }
[data-reveal-stagger].is-visible > *:nth-child(5)  { transition-delay: 320ms; }
[data-reveal-stagger].is-visible > *:nth-child(6)  { transition-delay: 400ms; }
[data-reveal-stagger].is-visible > *:nth-child(7)  { transition-delay: 480ms; }
[data-reveal-stagger].is-visible > *:nth-child(8)  { transition-delay: 560ms; }
[data-reveal-stagger].is-visible > *:nth-child(9)  { transition-delay: 640ms; }
[data-reveal-stagger].is-visible > *:nth-child(10) { transition-delay: 720ms; }


/* ========== HERO ENTRANCE SEQUENCE ========== */

.hero [data-reveal] {
  transition-duration: 0.75s !important;
}

/* Hero badge floats gently */
.hero .badge-accent {
  animation: float 5s ease-in-out infinite;
  animation-delay: 2.5s;
  position: relative;
}

/* Hero sub-text: slightly delayed, softer spring */
.hero-sub {
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
}


/* ========== CARD HOVER EFFECTS ========== */

.card[data-tilt] {
  transform-style: preserve-3d;
  transition:
    transform 0.5s cubic-bezier(0.03, 0.98, 0.52, 0.99),
    border-color 0.3s var(--ease-default),
    box-shadow 0.5s var(--ease-default);
}

/* Multi-color shine sweep */
.card[data-tilt]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(168, 85, 247, 0.05) 42%,
    rgba(24, 224, 199, 0.08) 50%,
    rgba(59, 130, 246, 0.05) 58%,
    transparent 70%
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.4s var(--ease-default), background-position 0.4s var(--ease-default);
  pointer-events: none;
  z-index: 1;
}

.card[data-tilt]:hover::after {
  opacity: 1;
  animation: shimmer 1.6s ease-in-out;
}

.card[data-tilt]:hover {
  box-shadow:
    0 14px 48px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(168, 85, 247, 0.18);
}

/* Card bottom-border accent on hover */
.card::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--gradient-primary);
  transform: translateX(-50%);
  transition: width 0.5s var(--ease-spring);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.card:hover::before {
  width: 80%;
}

/* Don't double-apply on card-featured */
.card-featured::before {
  display: none;
}


/* ========== BUTTON EFFECTS ========== */

.btn {
  position: relative;
  overflow: hidden;
}

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* Primary gradient animated on hover */
.btn-primary {
  background-size: 200% 200%;
  background-image: var(--gradient-primary);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring);
}

.btn-primary:hover {
  animation: glowPulseMulti 2s ease-in-out infinite;
}

.btn-primary:active {
  animation: none;
  transform: scale(0.97) !important;
}

/* Outline accent sweep */
.btn-outline::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.08), rgba(24, 224, 199, 0.06), transparent);
  transition: left 0.55s var(--ease-default);
  pointer-events: none;
}

.btn-outline:hover::before {
  left: 100%;
}


/* ========== SECTION LABEL ENTRANCE ========== */

.section-label {
  display: inline-block;
  position: relative;
}

.section-label::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gradient-primary);
  transition: width 0.6s var(--ease-spring);
}

.is-visible .section-label::after,
.section-header.is-visible .section-label::after {
  width: 100%;
}


/* ========== PROCESS CONNECTOR DRAW ========== */

.process-connector-line {
  display: none;
}

@media (min-width: 768px) {
  .process-connector-line {
    display: block;
    position: absolute;
    top: 3rem;
    height: 2px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.4), rgba(168, 85, 247, 0.4));
    transform-origin: left center;
    transform: scaleX(0);
    z-index: 2;
  }

  .process-steps.is-visible .process-connector-line {
    animation: drawLine 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .process-connector-line:nth-of-type(1) {
    left: calc(16.67% + 2.5rem);
    width: calc(33.33% - 5rem);
  }

  .process-steps.is-visible .process-connector-line:nth-of-type(1) {
    animation-delay: 0.3s;
  }

  .process-connector-line:nth-of-type(2) {
    left: calc(50% + 2.5rem);
    width: calc(33.33% - 5rem);
  }

  .process-steps.is-visible .process-connector-line:nth-of-type(2) {
    animation-delay: 0.6s;
  }
}


/* ========== PRICING FEATURED CARD ========== */

.card-featured {
  animation: glowPulseMulti 3s ease-in-out infinite;
  animation-play-state: paused;
}

.card-featured.is-visible {
  animation-play-state: running;
}


/* ========== HERO VISUAL GLOW FOLLOW ========== */

.hero-visual {
  position: relative;
  overflow: hidden;
}

.hero-visual .glow-follow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-default);
  z-index: 0;
}

.hero-visual:hover .glow-follow {
  opacity: 1;
}


/* ========== ICON HOVER LIFT ========== */

.icon-box {
  transition:
    transform 0.35s var(--ease-spring),
    box-shadow 0.35s var(--ease-spring);
}

.card:hover .icon-box-accent {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(24, 224, 199, 0.3);
}

.card:hover .icon-box-purple {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3);
}

.card:hover .icon-box-danger {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 16px rgba(244, 63, 94, 0.25);
}


/* ========== HEADING UNDERLINE DRAW ========== */

/* Animate h2 underlines on reveal */
h2 {
  position: relative;
}

/* Section header H2 accent line */
.section-header h2::after {
  content: "";
  display: block;
  height: 2px;
  width: 0;
  background: var(--gradient-primary);
  border-radius: 2px;
  margin-top: var(--space-4);
  transition: width 0.8s var(--ease-spring);
  opacity: 0.35;
}

.section-header.is-visible h2::after {
  width: 3rem;
}


/* ========== SECTION DIVIDER GLOW ========== */

.final-cta::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-purple), var(--color-accent), transparent);
  z-index: 1;
  transition: width 1.2s var(--ease-spring);
}

.final-cta.is-visible::after {
  width: 400px;
}


/* ========== FOOTER LINK UNDERLINE DRAW ========== */

.footer-links a {
  position: relative;
}

.footer-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gradient-primary);
  transition: width 0.35s var(--ease-spring);
}

.footer-links a:hover::after {
  width: 100%;
}


/* ========== NAV LINK UNDERLINE ========== */

.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  transition: width 0.3s var(--ease-spring), left 0.3s var(--ease-spring);
}

.nav-link:hover::after {
  width: 100%;
  left: 0;
}

/* Active nav link */
.nav-link.active {
  color: var(--color-text);
}

.nav-link.active::after {
  width: 100%;
  left: 0;
  background: var(--gradient-primary);
  opacity: 0.7;
}


/* ========== ACCORDION SMOOTH CONTENT ========== */

.accordion-body {
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-item[data-open="true"] .accordion-trigger {
  color: var(--color-accent);
}


/* ========== PRICING AMOUNT COUNTER ========== */

.pricing-amount[data-count] {
  font-variant-numeric: tabular-nums;
  /* No paused animation here — visible by default, .counted triggers entrance */
}

.pricing-amount[data-count].counted {
  animation: numberReveal 0.6s var(--ease-spring) forwards;
}


/* ========== EARLY BOX BORDER SHIMMER ========== */

.early-box {
  position: relative;
  overflow: hidden;
}

.early-box::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.03), transparent);
  pointer-events: none;
  z-index: 2;
}

.early-box:hover::after {
  animation: scanLine 1.2s var(--ease-default) forwards;
}


/* ========== GRADIENT TEXT ANIMATION (hero) ========== */

.gradient-text-animated {
  background: linear-gradient(270deg, #18E0C7, #a855f7, #3b82f6, #18E0C7);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  animation: gradientShift 6s ease infinite;
}


/* ========== WORD REVEAL — agiledigital-style ========== */

/* Add [data-word-reveal] to any heading for staggered word animation */
[data-word-reveal] .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

[data-word-reveal] .word-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.65s var(--ease-spring);
}

[data-word-reveal].is-visible .word-inner {
  transform: translateY(0);
}

/* Stagger words */
[data-word-reveal].is-visible .word:nth-child(1) .word-inner { transition-delay: 0ms; }
[data-word-reveal].is-visible .word:nth-child(2) .word-inner { transition-delay: 50ms; }
[data-word-reveal].is-visible .word:nth-child(3) .word-inner { transition-delay: 100ms; }
[data-word-reveal].is-visible .word:nth-child(4) .word-inner { transition-delay: 150ms; }
[data-word-reveal].is-visible .word:nth-child(5) .word-inner { transition-delay: 200ms; }
[data-word-reveal].is-visible .word:nth-child(6) .word-inner { transition-delay: 250ms; }
[data-word-reveal].is-visible .word:nth-child(7) .word-inner { transition-delay: 300ms; }
[data-word-reveal].is-visible .word:nth-child(8) .word-inner { transition-delay: 350ms; }


/* ========== HERO PARTICLE GRID ========== */

.hero-particles canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.hero-particles canvas.active {
  opacity: 1;
}


/* ========== DELIVERABLES ITEM HOVER ========== */

.deliverables-item {
  transition: border-color 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring), transform 0.3s var(--ease-spring);
}

.deliverables-item:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent-20);
  box-shadow: 0 8px 24px rgba(24, 224, 199, 0.06), 0 0 0 1px rgba(24, 224, 199, 0.08);
}


/* ========== TRUST CARD HOVER ========== */

.trust-card {
  transition: border-color 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring), transform 0.3s var(--ease-spring);
}

.trust-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent-20);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(24, 224, 199, 0.1);
}


/* ========== PROCESS STEP HOVER ========== */

.process-step {
  transition:
    border-color 0.35s var(--ease-spring),
    box-shadow 0.35s var(--ease-spring),
    transform 0.35s var(--ease-spring);
}

.process-step:hover {
  transform: translateY(-4px);
  border-color: var(--color-blue-20);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.08);
}


/* ========== COMPARISON SLIDER GLOW ON DRAG ========== */

.comparison-slider.dragging .comparison-handle-grip {
  transform: scale(1.15);
  box-shadow: 0 0 32px rgba(168, 85, 247, 0.6), 0 0 64px rgba(24, 224, 199, 0.3), 0 2px 8px rgba(0, 0, 0, 0.4);
}


/* ========== ACCESSIBILITY: 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;
  }

  [data-reveal],
  [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
    clip-path: none !important;
  }

  .scroll-progress {
    display: none;
  }
}
