/**
 * MOTION CSS — Fancy Animations & Effects
 * Webflow-style scroll animations and interactions
 */

/* ============================================
   REDUCED MOTION — CRITICAL
   ============================================ */
@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-animate], .reveal, .parallax {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */
[data-animate] {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate="fade-up"] {
  transform: translateY(60px);
}

[data-animate="fade-down"] {
  transform: translateY(-60px);
}

[data-animate="fade-left"] {
  transform: translateX(60px);
}

[data-animate="fade-right"] {
  transform: translateX(-60px);
}

[data-animate="zoom-in"] {
  transform: scale(0.8);
}

[data-animate="zoom-out"] {
  transform: scale(1.2);
}

[data-animate="flip-up"] {
  transform: perspective(1000px) rotateX(20deg) translateY(40px);
}

[data-animate="flip-left"] {
  transform: perspective(1000px) rotateY(-20deg) translateX(40px);
}

[data-animate="blur-in"] {
  filter: blur(20px);
  transform: scale(0.95);
}

[data-animate].is-visible {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Animation delays */
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }
[data-delay="700"] { transition-delay: 700ms; }
[data-delay="800"] { transition-delay: 800ms; }

/* ============================================
   PARALLAX EFFECTS
   ============================================ */
.parallax-container {
  overflow: hidden;
}

[data-parallax] {
  will-change: transform;
  transition: transform 0.1s linear;
}

[data-parallax-bg] {
  position: absolute;
  inset: -20%;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* ============================================
   TEXT ANIMATIONS
   ============================================ */
.text-reveal {
  overflow: hidden;
  display: inline-block;
}

.text-reveal .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.text-reveal.is-visible .char {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger character delays */
.text-reveal .char:nth-child(1) { transition-delay: 0ms; }
.text-reveal .char:nth-child(2) { transition-delay: 20ms; }
.text-reveal .char:nth-child(3) { transition-delay: 40ms; }
.text-reveal .char:nth-child(4) { transition-delay: 60ms; }
.text-reveal .char:nth-child(5) { transition-delay: 80ms; }
.text-reveal .char:nth-child(6) { transition-delay: 100ms; }
.text-reveal .char:nth-child(7) { transition-delay: 120ms; }
.text-reveal .char:nth-child(8) { transition-delay: 140ms; }
.text-reveal .char:nth-child(9) { transition-delay: 160ms; }
.text-reveal .char:nth-child(10) { transition-delay: 180ms; }
.text-reveal .char:nth-child(n+11) { transition-delay: 200ms; }

/* Word reveal */
.word-reveal .word {
  display: inline-block;
  overflow: hidden;
}

.word-reveal .word-inner {
  display: inline-block;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Line reveal mask */
.line-reveal {
  overflow: hidden;
}

.line-reveal-inner {
  transform: translateY(110%);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.line-reveal.is-visible .line-reveal-inner {
  transform: translateY(0);
}

/* ============================================
   MAGNETIC BUTTON EFFECT
   ============================================ */
.btn-magnetic {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-magnetic::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-magnetic:hover::before {
  opacity: 1;
}

/* Shine effect */
.btn-shine {
  position: relative;
  overflow: hidden;
}

.btn-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -100%;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}

.btn-shine:hover::after {
  left: 150%;
}

/* ============================================
   CARD HOVER EFFECTS
   ============================================ */
.card-hover {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s ease;
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(16, 185, 129, 0.15);
}

.card-3d {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-3d:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(-5deg) translateZ(10px);
}

/* Image zoom on hover */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.img-zoom:hover img {
  transform: scale(1.1);
}

/* ============================================
   FLOATING ELEMENTS
   ============================================ */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(2deg); }
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(-15px) translateX(10px); }
  50% { transform: translateY(-5px) translateX(-5px); }
  75% { transform: translateY(-20px) translateX(-10px); }
}

@keyframes float-rotate {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-20px) rotate(360deg); }
}

.float { animation: float 6s ease-in-out infinite; }
.float-slow { animation: float-slow 10s ease-in-out infinite; }
.float-delay-1 { animation-delay: -2s; }
.float-delay-2 { animation-delay: -4s; }
.float-delay-3 { animation-delay: -6s; }

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes gradient-rotate {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
}

.gradient-text {
  background: linear-gradient(135deg, #10b981, #34d399, #6ee7b7, #10b981);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* ============================================
   GLOW EFFECTS
   ============================================ */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 40px rgba(16, 185, 129, 0.6); }
}

@keyframes border-glow {
  0%, 100% { border-color: rgba(16, 185, 129, 0.3); }
  50% { border-color: rgba(16, 185, 129, 0.8); }
}

.glow-pulse { animation: pulse-glow 2s ease-in-out infinite; }
.border-glow { animation: border-glow 2s ease-in-out infinite; }

/* ============================================
   MARQUEE / INFINITE SCROLL
   ============================================ */
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes marquee-reverse {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: inline-flex;
  animation: marquee 30s linear infinite;
}

.marquee-reverse .marquee-content {
  animation: marquee-reverse 30s linear infinite;
}

.marquee:hover .marquee-content {
  animation-play-state: paused;
}

/* ============================================
   SCROLL PROGRESS
   ============================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #34d399);
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* ============================================
   STAGGER ANIMATIONS
   ============================================ */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(7) { transition-delay: 600ms; opacity: 1; transform: none; }
.stagger-children.is-visible > *:nth-child(8) { transition-delay: 700ms; opacity: 1; transform: none; }

/* ============================================
   CUSTOM CURSOR
   ============================================ */
.custom-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 2px solid #10b981;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transition: transform 0.15s ease, width 0.2s ease, height 0.2s ease, background 0.2s ease;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}

.custom-cursor.hover {
  width: 50px;
  height: 50px;
  background: rgba(16, 185, 129, 0.2);
}

.custom-cursor.click {
  transform: translate(-50%, -50%) scale(0.8);
}

@media (pointer: coarse) {
  .custom-cursor { display: none; }
}

/* ============================================
   TILT EFFECT
   ============================================ */
[data-tilt] {
  transform-style: preserve-3d;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-tilt] > * {
  transform: translateZ(30px);
}

/* ============================================
   BLOB ANIMATIONS
   ============================================ */
@keyframes blob {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50% { border-radius: 50% 60% 30% 60% / 30% 40% 70% 50%; }
  75% { border-radius: 60% 40% 60% 30% / 70% 50% 40% 60%; }
}

.blob {
  animation: blob 8s ease-in-out infinite;
}

.blob-1 { animation-delay: 0s; }
.blob-2 { animation-delay: -2s; }
.blob-3 { animation-delay: -4s; }

/* ============================================
   NOISE TEXTURE OVERLAY
   ============================================ */
.noise-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
}

/* ============================================
   SPLIT IMAGE REVEAL
   ============================================ */
.split-reveal {
  position: relative;
  overflow: hidden;
}

.split-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #020617;
  transform-origin: right;
  transform: scaleX(1);
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.split-reveal.is-visible::after {
  transform: scaleX(0);
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  cursor: pointer;
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #10b981;
  color: #020617;
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

/* ============================================
   SECTION TRANSITIONS
   ============================================ */
.section {
  position: relative;
  padding: 6rem 0;
}

.section-divider {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
}

/* ============================================
   PILL / TAG STYLES
   ============================================ */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(100, 116, 139, 0.2);
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 9999px;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.pill:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.pill-primary {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
}

/* ============================================
   SECTION LABEL
   ============================================ */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 9999px;
  color: #10b981;
}

/* ============================================
   LEGACY SUPPORT (data-reveal)
   ============================================ */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
