/* ═══════════════════════════════════════════════════════════
   KERNOLIX — Animations
   ═══════════════════════════════════════════════════════════ */

/* ─── Keyframes ───────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

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

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
    50% { box-shadow: 0 0 40px var(--primary-glow), 0 0 60px rgba(108, 92, 231, 0.2); }
}

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

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

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

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

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

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

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

@keyframes border-glow {
    0%, 100% { border-color: var(--glass-border); }
    50% { border-color: var(--primary-light); }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-cursor {
    0%, 100% { border-right-color: var(--accent); }
    50% { border-right-color: transparent; }
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

@keyframes orbit {
    from { transform: rotate(0deg) translateX(120px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(120px) rotate(-360deg); }
}

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

/* ─── Hero Animations ─────────────────────────────────────── */
.hero-content {
    animation: slide-up 1s ease-out;
}

.hero-badge {
    animation: slide-up 0.8s ease-out, glow-pulse 3s infinite;
}

.hero h1 {
    animation: slide-up 1s ease-out 0.2s both;
}

.hero p {
    animation: slide-up 1s ease-out 0.4s both;
}

.hero-buttons {
    animation: slide-up 1s ease-out 0.6s both;
}

/* ─── Floating animation for icons ────────────────────────── */
.float-anim {
    animation: float 3s ease-in-out infinite;
}

.float-anim-delay-1 { animation-delay: 0.5s; }
.float-anim-delay-2 { animation-delay: 1s; }
.float-anim-delay-3 { animation-delay: 1.5s; }

/* ─── Shimmer Text ────────────────────────────────────────── */
.shimmer-text {
    background: linear-gradient(
        90deg,
        var(--text-primary) 0%,
        var(--accent) 25%,
        var(--primary-light) 50%,
        var(--accent) 75%,
        var(--text-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: text-shimmer 4s linear infinite;
}

/* ─── Animated gradient border ────────────────────────────── */
.gradient-border {
    position: relative;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: var(--gradient-primary);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.gradient-border:hover::before {
    opacity: 1;
}

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

/* ─── Ripple button effect ────────────────────────────────── */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple .ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* ─── Staggered fade-in for lists ─────────────────────────── */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Orbit animation (for hero decorative elements) ──────── */
.orbit-ring {
    position: absolute;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    animation: spin-slow 30s linear infinite;
}

.orbit-ring-1 {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
}

.orbit-ring-2 {
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.15;
    animation-direction: reverse;
    animation-duration: 45s;
}

.orbit-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    animation: orbit 20s linear infinite;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ─── Counter animation ───────────────────────────────────── */
.count-up {
    animation: counter 0.6s ease-out;
}

/* ─── Magnetic effect (JS-controlled) ─────────────────────── */
.magnetic {
    transition: transform 0.3s ease-out;
}

/* ─── Page transition ─────────────────────────────────────── */
.page-transition {
    animation: slide-up 0.6s ease-out;
}

/* ─── Loading skeleton ────────────────────────────────────── */
@keyframes skeleton {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
    background-size: 200px 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ─── Noise texture overlay ───────────────────────────────── */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.015;
    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 type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px;
}

/* ─── Prefers reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .reveal {
        opacity: 1;
        transform: none;
    }
}
