/* White Nile - Motion Design System
 * Progressive enhancement animations using anime.js
 * Non-destructive, respects prefers-reduced-motion
 */

/* ============================================
   BASE ANIMATION STATES
   Initial states for elements before animation
   ============================================ */

/* Fade-in elements start invisible */
[data-animate="fade-up"],
[data-animate="fade-in"],
[data-animate="fade-left"],
[data-animate="fade-right"] {
    opacity: 0;
}

[data-animate="fade-up"] {
    transform: translateY(30px);
}

[data-animate="fade-left"] {
    transform: translateX(-30px);
}

[data-animate="fade-right"] {
    transform: translateX(30px);
}

/* Scale animations */
[data-animate="scale-in"] {
    opacity: 0;
    transform: scale(0.9);
}

/* ============================================
   MICRO-INTERACTION ENHANCEMENTS
   Subtle feedback for interactive elements
   ============================================ */

/* Enhanced button tactile feel */
.btn-tactile {
    position: relative;
    overflow: hidden;
}

.btn-tactile::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-tactile:active::before {
    width: 200%;
    height: 200%;
}

/* Card hover depth effect */
.card-depth {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
}

.card-depth:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px -12px rgba(17, 50, 212, 0.25);
}

/* Icon pulse on hover */
.icon-pulse {
    transition: transform 0.3s ease;
}

.icon-pulse:hover {
    animation: subtle-pulse 0.6s ease;
}

@keyframes subtle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* ============================================
   HERO SECTION ENHANCEMENTS
   Parallax-ready and depth effects
   ============================================ */

.hero-content {
    will-change: transform;
}

.hero-parallax-layer {
    will-change: transform;
    transition: transform 0.1s ease-out;
}

/* Floating animation for ambient elements */
.float-gentle {
    animation: float-gentle 6s ease-in-out infinite;
}

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ============================================
   CARD & PORTFOLIO ENHANCEMENTS
   Object-like behavior for cards
   ============================================ */

/* 3D card tilt container */
.card-3d {
    perspective: 1000px;
}

.card-3d-inner {
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
}

/* Staggered reveal for grid items */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Portfolio card shine effect */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.card-shine:hover::after {
    transform: rotate(45deg) translateX(100%);
}

/* ============================================
   FORM INTERACTIONS
   Calculator and input feedback
   ============================================ */

/* Input focus glow */
.input-glow:focus {
    box-shadow: 0 0 0 3px rgba(17, 50, 212, 0.15),
                0 4px 12px rgba(17, 50, 212, 0.1);
}

/* Calculator update pulse */
.calc-pulse {
    animation: calc-pulse 0.4s ease;
}

@keyframes calc-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); color: #1132d4; }
    100% { transform: scale(1); }
}

/* Checkbox/Radio check animation */
.check-animate {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.check-animate:checked {
    animation: check-pop 0.3s ease;
}

@keyframes check-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Slider thumb active state */
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(17, 50, 212, 0.2);
}

/* ============================================
   NAVIGATION ENHANCEMENTS
   Header and nav link interactions
   ============================================ */

/* Nav link underline animation */
.nav-link-animated {
    position: relative;
}

.nav-link-animated::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #1132d4;
    transition: width 0.3s ease;
}

.nav-link-animated:hover::after {
    width: 100%;
}

/* Logo subtle bounce on load */
.logo-animate {
    animation: logo-entrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes logo-entrance {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   CTA SECTION ENHANCEMENTS
   Ambient motion and attention-grabbing
   ============================================ */

/* Gradient background subtle animation */
.cta-gradient-animate {
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Attention-grabbing button */
.cta-attention {
    animation: attention-pulse 3s ease-in-out infinite;
}

@keyframes attention-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(17, 50, 212, 0.3); }
    50% { box-shadow: 0 8px 25px rgba(17, 50, 212, 0.5); }
}

/* ============================================
   MODAL ENHANCEMENTS
   Smooth entrance and backdrop
   ============================================ */

.modal-backdrop-animate {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop-animate.active {
    opacity: 1;
}

.modal-content-animate {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content-animate.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ============================================
   FILTER TABS ANIMATION
   Category filtering with smooth transitions
   ============================================ */

.filter-tab-active {
    position: relative;
}

.filter-tab-active::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #1132d4;
    border-radius: 2px 2px 0 0;
    animation: tab-slide-in 0.3s ease;
}

@keyframes tab-slide-in {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ============================================
   SCROLL REVEAL CLASSES
   Intersection Observer driven
   ============================================ */

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-on-scroll.delay-1 { transition-delay: 0.1s; }
.reveal-on-scroll.delay-2 { transition-delay: 0.2s; }
.reveal-on-scroll.delay-3 { transition-delay: 0.3s; }
.reveal-on-scroll.delay-4 { transition-delay: 0.4s; }

/* ============================================
   LOADING STATES
   Skeleton and content loading
   ============================================ */

.skeleton-pulse {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   SUCCESS/ERROR FEEDBACK
   Form submission states
   ============================================ */

.success-bounce {
    animation: success-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes success-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.shake-error {
    animation: shake-error 0.5s ease;
}

@keyframes shake-error {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* ============================================
   CURSOR FOLLOWERS
   Optional - for premium feel
   ============================================ */

.cursor-follower {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid #1132d4;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s ease, opacity 0.3s ease;
    opacity: 0;
}

.cursor-follower.active {
    opacity: 0.5;
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   Respects user preference
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    [data-animate],
    .reveal-on-scroll,
    .stagger-item {
        opacity: 1 !important;
        transform: none !important;
    }
}
