/**
 * VESTERA GROUPS - Animation System
 * Ultra-Premium, Subtle Luxury Animations
 * Uses CSS animations and Intersection Observer triggers
 */

/* ═══════════════════════════════════════════════════════════════
   ANIMATION KEYFRAMES
   ═══════════════════════════════════════════════════════════════ */

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

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(0.98); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(1deg); }
    75% { transform: translateY(5px) rotate(-1deg); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(201, 169, 98, 0.1); }
    50% { box-shadow: 0 0 50px rgba(201, 169, 98, 0.25); }
}

@keyframes borderGlow {
    0%, 100% { border-color: rgba(201, 169, 98, 0.2); }
    50% { border-color: rgba(201, 169, 98, 0.5); }
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(201, 169, 98, 0); }
    50% { text-shadow: 0 0 20px rgba(201, 169, 98, 0.3); }
}

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

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

@keyframes morphBlob {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
    75% { border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%; }
}

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

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

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

@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    75% { transform: rotate(-1deg); }
}

/* ═══════════════════════════════════════════════════════════════
   INTERSECTION OBSERVER ANIMATION CLASSES
   ═══════════════════════════════════════════════════════════════ */

/* Initial hidden states */
[data-animate] {
    opacity: 0;
    will-change: opacity, transform;
}

[data-animate="fade-in"] {
    opacity: 0;
}

[data-animate="fade-up"] {
    opacity: 0;
    transform: translateY(60px);
}

[data-animate="fade-down"] {
    opacity: 0;
    transform: translateY(-40px);
}

[data-animate="fade-left"] {
    opacity: 0;
    transform: translateX(-60px);
}

[data-animate="fade-right"] {
    opacity: 0;
    transform: translateX(60px);
}

[data-animate="scale"] {
    opacity: 0;
    transform: scale(0.85);
}

[data-animate="scale-up"] {
    opacity: 0;
    transform: scale(0.9) translateY(30px);
}

[data-animate="rotate"] {
    opacity: 0;
    transform: rotate(-5deg) scale(0.95);
}

[data-animate="blur"] {
    opacity: 0;
    filter: blur(10px);
}

/* Visible states with smooth transitions */
[data-animate].is-visible {
    opacity: 1;
    transform: none;
    filter: none;
    transition: 
        opacity 1s var(--ease-out-expo),
        transform 1s var(--ease-out-expo),
        filter 1s var(--ease-out-expo);
}

/* Delay variations */
[data-animate-delay="100"].is-visible { transition-delay: 100ms; }
[data-animate-delay="200"].is-visible { transition-delay: 200ms; }
[data-animate-delay="300"].is-visible { transition-delay: 300ms; }
[data-animate-delay="400"].is-visible { transition-delay: 400ms; }
[data-animate-delay="500"].is-visible { transition-delay: 500ms; }
[data-animate-delay="600"].is-visible { transition-delay: 600ms; }
[data-animate-delay="700"].is-visible { transition-delay: 700ms; }
[data-animate-delay="800"].is-visible { transition-delay: 800ms; }
[data-animate-delay="900"].is-visible { transition-delay: 900ms; }
[data-animate-delay="1000"].is-visible { transition-delay: 1000ms; }

/* Duration variations */
[data-animate-duration="fast"].is-visible {
    transition-duration: 0.5s;
}

[data-animate-duration="slow"].is-visible {
    transition-duration: 1.4s;
}

[data-animate-duration="slower"].is-visible {
    transition-duration: 2s;
}

/* ═══════════════════════════════════════════════════════════════
   STAGGER ANIMATION FOR CHILDREN
   ═══════════════════════════════════════════════════════════════ */

[data-animate-stagger] > * {
    opacity: 0;
    transform: translateY(40px);
    will-change: opacity, transform;
}

[data-animate-stagger].is-visible > * {
    opacity: 1;
    transform: translateY(0);
    transition: 
        opacity 0.8s var(--ease-out-expo),
        transform 0.8s var(--ease-out-expo);
}

[data-animate-stagger].is-visible > *:nth-child(1) { transition-delay: 0ms; }
[data-animate-stagger].is-visible > *:nth-child(2) { transition-delay: 100ms; }
[data-animate-stagger].is-visible > *:nth-child(3) { transition-delay: 200ms; }
[data-animate-stagger].is-visible > *:nth-child(4) { transition-delay: 300ms; }
[data-animate-stagger].is-visible > *:nth-child(5) { transition-delay: 400ms; }
[data-animate-stagger].is-visible > *:nth-child(6) { transition-delay: 500ms; }
[data-animate-stagger].is-visible > *:nth-child(7) { transition-delay: 600ms; }
[data-animate-stagger].is-visible > *:nth-child(8) { transition-delay: 700ms; }
[data-animate-stagger].is-visible > *:nth-child(9) { transition-delay: 800ms; }
[data-animate-stagger].is-visible > *:nth-child(10) { transition-delay: 900ms; }

