/* ═══════════════════════════════════════════
   ANIMATIONS & TRANSITIONS
   ═══════════════════════════════════════════ */

/* ── Fade Up (Scroll Reveal) ──────────────── */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: var(--delay, 0s);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Fade In Keyframe ─────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

/* ── Scale Animation ──────────────────────── */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── Slide In ─────────────────────────────── */
@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ── Gradient Shift ───────────────────────── */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

/* ── Glow Pulse ───────────────────────────── */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(108, 99, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(108, 99, 255, 0.4),
                    0 0 60px rgba(0, 212, 255, 0.2);
    }
}

/* ── Ripple Effect ────────────────────────── */
.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
    transition: opacity 0.5s;
}

.btn-primary:active::after {
    opacity: 1;
    transition: opacity 0s;
}

/* ── Tilt Effect (via JS) ─────────────────── */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* ── Magnetic Button Hover ────────────────── */
.magnetic-hover {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Stagger Children ─────────────────────── */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.6s; opacity: 1; transform: translateY(0); }

/* ── Text Reveal ──────────────────────────── */
@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* ── Border Glow Animation ────────────────── */
@keyframes borderGlow {
    0%, 100% {
        border-color: var(--border-color);
    }
    50% {
        border-color: var(--accent-1);
    }
}

/* ── Smooth Page Transitions ──────────────── */
.page-transition {
    animation: fadeIn 0.5s ease forwards;
}

/* ── Hover Lift ───────────────────────────── */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

/* ── Skeleton Loading ─────────────────────── */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ── Noise texture overlay ────────────────── */
.noise-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ── Mobile Menu Overlay ──────────────────── */
.nav-menu::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.nav-menu.active::before {
    opacity: 1;
    pointer-events: auto;
}

/* ── Toast notification ───────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 28px;
    background: var(--accent-1);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s ease;
    box-shadow: 0 10px 40px rgba(108, 99, 255, 0.4);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

    .fade-up {
        opacity: 1;
        transform: none;
    }

    html {
        scroll-behavior: auto;
    }
}
