/* Global Premium Micro-Interactions & Hover Animation System */

/* Smooth Scroll and Selection */
html.scroll-smooth {
  scroll-behavior: smooth;
}

/* Page Transition Initial State */
body {
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.page-loaded {
  opacity: 1;
}

/* Progressive cursor hiding (only hides default cursor after mouse moves and on mouse devices) */
@media (pointer: fine) {
  .hide-default-cursor,
  .hide-default-cursor body,
  .hide-default-cursor a,
  .hide-default-cursor button,
  .hide-default-cursor select,
  .hide-default-cursor input,
  .hide-default-cursor textarea,
  .hide-default-cursor [role="button"],
  .hide-default-cursor .animate-card-hover,
  .hide-default-cursor .magnetic-btn {
    cursor: none !important;
  }
}

/* Custom Cursor Follower */
.custom-cursor-glow {
  position: fixed;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background 0.3s;
  will-change: transform, width, height;
  display: block; /* Visible if elements are injected */
}

.custom-cursor-dot {
  position: fixed;
  width: 18px;
  height: 18px;
  background: rgba(37, 99, 235, 0.15);
  border: 1.5px solid rgba(37, 99, 235, 0.6);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.25s, height 0.25s, background-color 0.25s, border-color 0.25s;
  will-change: transform, width, height, background-color, border-color;
  display: block; /* Visible if elements are injected */
}

/* Hide custom cursor on mobile/touch screens */
@media (pointer: coarse) {
  .custom-cursor-glow,
  .custom-cursor-dot {
    display: none !important;
  }
}

/* Hover active state (Stripe / Apple style hollow ring with center dot) */
.custom-cursor-active {
  width: 36px !important;
  height: 36px !important;
  background: rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.9) !important;
}

.custom-cursor-glow-active {
  width: 150px !important;
  height: 150px !important;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0) 70%) !important;
}

/* Magnetic Buttons base styles */
.magnetic-btn-wrap {
  display: inline-block;
  will-change: transform;
}

.magnetic-btn {
  position: relative;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.25s, background-color 0.25s;
  will-change: transform;
}

.magnetic-btn:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4), 0 8px 10px -6px rgba(37, 99, 235, 0.4);
}

/* Button Icon Slide */
.magnetic-btn svg {
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.magnetic-btn:hover svg {
  transform: translateX(4px);
}

/* Navigation Links */
.theme-nav-link {
  position: relative;
  transition: color 0.25s cubic-bezier(0.25, 1, 0.5, 1), transform 0.25s;
  will-change: transform, color;
}

.theme-nav-link:hover {
  color: #2563EB !important;
  transform: translateY(-2px);
}

/* Nav Link Underline */
.theme-nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #2563EB;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.theme-nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Persistent underline for current page */
.theme-nav-link.current-page::after {
  transform: scaleX(1);
}

/* Cards Hover System */
.animate-card-hover {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s, border-color 0.3s;
  will-change: transform, box-shadow, border-color;
  overflow: hidden;
}

.animate-card-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  transition: 0.75s;
  pointer-events: none;
}

.animate-card-hover:hover::before {
  left: 150%;
}

.animate-card-hover:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 25px rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.3) !important;
}

/* Text links */
a:not([class]) {
  position: relative;
  transition: color 0.25s ease;
}

a:not([class])::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

