/* 
   SlapIA - Minimal Animations Styles
   Clean, performant and subtle animations.
*/

/* 1. Base Entry Animations (Fade & Slight Slide) */
.animate-enter,
.fade-in-up {
    /* If no JS adds .is-visible, element might stay hidden. 
       We add a fallback animation for immediate elements that don't rely on JS observer */
    animation: simpleFadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes simpleFadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-enter.is-visible,
.content-loaded .fade-in-up,
.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
    animation: none;
    /* override keyframe if JS hits first */
}

/* 2. Scroll Reveal Animations */
.scroll-reveal {
    /* Base state is visible if JS not active, but we rely on JS to add .is-visible */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

/* Fallback: if JS takes too long to add .is-visible, show it anyway after short delay */
@keyframes fallbackShow {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-reveal:not(.is-visible) {
    animation: fallbackShow 0.1s cubic-bezier(0.16, 1, 0.3, 1) forwards 1s;
    /* Force show after 1s */
}

.scroll-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    animation: none;
}

/* 3. Scale Reveal Animations (For cards) */
.scroll-scale {
    opacity: 0;
    transform: scale(0.97) translateY(10px);
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.scroll-scale:not(.is-visible) {
    animation: fallbackShow 0.1s cubic-bezier(0.16, 1, 0.3, 1) forwards 1.2s;
}

.scroll-scale.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: none;
}

/* 4. Delays utility classes */
.delay-1,
.delay-100 {
    transition-delay: 100ms;
    animation-delay: 100ms;
}

.delay-2,
.delay-200 {
    transition-delay: 200ms;
    animation-delay: 200ms;
}

.delay-3,
.delay-300 {
    transition-delay: 300ms;
    animation-delay: 300ms;
}

.delay-4,
.delay-400 {
    transition-delay: 400ms;
    animation-delay: 400ms;
}

.delay-5,
.delay-500 {
    transition-delay: 500ms;
    animation-delay: 500ms;
}

.delay-6,
.delay-600 {
    transition-delay: 600ms;
    animation-delay: 600ms;
}

/* 5. Staggered Table Rows */
.stagger-row {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.stagger-row:nth-child(1) {
    transition-delay: 50ms;
}

.stagger-row:nth-child(2) {
    transition-delay: 100ms;
}

.stagger-row:nth-child(3) {
    transition-delay: 150ms;
}

.stagger-row:nth-child(4) {
    transition-delay: 200ms;
}

.stagger-row:nth-child(5) {
    transition-delay: 250ms;
}

.stagger-row:nth-child(6) {
    transition-delay: 300ms;
}

.stagger-row:nth-child(7) {
    transition-delay: 350ms;
}

.stagger-row:nth-child(8) {
    transition-delay: 400ms;
}

.stagger-row:nth-child(9) {
    transition-delay: 450ms;
}

.stagger-row:nth-child(10) {
    transition-delay: 500ms;
}

/* 6. Mouse Spotlight Effect (Cards interaction) */
.bento-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(400px circle at var(--mouse-x) var(--mouse-y),
            rgba(255, 255, 255, 0.04),
            transparent 40%);
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    border-radius: inherit;
}

.bento-card:hover::after {
    opacity: 1;
}

/* 7. Cursor Blink (Typewriter) */
.cursor-blink {
    animation: blink 1s step-end infinite;
    font-weight: 100;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* 8. Emoji Rain (If activated) */
.falling-emoji {
    position: fixed;
    top: -50px;
    user-select: none;
    pointer-events: none;
    z-index: 99999;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(360deg);
    }
}

/* 9. Swup Slide Theme overrides (Minimalist page transition) */
.swup-transition-main {
    /* 0.5s timing matches the nav-liquid-pill transition time */
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), filter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
    transform-origin: center top;
}

html.is-animating .swup-transition-main {
    opacity: 0;
    transform: translateY(15px) scale(0.99);
    filter: blur(4px);
}

html.is-leaving .swup-transition-main {
    opacity: 0;
    transform: translateY(15px) scale(0.99);
    filter: blur(4px);
}

html.is-rendering .swup-transition-main {
    transform: translateY(-15px) scale(0.99);
    filter: blur(4px);
}

/* Fix for Scroll Reveal firing too early with Swup */
.swup-transition-main .scroll-reveal:not(.is-visible) {
    opacity: 0;
}

/* 10. Form Validation Animation (Replaces shake) */
.form-control:invalid:not(:placeholder-shown) {
    animation: subtlePulse 0.4s ease;
}

@keyframes subtlePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.98);
        border-color: rgba(255, 71, 87, 0.8);
    }

    100% {
        transform: scale(1);
    }
}

/* 11. Custom Cursor Aura */
.custom-cursor {
    position: fixed;
    top: -20px;
    left: -20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(191, 90, 242, 0.5) 0%, rgba(191, 90, 242, 0) 70%);
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: screen;
    opacity: 0;
    /* Hidden until first move */
    transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s;
}

.custom-cursor.cursor-hover {
    width: 80px;
    height: 80px;
    top: -40px;
    left: -40px;
    background: radial-gradient(circle, rgba(41, 151, 255, 0.4) 0%, rgba(41, 151, 255, 0) 70%);
}

/* 12. Infinite Marquee */
.marquee-container {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
    padding: 30px 0;
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.marquee-content {
    display: inline-flex;
    gap: 4rem;
    padding-right: 4rem;
    /* Add padding to match gap so the loop is seamless */
    animation: marquee 50s linear infinite;
}

.marquee-content:hover {
    animation-play-state: paused;
}

.marquee-item {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.2);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: color 0.3s ease;
}

.marquee-item:hover {
    color: rgba(255, 255, 255, 0.8);
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* 13. Shimmer Badge */
.shimmer-badge {
    position: relative;
    overflow: hidden;
}

.shimmer-badge::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(30deg) translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: rotate(30deg) translateX(-100%);
    }

    20% {
        transform: rotate(30deg) translateX(50%);
    }

    100% {
        transform: rotate(30deg) translateX(50%);
    }
}