/* ==========================================================================
   Algoloom Tech Solutions - Animations & Graphics Layer
   Advanced CSS Animations, Scroll Effects & Visual Enhancements
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PAGE LOADER
   -------------------------------------------------------------------------- */
#page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    animation: loaderPulse 1.5s ease-in-out infinite;
}

/* Logo image in loader */
.loader-logo-img {
    height: 72px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
    /* Make colorful logo visible on dark loader background */
    filter: drop-shadow(0 2px 16px rgba(6, 182, 212, 0.5)) brightness(1.05);
    background: white;
    border-radius: 12px;
    padding: 8px 18px;
}

.loader-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 99px;
    overflow: hidden;
}

.loader-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0284c7, #06b6d4, #6366f1);
    border-radius: 99px;
    animation: loaderFill 1.2s ease forwards;
}

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

@keyframes loaderPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.04); opacity: 0.9; }
}

/* --------------------------------------------------------------------------
   2. HERO ANIMATED BACKGROUND — Gradient Blobs
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
    animation: blobFloat 10s ease-in-out infinite alternate;
}

.hero-blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #0284c7, #06b6d4);
    top: -150px;
    left: -150px;
    animation-duration: 12s;
}

.hero-blob-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #6366f1, #8b5cf6);
    bottom: -120px;
    right: -100px;
    animation-duration: 15s;
    animation-delay: -5s;
}

.hero-blob-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #10b981, #06b6d4);
    top: 40%;
    left: 40%;
    animation-duration: 18s;
    animation-delay: -8s;
    opacity: 0.25;
}

@keyframes blobFloat {
    0%   { transform: translate(0px, 0px) scale(1); }
    33%  { transform: translate(30px, -30px) scale(1.05); }
    66%  { transform: translate(-20px, 20px) scale(0.96); }
    100% { transform: translate(20px, 10px) scale(1.03); }
}

.hero .container,
.hero .hero-grid {
    position: relative;
    z-index: 2;
}

/* Particle Canvas */
#hero-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   3. SCROLL REVEAL — Base State (hidden) → Animated
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.reveal-left {
    transform: translateX(-50px);
}

.reveal.reveal-right {
    transform: translateX(50px);
}

.reveal.reveal-scale {
    transform: scale(0.9);
}

.reveal.visible {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Stagger delays for grid children */
.reveal-stagger > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.15s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.25s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.35s; }
.reveal-stagger > *:nth-child(5) { transition-delay: 0.45s; }
.reveal-stagger > *:nth-child(6) { transition-delay: 0.55s; }

/* --------------------------------------------------------------------------
   4. ANIMATED COUNTER NUMBERS
   -------------------------------------------------------------------------- */
[data-count] {
    display: inline-block;
}

/* --------------------------------------------------------------------------
   5. HERO CONTENT TEXT — Typing Effect Cursor
   -------------------------------------------------------------------------- */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--primary, #0284c7);
    margin-left: 3px;
    vertical-align: text-bottom;
    animation: cursorBlink 0.85s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* --------------------------------------------------------------------------
   6. TECH STACK MARQUEE STRIP
   -------------------------------------------------------------------------- */
.tech-marquee-section {
    background: var(--dark, #0f172a);
    padding: 22px 0;
    overflow: hidden;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tech-marquee-label {
    display: none; /* hidden on small screens, show on lg */
}

.marquee-track {
    display: flex;
    gap: 0;
    width: max-content;
    animation: marqueeScroll 28s linear infinite;
}

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

.marquee-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 30px;
    color: rgba(255,255,255,0.6);
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.marquee-item:hover {
    color: #06b6d4;
}

.marquee-item i {
    font-size: 1.1rem;
    color: #0284c7;
}

.marquee-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.12);
    margin: auto 0;
    flex-shrink: 0;
}

@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* --------------------------------------------------------------------------
   7. SERVICE CARD — Shine & Icon Pulse on Hover
   -------------------------------------------------------------------------- */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -60%;
    width: 220%;
    height: 220%;
    background: conic-gradient(
        transparent 0deg 240deg,
        rgba(2, 132, 199, 0.15) 240deg 300deg,
        transparent 300deg 360deg
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: inherit;
    pointer-events: none;
}