a:not([class]):hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Section Reveal system */
.reveal-section {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(8px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform, filter;
}

.reveal-section.revealed {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Staggered Child Reveal System */
.reveal-item {
  opacity: 0 !important;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: opacity, transform;
}

.revealed .reveal-item,
.revealed.reveal-item {
  opacity: 1 !important;
  transform: translateY(0) scale(1);
}

.revealed .reveal-item:nth-child(1) { transition-delay: 0.1s !important; }
.revealed .reveal-item:nth-child(2) { transition-delay: 0.2s !important; }
.revealed .reveal-item:nth-child(3) { transition-delay: 0.3s !important; }
.revealed .reveal-item:nth-child(4) { transition-delay: 0.4s !important; }
.revealed .reveal-item:nth-child(5) { transition-delay: 0.5s !important; }
.revealed .reveal-item:nth-child(6) { transition-delay: 0.6s !important; }
.revealed .reveal-item:nth-child(7) { transition-delay: 0.7s !important; }
.revealed .reveal-item:nth-child(8) { transition-delay: 0.8s !important; }

/* Headings reveal */
.reveal-heading {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

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

/* Blue highlighted words soft pulse */
.text-brand-500,
span.text-brand-500 {
  animation: glow-pulse 3s infinite ease-in-out;
}

@keyframes glow-pulse {
  0%, 100% {
    text-shadow: 0 0 0px rgba(37, 99, 235, 0);
  }
  50% {
    text-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
  }
}

/* Floating Images/Illustrations */
.floating-illustration {
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.floating-illustration:hover {
  transform: scale(1.02) rotate(1deg) translateY(-5px);
}

/* Icons */
.hover-icon-animate {
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), filter 0.3s;
  will-change: transform, filter;
}

.hover-icon-animate:hover {
  transform: scale(1.1) rotate(5deg);
  filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.5));
}

/* Form Inputs */
input, textarea {
  transition: border-color 0.25s, box-shadow 0.25s;
  will-change: border-color, box-shadow;
}

input:hover, textarea:hover {
  border-color: rgba(37, 99, 235, 0.5) !important;
}

input:focus, textarea:focus {
  border-color: #2563EB !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15) !important;
  outline: none;
}

/* Floating Radial Background Gradients */
.floating-ambient-gradient {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.08;
  will-change: transform;
}

/* Reusable Decorative Elements */
.large-blue-circle {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.10);
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

.small-blue-circle {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.18);
  filter: blur(35px);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

/* Reusable Animation Utility Classes */
.animate-float-small {
  animation: floatSmall 6s ease-in-out infinite;
}

.animate-float-large {
  animation: floatLarge 12s ease-in-out infinite;
}

.animate-pulse-soft {
  animation: pulseSoft 4s ease-in-out infinite;
}

.animate-glow {
  animation: glowPulse 2.5s ease-in-out infinite;
}

.animate-rotate {
  animation: rotateAll 20s linear infinite;
}

.animate-bounce-soft {
  animation: bounceSoft 3s ease-in-out infinite;
}

/* Keyframes */
@keyframes floatSmall {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes floatLarge {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-20px) translateX(10px); }
}

@keyframes pulseSoft {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(37, 99, 235, 0.2); }
  50% { box-shadow: 0 0 25px rgba(37, 99, 235, 0.5); }
}

@keyframes rotateAll {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Accessibility settings for users preferring reduced motion */
@media (prefers-reduced-motion: reduce) {
  body {
    opacity: 1 !important;
    transition: none !important;
  }
  
  .custom-cursor-glow,
  .custom-cursor-dot {
    display: none !important;
  }
  
  .magnetic-btn-wrap {
    transform: none !important;
  }
  
  .magnetic-btn:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  
  .magnetic-btn svg {
    transform: none !important;
  }
  
  .theme-nav-link:hover {
    transform: none !important;
  }
  
  .animate-card-hover:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: inherit !important;
  }
  
  .animate-card-hover::before {
    display: none !important;
  }
  
  .reveal-section {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
  
  .reveal-heading {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  
  .text-brand-500,
  span.text-brand-500 {
    animation: none !important;
    text-shadow: none !important;
  }
  
  .floating-illustration:hover {
    transform: none !important;
  }
  
  .hover-icon-animate:hover {
    transform: none !important;
    filter: none !important;
  }
  
  .animate-float-small,
  .animate-float-large,
  .animate-pulse-soft,
  .animate-glow,
  .animate-rotate,
  .animate-bounce-soft {
    animation: none !important;
    transform: none !important;
  }
  
  .large-blue-circle,
  .small-blue-circle {
    animation: none !important;
  }
}
