/* ===========================
   HUSHIKO Magic Effects CSS
   Advanced animations & effects
   2025-11-27
   =========================== */

/* ===========================
   1. HERO - Animated Gradient Mesh
   =========================== */

/* Hero section - full width gradient background */
section.hero {
  position: relative;
  overflow: hidden;
  background: var(--color-cream);
  max-width: none !important;
  width: 100%;
  padding-left: calc((100vw - 1200px) / 2 + var(--spacing-md));
  padding-right: calc((100vw - 1200px) / 2 + var(--spacing-md));
}

@media (max-width: 1264px) {
  section.hero {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
  }
}

/* Animated gradient mesh background */
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse 40% 30% at 20% 30%, rgba(155, 135, 217, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 35% 25% at 75% 70%, rgba(255, 159, 102, 0.2) 0%, transparent 70%),
    radial-gradient(ellipse 30% 20% at 50% 50%, rgba(244, 166, 184, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 45% 35% at 85% 20%, rgba(90, 185, 234, 0.12) 0%, transparent 70%);
  animation: gradientMeshMove 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes gradientMeshMove {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(2%, 3%) rotate(1deg);
  }
  50% {
    transform: translate(-1%, 2%) rotate(-1deg);
  }
  75% {
    transform: translate(1%, -2%) rotate(0.5deg);
  }
}

/* Floating sparkles/stars */
.hero-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(155, 135, 217, 0.6) 50%, transparent 70%);
  border-radius: 50%;
  animation: sparkleFloat 4s ease-in-out infinite;
  opacity: 0;
}

.sparkle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 5s; }
.sparkle:nth-child(2) { left: 25%; top: 60%; animation-delay: 0.5s; animation-duration: 4.5s; }
.sparkle:nth-child(3) { left: 45%; top: 15%; animation-delay: 1s; animation-duration: 5.5s; }
.sparkle:nth-child(4) { left: 60%; top: 75%; animation-delay: 1.5s; animation-duration: 4s; }
.sparkle:nth-child(5) { left: 80%; top: 35%; animation-delay: 2s; animation-duration: 6s; }
.sparkle:nth-child(6) { left: 15%; top: 80%; animation-delay: 2.5s; animation-duration: 5s; }
.sparkle:nth-child(7) { left: 70%; top: 50%; animation-delay: 3s; animation-duration: 4.5s; }
.sparkle:nth-child(8) { left: 90%; top: 10%; animation-delay: 0.8s; animation-duration: 5.2s; }
.sparkle:nth-child(9) { left: 35%; top: 40%; animation-delay: 1.8s; animation-duration: 4.8s; }
.sparkle:nth-child(10) { left: 55%; top: 90%; animation-delay: 2.8s; animation-duration: 5.8s; }

@keyframes sparkleFloat {
  0%, 100% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }
  80% {
    opacity: 1;
    transform: translateY(-30px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.5);
  }
}

/* Hero content z-index fix */
.hero-content,
.hero-image {
  position: relative;
  z-index: 2;
}

/* Animated hero image */
.hero-fairy-img {
  animation: heroImageFloat 6s ease-in-out infinite;
  filter: drop-shadow(0 20px 40px rgba(155, 135, 217, 0.3));
}

@keyframes heroImageFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(1deg);
  }
}

/* ===========================
   2. MAGNETIC CTA BUTTONS
   =========================== */

.btn-magnetic {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Liquid blob effect on hover */
.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.3) 60deg,
    transparent 120deg
  );
  animation: buttonShine 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover::after {
  opacity: 1;
}