.service-card:hover::before {
    opacity: 1;
    animation: cardShine 1.2s linear;
}

@keyframes cardShine {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.service-card:hover .service-icon {
    animation: iconPulse 0.6s ease;
}

@keyframes iconPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18) rotate(-5deg); }
    70%  { transform: scale(0.95) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* --------------------------------------------------------------------------
   8. PROJECT CARD — Image Overlay Glow
   -------------------------------------------------------------------------- */
.project-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: inherit;
}

.project-card:hover .project-img::after {
    opacity: 1;
}

.project-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.4s ease;
}

/* --------------------------------------------------------------------------
   9. CTA SECTION — Animated Gradient & Floating Orbs
   -------------------------------------------------------------------------- */
.cta-section {
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        270deg,
        #0284c7, #06b6d4, #4f46e5, #7c3aed, #0284c7
    );
    background-size: 400% 400%;
    animation: ctaGradient 8s ease infinite;
    z-index: 0;
}

.cta-section > .container {
    position: relative;
    z-index: 2;
}

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

.cta-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: ctaOrbFloat 8s ease-in-out infinite alternate;
}

.cta-orb-1 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.12), transparent);
    top: -80px; left: -80px;
}

.cta-orb-2 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1), transparent);
    bottom: -60px; right: -40px;
    animation-duration: 12s;
    animation-delay: -4s;
}

.cta-orb-3 {
    width: 150px; height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.08), transparent);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 6s;
}

@keyframes ctaOrbFloat {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(20px, -20px) scale(1.1); }
}

/* --------------------------------------------------------------------------
   10. TESTIMONIAL CARD — Star Rating & Hover Lift
   -------------------------------------------------------------------------- */
.testimonial-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.4s ease;
}

.testimonial-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 24px 48px rgba(2, 132, 199, 0.18);
}

.star-rating {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
}

.star-rating i {
    color: #f59e0b;
    font-size: 0.95rem;
    animation: starPop 0.4s ease forwards;
    opacity: 0;
}

.testimonial-card:hover .star-rating i:nth-child(1) { animation-delay: 0.0s; }
.testimonial-card:hover .star-rating i:nth-child(2) { animation-delay: 0.08s; }
.testimonial-card:hover .star-rating i:nth-child(3) { animation-delay: 0.16s; }
.testimonial-card:hover .star-rating i:nth-child(4) { animation-delay: 0.24s; }
.testimonial-card:hover .star-rating i:nth-child(5) { animation-delay: 0.32s; }

