/* ===================================================
   MAHFUJ ALOM PORTFOLIO — animations.css
   Particles, Glow Orbs, Keyframe Animations & FX
   =================================================== */

/* ===== SCROLL PROGRESS ===== */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    background-size: 200% 100%;
    z-index: 9999;
    transition: width 0.1s linear;
    animation: shimmer-progress 2s linear infinite;
}
@keyframes shimmer-progress {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== BACKGROUND FX ===== */
.background-fx {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: var(--bg-base);
}
#particleCanvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
}
.tech-grid {
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background-image:
        linear-gradient(rgba(10,132,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10,132,255,0.04) 1px, transparent 1px);
    background-size: 64px 64px;
    z-index: 0;
    transform: perspective(500px) rotateX(60deg) translateY(-80px) translateZ(-200px);
    animation: gridScroll 24s linear infinite;
}
@keyframes gridScroll {
    0%   { transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-200px); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(64px) translateZ(-200px); }
}

/* Glow Orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.5;
    animation: floatOrb 28s infinite alternate cubic-bezier(0.4,0,0.2,1);
}
.orb-1 { top:-10%;left:-10%;width:55vw;height:55vw;background:var(--color-1);animation-delay:0s; }
.orb-2 { bottom:-20%;right:-10%;width:65vw;height:65vw;background:var(--color-2);animation-delay:-7s; }
.orb-3 { top:30%;left:50%;width:45vw;height:45vw;background:var(--color-3);animation-delay:-14s; }
.orb-4 { bottom:15%;left:5%;width:38vw;height:38vw;background:var(--color-4);animation-delay:-21s; }
@keyframes floatOrb {
    0%   { transform: translate(0,0) scale(0.85); }
    50%  { transform: translate(8vw,12vh) scale(1.15); }
    100% { transform: translate(-6vw,-8vh) scale(0.9); }
}

/* ===== REVEAL OBSERVER ANIMATIONS ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-expo), transform 0.7s var(--ease-expo);
    will-change: opacity, transform;
}
.reveal.active {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Hero elements fade in immediately so above-the-fold content is NEVER blank */
.hero .reveal,
.section-head .reveal {
    animation: heroContentFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroContentFadeIn {
    0% {
        opacity: 0;
        transform: translateY(18px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Stagger delays */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Pulse animation */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(10,132,255,0.2); }
    50% { box-shadow: 0 0 40px rgba(10,132,255,0.5); }
}
.pulse-glow { animation: pulseGlow 3s infinite ease-in-out; }

/* ===== PORTFOLIO SMOOTH TRANSITION & FILTER GRID ===== */
.portfolio-grid,
.case-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    position: relative;
    transition: min-height 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 900px) {
    .portfolio-grid,
    .case-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Category Filter Tabs with Luminous States */
.feed-tabs.portfolio-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 36px;
    position: relative;
    z-index: 10;
}

.feed-tabs .filter-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    outline: none;
}

.feed-tabs .filter-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.feed-tabs .filter-btn:active {
    transform: translateY(0) scale(0.97);
}

.feed-tabs .filter-btn.active {
    color: #FFFFFF;
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.24), rgba(94, 92, 230, 0.25));
    border-color: rgba(10, 132, 255, 0.7);
    box-shadow: 0 0 24px rgba(10, 132, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.feed-tabs .filter-btn .filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.feed-tabs .filter-btn.active .filter-count {
    background: rgba(10, 132, 255, 0.4);
    color: #64D2FF;
}

/* Card Transitions & Filter Morphing */
.case-card,
.portfolio-card {
    will-change: transform, opacity, filter;
    transform-origin: center center;
    transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.32s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

.case-card.is-visible,
.portfolio-card.is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0px);
    pointer-events: auto;
    visibility: visible;
}

.case-card.is-exiting,
.portfolio-card.is-exiting {
    opacity: 0;
    transform: scale(0.92) translateY(14px);
    filter: blur(4px);
    pointer-events: none;
}

.case-card.is-hidden,
.portfolio-card.is-hidden {
    display: none !important;
}

/* Smooth CSS Fallback Entrance */
@keyframes portfolioCardIn {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(0.93);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

.portfolio-card.animate-in,
.case-card.animate-in {
    animation: portfolioCardIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Interactive Card Buttons */
.case-card .case-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-wrap: wrap;
}

.case-card .btn-case-modal {
    padding: 9px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 100px;
    background: rgba(10, 132, 255, 0.12);
    color: #64D2FF;
    border: 1px solid rgba(10, 132, 255, 0.3);
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.case-card .btn-case-modal:hover {
    background: rgba(10, 132, 255, 0.25);
    border-color: rgba(10, 132, 255, 0.6);
    color: #FFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(10, 132, 255, 0.25);
}

/* ===== SOCIAL FEED LAZY IMAGES & SKELETON PLACEHOLDER ===== */
.sp-image-wrap {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    background: #0d1424;
}

@media (max-width: 768px) {
    .sp-image-wrap {
        height: 185px;
    }
}

.sp-image-wrap.skeleton-loading {
    background: linear-gradient(90deg, #0e1627 0%, #1a253a 50%, #0e1627 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.6s infinite ease-in-out;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sp-image-wrap img.sp-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    filter: blur(8px);
    transform: scale(1.04);
    transition: opacity 0.45s ease-out, filter 0.45s ease-out, transform 0.6s var(--ease-expo);
    will-change: opacity, filter, transform;
}

.sp-image-wrap img.sp-img.loaded {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
}

.social-post-card:hover .sp-image-wrap img.sp-img.loaded {
    transform: scale(1.04);
}

/* ===== MOBILE GPU OPTIMIZATION FOR BACKGROUND FX ===== */
@media (max-width: 768px) {
    .background-fx {
        contain: strict;
    }
    #particleCanvas {
        contain: strict;
        will-change: transform;
    }
    .tech-grid {
        background-size: 80px 80px;
        opacity: 0.55;
    }
    /* Reduce intense GPU blur shaders on mobile */
    .glow-orb {
        filter: blur(48px) !important;
        opacity: 0.35 !important;
        animation-duration: 40s !important;
    }
    /* Disable offscreen secondary orbs on mobile to free GPU fill-rate */
    .glow-orb.orb-3,
    .glow-orb.orb-4 {
        display: none !important;
    }
}


