/**
 * Premium Animation Styles - Ophiram Inspired
 * Sophisticated animations and transitions for QVG Capital theme
 */

/* ============================================
   Core Animation Variables
   ============================================ */

:root {
  /* Premium Easing Functions */
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Animation Durations */
  --duration-instant: 0.1s;
  --duration-fast: 0.2s;
  --duration-normal: 0.4s;
  --duration-slow: 0.6s;
  --duration-slower: 0.8s;
  --duration-slowest: 1.2s;
}

/* ============================================
   Page Load Animation
   ============================================ */

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

body {
  animation: pageReveal 0.6s var(--ease-out-quart);
}

/* ============================================
   Text Reveal Animations (Ophiram Style)
   ============================================ */

/* Clip-path reveal from bottom */
@keyframes textRevealUp {
  from {
    clip-path: inset(100% 0 0 0);
    transform: translateY(20px);
  }
  to {
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
  }
}

/* Character-by-character reveal */
@keyframes charReveal {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Elegant fade and slide */
@keyframes elegantReveal {
  from {
    opacity: 0;
    transform: translateY(60px);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.text-reveal {
  animation: textRevealUp 0.8s var(--ease-out-expo) both;
}

.text-reveal-delay-1 { animation-delay: 0.1s; }
.text-reveal-delay-2 { animation-delay: 0.2s; }
.text-reveal-delay-3 { animation-delay: 0.3s; }
.text-reveal-delay-4 { animation-delay: 0.4s; }

.elegant-reveal {
  animation: elegantReveal 1s var(--ease-out-expo) both;
}

/* ============================================
   Hero Section Animations
   ============================================ */

@keyframes heroTitleReveal {
  from {
    opacity: 0;
    transform: translateY(80px) scale(0.95);
    letter-spacing: 0.3em;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    letter-spacing: 0.05em;
  }
}

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

@keyframes heroLineExpand {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

.hero-title {
  animation: heroTitleReveal 1.2s var(--ease-out-expo) both;
}

.hero-tagline {
  animation: heroSubtitleReveal 1s var(--ease-out-expo) 0.3s both;
}

.hero-line {
  transform-origin: left center;
  animation: heroLineExpand 0.8s var(--ease-out-expo) 0.5s both;
}

/* ============================================
   Scroll-Triggered Animations (Enhanced AOS)
   ============================================ */

/* Premium fade up */
[data-aos="premium-fade-up"] {
  opacity: 0;
  transform: translateY(60px);
  transition-property: opacity, transform;
  transition-timing-function: var(--ease-out-expo);
}

[data-aos="premium-fade-up"].aos-animate {
  opacity: 1;
  transform: translateY(0);
}

/* Premium fade with blur */
[data-aos="fade-blur"] {
  opacity: 0;
  filter: blur(15px);
  transform: translateY(30px);
  transition-property: opacity, filter, transform;
  transition-timing-function: var(--ease-out-expo);
}

[data-aos="fade-blur"].aos-animate {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* Scale reveal */
[data-aos="scale-reveal"] {
  opacity: 0;
  transform: scale(0.9);
  transition-property: opacity, transform;
  transition-timing-function: var(--ease-out-back);
}

[data-aos="scale-reveal"].aos-animate {
  opacity: 1;
  transform: scale(1);
}

/* Slide from left with fade */
[data-aos="slide-fade-left"] {
  opacity: 0;
  transform: translateX(-80px);
  transition-property: opacity, transform;
  transition-timing-function: var(--ease-out-expo);
}

[data-aos="slide-fade-left"].aos-animate {
  opacity: 1;
  transform: translateX(0);
}

/* Slide from right with fade */
[data-aos="slide-fade-right"] {
  opacity: 0;
  transform: translateX(80px);
  transition-property: opacity, transform;
  transition-timing-function: var(--ease-out-expo);
}

[data-aos="slide-fade-right"].aos-animate {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered children animation */
[data-aos="stagger-children"] > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

[data-aos="stagger-children"].aos-animate > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
[data-aos="stagger-children"].aos-animate > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
[data-aos="stagger-children"].aos-animate > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
[data-aos="stagger-children"].aos-animate > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
[data-aos="stagger-children"].aos-animate > *:nth-child(5) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
[data-aos="stagger-children"].aos-animate > *:nth-child(6) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }

/* ============================================
   Premium Hover Effects
   ============================================ */

/* Sophisticated card hover */
.card-premium {
  position: relative;
}

.card-premium::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0, 169, 157, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out-expo);
  pointer-events: none;
}

/* Only apply transitions after AOS animation completes */
.card-premium.aos-animate {
  transition: transform 0.3s var(--ease-out-expo),
              box-shadow 0.3s var(--ease-out-expo);
}

.card-premium.aos-animate:hover {
  transform: translateY(-12px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}

.card-premium.aos-animate:hover::before {
  opacity: 1;
}

/* Fallback hover styles for non-AOS scenarios */
.card-premium:not([data-aos]):hover {
  transform: translateY(-12px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s var(--ease-out-expo),
              box-shadow 0.3s var(--ease-out-expo);
}

.card-premium:not([data-aos]):hover::before {
  opacity: 1;
}

/* Magnetic hover effect (subtle) */
.magnetic-hover {
  transition: transform 0.3s var(--ease-out-quart);
}

/* Image reveal on scroll */
.image-reveal {
  position: relative;
  overflow: hidden;
}

.image-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-navy);
  transform-origin: left;
  transition: transform 1s var(--ease-out-expo);
}

.image-reveal.revealed::after {
  transform: scaleX(0);
  transform-origin: right;
}

.image-reveal img {
  transform: scale(1.2);
  transition: transform 1.2s var(--ease-out-expo);
}

.image-reveal.revealed img {
  transform: scale(1);
}

/* ============================================
   Button Animations (Premium)
   ============================================ */

.btn-premium {
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: color 0.4s var(--ease-out-expo), transform 0.3s var(--ease-out-expo), box-shadow 0.3s var(--ease-out-expo);
}

.btn-premium::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-teal);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out-expo);
  z-index: -1;
}

