/* Base Styles & Variables */
:root {
    --color-deep-blue: #021024;
    --color-ocean-blue: #05445E;
    --color-turquoise: #05DFD7;
    --color-light-blue: #75E6DA;
    --color-white: #F4F9F9;
    --color-text: #D1E8E2;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Poppins', sans-serif;
    --glass-bg: rgba(5, 68, 94, 0.25);
    --glass-border: rgba(117, 230, 218, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(2, 16, 36, 0.37);
}

* {document.addEventListener('DOMContentLoaded', () => {
    // Scroll Reveal Animations
    const observerOptions = {
        root: null,
        rootMargin: '0px',
        threshold: 0.2
    };

    const observer = new IntersectionObserver((entries, observer) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('appear');
                
                // Trigger counter animation if it's the impact section
                if (entry.target.classList.contains('impact') || entry.target.querySelector('.counter')) {
                    startCounters(entry.target);
                }
                
                observer.unobserve(entry.target);
            }
        });
    }, observerOptions);

    document.querySelectorAll('.fade-in').forEach(el => {
        observer.observe(el);
    });

    // Counter Animation
    const animatedCounters = new Set();
    
    function startCounters(container) {
        const counters = container.querySelectorAll('.counter');
        counters.forEach(counter => {
            if (animatedCounters.has(counter)) return;
            animatedCounters.add(counter);
            
            const target = +counter.getAttribute('data-target');
            const duration = 2000; // 2 seconds
            const step = Math.max(1, Math.floor(target / 40)); 
            
            let current = 0;
            const updateCounter = () => {
                current += step;
                if (current < target) {
                    counter.innerText = Math.ceil(current);
                    requestAnimationFrame(updateCounter);
                } else {
                    counter.innerText = target;
                }
            };
            
            updateCounter();
        });
    }

    // Canvas Bubble Particle System
    const canvas = document.getElementById('bubble-canvas');
    if (canvas) {
        const ctx = canvas.getContext('2d');
        let particles = [];
        
        function resizeCanvas() {
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
        }
        
        window.addEventListener('resize', resizeCanvas);
        resizeCanvas();

        class Particle {
            constructor() {
                this.x = Math.random() * canvas.width;
                this.y = canvas.height + Math.random() * 200;
                this.size = Math.random() * 5 + 2;
                this.speedY = Math.random() * 1.5 + 0.5;
                this.speedX = (Math.random() - 0.5) * 0.5;
                this.opacity = Math.random() * 0.5 + 0.1;
                this.color = `rgba(5, 223, 215, ${this.opacity})`;
            }
            
            update() {
                this.y -= this.speedY;
                this.x += this.speedX;
                
                // Reset when out of screen
                if (this.y < -10) {
                    this.y = canvas.height + 10;
                    this.x = Math.random() * canvas.width;
                }
            }
            
            draw() {
                ctx.beginPath();
                ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
                ctx.fillStyle = this.color;
                ctx.fill();
            }
        }
        
        function initParticles() {
            particles = [];
            let particleCount = Math.floor(window.innerWidth / 20); // Responsive amount
            for (let i = 0; i < particleCount; i++) {
                particles.push(new Particle());
            }
        }
        
        function animateParticles() {
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            for (let i = 0; i < particles.length; i++) {
                particles[i].update();
                particles[i].draw();
            }
            requestAnimationFrame(animateParticles);
        }
        
        initParticles();
        animateParticles();
    }
});

    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-deep-blue);
    color: var(--color-text);
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-white);
}

