/* ============================================================
   GM Associates - Motion System
   Ported from motion-graphics-poc.html, adapted to brand-red
   ============================================================ */

/* --- 1. Staggered Text Reveal (blur-to-sharp) --- */
.motion-reveal {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(8px);
}
.motion-reveal.visible {
    animation: textReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.motion-reveal.visible.d1 { animation-delay: 0.1s; }
.motion-reveal.visible.d2 { animation-delay: 0.2s; }
.motion-reveal.visible.d3 { animation-delay: 0.3s; }
.motion-reveal.visible.d4 { animation-delay: 0.4s; }
.motion-reveal.visible.d5 { animation-delay: 0.5s; }
.motion-reveal.visible.d6 { animation-delay: 0.6s; }
.motion-reveal.visible.d7 { animation-delay: 0.7s; }

@keyframes textReveal {
    from { opacity: 0; transform: translateY(30px); filter: blur(8px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* --- 2. Glow Pulse on Keywords --- */
.glow-red {
    color: var(--brand-red-light);
    text-shadow: 0 0 20px rgba(164,30,30,0.4), 0 0 60px rgba(164,30,30,0.1);
    animation: glowPulseRed 3s ease-in-out infinite;
}
.glow-white {
    text-shadow: 0 0 20px rgba(255,255,255,0.3), 0 0 60px rgba(255,255,255,0.08);
    animation: glowPulseWhite 4s ease-in-out infinite;
}
@keyframes glowPulseRed {
    0%, 100% { text-shadow: 0 0 20px rgba(164,30,30,0.3), 0 0 60px rgba(164,30,30,0.08); }
    50% { text-shadow: 0 0 30px rgba(164,30,30,0.6), 0 0 80px rgba(164,30,30,0.2); }
}
@keyframes glowPulseWhite {
    0%, 100% { text-shadow: 0 0 15px rgba(255,255,255,0.15), 0 0 40px rgba(255,255,255,0.05); }
    50% { text-shadow: 0 0 25px rgba(255,255,255,0.3), 0 0 60px rgba(255,255,255,0.1); }
}

/* --- 3. Shimmer Text (gradient sweep) --- */
.shimmer {
    background: linear-gradient(90deg, #fff 0%, var(--brand-red-light) 40%, #E06030 60%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmerSlide 4s linear infinite;
}
@keyframes shimmerSlide {
    to { background-position: 200% center; }
}

/* --- 4. Card Entrance (scale + translate + stagger) --- */
.motion-card-enter {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}
.motion-card-enter.visible {
    animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.motion-card-enter.visible.d1 { animation-delay: 0.15s; }
.motion-card-enter.visible.d2 { animation-delay: 0.3s; }
.motion-card-enter.visible.d3 { animation-delay: 0.45s; }
.motion-card-enter.visible.d4 { animation-delay: 0.6s; }

@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- 5. Floating Orbs (gradient-morph background) --- */
.gradient-morph {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.gradient-morph .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: orbFloat 8s ease-in-out infinite;
}

/* Hero orbs - brand red */
.gradient-morph .orb-r1 {
    width: 400px; height: 400px;
    background: rgba(164,30,30,0.12);
    top: -100px; left: -50px;
}
.gradient-morph .orb-r2 {
    width: 350px; height: 350px;
    background: rgba(164,30,30,0.08);
    bottom: -80px; right: -30px;
    animation-delay: -3s;
}
.gradient-morph .orb-r3 {
    width: 250px; height: 250px;
    background: rgba(164,30,30,0.06);
    top: 50%; left: 60%;
    animation-delay: -5s;
}

/* Contact orbs - white */
.gradient-morph .orb-w1 {
    width: 400px; height: 400px;
    background: rgba(255,255,255,0.05);
    top: -100px; right: -80px;
}
.gradient-morph .orb-w2 {
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.04);
    bottom: -60px; left: -40px;
    animation-delay: -3s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.1); }
    66% { transform: translate(-20px, 15px) scale(0.9); }
}

/* --- 6. Typewriter Effect --- */
.typewriter {
    font-family: 'Plus Jakarta Sans', monospace;
    color: var(--brand-red-light);
    border-right: 2px solid var(--brand-red);
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    display: inline-block;
    font-size: 14px;
    line-height: 1.8;
}
.typewriter.visible {
    animation: typing 2s steps(30) 0.3s forwards, blinkCaret 0.6s step-end infinite;
}
.typewriter.tw-d1.visible { animation-delay: 0.3s, 0.3s; }
.typewriter.tw-d2.visible { animation-delay: 1.8s, 1.8s; }
.typewriter.tw-d3.visible { animation-delay: 3.3s, 3.3s; }

@keyframes typing {
    to { width: 100%; }
}
@keyframes blinkCaret {
    50% { border-color: transparent; }
}

/* --- 7. Draw-in SVG Line --- */
.draw-line {
    stroke-dasharray: var(--dash-length, 300);
    stroke-dashoffset: var(--dash-length, 300);
}
.draw-line.visible {
    animation: drawIn 1s ease-out forwards;
}
@keyframes drawIn {
    to { stroke-dashoffset: 0; }
}

/* --- 8. Scale-in (bouncy entrance) --- */
.scale-in {
    display: inline-block;
    opacity: 0;
    transform: scale(0) rotate(-15deg);
}
.scale-in.visible {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0) rotate(-15deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

/* --- 9. Progress Bar Fill --- */
.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-fill {
    height: 100%;
    border-radius: 6px;
    width: 0;
    background: linear-gradient(90deg, var(--brand-red), var(--brand-red-light));
}
.progress-fill.visible {
    animation: fillBar 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}
@keyframes fillBar {
    to { width: var(--target, 90%); }
}

/* --- 10. Particle Canvas --- */
#hero-particles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- 11. Counter styling (JS handles animation) --- */
.counter {
    font-family: 'Space Grotesk', sans-serif;
    display: inline-block;
}

/* --- 12. Service Visual Animations --- */

/* IT: Terminal style */
.service-visual-it {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 28px;
    gap: 4px;
}

/* Web: Wireframe SVG */
.service-visual-web {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.service-visual-web svg {
    width: 80%;
    max-width: 280px;
}

/* Social: Notification dots */
.service-visual-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px;
}
.notif-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand-red);
    animation: notifPulse 2s ease-in-out infinite;
}
.notif-dot:nth-child(2) { animation-delay: 0.4s; background: var(--brand-red-light); }
.notif-dot:nth-child(3) { animation-delay: 0.8s; }
.notif-dot:nth-child(4) { animation-delay: 1.2s; background: var(--brand-red-light); }
.notif-dot:nth-child(5) { animation-delay: 1.6s; }
.notif-line {
    width: 60px;
    height: 3px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    margin: 8px 0;
}
.notif-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.5); opacity: 1; }
}