.btn-premium:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.btn-premium:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 169, 157, 0.3);
}

/* Outline button with fill animation */
.btn-outline-premium {
  position: relative;
  overflow: hidden;
  border: 2px solid currentColor;
  background: transparent;
  z-index: 1;
  transition: color 0.4s var(--ease-out-expo), border-color 0.4s var(--ease-out-expo);
}

.btn-outline-premium::before {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-out-expo);
  z-index: -1;
}

.btn-outline-premium:hover::before {
  transform: translateY(0);
}

/* ============================================
   Navigation Animations
   ============================================ */

/* Nav link underline animation */
.nav-link-premium {
  position: relative;
  display: inline-block;
}

.nav-link-premium::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out-expo);
}

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

/* Dropdown animation */
@keyframes dropdownReveal {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-premium {
  animation: dropdownReveal 0.3s var(--ease-out-expo) both;
}

/* Mobile menu animations */
@keyframes mobileMenuSlide {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.mobile-menu-premium {
  animation: mobileMenuSlide 0.5s var(--ease-out-expo) both;
}

.mobile-menu-premium li {
  animation: mobileMenuItemSlide 0.4s var(--ease-out-expo) both;
}

.mobile-menu-premium li:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-premium li:nth-child(2) { animation-delay: 0.15s; }
.mobile-menu-premium li:nth-child(3) { animation-delay: 0.2s; }
.mobile-menu-premium li:nth-child(4) { animation-delay: 0.25s; }
.mobile-menu-premium li:nth-child(5) { animation-delay: 0.3s; }
.mobile-menu-premium li:nth-child(6) { animation-delay: 0.35s; }

/* ============================================
   Scroll Indicator Animation
   ============================================ */

@keyframes scrollIndicatorBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
}

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

.scroll-indicator-premium {
  animation:
    scrollIndicatorBounce 2s var(--ease-in-out-circ) infinite,
    scrollIndicatorFade 2s ease-in-out infinite;
}

/* ============================================
   Section Transitions
   ============================================ */

/* Parallax-like effect for backgrounds */
.section-parallax {
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

/* Section divider line animation */
@keyframes sectionLineGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  transform-origin: center;
  animation: sectionLineGrow 1s var(--ease-out-expo) both;
}

/* ============================================
   Counter Animation
   ============================================ */

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.counter-animate {
  animation: countUp 0.6s var(--ease-out-expo) both;
}

/* ============================================
   Image Hover Effects
   ============================================ */

/* Ken Burns effect */
.image-ken-burns {
  overflow: hidden;
}

.image-ken-burns img {
  transition: transform 8s ease-out;
}

.image-ken-burns:hover img {
  transform: scale(1.1);
}

/* Overlay reveal */
.image-overlay-reveal {
  position: relative;
  overflow: hidden;
}

.image-overlay-reveal::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26, 35, 50, 0.8) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-expo);
  z-index: 1;
}

.image-overlay-reveal:hover::before {
  opacity: 1;
}

/* ============================================
   Loading States
   ============================================ */

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

.skeleton-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.spinner-premium {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-teal);
  border-radius: 50%;
  animation: spinnerRotate 0.8s linear infinite;
}

/* ============================================
   Form Focus Animations
   ============================================ */

.form-control-premium {
  transition: border-color 0.3s var(--ease-out-expo), box-shadow 0.3s var(--ease-out-expo), background-color 0.3s var(--ease-out-expo);
}

.form-control-premium:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 4px rgba(107, 187, 174, 0.1);
  background-color: rgba(107, 187, 174, 0.02);
}

/* Label float animation */
.form-floating-label {
  position: relative;
}

.form-floating-label label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.3s var(--ease-out-expo);
  pointer-events: none;
  color: var(--color-text-muted);
}

.form-floating-label input:focus ~ label,
.form-floating-label input:not(:placeholder-shown) ~ label {
  top: 0;
  transform: translateY(-50%) scale(0.85);
  background: white;
  padding: 0 0.25rem;
  color: var(--color-teal);
}

/* ============================================
   Stagger Delays (Extended)
   ============================================ */

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }
.stagger-9 { animation-delay: 0.45s; }
.stagger-10 { animation-delay: 0.5s; }

/* ============================================
   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;
  }

  html {
    scroll-behavior: auto;
  }

  .section-parallax {
    background-attachment: scroll;
  }
}

/* ============================================
   GPU Acceleration Hints
   ============================================ */

.gpu-accelerate {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ============================================
   AOS Library Enhancements
   ============================================ */

[data-aos] {
  transition-timing-function: var(--ease-out-expo);
}

[data-aos][data-aos-duration="400"] { transition-duration: 400ms; }
[data-aos][data-aos-duration="600"] { transition-duration: 600ms; }
[data-aos][data-aos-duration="800"] { transition-duration: 800ms; }
[data-aos][data-aos-duration="1000"] { transition-duration: 1000ms; }
[data-aos][data-aos-duration="1200"] { transition-duration: 1200ms; }

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}
