/* ============================================
   MOTION SYSTEM — Premium Animations & Effects
   ============================================ */

/* ---- Scroll-Triggered Animation Base States ---- */
[data-motion] {
    opacity: 0;
    transition-property: opacity, transform, filter;
    transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

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

[data-motion="fade-down"] {
    transform: translateY(-60px);
}

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

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

[data-motion="zoom-in"] {
    transform: scale(0.85);
}

[data-motion="zoom-out"] {
    transform: scale(1.15);
}

[data-motion="flip-up"] {
    transform: perspective(800px) rotateX(12deg) translateY(40px);
}

[data-motion="blur-in"] {
    filter: blur(12px);
    transform: translateY(20px);
}

/* ---- Active State (When element enters viewport) ---- */
[data-motion].motion-visible {
    opacity: 1;
    transform: none;
    filter: none;
}

/* ---- Stagger Delay Utility Classes ---- */
[data-motion-delay="100"] { transition-delay: 100ms; }
[data-motion-delay="200"] { transition-delay: 200ms; }
[data-motion-delay="300"] { transition-delay: 300ms; }
[data-motion-delay="400"] { transition-delay: 400ms; }
[data-motion-delay="500"] { transition-delay: 500ms; }
[data-motion-delay="600"] { transition-delay: 600ms; }
[data-motion-delay="700"] { transition-delay: 700ms; }
[data-motion-delay="800"] { transition-delay: 800ms; }
[data-motion-delay="1000"] { transition-delay: 1000ms; }
[data-motion-delay="1200"] { transition-delay: 1200ms; }

/* ---- Duration Utility Classes ---- */
[data-motion-duration="fast"] { transition-duration: 0.5s; }
[data-motion-duration="normal"] { transition-duration: 0.8s; }
[data-motion-duration="slow"] { transition-duration: 1.2s; }
[data-motion-duration="slower"] { transition-duration: 1.6s; }

/* Default duration */
[data-motion] {
    transition-duration: 0.8s;
}


/* ========================================
   HERO SECTION — Cinematic Entrance
   ======================================== */

/* Hero text split-reveal animation */
.hero-line {
    overflow: hidden;
    display: block;
}

.hero-line-inner {
    display: block;
    transform: translateY(110%);
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-loaded .hero-line-inner {
    transform: translateY(0);
}

/* Staggered hero lines */
.hero-loaded .hero-line:nth-child(1) .hero-line-inner { transition-delay: 0.15s; }
.hero-loaded .hero-line:nth-child(2) .hero-line-inner { transition-delay: 0.3s; }
.hero-loaded .hero-line:nth-child(3) .hero-line-inner { transition-delay: 0.45s; }

/* Hero badge entrance */
.hero-badge {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-loaded .hero-badge {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition-delay: 0s;
}

/* Hero subtitle typewriter */
.hero-subtitle {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 0.55s;
}

.hero-loaded .hero-subtitle {
    opacity: 1;
    transform: translateY(0);
}

/* Hero CTA buttons */
.hero-cta {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-loaded .hero-cta {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.7s;
}

/* Hero profile image entrance */
.hero-image-wrapper {
    opacity: 0;
    transform: scale(0.8) rotate(-5deg);
    transition: opacity 1s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 0.3s;
}

.hero-loaded .hero-image-wrapper {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}


/* ========================================
   AETHER FLOW CANVAS (Interactive Particles)
   ======================================== */
#aether-flow-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none; /* Let mouse events through to the section for tracking */
}


/* ========================================
   ANIMATED GRADIENT ORBS
   ======================================== */
.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: orbFloat 8s ease-in-out infinite;
    pointer-events: none;
}

.gradient-orb--1 {
    width: 28rem;
    height: 28rem;
    top: -6rem;
    right: -8rem;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.25) 0%, transparent 70%);
    animation-duration: 10s;
}

.gradient-orb--2 {
    width: 22rem;
    height: 22rem;
    bottom: -5rem;
    left: -6rem;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, transparent 70%);
    animation-duration: 12s;
    animation-delay: -3s;
}

.gradient-orb--3 {
    width: 16rem;
    height: 16rem;
    top: 40%;
    left: 35%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    animation-duration: 14s;
    animation-delay: -6s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 15px) scale(0.95); }
    75% { transform: translate(15px, 25px) scale(1.02); }
}


/* ========================================
   MAGNETIC BUTTON EFFECT
   ======================================== */
.btn-magnetic {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.btn-magnetic:hover {
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.4);
}


/* ========================================
   PROFILE PHOTO GLOW PULSE
   ======================================== */
.profile-glow {
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.04);
    }
}


/* ========================================
   SKILL BAR COUNTER ANIMATION
   ======================================== */
.skill-bar-fill {
    width: 0;
    transition: width 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.skill-bar-fill.animated {
    /* width is set inline by JS to the final value */
}


/* ========================================
   TIMELINE SECTION — Draw-in Effect
   ======================================== */
.timeline-line {
    height: 0;
    transition: height 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-line.animated {
    height: 100%;
}

.timeline-dot {
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timeline-dot.animated {
    opacity: 1;
    transform: scale(1);
}


/* ========================================
   INTERACTIVE 3D CARDS (Projects & Blog)
   ======================================== */
.interactive-card {
    /* JS will apply dynamic rotateX and rotateY via transform */
    transform-style: preserve-3d;
    transition: box-shadow 0.3s ease;
    will-change: transform;
}

.interactive-card-inner {
    transform: translateZ(50px);
    transform-style: preserve-3d;
    will-change: transform;
}

/* 3D Depth Utilities */
.translate-z-40 {
    transform: translateZ(40px);
    will-change: transform;
}

.translate-z-50 {
    transform: translateZ(50px);
    will-change: transform;
}

.translate-z-60 {
    transform: translateZ(60px);
    will-change: transform;
}


/* ========================================
   SECTION DIVIDER — Animated Wave
   ======================================== */
.section-wave {
    position: relative;
    overflow: hidden;
}

.section-wave::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 60px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 60' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' d='M0,30 C360,60 720,0 1080,30 C1260,45 1380,25 1440,30 L1440,60 L0,60 Z'/%3E%3C/svg%3E") no-repeat bottom center;
    background-size: 100% 100%;
}


/* ========================================
   SMOOTH PARALLAX UTILITY
   ======================================== */
.parallax-slow {
    will-change: transform;
    transition: transform 0.1s linear;
}


/* ========================================
   CURSOR GLOW (Optional fancy touch)
   ======================================== */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: opacity 0.3s ease;
    opacity: 0;
    mix-blend-mode: screen;
}

.cursor-glow.active {
    opacity: 1;
}


/* ========================================
   TEXT GRADIENT SHIMMER
   ======================================== */
.text-shimmer {
    background: linear-gradient(
        120deg,
        #4f46e5 0%,
        #8b5cf6 25%,
        #ec4899 50%,
        #8b5cf6 75%,
        #4f46e5 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}

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


/* ========================================
   NAVBAR MORPH — Refined scroll transition
   ======================================== */
#navbar {
    transition: background-color 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease, backdrop-filter 0.4s ease;
}

#navbar.scrolled {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    background-color: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

#navbar.scrolled .container {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}


/* ========================================
   REDUCED MOTION — Accessibility
   ======================================== */
@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-motion] {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .gradient-orb {
        animation: none;
    }

    .cursor-glow {
        display: none;
    }
}