/* AI: Mini floating orbs */
.service-visual-ai {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.service-visual-ai .mini-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    animation: orbFloat 6s ease-in-out infinite;
}
.service-visual-ai .mini-orb-1 {
    width: 120px; height: 120px;
    background: rgba(164,30,30,0.2);
    top: 20%; left: 15%;
}
.service-visual-ai .mini-orb-2 {
    width: 100px; height: 100px;
    background: rgba(196,43,43,0.15);
    bottom: 20%; right: 15%;
    animation-delay: -2s;
}
.service-visual-ai .mini-orb-3 {
    width: 80px; height: 80px;
    background: rgba(164,30,30,0.12);
    top: 40%; left: 50%;
    animation-delay: -4s;
}

/* --- 13. CTA Button Glow (contact section) --- */
.btn-glow {
    animation: btnGlow 3s ease-in-out infinite;
}
@keyframes btnGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(255,255,255,0.1); }
    50% { box-shadow: 0 4px 30px rgba(255,255,255,0.25), 0 0 60px rgba(255,255,255,0.08); }
}

/* --- 14. About Quote Border Glow --- */
.quote-glow {
    animation: quoteBorderGlow 4s ease-in-out infinite;
}
@keyframes quoteBorderGlow {
    0%, 100% { border-left-color: var(--brand-red); }
    50% { border-left-color: var(--brand-red-light); box-shadow: -4px 0 20px rgba(164,30,30,0.15); }
}

/* --- Prefers Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .motion-reveal,
    .motion-card-enter {
        opacity: 1;
        transform: none;
        filter: none;
        animation: none !important;
        transition: none !important;
    }
    .shimmer {
        animation: none !important;
        -webkit-text-fill-color: var(--brand-red-light);
        background: none;
    }
    .gradient-morph .orb,
    .notif-dot,
    .service-visual-ai .mini-orb {
        animation: none !important;
    }
    .typewriter {
        width: 100% !important;
        animation: none !important;
        border-right: none;
    }
    .draw-line {
        stroke-dashoffset: 0 !important;
        animation: none !important;
    }
    .scale-in {
        opacity: 1;
        transform: none;
        animation: none !important;
    }
    .progress-fill {
        width: var(--target, 90%) !important;
        animation: none !important;
    }
    .glow-red, .glow-white {
        animation: none !important;
        text-shadow: none;
    }
    .btn-glow {
        animation: none !important;
        box-shadow: none;
    }
    .quote-glow {
        animation: none !important;
        box-shadow: none;
    }
    #hero-particles {
        display: none !important;
    }
}
