/* =====================================================
   neoshare Motion & Animation System
   Based on Emil Kowalski's design engineering principles

   Key improvements:
   - Stronger easing curves (ease-out) for instant feedback
   - Faster stagger delays (50ms vs 100ms)
   - Button :active states with scale(0.97) for responsiveness
   - Hover states protected by @media (hover: hover)
   - Reduced durations (160ms-600ms range)
   - Card :active press feedback
   - Ripple animation starts from scale(0)
   ===================================================== */

/* ===== Animation Variables ===== */
:root {
  /* Timing Functions - Strong curves from easing.dev */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Durations */
  --duration-fast: 160ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 600ms;
}

/* ===== Page Load Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== Hero Entrance Animations ===== */
.hero-title {
  animation: fadeInUp var(--duration-slower) var(--ease-out) 0.2s both;
}

.hero-subtitle {
  animation: fadeInUp var(--duration-slower) var(--ease-out) 0.4s both;
}

.hero-ctas {
  animation: fadeInUp var(--duration-slower) var(--ease-out) 0.5s both;
}

.hero-proof {
  animation: fadeIn var(--duration-slower) var(--ease-out) 0.6s both;
}

/* ===== Scroll-Triggered Animations ===== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

.animate-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-scale.in-view {
  opacity: 1;
  transform: scale(1);
}

.animate-slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-slide-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

.animate-slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.animate-slide-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.stagger-children.in-view > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.in-view > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.in-view > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.in-view > *:nth-child(4) { transition-delay: 0.2s; }
.stagger-children.in-view > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.in-view > *:nth-child(6) { transition-delay: 0.3s; }

.stagger-children.in-view > * {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Button & Interactive Element Animations ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(var(--shadow-tint), 0.17);
  }

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

.btn:active {
  transform: scale(0.97);
}

/* Ripple effect */
@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.6;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  width: 20px;
  height: 20px;
  margin-top: -10px;
  margin-left: -10px;
  animation: ripple 600ms var(--ease-out);
  pointer-events: none;
}

/* ===== Card Hover Animations ===== */
.product-dropdown-card,
.industry-card,
.product-card,
.feature-card,
.audience-card {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out),
              background var(--duration-normal) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .product-dropdown-card:hover,
  .industry-card:hover,
  .product-card:hover,
  .feature-card:hover,
  .audience-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(var(--shadow-tint), 0.14);
  }
}

.product-dropdown-card:active,
.industry-card:active,
.product-card:active,
.feature-card:active,
.audience-card:active {
  transform: scale(0.98);
}

/* ===== Navigation Animations ===== */
.nav {
  transition: transform var(--duration-normal) var(--ease-out),
              opacity var(--duration-normal) var(--ease-out);
}

.nav-dropdown {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              visibility 0s linear var(--duration-fast);
  visibility: hidden;
  pointer-events: none;
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown {
  opacity: 1;
  transform: scale(1);
  transition-delay: 0s;
  visibility: visible;
  pointer-events: auto;
}

/* Stagger dropdown items */
.nav-dropdown-content .product-dropdown-card {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card:nth-child(1) {
  transition-delay: 0.03s;
  opacity: 1;
  transform: translateY(0);
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card:nth-child(2) {
  transition-delay: 0.06s;
  opacity: 1;
  transform: translateY(0);
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card:nth-child(3) {
  transition-delay: 0.09s;
  opacity: 1;
  transform: translateY(0);
}

/* ===== Link Animations ===== */
.link-arrow {
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
}

.link-arrow::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-normal) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .link-arrow:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* ===== Product Image Transitions ===== */
.product-image {
  transition: opacity 0.5s var(--ease-out),
              transform 0.5s var(--ease-out);
}

.product-image.active {
  animation: imageReveal 0.5s var(--ease-out);
}

@keyframes imageReveal {
  from {
    opacity: 0;
    transform: scale(0.98);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

/* ===== Parallax Effects ===== */
.parallax-slow {
  transition: transform 0.1s linear;
}

/* ===== Loading States ===== */
@keyframes shimmerLoad {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 1000px 100%;
  animation: shimmerLoad 2s infinite linear;
}

/* ===== Pulse Animations ===== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s var(--ease-smooth) infinite;
}

/* ===== Bounce Animation ===== */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.bounce {
  animation: bounce 2s var(--ease-smooth) infinite;
}

/* ===== Rotate Animation ===== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 1s linear infinite;
}

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

  .animate-on-scroll,
  .animate-scale,
  .animate-slide-left,
  .animate-slide-right {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ===== Badge Animations ===== */
.badge {
  transition: transform var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .badge:hover {
    transform: translateY(-2px);
  }
}

/* ===== Text Link Hover Enhancement ===== */
.product-link {
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
}

.product-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-normal) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .product-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* ===== Logo Animation ===== */
.logo-image {
  transition: transform var(--duration-normal) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .wordmark:hover .logo-image {
    transform: scale(1.05);
  }
}

/* ===== Floating Animation for Subtle Elements ===== */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* ===== Image Zoom on Hover ===== */
.product-image-wrapper {
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.product-image-wrapper .product-image {
  transition: transform 0.4s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .product-image-wrapper:hover .product-image {
    transform: scale(1.02);
  }
}

/* ===== Smooth Opacity Transitions ===== */
.fade-transition {
  transition: opacity var(--duration-normal) var(--ease-smooth);
}

/* ===== Video Background Smooth Load ===== */
.hero-video,
.atlas-hero-video {
  opacity: 0;
  animation: fadeIn 1s ease-in forwards;
  animation-delay: 0.3s;
}

/* ===== Performance Optimizations ===== */
.will-animate {
  will-change: transform, opacity;
}

.animate-on-scroll.in-view,
.btn:hover,
.product-dropdown-card:hover,
.industry-card:hover {
  will-change: auto;
}

/* ===== Stagger Grid Items ===== */
.industries-grid {
  display: grid;
}

.industries-grid .industry-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-smooth),
              transform var(--duration-slow) var(--ease-smooth);
}

.industries-grid.in-view .industry-card:nth-child(1) {
  transition-delay: 0.1s;
  opacity: 1;
  transform: translateY(0);
}

.industries-grid.in-view .industry-card:nth-child(2) {
  transition-delay: 0.2s;
  opacity: 1;
  transform: translateY(0);
}

.industries-grid.in-view .industry-card:nth-child(3) {
  transition-delay: 0.3s;
  opacity: 1;
  transform: translateY(0);
}

/* ===== Section Title Animations ===== */
.section-title,
.section-title-center {
  transition: opacity var(--duration-slow) var(--ease-smooth),
              transform var(--duration-slow) var(--ease-smooth);
}

/* ===== CTA Button Group Stagger ===== */
.hero-ctas .btn:nth-child(1) {
  animation-delay: 0.6s;
}

.hero-ctas .btn:nth-child(2) {
  animation-delay: 0.7s;
}

.final-cta-actions .btn:nth-child(1) {
  transition-delay: 0.1s;
}

.final-cta-actions .btn:nth-child(2) {
  transition-delay: 0.2s;
}