/* ═══════════════════════════════════════════════════════════════
   HERO SPECIFIC ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.hero__content .hero__overline {
    animation: fadeInDown 1s var(--ease-out-expo) 0.3s both;
}

.hero__content .hero__title {
    animation: fadeInUp 1.2s var(--ease-out-expo) 0.5s both;
}

.hero__content .hero__title span {
    display: inline-block;
    animation: textGlow 4s ease-in-out infinite;
    animation-delay: 2s;
}

.hero__content .hero__subtitle {
    animation: fadeInUp 1.2s var(--ease-out-expo) 0.7s both;
}

.hero__content .hero__cta {
    animation: fadeInUp 1.2s var(--ease-out-expo) 0.9s both;
}

.hero__scroll {
    animation: fadeIn 1s var(--ease-out-expo) 1.5s both;
}

/* ═══════════════════════════════════════════════════════════════
   NAVBAR ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.navbar {
    animation: fadeInDown 0.8s var(--ease-out-expo) 0.1s both;
}

.navbar__link {
    transition: color 0.3s ease, transform 0.3s ease;
}

.navbar__link:hover {
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════
   HOVER MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════ */

/* Button hover lift with glow */
.btn {
    transition: all 0.4s var(--ease-out-expo);
}

.btn:hover {
    transform: translateY(-3px);
}

.btn:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

.btn--primary:hover {
    box-shadow: 
        0 10px 40px rgba(201, 169, 98, 0.3),
        0 0 20px rgba(201, 169, 98, 0.2);
}

/* Card hover effects */
.card {
    transition: 
        transform 0.5s var(--ease-out-expo),
        border-color 0.5s var(--ease-out-expo),
        box-shadow 0.5s var(--ease-out-expo);
}

.card:hover {
    transform: translateY(-10px) scale(1.01);
}

/* Premium card inner glow on hover - uses JS for mouse tracking */
.card--company {
    position: relative;
}

.card--company .card__glow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(201, 169, 98, 0.06),
        transparent 40%
    );
    pointer-events: none;
}

.card--company:hover .card__glow {
    opacity: 1;
}

/* Link underline animation */
.link-underline {
    position: relative;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--gradient-gold);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.5s var(--ease-out-expo);
}

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

/* Icon hover animations */
.icon-hover {
    transition: transform 0.4s var(--ease-out-expo);
}

.icon-hover:hover {
    transform: scale(1.15) rotate(5deg);
}

/* ═══════════════════════════════════════════════════════════════
   CONTINUOUS ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

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

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

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

.animate-bounce {
    animation: bounceSubtle 2s ease-in-out infinite;
}

.animate-scale {
    animation: scaleSubtle 3s ease-in-out infinite;
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

/* ═══════════════════════════════════════════════════════════════
   TEXT ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    animation: fadeInUp 0.8s var(--ease-out-expo) both;
}

/* Typing cursor effect */
.typing-cursor::after {
    content: '|';
    animation: pulse 1s ease-in-out infinite;
    color: var(--color-accent-gold);
}

/* ═══════════════════════════════════════════════════════════════
   LOADING STATES
   ═══════════════════════════════════════════════════════════════ */

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

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border-subtle);
    border-top-color: var(--color-accent-gold);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--color-accent-gold);
    border-radius: 50%;
    margin: 0 4px;
    animation: bounceSubtle 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ═══════════════════════════════════════════════════════════════
   PAGE TRANSITIONS
   ═══════════════════════════════════════════════════════════════ */

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s var(--ease-out-expo);
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 0.3s var(--ease-out-expo);
}

/* ═══════════════════════════════════════════════════════════════
   SCROLL-TRIGGERED PARALLAX
   ═══════════════════════════════════════════════════════════════ */

.parallax-slow {
    will-change: transform;
    transition: transform 0.1s linear;
}

.parallax-medium {
    will-change: transform;
    transition: transform 0.05s linear;
}

/* ═══════════════════════════════════════════════════════════════
   MAGNETIC EFFECT (for buttons/icons)
   ═══════════════════════════════════════════════════════════════ */

.magnetic {
    transition: transform 0.3s var(--ease-out-expo);
}

/* ═══════════════════════════════════════════════════════════════
   REVEAL ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.reveal-mask {
    overflow: hidden;
}

.reveal-mask > * {
    transform: translateY(100%);
    transition: transform 0.8s var(--ease-out-expo);
}

.reveal-mask.is-visible > * {
    transform: translateY(0);
}

/* Line reveal */
.line-reveal {
    position: relative;
    overflow: hidden;
}

.line-reveal::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s var(--ease-out-expo);
}

.line-reveal.is-visible::after {
    transform: scaleX(1);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE MENU ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.navbar__mobile-nav .navbar__mobile-link {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease, padding-left 0.2s ease, border-color 0.2s ease;
}

.navbar__mobile-nav--active .navbar__mobile-link {
    opacity: 1;
    transform: translateX(0);
}

.navbar__mobile-nav--active .navbar__mobile-link:nth-child(1) { transition-delay: 0.15s; }
.navbar__mobile-nav--active .navbar__mobile-link:nth-child(2) { transition-delay: 0.2s; }
.navbar__mobile-nav--active .navbar__mobile-link:nth-child(3) { transition-delay: 0.25s; }
.navbar__mobile-nav--active .navbar__mobile-link:nth-child(4) { transition-delay: 0.3s; }
.navbar__mobile-nav--active .navbar__mobile-link:nth-child(5) { transition-delay: 0.35s; }
.navbar__mobile-nav--active .navbar__mobile-link:nth-child(6) { transition-delay: 0.4s; }

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    [data-animate],
    [data-animate-stagger] > * {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

/* ═══════════════════════════════════════════════════════════════
   HIGH PERFORMANCE MODE
   ═══════════════════════════════════════════════════════════════ */

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
