/* Base & Typography */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(107, 58, 110, 0.15);
    color: #3d1f40;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #fafaf5;
}
::-webkit-scrollbar-thumb {
    background: #d4b5dd;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #ba8cc5;
}

/* Navbar */
#navbar {
    background: transparent;
}

#navbar.scrolled {
    background: rgba(250, 250, 245, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(212, 181, 221, 0.2);
    box-shadow: 0 1px 20px rgba(107, 58, 110, 0.05);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #f59e0b;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Mobile menu */
#mobileMenu.open {
    opacity: 1;
    pointer-events: all;
}

#mobileMenu.open #bar1 {
    transform: rotate(45deg) translate(3px, 3px);
}
#mobileMenu.open #bar2 {
    opacity: 0;
    transform: translateX(10px);
}
#mobileMenu.open #bar3 {
    transform: rotate(-45deg) translate(3px, -3px);
}

.mobile-link {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#mobileMenu.open .mobile-link {
    opacity: 1;
    transform: translateY(0);
}

#mobileMenu.open .mobile-link:nth-child(1) { transition-delay: 0.05s; }
#mobileMenu.open .mobile-link:nth-child(2) { transition-delay: 0.1s; }
#mobileMenu.open .mobile-link:nth-child(3) { transition-delay: 0.15s; }
#mobileMenu.open .mobile-link:nth-child(4) { transition-delay: 0.2s; }
#mobileMenu.open .mobile-link:nth-child(5) { transition-delay: 0.25s; }

/* Hero animations */
.hero-subtitle {
    animation: fadeUp 0.8s ease forwards;
}

.hero-title {
    animation: fadeUp 0.8s ease 0.15s forwards;
    opacity: 0;
}

.hero-desc {
    animation: fadeUp 0.8s ease 0.3s forwards;
    opacity: 0;
}

.hero-cta-primary {
    animation: fadeUp 0.8s ease 0.45s forwards;
    opacity: 0;
}

.hero-cta-secondary {
    animation: fadeUp 0.8s ease 0.55s forwards;
    opacity: 0;
}

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

/* Stat cards */
.stat-card {
    animation: floatIn 0.8s ease forwards;
    opacity: 0;
}

.card-main {
    animation-delay: 0.5s;
}

.card-stat:nth-child(1) {
    animation-delay: 0.7s;
}

.card-stat:nth-child(2) {
    animation-delay: 0.85s;
}

.card-accent {
    animation-delay: 1s;
}

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

/* Floating animation for stat cards */
.stat-card.card-main {
    animation: floatMain 6s ease-in-out infinite, floatIn 0.8s ease 0.5s forwards;
    opacity: 0;
}

.stat-card.card-stat {
    animation: floatStat 5s ease-in-out infinite;
}

.stat-card.card-stat:nth-child(2) {
    animation-delay: 1s;
    animation: floatStat2 5.5s ease-in-out infinite;
}

.stat-card.card-accent {
    animation: floatAccent 7s ease-in-out infinite;
}

@keyframes floatMain {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes floatStat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes floatStat2 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes floatAccent {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Scroll line animation */
.scroll-line {
    animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
    0% { top: -16px; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* Service cards */
.service-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.service-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Testimonial cards */
.testimonial-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.testimonial-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hover effects */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #6B3A6E;
    outline-offset: 2px;
}

/* Form select arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23d4b5dd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    appearance: none;
    -webkit-appearance: none;
}

/* Smooth image loading */
img {
    opacity: 1;
    transition: opacity 0.5s ease;
}
</style>

<sm-file path="script.js">
(function () {
    'use strict';

    // Navbar scroll behavior
    const navbar = document.getElementById('navbar');
    let lastScroll = 0;

    function handleScroll() {
        const currentScroll = window.pageYOffset;

        if (currentScroll > 60) {
            navbar.classList.add('scrolled');
        } else {
            navbar.classList.remove('scrolled');
        }

        lastScroll = currentScroll;
    }

    window.addEventListener('scroll', handleScroll, { passive: true });
    handleScroll();

    // Mobile menu
    const menuBtn = document.getElementById('menuBtn');
    const mobileMenu = document.getElementById('mobileMenu');
    const mobileLinks = mobileMenu.querySelectorAll('a');
    let menuOpen = false;

    menuBtn.addEventListener('click', function () {
        menuOpen = !menuOpen;
        mobileMenu.classList.toggle('open', menuOpen);
        document.body.style.overflow = menuOpen ? 'hidden' : '';
    });

    mobileLinks.forEach(function (link) {
        link.addEventListener('click', function () {
            menuOpen = false;
            mobileMenu.classList.remove('open');
            document.body.style.overflow = '';
        });
    });

    // Scroll reveal
    const revealElements = document.querySelectorAll('.reveal, .service-card, .testimonial-card');

    function checkReveal() {
        const windowHeight = window.innerHeight;
        const revealPoint = 100;

        revealElements.forEach(function (el) {
            const elementTop = el.getBoundingClientRect().top;
            if (elementTop < windowHeight - revealPoint) {
                el.classList.add('visible');
            }
        });
    }

    window.addEventListener('scroll', checkReveal, { passive: true });
    window.addEventListener('resize', checkReveal, { passive: true });
    checkReveal();

    // Contact form
    const contactForm = document.getElementById('contactForm');
    const formSuccess = document.getElementById('formSuccess');

    contactForm.addEventListener('submit', function (e) {
        e.preventDefault();

        // Simulate form submission
        const submitBtn = contactForm.querySelector('button[type="submit"]');
        const originalText = submitBtn.textContent;
        submitBtn.textContent = 'Sending...';
        submitBtn.disabled = true;

        setTimeout(function () {
            contactForm.reset();
            formSuccess.classList.remove('hidden');
            submitBtn.textContent = originalText;
            submitBtn.disabled = false;

            // Hide success message after 5 seconds
            setTimeout(function () {
                formSuccess.classList.add('hidden');
            }, 5000);
        }, 1200);
    });

    // Smooth scroll for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(function (anchor) {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            const target = document.querySelector(anchor.getAttribute('href'));
            if (target) {
                const navHeight = navbar.offsetHeight;
                const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - navHeight - 20;
                window.scrollTo({
                    top: targetPosition,
                    behavior: 'smooth'
                });
            }
        });
    });
})();