a {
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.py-section {
    padding: 120px 0;
}

.text-center {
    text-align: center;
}

.text-glow {
    color: var(--color-turquoise);
    text-shadow: 0 0 15px rgba(5, 223, 215, 0.6), 0 0 30px rgba(5, 223, 215, 0.4);
}

/* Glassmorphism Utilities */
.glass-card {
    background: rgba(5, 68, 94, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(117, 230, 218, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(2, 16, 36, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 40px 30px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px 0 rgba(2, 16, 36, 0.7), inset 0 0 20px rgba(5, 223, 215, 0.1);
    border-color: rgba(5, 223, 215, 0.6);
}

.glass-btn {
    background: linear-gradient(135deg, rgba(5, 223, 215, 0.1), rgba(5, 68, 94, 0.3));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(5, 223, 215, 0.4);
    border-radius: 30px;
    color: var(--color-white);
    padding: 15px 35px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.4s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(5, 223, 215, 0.15);
}

.glass-btn:hover {
    background: linear-gradient(135deg, rgba(5, 223, 215, 0.25), rgba(5, 68, 94, 0.5));
    box-shadow: 0 0 25px rgba(5, 223, 215, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.2);
    transform: translateY(-3px) scale(1.02);
}

.btn-primary {
    background: linear-gradient(135deg, #05445E, #05DFD7);
    border: none;
    box-shadow: 0 8px 20px rgba(5, 223, 215, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 12px 30px rgba(5, 223, 215, 0.6);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-white);
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.8rem;
    margin-bottom: 20px;
    font-weight: 800;
    background: linear-gradient(to right, #F4F9F9, #75E6DA);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-divider {
    height: 4px;
    width: 60px;
    background: var(--color-turquoise);
    margin: 0 auto;
    border-radius: 2px;
    position: relative;
}

.title-divider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 4px;
    background: var(--color-light-blue);
    right: -30px;
    border-radius: 2px;
}

/* Background Canvas */
#bubble-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.ocean-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--color-deep-blue) 0%, var(--color-ocean-blue) 100%);
    z-index: -1;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1440 320" xmlns="http://www.w3.org/2000/svg"><path fill="rgba(5, 223, 215, 0.2)" d="M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    background-size: 1000px 100px;
}

.wave1 {
    animation: wave-animation 15s linear infinite;
    z-index: 10;
    opacity: 1;
    bottom: 0;
}

.wave2 {
    animation: wave-animation 20s linear infinite reverse;
    z-index: 9;
    opacity: 0.5;
    bottom: 10px;
}

.wave3 {
    animation: wave-animation 25s linear infinite;
    z-index: 8;
    opacity: 0.2;
    bottom: 15px;
}

@keyframes wave-animation {
    0% { background-position-x: 0; }
    100% { background-position-x: 1000px; }
}

.hero-content {
    max-width: 800px;
    z-index: 2;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 40px;
    font-weight: 300;
    max-width: 600px;
}

/* Problems Section */
.problems {
    position: relative;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
}

.problem-card .icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(5, 223, 215, 0.2), rgba(5, 68, 94, 0.8));
    border: 1px solid rgba(117, 230, 218, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--color-turquoise);
    margin-bottom: 25px;
    box-shadow: 0 0 20px rgba(5, 223, 215, 0.3), inset 0 0 10px rgba(5, 223, 215, 0.2);
    transition: all 0.4s ease;
}

.problem-card:hover .icon-wrapper {
    box-shadow: 0 0 30px rgba(5, 223, 215, 0.6), inset 0 0 15px rgba(5, 223, 215, 0.4);
    transform: scale(1.1);
}

.problem-card h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.problem-card p {
    font-size: 0.95rem;
    color: var(--color-text);
}

/* Impact Section */
.impact {
    background: linear-gradient(180deg, rgba(2, 16, 36, 0.5) 0%, rgba(5, 68, 94, 0.3) 100%);
    position: relative;
    border-top: 1px solid rgba(117, 230, 218, 0.1);
    border-bottom: 1px solid rgba(117, 230, 218, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--color-light-blue);
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(117, 230, 218, 0.5));
}

.stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--color-white);
    margin-bottom: 10px;
    line-height: 1;
    text-shadow: 0 0 15px rgba(5, 223, 215, 0.4);
}

.stat-text {
    font-weight: 300;
    font-size: 1rem;
}

/* Solutions Section */
.solutions-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
}

.solution-item {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.solution-icon {
    font-size: 2.2rem;
    color: var(--color-white);
    background: linear-gradient(135deg, #05DFD7, #05445E);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 20px rgba(2, 16, 36, 0.4);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.solution-item:hover .solution-icon {
    transform: translateY(-5px) rotate(5deg);
    box-shadow: 0 15px 30px rgba(5, 223, 215, 0.5);
}

.solution-content h3 {
    margin-bottom: 10px;
    font-size: 1.25rem;
}

.solution-content p {
    font-size: 0.95rem;
}

/* CTA Section */
.cta-section {
    position: relative;
    overflow: hidden;
}

.cta-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--color-ocean-blue) 0%, var(--color-deep-blue) 100%);
    z-index: -1;
}

.cta-content {
    max-width: 800px;
}

.cta-content h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.cta-content p {
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Footer */
footer {
    padding: 30px 0;
    background: rgba(2, 16, 36, 0.9);
    border-top: 1px solid rgba(117, 230, 218, 0.2);
}

footer p {
    font-size: 0.9rem;
    color: rgba(209, 232, 226, 0.7);
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-up {
    animation: fadeInUp 1s ease forwards;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .cta-content h2 {
        font-size: 2.2rem;
    }
    
    .cta-buttons {
        flex-direction: column;
    }
    
    .solution-item {
        flex-direction: column;
    }
}