@keyframes buttonShine {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Animated border gradient */
.btn-animated-border {
  position: relative;
  background: var(--color-white);
  z-index: 1;
}

.btn-animated-border::before {
  content: '';
  position: absolute;
  inset: -3px;
  background: linear-gradient(90deg,
    var(--color-purple),
    var(--color-orange),
    var(--color-pink),
    var(--color-purple)
  );
  background-size: 300% 100%;
  border-radius: inherit;
  z-index: -1;
  animation: borderGradient 4s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-animated-border:hover::before {
  opacity: 1;
}

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

/* Bounce on click */
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

/* ===========================
   3. GLASSMORPHISM FEATURE CARDS
   =========================== */

.feature {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 8px 32px rgba(155, 135, 217, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.feature:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow:
    0 20px 60px rgba(155, 135, 217, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  transform: translateY(-10px) rotateX(2deg) rotateY(-2deg);
}

/* 3D tilt effect on hover (JavaScript enhanced) */
.feature.tilt-active {
  transition: transform 0.1s ease-out;
}

/* Feature icon glow */
.feature-icon {
  position: relative;
}

.feature-icon::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(155, 135, 217, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 50%;
  z-index: -1;
}

.feature:hover .feature-icon::after {
  opacity: 1;
  animation: iconGlow 2s ease-in-out infinite;
}

@keyframes iconGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* Staggered animation on scroll */
.feature:nth-child(1) { animation-delay: 0s; }
.feature:nth-child(2) { animation-delay: 0.1s; }
.feature:nth-child(3) { animation-delay: 0.2s; }
.feature:nth-child(4) { animation-delay: 0.3s; }
.feature:nth-child(5) { animation-delay: 0.4s; }
.feature:nth-child(6) { animation-delay: 0.5s; }

/* ===========================
   4. ANIMATED COUNTERS (Social Proof)
   =========================== */

.social-proof {
  position: relative;
}

/* Animated sparkle overlay */
.social-proof::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 100px 100px, 150px 150px, 80px 80px;
  animation: sparkleOverlay 20s linear infinite;
  pointer-events: none;
}

@keyframes sparkleOverlay {
  from { background-position: 0 0, 50px 50px, 25px 25px; }
  to { background-position: 100px 100px, 150px 150px, 105px 105px; }
}

.stat-item {
  position: relative;
}

/* Counter number animation */
.stat-value {
  display: inline-block;
  background: linear-gradient(135deg, var(--color-white) 0%, rgba(255, 255, 255, 0.9) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Pulse effect on counter */
.stat-value.counting {
  animation: counterPulse 0.1s ease;
}

@keyframes counterPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Decorative rings around stats */
.stat-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: all 0.4s ease;
}

.stat-item:hover::before {
  opacity: 1;
  width: 140px;
  height: 140px;
}

/* ===========================
   5. HOW IT WORKS - Timeline
   =========================== */

.how-it-works {
  position: relative;
}

/* Timeline connector line */
.steps::before {
  content: '';
  position: absolute;
  top: 60px;
  left: 50%;
  width: calc(100% - 200px);
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-purple-light) 10%,
    var(--color-purple-light) 90%,
    transparent 100%
  );
  transform: translateX(-50%);
  z-index: 0;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .steps::before {
    display: none;
  }
}

/* Step cards enhancement */
.step {
  position: relative;
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.step:hover {
  transform: translateY(-8px);
}

/* Step number animated ring */
.step-number {
  position: relative;
}

.step-number::before {
  content: '';
  position: absolute;
  inset: -8px;
  border: 2px dashed var(--color-purple-light);
  border-radius: 50%;
  opacity: 0;
  animation: none;
}

.step:hover .step-number::before {
  opacity: 1;
  animation: stepRingSpin 8s linear infinite;
}

@keyframes stepRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Step image enhancement */
.step-image {
  position: relative;
  overflow: hidden;
}

.step-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(155, 135, 217, 0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.step:hover .step-image::after {
  opacity: 1;
}

/* ===========================
   6. TESTIMONIALS ENHANCEMENT
   =========================== */

.testimonial {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Quote decoration */
.testimonial::before {
  content: '"';
  position: absolute;
  top: -20px;
  left: 10px;
  font-size: 8rem;
  font-family: Georgia, serif;
  color: var(--color-purple);
  opacity: 0.08;
  line-height: 1;
  pointer-events: none;
}

.testimonial:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 25px 50px rgba(155, 135, 217, 0.15),
    0 10px 20px rgba(0, 0, 0, 0.05);
}

/* Stars animation */
.stars {
  display: flex;
  gap: 2px;
  margin-bottom: 1rem;
}

.star {
  display: inline-block;
  color: #FFD700;
  animation: starPop 0.3s ease backwards;
}

.star:nth-child(1) { animation-delay: 0.1s; }
.star:nth-child(2) { animation-delay: 0.2s; }
.star:nth-child(3) { animation-delay: 0.3s; }
.star:nth-child(4) { animation-delay: 0.4s; }
.star:nth-child(5) { animation-delay: 0.5s; }

@keyframes starPop {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Testimonial image glow - DISABLED (visual artifact) */
/*
.testimonial-image {
  position: relative;
}

.testimonial-image::after {
  content: '';
  position: absolute;
  inset: -5px;
  background: var(--gradient-magic);
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.testimonial:hover .testimonial-image::after {
  opacity: 0.5;
}
*/

/* ===========================
   7. FOOTER WAVE DIVIDER
   =========================== */

.footer {
  position: relative;
  margin-top: 80px;
  padding-top: 20px;
}

.footer-wave {
  position: absolute;
  top: -80px;
  left: 0;
  width: 100%;
  height: 80px;
  overflow: hidden;
}

.footer-wave svg {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.footer-wave-path {
  fill: var(--color-gray-900);
}

/* Animated wave */
.footer-wave-animated {
  animation: waveMove 10s ease-in-out infinite;
}

@keyframes waveMove {
  0%, 100% { d: path('M0,40 C200,80 400,0 600,40 C800,80 1000,0 1200,40 L1200,80 L0,80 Z'); }
  50% { d: path('M0,40 C200,0 400,80 600,40 C800,0 1000,80 1200,40 L1200,80 L0,80 Z'); }
}

/* Footer gradient overlay */
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(155, 135, 217, 0.05) 0%, transparent 100%);
  pointer-events: none;
}

/* ===========================
   8. SCROLL-TRIGGERED ANIMATIONS
   =========================== */

/* FALLBACK: If JS doesn't load, show content with smooth fade */
@keyframes forceReveal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}

/* Initial hidden state for scroll animations */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: forceReveal 0.6s 0.2s forwards; /* Fallback: show after 0.2s */
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Different animation variants */
.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  animation: forceReveal 0.6s 0.3s forwards;
}

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(40px);
  animation: forceReveal 0.6s 0.4s forwards;
}

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  animation: forceReveal 0.6s 0.3s forwards;
}

