/* ============================================================
   FAVEL — Premium Animations
   Scroll reveals, micro-interactions, transitions
   ============================================================ */

/* ─── Reveal Animations (Scroll-triggered) ──────────────────── */
[data-reveal] {
  opacity: 0;
  transition-property: opacity, transform, filter;
  transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-duration: 700ms;
  will-change: opacity, transform;
}

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

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

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

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

[data-reveal="scale-up"] {
  transform: scale(0.9) translateY(20px);
}

[data-reveal="blur-in"] {
  filter: blur(10px);
  transform: translateY(20px);
}

[data-reveal].revealed {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  filter: none;
}

/* Staggered children */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 600ms ease, transform 600ms ease;
}

[data-stagger].revealed > *:nth-child(1) { transition-delay: 0ms;   opacity: 1; transform: none; }
[data-stagger].revealed > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: none; }
[data-stagger].revealed > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: none; }
[data-stagger].revealed > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: none; }
[data-stagger].revealed > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: none; }
[data-stagger].revealed > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: none; }

/* ─── Hero Animations ────────────────────────────────────────── */
@keyframes hero-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes hero-blob-1 {
  0%   { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50%  { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

@keyframes hero-blob-2 {
  0%   { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
  50%  { border-radius: 70% 30% 40% 60% / 60% 40% 50% 40%; }
  100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
}

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

.hero-blob-2 {
  animation: hero-blob-2 10s ease-in-out infinite;
}

.hero-float {
  animation: hero-float 5s ease-in-out infinite;
}

/* ─── Gradient Text Shimmer ──────────────────────────────────── */
@keyframes shimmer-text {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.text-shimmer {
  background: linear-gradient(270deg, #C084FC, #9333EA, #A855F7, #7C3AED, #C084FC);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer-text 4s ease infinite;
}

/* ─── Grain Noise Overlay ────────────────────────────────────── */
.noise-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
  border-radius: inherit;
}

/* ─── Particle Dots (Pure CSS) ───────────────────────────────── */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--purple-300);
  animation: particle-float linear infinite;
  opacity: 0;
}

@keyframes particle-float {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10px) scale(1); opacity: 0; }
}

/* ─── Card Hover 3D Effect ───────────────────────────────────── */
.card-3d {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.card-3d-inner {
  transition: transform 0.4s var(--ease-smooth);
  transform-style: preserve-3d;
}

/* ─── Glowing Border Animation ───────────────────────────────── */
@keyframes border-glow {
  0%, 100% { border-color: rgba(147,51,234,0.2); box-shadow: 0 0 0 rgba(147,51,234,0); }
  50%       { border-color: rgba(147,51,234,0.6); box-shadow: 0 0 20px rgba(147,51,234,0.25); }
}

.card-glow {
  animation: border-glow 3s ease-in-out infinite;
}

/* ─── Number Counter ─────────────────────────────────────────── */
.count-up {
  transition: none;
}

/* ─── Progress Bar ───────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--glass-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-cta);
  border-radius: var(--radius-full);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease-out) 0.3s;
}

.progress-fill.animated {
  transform: scaleX(1);
}

/* ─── Magnetic Button ────────────────────────────────────────── */
.btn-magnetic {
  transition: transform 0.2s var(--ease-smooth);
}

/* ─── Slide-in from Bottom (for modals) ─────────────────────── */
@keyframes slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* ─── Rotating Ring ──────────────────────────────────────────── */
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spin-reverse {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

.spin-slow    { animation: spin-slow 12s linear infinite; }
.spin-reverse { animation: spin-reverse 16s linear infinite; }

/* ─── Gradient Background Shift ─────────────────────────────── */
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

/* ─── Typewriter Cursor ──────────────────────────────────────── */
.typewriter::after {
  content: '|';
  animation: blink 0.8s step-end infinite;
  color: var(--purple-400);
  margin-left: 2px;
}

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

/* ─── Scale Hover ────────────────────────────────────────────── */
.hover-scale {
  transition: transform var(--duration-normal) var(--ease-bounce);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* ─── Tilt Hover Card ────────────────────────────────────────── */
.tilt-card {
  transition: transform 0.15s ease;
  transform-style: preserve-3d;
}

/* ─── Spotlight Hover ────────────────────────────────────────── */
.spotlight {
  position: relative;
  overflow: hidden;
}

.spotlight::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147,51,234,0.15) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.spotlight:hover::after {
  opacity: 1;
}

/* ─── Appear animations for page load ───────────────────────── */
@keyframes appear-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes appear-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes appear-scale {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

.appear-1 { animation: appear-up 0.6s ease forwards; animation-delay: 0.1s; opacity: 0; }
.appear-2 { animation: appear-up 0.6s ease forwards; animation-delay: 0.25s; opacity: 0; }
.appear-3 { animation: appear-up 0.6s ease forwards; animation-delay: 0.4s; opacity: 0; }
.appear-4 { animation: appear-up 0.6s ease forwards; animation-delay: 0.55s; opacity: 0; }
.appear-5 { animation: appear-fade 0.8s ease forwards; animation-delay: 0.7s; opacity: 0; }

/* ─── Underline Hover ────────────────────────────────────────── */
.underline-hover {
  position: relative;
  display: inline-block;
}

.underline-hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-cta);
  transition: width var(--duration-normal) var(--ease-smooth);
}

.underline-hover:hover::after {
  width: 100%;
}

/* ─── Diagonal line decoration ───────────────────────────────── */
.deco-lines {
  position: absolute;
  pointer-events: none;
  opacity: 0.06;
}

/* ─── Skip Link ──────────────────────────────────────────────── */
.skip-link {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple-600);
  color: white;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 99999;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: var(--space-4);
}

/* ─── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  [data-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