@keyframes starPop {
    0%   { opacity: 0; transform: scale(0.5) rotate(-15deg); }
    70%  { opacity: 1; transform: scale(1.3) rotate(5deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Always show stars (just no pop animation by default) */
.star-rating i {
    opacity: 1;
    animation: none;
}

/* --------------------------------------------------------------------------
   11. HEADER — Animated Logo Glow (image-based logo)
   -------------------------------------------------------------------------- */
.logo-img {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.logo-img-wrap:hover .logo-img {
    filter: drop-shadow(0 0 12px rgba(2, 132, 199, 0.5)) drop-shadow(0 0 24px rgba(6, 182, 212, 0.25));
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   12. BUTTON — Ripple Effect
   -------------------------------------------------------------------------- */
.btn {
    position: relative;
    overflow: hidden;
}

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

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

/* --------------------------------------------------------------------------
   13. FOOTER — Social Links Glow
   -------------------------------------------------------------------------- */
.social-links a:hover {
    box-shadow: 0 0 16px rgba(2, 132, 199, 0.5);
}

/* --------------------------------------------------------------------------
   14. SECTION TITLE — Animated Underline
   -------------------------------------------------------------------------- */
.section-title h2::after {
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0;
}

.section-title.title-animated h2::after {
    width: 60px;
}

/* --------------------------------------------------------------------------
   15. FLOATING BADGE — Enhanced Glow
   -------------------------------------------------------------------------- */
.floating-badge {
    box-shadow: 0 10px 30px rgba(2, 132, 199, 0.2);
    transition: box-shadow 0.3s ease;
}

.floating-badge:hover {
    box-shadow: 0 15px 40px rgba(2, 132, 199, 0.4);
}

/* --------------------------------------------------------------------------
   16. HERO STAT NUMBERS — Shimmer on Load
   -------------------------------------------------------------------------- */
.hero-stat-item .num {
    position: relative;
    display: inline-block;
}

/* --------------------------------------------------------------------------
   17. SKILL / VALUE CARDS — Border Glow Pulse
   -------------------------------------------------------------------------- */
.value-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.value-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(2, 132, 199, 0.2);
}

.value-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--primary, #0284c7), var(--secondary, #06b6d4));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
    border-radius: 0 0 2px 2px;
}

.value-card:hover::after {
    transform: scaleX(1);
}

/* --------------------------------------------------------------------------
   18. STAT BOX — Count Reveal Animation
   -------------------------------------------------------------------------- */
.stat-box {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 14px 35px rgba(2, 132, 199, 0.2);
}

/* --------------------------------------------------------------------------
   19. HERO CONSOLE — Enhanced Glow
   -------------------------------------------------------------------------- */
.hero-tech-console {
    animation: consoleEntrance 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s both;
}

@keyframes consoleEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --------------------------------------------------------------------------
   20. HERO CONTENT — Staggered Entry
   -------------------------------------------------------------------------- */
.hero-content .badge {
    animation: heroFadeUp 0.6s ease 0.1s both;
}
.hero-content h1 {
    animation: heroFadeUp 0.7s ease 0.2s both;
}
.hero-content p {
    animation: heroFadeUp 0.7s ease 0.35s both;
}
.hero-content .hero-btns {
    animation: heroFadeUp 0.7s ease 0.5s both;
}

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

/* --------------------------------------------------------------------------
   21. SCROLL TO TOP BUTTON
   -------------------------------------------------------------------------- */
#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4);
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none;
}

#scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

#scroll-top-btn:hover {
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.6);
    transform: translateY(-3px);
}

/* --------------------------------------------------------------------------
   22. NAV LINK — Ripple On Hover
   -------------------------------------------------------------------------- */
.nav-links a {
    position: relative;
}

/* --------------------------------------------------------------------------
   23. ABOUT PAGE — IMAGE PLACEHOLDER ANIMATION
   -------------------------------------------------------------------------- */
.about-visual-card {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 20px;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(2, 132, 199, 0.15);
    border: 1px solid rgba(2, 132, 199, 0.15);
}

.about-visual-card::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(2,132,199,0.15), transparent);
    top: -80px; right: -80px;
    animation: blobFloat 10s ease-in-out infinite alternate;
}

.about-visual-card::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.12), transparent);
    bottom: -50px; left: -50px;
    animation: blobFloat 14s ease-in-out infinite alternate-reverse;
}

.about-icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    position: relative;
    z-index: 2;
}

.about-icon-item {
    background: white;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    border: 1px solid rgba(2,132,199,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: floatBadge 4s ease-in-out infinite alternate;
}

.about-icon-item:nth-child(2) { animation-delay: -1s; }
.about-icon-item:nth-child(3) { animation-delay: -2s; }
.about-icon-item:nth-child(4) { animation-delay: -3s; }

.about-icon-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(2,132,199,0.2);
}

.about-icon-item i {
    font-size: 2rem;
    color: #0284c7;
    margin-bottom: 10px;
    display: block;
}

.about-icon-item span {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    font-family: 'Poppins', sans-serif;
}

/* --------------------------------------------------------------------------
   RESPONSIVE ADJUSTMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .hero-blob-1 {
        width: 300px; height: 300px;
    }
    .hero-blob-2 {
        width: 250px; height: 250px;
    }
    #scroll-top-btn {
        bottom: 20px; right: 20px;
        width: 42px; height: 42px;
    }
}