.scroll-reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children */
.scroll-reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: forceReveal 0.5s calc(0.2s + var(--child-index, 0) * 0.1s) forwards;
}
.scroll-reveal-stagger > *:nth-child(1) { --child-index: 0; }
.scroll-reveal-stagger > *:nth-child(2) { --child-index: 1; }
.scroll-reveal-stagger > *:nth-child(3) { --child-index: 2; }
.scroll-reveal-stagger > *:nth-child(4) { --child-index: 3; }
.scroll-reveal-stagger > *:nth-child(5) { --child-index: 4; }
.scroll-reveal-stagger > *:nth-child(6) { --child-index: 5; }

.scroll-reveal-stagger.revealed > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(5) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(6) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(7) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(8) { transition-delay: 0.7s; opacity: 1; transform: translateY(0); }
.scroll-reveal-stagger.revealed > *:nth-child(9) { transition-delay: 0.8s; opacity: 1; transform: translateY(0); }

/* ===========================
   9. PRICING CARDS ENHANCEMENT
   =========================== */

.pricing-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Shine effect on featured card */
.pricing-card.featured::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  animation: pricingShine 4s ease-in-out infinite;
}

@keyframes pricingShine {
  0% { transform: translateX(-100%) translateY(-100%); }
  100% { transform: translateX(100%) translateY(100%); }
}

/* Price number animation */
.price {
  position: relative;
  display: inline-block;
}

.price::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 100%;
  height: 8px;
  background: var(--color-purple);
  opacity: 0.2;
  border-radius: 4px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.pricing-card:hover .price::after {
  transform: scaleX(1);
}

/* ===========================
   10. CTA FINAL ENHANCEMENT
   =========================== */

.cta-final {
  position: relative;
  overflow: hidden;
}

/* Animated particles */
.cta-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cta-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: particleRise 8s linear infinite;
}

.cta-particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.cta-particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.cta-particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.cta-particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.cta-particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.cta-particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.cta-particle:nth-child(7) { left: 70%; animation-delay: 6s; }
.cta-particle:nth-child(8) { left: 80%; animation-delay: 7s; }
.cta-particle:nth-child(9) { left: 90%; animation-delay: 0.5s; }
.cta-particle:nth-child(10) { left: 15%; animation-delay: 2.5s; }

@keyframes particleRise {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(80vh) scale(1);
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-20vh) scale(0.5);
    opacity: 0;
  }
}

/* ===========================
   11. CURSOR EFFECTS
   =========================== */

/* Custom cursor on interactive elements */
.btn-primary,
.btn-secondary,
.feature,
.pricing-card,
.faq-question {
  cursor: pointer;
}

/* ===========================
   12. LOADING STATES
   =========================== */

.skeleton {
  background: linear-gradient(90deg,
    var(--color-gray-200) 25%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* ===========================
   13. RESPONSIVE ADJUSTMENTS
   =========================== */

@media (max-width: 768px) {
  .hero::before {
    animation-duration: 30s;
  }

  .sparkle {
    width: 6px;
    height: 6px;
  }

  .feature {
    backdrop-filter: blur(5px);
  }

  .pricing-card.featured::before {
    animation: none;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .hero::before,
  .sparkle,
  .hero-fairy-img,
  .btn-primary::after,
  .btn-animated-border::before,
  .feature-icon::after,
  .social-proof::after,
  .step-number::before,
  .pricing-card.featured::before,
  .cta-particle,
  .footer-wave-animated,
  .skeleton {
    animation: none !important;
  }

  .scroll-reveal,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .scroll-reveal-scale {
    opacity: 1;
    transform: none;
  }
}
