/* ═══════════════════════════════════════════════════════════════
   ANTIGRAVITY PORTFOLIO — Animations & Keyframes
   ═══════════════════════════════════════════════════════════════ */

/* ── Float Drift — Idle card floating ───────────────────────── */
@keyframes float-drift-1 {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(8px, -12px, 0); }
    50% { transform: translate3d(-5px, -20px, 0); }
    75% { transform: translate3d(12px, -8px, 0); }
}

@keyframes float-drift-2 {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-10px, -8px, 0); }
    50% { transform: translate3d(6px, -15px, 0); }
    75% { transform: translate3d(-8px, -5px, 0); }
}

@keyframes float-drift-3 {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(5px, -18px, 0); }
    50% { transform: translate3d(-12px, -10px, 0); }
    75% { transform: translate3d(10px, -14px, 0); }
}

/* ── Card Emerge — Entering viewport from behind ────────────── */
@keyframes card-emerge {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(40px);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px);
    }
}

/* ── Card Recede — Exiting viewport toward camera ───────────── */
@keyframes card-recede {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px);
    }
    to {
        opacity: 0;
        transform: scale(1.15) translateY(-40px);
        filter: blur(6px);
    }
}

/* ── Fly to Camera — Card expanding to detail view ──────────── */
@keyframes fly-to-camera {
    0% {
        opacity: 1;
        border-radius: 16px;
    }
    100% {
        opacity: 1;
        border-radius: 24px;
    }
}

/* ── Dissolve Away — Detail view closing ────────────────────── */
@keyframes dissolve-away {
    0% {
        opacity: 1;
        transform: scale(1) translateZ(0);
        filter: blur(0px);
    }
    60% {
        opacity: 0.5;
        transform: scale(0.95) translateZ(-50px);
        filter: blur(4px);
    }
    100% {
        opacity: 0;
        transform: scale(0.85) translateZ(-100px);
        filter: blur(12px);
    }
}

/* ── Nebula Pulse — Background breathing ────────────────────── */
@keyframes nebula-pulse {
    0%, 100% { 
        opacity: 0.3;
        transform: scale(1);
    }
    50% { 
        opacity: 0.5;
        transform: scale(1.1);
    }
}

/* ── Glow Breathe — Neon shadow oscillation ─────────────────── */
@keyframes glow-breathe {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 240, 255, 0.1), 0 0 40px rgba(0, 240, 255, 0.05);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 240, 255, 0.2), 0 0 60px rgba(0, 240, 255, 0.1), 0 0 90px rgba(0, 240, 255, 0.05);
    }
}

/* ── Text Weight Shift — Variable font on scroll ────────────── */
@keyframes text-weight-shift {
    0% { font-variation-settings: 'wght' 300; }
    50% { font-variation-settings: 'wght' 700; }
    100% { font-variation-settings: 'wght' 300; }
}

/* ── Hero Entrance ──────────────────────────────────────────── */
@keyframes hero-fade-up {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* ── Stagger Entry ──────────────────────────────────────────── */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* ── Scroll-Driven State Classes ────────────────────────────── */

/* Card entering viewport */
.card-visible {
    animation: card-emerge 0.7s var(--ease-out-expo) forwards;
}

/* Card exiting viewport (going up/toward camera) */
.card-exiting {
    animation: card-recede 0.6s var(--ease-smooth) forwards;
}

/* Card in initial hidden state */
.card-hidden {
    opacity: 0;
    transform: scale(0.8) translateY(40px);
    filter: blur(6px);
}

/* After entrance animation completes, JS controls transform */
.drift-ready {
    animation: none !important;
}

/* Magnetic hover active */
.is-magnetic {
    transition: transform 0.08s linear !important;
}

/* Wind tilt on fast scroll */
.wind-tilt {
    transition: transform 0.3s var(--ease-out-expo) !important;
}

/* ── Detail View Transitions ────────────────────────────────── */
.detail-entering .detail-backdrop {
    animation: fade-in 0.4s var(--ease-smooth) forwards;
}

.detail-entering .detail-content {
    animation: detail-scale-in 0.6s var(--ease-out-expo) forwards;
}

.detail-leaving .detail-backdrop {
    animation: fade-out 0.3s var(--ease-smooth) forwards;
}

.detail-leaving .detail-content {
    animation: dissolve-away 0.5s var(--ease-smooth) forwards;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes detail-scale-in {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* ── Hero Section Animation ─────────────────────────────────── */
.hero-eyebrow {
    animation: hero-fade-up 0.8s var(--ease-out-expo) 0.2s both;
}

.hero-title {
    animation: hero-fade-up 0.8s var(--ease-out-expo) 0.4s both;
}

.hero-subtitle {
    animation: hero-fade-up 0.8s var(--ease-out-expo) 0.6s both;
}

/* ── Filter Bar Entry ───────────────────────────────────────── */
.filter-bar {
    animation: hero-fade-up 0.8s var(--ease-out-expo) 0.8s both;
}

/* ── Shimmer Effect ─────────────────────────────────────────── */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.card-shimmer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: inherit;
    z-index: 3;
}

.card-shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.03) 45%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 55%,
        transparent 100%
    );
    transform: translateX(-100%);
}

.project-card:hover .card-shimmer::after {
    animation: shimmer 0.8s var(--ease-smooth) forwards;
}

/* ── Floating Particles Ambient (CSS fallback) ──────────────── */
@keyframes ambient-float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.2;
    }
    25% {
        transform: translate(20px, -30px) scale(1.1);
        opacity: 0.4;
    }
    50% {
        transform: translate(-10px, -50px) scale(0.9);
        opacity: 0.3;
    }
    75% {
        transform: translate(15px, -20px) scale(1.05);
        opacity: 0.25;
    }
}

/* ── Nav entry ──────────────────────────────────────────────── */
@keyframes nav-slide-down {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.nav-glass {
    animation: nav-slide-down 0.8s var(--ease-out-expo) 0.1s both;
}

/* ── Scroll indicator ───────────────────────────────────────── */
@keyframes scroll-indicator-entry {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.scroll-indicator {
    animation: scroll-indicator-entry 0.8s var(--ease-out-expo) 1.2s both;
}
