/* =====================================================
   Immersive Effects & Rich Micro-interactions
   Advanced animations for depth, smoothness, and delight
   ===================================================== */

/* ===== Smooth Page Transitions ===== */
@keyframes pageLoad {
  from {
    opacity: 0;
    filter: blur(20px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

body {
  animation: pageLoad 0.8s cubic-bezier(0.23, 1, 0.32, 1) both;
}

/* ===== Enhanced Button States ===== */
.btn {
  position: relative;
  overflow: visible;
}

/* Glow effect removed - kept clean */

/* Press state with spring-like bounce */
.btn:active {
  animation: buttonPress 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(0.98);
  }
}

/* ===== Card Depth & Shadow Enhancement ===== */
.product-dropdown-card,
.industry-card,
.testimonial-card {
  position: relative;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* Layered shadow for depth */
@media (hover: hover) and (pointer: fine) {
  .product-dropdown-card:hover,
  .industry-card:hover {
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.05),
      0 4px 8px rgba(0, 0, 0, 0.08),
      0 12px 24px rgba(0, 0, 0, 0.12),
      0 24px 48px rgba(0, 0, 0, 0.15);
  }
}

/* ===== Text Reveal Animations ===== */
.section-title-center,
.section-title {
  overflow: hidden;
}

.section-title-center.in-view,
.section-title.in-view {
  animation: textRevealMask 800ms cubic-bezier(0.77, 0, 0.175, 1) both;
}

@keyframes textRevealMask {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* ===== Smooth Gradient Shifts ===== */
.hero-card {
  background: linear-gradient(135deg,
    rgba(0, 0, 0, 1) 0%,
    rgba(10, 10, 10, 1) 100%
  );
  transition: background 1s ease;
}

/* ===== Icon Animation Enhancement ===== */
.industry-icon-animated,
.product-dropdown-icon {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  transition: filter 300ms cubic-bezier(0.23, 1, 0.32, 1),
              transform 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

.industry-card:hover .industry-icon-animated {
  filter: drop-shadow(0 12px 24px rgba(230, 99, 0, 0.3));
}

/* ===== Smooth Scroll Snap Enhancement ===== */
.testimonials-scroll-wrapper {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ===== Enhanced Focus States ===== */
.btn:focus-visible,
.nav-list a:focus-visible,
.product-dropdown-card:focus-visible {
  outline: 3px solid var(--signal-orange);
  outline-offset: 4px;
  animation: focusPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes focusPulse {
  0%, 100% {
    outline-color: var(--signal-orange);
    outline-width: 3px;
  }
  50% {
    outline-color: var(--soft-orange);
    outline-width: 4px;
  }
}

/* ===== Ambient Background Motion ===== */
@keyframes subtleFloat {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(8px, -8px) rotate(2deg);
  }
  66% {
    transform: translate(-6px, -12px) rotate(-2deg);
  }
}

/* ===== Data Visualization Enhancements ===== */
.core-orb {
  position: relative;
}

.core-orb::after {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(230, 99, 0, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  animation: coreGlow 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes coreGlow {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

/* ===== Output Node Connection Lines (if you want to add them) ===== */
.unified-hub-canvas {
  position: relative;
}

/* ===== Loop Step Pulse ===== */
.loop-step .step-box {
  transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

.loop-step:hover .step-box {
  background: rgba(230, 99, 0, 0.05);
  border-color: var(--signal-orange);
  box-shadow: 0 8px 24px rgba(230, 99, 0, 0.15);
}

/* ===== Enhanced Badge Interaction ===== */
.badge {
  position: relative;
  overflow: hidden;
}

.badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 500ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .badge:hover::before {
    transform: translateX(100%);
  }
}

/* ===== Product Demo Smooth Transitions ===== */
.product-demo iframe {
  transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1),
              transform 400ms cubic-bezier(0.23, 1, 0.32, 1);
}

.product-demo.active iframe {
  animation: demoReveal 600ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

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

/* ===== Testimonial Scroll Momentum ===== */
.testimonials-track {
  transition: transform 400ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* ===== Layer Stack Depth Effect ===== */
.layer-stack .layer {
  position: relative;
}

.layer-stack .layer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(230, 99, 0, 0.02));
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .layer-stack .layer:hover::before {
    opacity: 1;
  }
}

/* ===== Enhanced Product Content Transitions ===== */
.product-content-item {
  transition: opacity 600ms cubic-bezier(0.23, 1, 0.32, 1),
              transform 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

/* ===== Smooth Link Hover with Underline ===== */
.link-arrow,
.product-link {
  position: relative;
  display: inline-block;
}

.link-arrow::after,
.product-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 350ms cubic-bezier(0.77, 0, 0.175, 1);
}

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

/* ===== Hero Layer Depth ===== */
.hero-3d-container {
  transform-style: preserve-3d;
  perspective: 1200px;
}

.hero-layer-back {
  transform: translateZ(-30px) scale(1.025);
}

.hero-layer-text {
  transform: translateZ(0);
}

.hero-layer-front {
  transform: translateZ(30px) scale(0.975);
}

/* ===== Scroll Progress Enhancement ===== */
.scroll-progress {
  transition: width 150ms cubic-bezier(0.23, 1, 0.32, 1);
  background: linear-gradient(90deg, var(--signal-orange), var(--soft-orange));
  box-shadow: 0 2px 8px rgba(230, 99, 0, 0.3);
}

/* ===== Final CTA Section Enhancement ===== */
.final-cta-container {
  position: relative;
}

.final-cta-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(230, 99, 0, 0.05) 0%, transparent 70%);
  pointer-events: none;
  animation: ctaGlow 6s ease-in-out infinite;
}

@keyframes ctaGlow {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

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

/* Only apply expensive effects on capable devices */
@media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
  .hero-3d-container,
  .product-dropdown-card,
  .industry-card {
    transform-style: preserve-3d;
  }
}

/* ===== Loading State for Images ===== */
img {
  transition: opacity 400ms cubic-bezier(0.23, 1, 0.32, 1),
              filter 400ms cubic-bezier(0.23, 1, 0.32, 1);
}

img:not([src]) {
  opacity: 0;
  filter: blur(10px);
}

/* ===== Enhanced Navigation Dropdown ===== */
.nav-dropdown {
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.products-dropdown-grid {
  display: grid;
  gap: 8px;
}

/* Stagger enhancement for dropdown items */
.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card {
  animation: dropdownItemReveal 350ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card:nth-child(1) {
  animation-delay: 0.05s;
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card:nth-child(2) {
  animation-delay: 0.1s;
}

.nav-dropdown-trigger[aria-expanded="true"] + .nav-dropdown .product-dropdown-card:nth-child(3) {
  animation-delay: 0.15s;
}

@keyframes dropdownItemReveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ===== Smooth Color Transitions ===== */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Override for animated elements */
[class*="animate-"],
.btn,
.product-demo,
img {
  transition-property: all;
}
