const { useState, useEffect, useRef, createContext, useContext } = React;

const TRANSLATIONS = {
    // Nav
    'Services': 'Servicios',
    'Process': 'Proceso',
    'Custom Apps': 'Apps a medida',
    'Get Started': 'Empezar',
    'Book a Free Call': 'Reserva una llamada gratuita',
    // Hero
    'Full-Stack Growth Partner for Local Services': 'Socio de crecimiento integral para servicios locales',
    "We don't just run ": 'No solo creamos ',
    "We win when you win.": "Ganamos cuando tú ganas.",
    'Modern websites. Custom business apps. Smart AI automation. Accountable performance ads. We are in the game with you — and we only win when you win.': 'Sitios web modernos. Apps a medida para tu negocio. Automatización inteligente con IA. Anuncios de rendimiento con responsabilidad. Estamos en el juego contigo — y solo ganamos cuando tú ganas.',
    'See What We Build': 'Mira lo que construimos',
    'Crafted, Not Templated': 'Hecho a medida, no con plantillas',
    'We Only Win When You Win': 'Solo ganamos si tú ganas',
    'No Black-Box Retainers': 'Sin tarifas ocultas',
    'AI-Powered Automation': 'Automatización con IA',
    // Rotating Text
    'campaigns': 'campañas',
    'websites': 'sitios web',
    'automation': 'automatización',
    'apps': 'apps',
    // Problem
    'The Problem': 'El Problema',
    "You've been burned.": 'Te han quemado.',
    "We built this because of it.": "Por eso creamos esto.",
    "Thousands of local business owners have paid for promises and gotten nothing. Retainers that kept billing. Templates that look like every competitor's. Decks full of jargon with no connection to actual revenue.": "Miles de dueños de negocios locales han pagado por promesas y no han obtenido nada. Contratos que seguían facturando. Plantillas que se ven como las de todos los competidores. Presentaciones llenas de jerga sin conexión con los ingresos reales.",
    'Retainers for nothing': 'Pagos mensuales por nada',
    "Agencies keep billing month after month regardless of results. Your budget disappears. Your growth doesn't.": "Las agencias siguen facturando mes tras mes sin importar los resultados. Tu presupuesto desaparece. Tu crecimiento no.",
    'Templates everywhere': 'Plantillas por todas partes',
    "Your site looks identical to your competitor's because they used the same cheap theme. Zero differentiation.": "Tu sitio se ve idéntico al de tu competidor porque usaron el mismo tema barato. Cero diferenciación.",
    'Jargon without accountability': 'Jerga sin responsabilidad',
    'Decks full of "impressions" and "brand awareness" with zero connection to actual revenue.': 'Presentaciones llenas de "impresiones" y "reconocimiento de marca" sin conexión con los ingresos reales.',
    'Disappear after launch': 'Desaparecen después del lanzamiento',
    'Big energy during the pitch. Radio silence after you sign. Support tickets go unanswered for weeks.': 'Mucha energía durante la presentación. Silencio absoluto después de firmar. Los tickets de soporte no se responden durante semanas.',
    "Adrian's Strategies Group is the response to that system.": "Adrian's Strategies Group es la respuesta a ese sistema.",
    'We are the clutch teammate — in the game with you, executing when it counts. Performance-based. Transparent. Built on one unbreakable rule: ': 'Somos tu compañero de equipo decisivo: en el juego contigo, ejecutando cuando importa. Basado en el rendimiento. Transparente. Construido sobre una regla inquebrantable: ',
    'we only win when you win.': 'solo ganamos cuando tú ganas.',
    // Services
    'What We Build': 'Qué construimos',
    'The full stack.': 'Todo el paquete.',
    'Nothing missing.': 'No falta nada.',
    'We build the complete digital engine for local service businesses. Custom websites and apps, smart automation, and precise advertising all under one roof.': 'Construimos el motor digital completo para empresas de servicios locales. Sitios web y apps a medida, automatización inteligente y publicidad precisa, todo bajo un mismo techo.',
    'Custom Websites': 'Sitios web personalizados',
    'Every site starts from a blank canvas. Designed specifically for your brand, and engineered for high conversions.': 'Cada sitio comienza desde un lienzo en blanco. Diseñado específicamente para tu marca y diseñado para tener altas conversiones.',
    'Conversion-optimized UX': 'Diseño web optimizado para conseguir clientes',
    'Mobile-first responsive': 'Adaptado para celulares desde el inicio',
    'SEO & performance built-in': 'SEO y rendimiento incorporados',
    'Future-Ready': 'Listo para el futuro',
    'AI chatbot + voice receptionist that handles leads, answers questions, and books appointments securely 24/7.': 'Chatbot de IA + recepcionista de voz que maneja clientes potenciales, responde preguntas y reserva citas de forma segura las 24 horas del día, los 7 días de la semana.',
    'AI chatbot on your site': 'Chatbot de IA en tu sitio',
    'Voice receptionist system': 'Sistema de recepción por voz',
    'Automated booking flow': 'Flujo de reserva automatizado',
    'Built to Perform': 'Creado para rendir',
    'Google and Meta ads with absolute accountability. You pay platforms directly. We handle strategy and optimization.': 'Anuncios en Google y Meta de forma absolutamente responsable. Le pagas directamente a las plataformas. Nosotros nos encargamos de la estrategia y la optimización.',
    'Google & Meta campaigns': 'Campañas en Google y Meta',
    'Zero platform markup': 'Cero margen de beneficio de la plataforma',
    'Full ROI tracking': 'Seguimiento completo del ROI',
    'Made For You': 'Hecho para ti',
    'Custom apps for the way your business actually runs: booking, customer records, quotes, and team tools in one place.': 'Apps a medida según cómo funciona realmente tu negocio: reservas, registros de clientes, cotizaciones y herramientas para tu equipo en un solo lugar.',
    'Built around your workflow': 'Hecha según tu forma de trabajar',
    'Works on phone and desktop': 'Funciona en celular y computadora',
    'Customer & team logins': 'Acceso para clientes y equipo',
    'Explore approach ': 'Explorar enfoque ',
    'Tech Stack & Capabilities': 'Tecnología y Capacidades',
    // Process
    'Our Process': 'Nuestro Proceso',
    'Four steps. Full clarity.': 'Cuatro pasos. Claridad total.',
    'No surprises.': 'Sin sorpresas.',
    'Every client moves through the same transparent four-step process. You know exactly where things are, what\'s next, and what it costs.': 'Cada cliente pasa por el mismo proceso transparente de cuatro pasos. Sabes exactamente dónde están las cosas, qué sigue y cuánto cuesta.',
    'Consultation': 'Consulta',
    "We dissect your business, goals, and understand exactly where you're losing. We diagnose the pain before prescribing the cure.": "Analizamos tu negocio, tus objetivos y entendemos exactamente dónde estás perdiendo. Diagnosticamos el problema antes de recetar la cura.",
    'Scope & Quote': 'Alcance y Cotización',
    'An itemized proposal where you see exactly what you\'re paying for. If the budget is tight, we rework it. No hidden fees.': 'Una propuesta detallada en la que ves exactamente por lo que estás pagando. Si el presupuesto es ajustado, lo revisamos. Sin cargos ocultos.',
    'Build Phase': 'Fase de Construcción',
    "We design and develop with you in the loop. Regular check-ins and live previews. You track progress — absolutely no big-reveal surprises.": "Diseñamos y desarrollamos contigo al tanto de todo. Controles periódicos y vistas previas en directo. Supervisas el progreso: cero sorpresas.",
    'Launch & Grow': 'Lanzar y Crecer',
    "We deploy everything and stay in it. Ads tracked, AI active, full monthly reporting. We don't vanish after launch. This is the partnership.": "Implementamos todo y nos mantenemos al tanto. Anuncios con seguimiento, IA activa, informes mensuales completos. No desaparecemos después del lanzamiento. Somos un equipo.",
    'Start With a Free Consultation ': 'Empieza Con una Consulta Gratuita ',
    // Custom apps
    'Built Around Your Business': 'Hecho para tu negocio',
    'Apps that fit': 'Apps que se adaptan',
    'how you work.': 'a tu forma de trabajar.',
    'Most local businesses run on spreadsheets, text threads, and software that almost fits. A custom app puts the way you work in one place.': 'La mayoría de los negocios locales funcionan con hojas de cálculo, cadenas de mensajes y programas que casi sirven. Una app a medida reúne tu forma de trabajar en un solo lugar.',
    'We design and build apps around your real day-to-day: booking, scheduling, customer records, quotes, and job tracking. They work on phones and computers, and we only build what your team will actually use.': 'Diseñamos y construimos apps en torno a tu día a día: reservas, horarios, registros de clientes, cotizaciones y seguimiento de trabajos. Funcionan en celulares y computadoras, y solo construimos lo que tu equipo realmente va a usar.',
    'Plan My App ': 'Planear mi app ',
    'Booking & Scheduling': 'Reservas y horarios',
    'Customers book online and your team sees one up-to-date calendar.': 'Tus clientes reservan en línea y tu equipo ve un solo calendario actualizado.',
    'Customer Portals': 'Portales para clientes',
    'Give customers one place to see appointments, quotes, and updates.': 'Dale a tus clientes un solo lugar para ver citas, cotizaciones y novedades.',
    'Quotes & Invoices': 'Cotizaciones y facturas',
    'Create, send, and track quotes and invoices from your phone.': 'Crea, envía y da seguimiento a cotizaciones y facturas desde tu celular.',
    'Team Dashboards': 'Paneles para tu equipo',
    'See jobs, leads, and follow-ups on one screen.': 'Ve trabajos, clientes potenciales y seguimientos en una sola pantalla.',
    '5 questions to help us understand where you are. Followed by a strategy call.': '5 preguntas para ayudarnos a entender dónde te encuentras. Seguido de una llamada de estrategia.',
    // ROI
    "See How Much You're Leaving on the Table": "Mira cúanto dinero estás perdiendo de ganar",
    'Monthly Ad Spend': 'Inversión publicitaria mensual',
    'Avg. Ticket Size': 'Ingreso medio (Ticket medio)',
    'Estimated Untapped Monthly Revenue': 'Ingresos mensuales no aprovechados estimados',
    '*Based on standard conversion rate improvements from our optimized landing pages and AI follow-up.': '*Basado en las mejoras de la tasa de conversión estándar de nuestras páginas de destino optimizadas y el seguimiento con IA.',
    // Footer
    'Building modern, high-performance digital experiences that elevate and scale local businesses.': 'Creación de experiencias digitales modernas y de alto rendimiento que elevan y hacen crecer a los negocios locales.',
    'Company': 'Empresa',
    'How It Works': 'Cómo funciona',
    
    'Ready to grow?': '¿Listo para crecer?',
    '5 questions to help us understand where you are. Followed by a strategy call.': '5 preguntas para ayudarnos a entender dónde te encuentras. Seguido de una llamada de estrategia.',
    'Book Free Call ': 'Reserva llamada gratuita ',
    "© 2026 Adrian's Strategies Group. All rights reserved.": "© 2026 Adrian's Strategies Group. Todos los derechos reservados.",
    // Quiz & Forms
    'Get Started': 'Empezar',
    'Answer 5 quick questions.': 'Responde 5 preguntas rápidas.',
    'Book your discovery call.': 'Agendar una llamada de descubrimiento.',
    'We review your answers prior to the call so we show up thoroughly prepared — not guessing what you actually need. Takes only 90 seconds.': 'Revisamos tus respuestas antes de la llamada para que estemos completamente preparados, sin adivinar lo que realmente necesitas. Toma solo 90 segundos.',
    'Last step': 'Ultimo paso',
    ' of ': ' de ',
    '% complete': '% completado',
    'Almost there': 'Casi termino',
    'Where should we send the recap?': '¿A donde deberíamos mandar un resumen?',
    'We review your answers before the call so we show up prepared — not winging it.': 'Revisamos tus respuestas antes de la llamada para mostrarnos listos, sin improvisar.',
    'Your name': 'Su nombre',
    'Email address': 'Correo electrónico',
    'Back': 'Volver',
    'Book My Free Call': 'Agendar Mis Llamada Gratuita',
    'Continue': 'Continuar',
    "You're all set": "Todo Listo",
    "Opening your booking page now. We'll review your answers before the call so we come prepared.": "Abriendo su página para agendar ahora. Revisaremos sus antes respuestas de la llamada para estar preparados.",
    "Redirecting to your booking page…": "Redireccionando a su página de reservas...",

    'Page did not open? Book here.': '¿No se abrió la página? Reserva aquí.',

    // Quiz Options
    'What type of business are you running?': '¿Qué tipo de empresa gestionas?',
    'We work with local service businesses. Pick the closest match.': 'Trabajamos con empresas de servicios locales. Elige la opción más cercana.',
    'HVAC / Trades': 'HVAC / Oficios',
    'Heating, cooling, plumbing, electrical': 'Calefacción, refrigeración, plomería, electricidad',
    'Medical / Transport': 'Médico / Transporte',
    'Healthcare, medical transport, clinics': 'Salud, transporte médico, clínicas',
    'Travel / Hospitality': 'Viajes / Hostelería',
    'Travel agencies, tourism, vacation planning': 'Agencias de viajes, turismo, planificación de vacaciones',
    'Restaurant / Retail': 'Restaurante / Retail',
    'Food service, retail, consumer goods': 'Servicio de comidas, comercio minorista, bienes de consumo',
    'Professional Services': 'Servicios profesionales',
    'Legal, financial, consulting, real estate': 'Legal, financiero, consultoría, inmobiliaria',
    'Other Local Business': 'Otros negocios locales',
    'Cleaning, fitness, beauty, and more': 'Limpieza, fitness, belleza y más',
    'Where are you right now digitally?': '¿Dónde estás ahora mismo digitalmente?',
    "Be honest — this helps us figure out exactly where to start.": "Sé honesto: esto nos ayuda a saber exactamente por dónde empezar.",
    'No real online presence': 'No hay presencia en línea real',
    'Little to no website or digital footprint': 'Poco o ningún sitio web o huella digital',
    "Template site that's not working": "Sitio de plantilla que no funciona",
    'Have a Wix, Squarespace, or basic site': 'Ten un sitio básico, Squarespace o Wix',
    'Custom site but outdated': 'Sitio personalizado pero obsoleto',
    'Professionally built but old and underperforming': 'Construido profesionalmente pero antiguo y con bajo rendimiento',
    'Burned by an agency before': 'Quemado por una agencia antes',
    'Paid good money, got bad results': 'Pagaste buen dinero, obtuviste malos resultados',
    "What's your current annual revenue?": "¿Cuáles son tus ingresos anuales actuales?",
    'This helps us tailor the right growth strategy for your stage.': 'Esto nos ayuda a adaptar la estrategia de crecimiento adecuada a tu etapa.',
    'Under $300K': 'Menos de $ 300 mil',
    'Early growth stage — building momentum': 'Etapa inicial de crecimiento: ganar impulso',
    '$300K — $1M': '$300 mil — $1 millón',
    'Growing and ready to scale': 'Creciendo y listo para escalar',
    '$1M — $3M': '$1M — $3M',
    'Established and ready to dominate': 'Establecido y listo para dominar',
    'Over $3M': 'Más de $3M',
    'Scaling to the next level': 'Escalar al siguiente nivel',
    'What do you need most right now?': '¿Qué necesitas más en este momento?',
    'Select all that apply — we build full stacks or focused solutions.': 'Selecciona todo lo que aplique: construimos stacks completos o soluciones enfocadas.',
    'A website that actually converts': 'Un sitio web que realmente convierta',
    'Custom-built, crafted from scratch': 'Construido a medida, creado desde cero',
    'AI lead automation': 'Automatización de clientes potenciales con IA',
    'Chatbot + voice receptionist, 24/7': 'Chatbot + recepcionista de voz, 24/7',
    'Performance advertising': 'Publicidad de rendimiento',
    'Google & Meta ads that prove ROI': 'Anuncios de Google y Meta que demuestran el ROI',
    'A custom app for my business': 'Una app a medida para mi negocio',
    'Booking, customer, or team tools': 'Herramientas de reservas, clientes o equipo',
    'How fast do you want to move?': '¿Qué tan rápido quieres moverte?',
    'No wrong answer — this just helps us prioritize your call.': 'No hay respuestas incorrectas, esto solo nos ayuda a priorizar tu llamada.',
    'Ready to start now': 'Listo para empezar ahora',
    "Let's go — I know what I want": "Vamos, sé lo que quiero",
    'Within the next 30 days': 'En los próximos 30 días',
    'Exploring but getting close to deciding': 'Explorando pero acercándose a decidir',
    'Just exploring options': 'Solo explorando opciones',
    "Learning what's possible before committing": "Aprender lo que es posible antes de comprometerse"
};

const LanguageContext = createContext({ lang: 'en', setLang: () => { }, t: (str) => str });

function useLang() {
    return useContext(LanguageContext);
}

function LanguageProvider({ children }) {
    const [lang, setLang] = useState(() => { try { return localStorage.getItem('asg-lang') || 'en'; } catch (e) { return 'en'; } });
    useEffect(() => {
        document.documentElement.lang = lang;
        try { localStorage.setItem('asg-lang', lang); } catch (e) { }
    }, [lang]);
    const t = (str) => (lang === 'es' && TRANSLATIONS[str]) || str;
    return <LanguageContext.Provider value={{ lang, setLang, t }}>{children}</LanguageContext.Provider>;
}

/* ── Rotating Text (GSAP-powered slide) ── */
function RotatingText({ words, interval = 2500, style }) {
    const [idx, setIdx] = useState(0);
    const spanRef = useRef(null);
    const idxRef = useRef(0);
    useEffect(() => {
        const id = setInterval(() => {
            const gsap = window.gsap;
            const next = (idxRef.current + 1) % words.length;
            if (gsap && spanRef.current) {
                gsap.to(spanRef.current, {
                    y: '-110%', opacity: 0, duration: 0.35, ease: 'power2.inOut',
                    onComplete: () => {
                        idxRef.current = next;
                        setIdx(next);
                        gsap.fromTo(spanRef.current,
                            { y: '110%', opacity: 0 },
                            { y: '0%', opacity: 1, duration: 0.4, ease: 'power2.out' }
                        );
                    }
                });
            } else {
                idxRef.current = next;
                setIdx(next);
            }
        }, interval);
        return () => clearInterval(id);
    }, [words.length, interval]);
    const longest = words.reduce((a, b) => a.length > b.length ? a : b, '');
    return (
        <span style={{ position: 'relative', display: 'inline-flex', overflow: 'hidden', verticalAlign: 'bottom', ...style }}>
            <span style={{ visibility: 'hidden', pointerEvents: 'none', paddingBottom: '0.15em' }}>{longest}</span>
            <span ref={spanRef} style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', paddingBottom: '0.15em' }}>
                {words[idx]}
            </span>
        </span>
    );
}

/* ── Glowing Border Effect ── */
function GlowingEffect({ spread = 20, borderWidth = 1, proximity = 0, inactiveZone = 0.7 }) {
    const wrapRef = useRef(null);
    const gsapObj = useRef({ val: 0 });
    const lastPos = useRef({ x: 0, y: 0 });
    const rafRef = useRef(null);

    useEffect(() => {
        const el = wrapRef.current;
        if (!el) return;

        const handleMove = (e) => {
            if (rafRef.current) cancelAnimationFrame(rafRef.current);
            rafRef.current = requestAnimationFrame(() => {
                const { left, top, width, height } = el.getBoundingClientRect();
                const mx = e ? e.clientX : lastPos.current.x;
                const my = e ? e.clientY : lastPos.current.y;
                if (e) lastPos.current = { x: mx, y: my };

                const cx = left + width * 0.5, cy = top + height * 0.5;
                const dist = Math.hypot(mx - cx, my - cy);
                if (dist < 0.5 * Math.min(width, height) * inactiveZone) {
                    el.style.setProperty('--ga', '0'); return;
                }

                const active = mx > left - proximity && mx < left + width + proximity &&
                    my > top - proximity && my < top + height + proximity;
                el.style.setProperty('--ga', active ? '1' : '0');
                if (!active) return;

                const target = (180 * Math.atan2(my - cy, mx - cx)) / Math.PI + 90;
                const diff = ((target - gsapObj.current.val + 180) % 360) - 180;
                const newAngle = gsapObj.current.val + diff;

                const gsap = window.gsap;
                if (gsap) {
                    gsap.to(gsapObj.current, {
                        val: newAngle, duration: 2, ease: 'power1.out', overwrite: true,
                        onUpdate: () => el.style.setProperty('--gs', String(gsapObj.current.val))
                    });
                } else {
                    gsapObj.current.val = newAngle;
                    el.style.setProperty('--gs', String(newAngle));
                }
            });
        };

        const onScroll = () => handleMove(null);
        window.addEventListener('scroll', onScroll, { passive: true });
        document.body.addEventListener('pointermove', handleMove, { passive: true });
        return () => {
            if (rafRef.current) cancelAnimationFrame(rafRef.current);
            window.removeEventListener('scroll', onScroll);
            document.body.removeEventListener('pointermove', handleMove);
        };
    }, [inactiveZone, proximity]);

    return (
        <div ref={wrapRef} className="glow-wrap" style={{ '--gw': `${borderWidth}px`, '--gsp': spread }}>
            <div className="glow-inner" />
        </div>
    );
}

/* ── Quiz ── */
function Quiz() {
    const { t, lang } = useLang();
    const [honeypot, setHoneypot] = useState('');
    const honeypotRef = useRef(null);
    const STEPS = [
        {
            id: 'biz', step: '01', label: `Step 1${t(' of ')}5`, q: t('What type of business are you running?'), sub: t('We work with local service businesses. Pick the closest match.'), multi: false,
            opts: [
                { v: 'hvac', e: <QWrench />, l: t('HVAC / Trades'), d: t('Heating, cooling, plumbing, electrical') },
                { v: 'med', e: <QCross />, l: t('Medical / Transport'), d: t('Healthcare, medical transport, clinics') },
                { v: 'travel', e: <QPlane />, l: t('Travel / Hospitality'), d: t('Travel agencies, tourism, vacation planning') },
                { v: 'food', e: <QFork />, l: t('Restaurant / Retail'), d: t('Food service, retail, consumer goods') },
                { v: 'pro', e: <QBriefcase />, l: t('Professional Services'), d: t('Legal, financial, consulting, real estate') },
                { v: 'other', e: <QLightning />, l: t('Other Local Business'), d: t('Cleaning, fitness, beauty, and more') },
            ],
        },
        {
            id: 'sit', step: '02', label: `Step 2${t(' of ')}5`, q: t('Where are you right now digitally?'), sub: t("Be honest — this helps us figure out exactly where to start."), multi: false,
            opts: [
                { v: 'none', e: <QCircleX />, l: t('No real online presence'), d: t('Little to no website or digital footprint') },
                { v: 'template', e: <QBrowser />, l: t("Template site that's not working"), d: t('Have a Wix, Squarespace, or basic site') },
                { v: 'old', e: <QClock />, l: t('Custom site but outdated'), d: t('Professionally built but old and underperforming') },
                { v: 'burned', e: <QWarning />, l: t('Burned by an agency before'), d: t('Paid good money, got bad results') },
            ],
        },
        {
            id: 'rev', step: '03', label: `Step 3${t(' of ')}5`, q: t("What's your current annual revenue?"), sub: t('This helps us tailor the right growth strategy for your stage.'), multi: false,
            opts: [
                { v: 'u300', e: <QChartUp />, l: t('Under $300K'), d: t('Early growth stage — building momentum') },
                { v: '1m', e: <QRocket />, l: t('$300K — $1M'), d: t('Growing and ready to scale') },
                { v: '3m', e: <QFlame />, l: t('$1M — $3M'), d: t('Established and ready to dominate') },
                { v: 'over', e: <QTrophy />, l: t('Over $3M'), d: t('Scaling to the next level') },
            ],
        },
        {
            id: 'need', step: '04', label: `Step 4${t(' of ')}5`, q: t('What do you need most right now?'), sub: t('Select all that apply — we build full stacks or focused solutions.'), multi: true,
            opts: [
                { v: 'web', e: <QGlobe />, l: t('A website that actually converts'), d: t('Custom-built, crafted from scratch') },
                { v: 'ai', e: <QCircuit />, l: t('AI lead automation'), d: t('Chatbot + voice receptionist, 24/7') },
                { v: 'ads', e: <QBarChart />, l: t('Performance advertising'), d: t('Google & Meta ads that prove ROI') },
                { v: 'apps', e: <QStar />, l: t('A custom app for my business'), d: t('Booking, customer, or team tools') },
            ],
        },
        {
            id: 'time', step: '05', label: `Step 5${t(' of ')}5`, q: t('How fast do you want to move?'), sub: t('No wrong answer — this just helps us prioritize your call.'), multi: false,
            opts: [
                { v: 'now', e: <QBolt />, l: t('Ready to start now'), d: t("Let's go — I know what I want") },
                { v: '30days', e: <QCalendar />, l: t('Within the next 30 days'), d: t('Exploring but getting close to deciding') },
                { v: 'looking', e: <QSearch />, l: t('Just exploring options'), d: t("Learning what's possible before committing") },
            ],
        },
    ];

    const [step, setStep] = useState(0);
    const [answers, setAnswers] = useState({});
    const [contact, setContact] = useState({ name: '', email: '' });
    const [done, setDone] = useState(false);
    const [dir, setDir] = useState(1);
    const bodyRef = useRef(null);
    const total = STEPS.length;
    const isContact = step === total;
    const cur = STEPS[step];
    const pct = isContact ? 90 : Math.round((step / total) * 100);

    const valid = () => {
        if (isContact) return contact.name.trim().length > 0 && contact.email.includes('@');
        const a = cur ? answers[cur.id] : null;
        if (!a) return false;
        return cur && cur.multi ? (Array.isArray(a) && a.length > 0) : true;
    };

    const animate = (cb) => {
        const gsap = window.gsap;
        if (!gsap || !bodyRef.current) { cb(); return; }
        const xOut = dir > 0 ? -40 : 40;
        gsap.to(bodyRef.current, {
            opacity: 0, x: xOut, duration: 0.2, ease: 'power2.in', onComplete: () => {
                cb();
                gsap.fromTo(bodyRef.current, { opacity: 0, x: -xOut }, { opacity: 1, x: 0, duration: 0.35, ease: 'power3.out' });
            }
        });
    };

    const pick = (id, v, multi) => {
        setAnswers(p => {
            if (multi) {
                const cur = Array.isArray(p[id]) ? p[id] : [];

                return { ...p, [id]: cur.includes(v) ? cur.filter(x => x !== v) : [...cur, v] };
            }
            return { ...p, [id]: v };
        });
        if (!multi) {
            setTimeout(() => { setDir(1); animate(() => setStep(s => s + 1)); }, 200);
        }
    };

    const next = () => { if (!valid()) return; setDir(1); animate(() => setStep(s => s + 1)); };
    const back = () => { if (step === 0) return; setDir(-1); animate(() => setStep(s => s - 1)); };
    const submit = () => {
        if (!valid()) return;
        setDone(true);
        // Email the answers to the team. keepalive lets it finish even if the visitor leaves the page.
        fetch('/api/quiz', {
            method: 'POST', keepalive: true, headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ ...contact, answers, lang, company_url: honeypotRef.current ? honeypotRef.current.value : honeypot }),
        }).catch(() => { });
        setTimeout(() => { window.open('https://calendly.com/adrianstrategiesgroup/30min', '_blank'); }, 2200);
    };

    if (done) return (
        <div className="quiz-wrap" style={{ textAlign: 'center', padding: '5rem 2rem' }}>
            <GlowingEffect spread={60} borderWidth={1.5} proximity={64} inactiveZone={0.01} />
            <div style={{ marginBottom: '1.5rem', display: 'flex', justifyContent: 'center' }}><QuizSuccessIco /></div>
            <div style={{ fontWeight: 800, fontSize: 'clamp(1.75rem,3.5vw,2.25rem)', letterSpacing: '-0.025em', color: '#fff', marginBottom: '1rem' }}>
                {t("You're all set")}{contact.name ? `, ${contact.name.split(' ')[0]}` : ''}.
            </div>
            <p style={{ color: '#8892A4', fontSize: '1.0625rem', lineHeight: 1.7, maxWidth: '420px', margin: '0 auto 2.5rem' }}>
                {t("Opening your booking page now. We'll review your answers before the call so we come prepared.")}
            </p>
            <div style={{ display: 'inline-flex', alignItems: 'center', gap: '0.625rem', background: 'rgba(0,229,160,0.08)', border: '1px solid rgba(0,229,160,0.25)', borderRadius: '9999px', padding: '0.625rem 1.5rem', color: '#00E5A0', fontSize: '0.9375rem', fontWeight: 600 }}>
                <span style={{ width: 8, height: 8, borderRadius: '50%', background: '#00E5A0', display: 'inline-block', animation: 'pulse 1.5s ease infinite', boxShadow: '0 0 10px rgba(0,229,160,0.5)' }} />
                {t("Redirecting to your booking page…")}
            </div>
            <div style={{ marginTop: '1.5rem' }}>
                <a href="https://calendly.com/adrianstrategiesgroup/30min" target="_blank" rel="noopener" style={{ color: '#00C2FF', fontSize: '0.9375rem' }}>{t('Page did not open? Book here.')}</a>
            </div>
        </div>
    );

    return (
        <div className="quiz-wrap">
            <GlowingEffect spread={50} borderWidth={1.5} proximity={64} inactiveZone={0.01} />
            <div style={{ position: 'relative', zIndex: 5 }}>
                <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '0.75rem' }}>
                    <span style={{ fontSize: '0.8125rem', fontWeight: 600, color: '#8892A4', textTransform: 'uppercase', letterSpacing: '0.05em' }}>{isContact ? t('Last step') : `${step + 1}${t(' of ')}${total}`}</span>
                    <span style={{ fontSize: '0.8125rem', fontWeight: 700, color: '#00C2FF' }}>{pct}{t('% complete')}</span>
                </div>
                <div className="progress-track"><div className="progress-fill" style={{ width: `${pct}%` }} /></div>

                <div ref={bodyRef}>
                    {isContact ? (
                        <React.Fragment>
                            <span className="section-label" style={{ marginBottom: '0.5rem', fontSize: '0.8125rem' }}>{t('Almost there')}</span>
                            <h3 className="quiz-q">{t('Where should we send the recap?')}</h3>
                            <p className="quiz-sub">{t('We review your answers before the call so we show up prepared — not winging it.')}</p>
                            <div style={{ display: 'flex', flexDirection: 'column', gap: '1.25rem', marginBottom: '2.5rem' }}>
                                <div>
                                    <label className="form-label">{t('Your name')}</label>
                                    <input className="form-input" type="text" placeholder="First Last" value={contact.name} onChange={e => setContact(p => ({ ...p, name: e.target.value }))} />
                                </div>
                                <div>
                                    <label className="form-label">{t('Email address')}</label>
                                    <input ref={honeypotRef} onChange={e => setHoneypot(e.target.value)} type="text" name="company_url" tabIndex={-1} autoComplete="off" aria-hidden="true" style={{ position: 'absolute', left: '-9999px', width: 1, height: 1 }} />
                                    <input className="form-input" type="email" placeholder="you@yourbusiness.com" value={contact.email} onChange={e => setContact(p => ({ ...p, email: e.target.value }))} />
                                </div>
                            </div>
                        </React.Fragment>
                    ) : (
                        <React.Fragment>
                            <span className="section-label" style={{ marginBottom: '0.5rem', fontSize: '0.8125rem' }}>{cur && cur.label}</span>
                            <h3 className="quiz-q">{cur && cur.q}</h3>
                            <p className="quiz-sub">{cur && cur.sub}</p>
                            <div style={{ display: 'grid', gridTemplateColumns: (cur && cur.opts && cur.opts.length >= 6) ? 'repeat(auto-fit,minmax(280px,1fr))' : '1fr', gap: '1rem', marginBottom: '2.5rem' }}>
                                {cur && cur.opts && cur.opts.map(o => {
                                    const ans = answers[cur.id];
                                    const sel = cur.multi ? (Array.isArray(ans) && ans.includes(o.v)) : ans === o.v;
                                    return (
                                        <div key={o.v} className={`opt-card ${sel ? 'sel' : ''}`} onClick={() => pick(cur.id, o.v, cur.multi)} tabIndex={0} role="button" onKeyDown={e => e.key === 'Enter' && pick(cur.id, o.v, cur.multi)}>
                                            <div className="opt-icon">{o.e}</div>
                                            <div style={{ flex: 1 }}>
                                                <div className="opt-label">{o.l}</div>
                                                {o.d && <div className="opt-desc">{o.d}</div>}
                                            </div>
                                            {cur.multi
                                                ? <div className="opt-checkbox">{sel && <IcoCheck s={12} c="#0A0A0F" />}</div>
                                                : <div className="opt-check">{sel && <IcoCheck s={12} c="#0A0A0F" />}</div>
                                            }
                                        </div>
                                    );
                                })}
                            </div>
                        </React.Fragment>
                    )}

                    <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: '1rem', paddingTop: '1rem', borderTop: '1px solid rgba(255,255,255,0.06)' }}>
                        {step > 0
                            ? <button onClick={back} className="btn btn-outline" style={{ padding: '0.875rem 1.5rem', fontSize: '0.9375rem', gap: '0.5rem' }}><IcoArrowL s={16} /> {t('Back')}</button>
                            : <div />
                        }
                        {(isContact || (cur && cur.multi)) && (
                            <button onClick={isContact ? submit : next} className="btn btn-electric" disabled={!valid()} style={{ padding: '0.875rem 2rem', fontSize: '0.9375rem', gap: '0.625rem', opacity: valid() ? 1 : 0.4, cursor: valid() ? 'pointer' : 'not-allowed' }}>
                                {isContact ? <React.Fragment><span>{t('Book My Free Call')}</span><IcoArrow s={16} /></React.Fragment> : <React.Fragment><span>{t('Continue')}</span><IcoArrow s={16} /></React.Fragment>}
                            </button>
                        )}
                    </div>
                </div>
            </div>
        </div>
    );
}
/* ── ROI Estimator ── */
function ROIEstimator() {
    const { t } = useLang();
    const [spend, setSpend] = useState(2500);
    const [ticket, setTicket] = useState(1500);

    const leads = Math.round(spend / 50);
    const extraSales = Math.round(leads * 0.15);
    const extraRev = extraSales * ticket;

    return (
        <div className="roi-card section-animate">
            <GlowingEffect spread={40} borderWidth={1.5} proximity={64} inactiveZone={0.01} />
            <div style={{ position: 'relative', zIndex: 5 }}>
                <h3 style={{ fontWeight: 800, fontSize: '1.5rem', marginBottom: '1.5rem', letterSpacing: '-0.02em', color: '#fff' }}>
                    {t("See How Much You're Leaving on the Table")}
                </h3>

                <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit,minmax(250px,1fr))', gap: '2rem' }}>
                    <div>
                        <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '0.5rem' }}>
                            <label className="form-label" style={{ margin: 0 }}>{t('Monthly Ad Spend')}</label>
                            <span style={{ fontWeight: 700, color: '#00C2FF' }}>${spend.toLocaleString()}</span>
                        </div>
                        <input type="range" className="range-slider" min="500" max="20000" step="500" value={spend} onChange={e => setSpend(Number(e.target.value))} />
                    </div>
                    <div>
                        <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '0.5rem' }}>
                            <label className="form-label" style={{ margin: 0 }}>{t('Avg. Ticket Size')}</label>
                            <span style={{ fontWeight: 700, color: '#00C2FF' }}>${ticket.toLocaleString()}</span>
                        </div>
                        <input type="range" className="range-slider" min="100" max="10000" step="100" value={ticket} onChange={e => setTicket(Number(e.target.value))} />
                    </div>
                </div>

                <div className="roi-result">
                    <p style={{ margin: '0 0 0.5rem', color: '#8892A4', fontSize: '0.9375rem' }}>{t('Estimated Untapped Monthly Revenue')}</p>
                    <div style={{ fontSize: '2.5rem', fontWeight: 800, color: '#00E5A0', letterSpacing: '-0.03em', lineHeight: 1 }}>
                        +${extraRev.toLocaleString()}
                    </div>
                    <p style={{ margin: '0.75rem 0 0', fontSize: '0.8125rem', color: 'rgba(255,255,255,0.4)' }}>
                        {t('*Based on standard conversion rate improvements from our optimized landing pages and AI follow-up.')}
                    </p>
                </div>
            </div>
        </div>
    );
}

const SERVICES_DATA = [
    {
        id: 'web', icon: <IcoGlobe c="#00C2FF" s={28} />, bg: 'rgba(0,194,255,0.1)', accent: '#00C2FF', tag: 'Crafted, Not Templated', title: 'Custom Websites',
        desc: 'Every site starts from a blank canvas. Designed specifically for your brand, and engineered for high conversions.',
        bullets: ['Conversion-optimized UX', 'Mobile-first responsive', 'SEO & performance built-in'],
        tech: ['React / Next.js', 'Figma', 'GSAP Animation', 'Tailwind CSS'],
        approach: 'We don’t believe in templates. Your business is unique, and your digital presence should reflect that. We start with a deep dive into your brand architecture, wireframing a user journey designed specifically to turn your traffic into booked appointments.'
    },
    {
        id: 'ai', icon: <IcoBot c="#00E5A0" s={28} />, bg: 'rgba(0,229,160,0.1)', accent: '#00E5A0', tag: 'Future-Ready', title: 'AI Automation',
        desc: 'AI chatbot + voice receptionist that handles leads, answers questions, and books appointments securely 24/7.',
        bullets: ['AI chatbot on your site', 'Voice receptionist system', 'Automated booking flow'],
        tech: ['OpenAI / GPT-4', 'Twilio Voice', 'Dialogflow', 'Zapier Automation'],
        approach: 'Missed calls equal missed revenue. We deploy intelligent conversational agents that instantly respond to inbound inquiries, qualify leads, and map directly into your CRM or booking software.'
    },
    {
        id: 'ads', icon: <IcoBars c="#00C2FF" s={28} />, bg: 'rgba(0,194,255,0.08)', accent: '#00C2FF', tag: 'Built to Perform', title: 'Performance Ads',
        desc: 'Google and Meta ads with absolute accountability. You pay platforms directly. We handle strategy and optimization.',
        bullets: ['Google & Meta campaigns', 'Zero platform markup', 'Full ROI tracking'],
        tech: ['Google Ads Network', 'Meta Business Suite', 'Google Tag Manager', 'Server-Side Tracking'],
        approach: 'No vanity metrics. We only care about cost-per-acquisition (CPA) and return on ad spend (ROAS). We meticulously track every click through to conversion, optimizing campaigns daily to ensure your budget is driving tangible pipeline growth.'
    },
    {
        id: 'apps', icon: <IcoStar c="#A78BFA" s={28} />, bg: 'rgba(124,58,237,0.1)', accent: '#A78BFA', tag: 'Made For You', title: 'Custom Apps',
        desc: 'Custom apps for the way your business actually runs: booking, customer records, quotes, and team tools in one place.',
        bullets: ['Built around your workflow', 'Works on phone and desktop', 'Customer & team logins'],
        tech: ['React', 'Supabase', 'Vercel', 'API Integrations'],
        approach: 'Off-the-shelf software makes you change how you work to fit it. We map your day-to-day first, then build an app around it, so your team spends less time on busywork and nothing lives only in someone’s head.'
    },
];

/* ── App ── */
function App() {
    const { lang, setLang, t } = useLang();
    const [scrolled, setScrolled] = useState(false);
    const [menu, setMenu] = useState(false);
    const [activeModal, setActiveModal] = useState(null);

    const closeModal = () => setActiveModal(null);

    useEffect(() => {
        const fn = () => setScrolled(window.scrollY > 60);
        window.addEventListener('scroll', fn, { passive: true });
        return () => window.removeEventListener('scroll', fn);
    }, []);

    useEffect(() => { document.body.style.overflow = menu ? 'hidden' : ''; }, [menu]);

    useEffect(() => {
        const gsap = window.gsap, ST = window.ScrollTrigger;
        if (!gsap || !ST) return;
        gsap.registerPlugin(ST);

        // Hero Custom Entry
        gsap.fromTo('.hero-animate', { y: 60, opacity: 0 }, { y: 0, opacity: 1, stagger: 0.12, duration: 1.2, ease: 'power3.out', delay: 0.15 });

        // Section fades
        document.querySelectorAll('.section-animate').forEach(el => {
            gsap.fromTo(el, { y: 32, opacity: 0 }, { y: 0, opacity: 1, duration: 0.8, ease: 'power3.out', scrollTrigger: { trigger: el, start: 'top 85%' } });
        });

        // Card groups
        document.querySelectorAll('.card-group').forEach(g => {
            const kids = g.children;
            gsap.fromTo(kids, { y: 40, opacity: 0 }, { y: 0, opacity: 1, stagger: 0.1, duration: 0.75, ease: 'power3.out', scrollTrigger: { trigger: g, start: 'top 85%' } });
        });

        // Step connectors
        document.querySelectorAll('.step-connector').forEach((el, i) => {
            gsap.to(el, { scaleX: 1, duration: 1.4, ease: 'power2.inOut', delay: i * 0.2, scrollTrigger: { trigger: el, start: 'top 85%' } });
        });

        // Villain icon stroke draw-in
        document.querySelectorAll('.v-icon-path').forEach(el => {
            const len = (typeof el.getTotalLength === 'function') ? el.getTotalLength() : 60;
            gsap.set(el, { strokeDasharray: len, strokeDashoffset: len });
            gsap.to(el, {
                strokeDashoffset: 0, duration: 1.6, ease: 'power2.inOut',
                scrollTrigger: { trigger: el, start: 'top 88%', toggleActions: 'play none none none' }
            });
        });

        // Nexr icon stroke draw-in
        document.querySelectorAll('.n-icon-path').forEach(el => {
            if (!el.getTotalLength) return;
            const len = el.getTotalLength();
            gsap.set(el, { strokeDasharray: len, strokeDashoffset: len });
            gsap.to(el, {
                strokeDashoffset: 0, duration: 1.5, ease: 'power2.inOut',
                scrollTrigger: { trigger: el, start: 'top 90%', toggleActions: 'play none none none' }
            });
        });
    }, []);

    const navLinks = [
        { href: '#services', l: 'Services' },
        { href: '#how-it-works', l: 'Process' },
        { href: '#apps', l: 'Custom Apps' },
        { href: '#qualify', l: 'Get Started' },
    ];

    const Wordmark = () => (
        <div style={{ display: 'flex', alignItems: 'center', gap: '0.625rem' }}>
            <img src="logo-mark.png" alt="Adrian's Strategies Group" style={{ width: 40, height: 40, borderRadius: '10px', flexShrink: 0, display: 'block' }} />
            <span className="wordmark-text" style={{ fontWeight: 800, letterSpacing: '-0.03em', color: '#fff', lineHeight: 1.15 }}>
                Adrian's <span style={{ color: '#00C2FF' }}>Strategies</span>
                <span style={{ fontWeight: 500, color: 'rgba(255,255,255,0.4)' }}> Group</span>
            </span>
        </div>
    );

    return (
        <React.Fragment>
            {/* NAV */}
            <nav style={{ padding: scrolled ? '0 1rem' : '0 1.5rem', top: scrolled ? '10px' : '0' }}>
                <div className={`nav-inner ${scrolled ? 'scrolled' : ''}`}>
                    <a href="#" style={{ textDecoration: 'none' }}><Wordmark /></a>
                    <div className="desktop-nav" style={{ display: 'flex', gap: '0.5rem' }}>
                        {navLinks.map(l => <a key={l.href} href={l.href} className="nav-link">{t(l.l)}</a>)}
                        <button
                            onClick={() => setLang(lang === 'en' ? 'es' : 'en')}
                            style={{ background: 'transparent', border: '1px solid rgba(255,255,255,0.2)', color: '#fff', padding: '0.25rem 0.5rem', borderRadius: '4px', cursor: 'pointer', fontSize: '0.8125rem', fontWeight: 600, marginLeft: '0.5rem' }}
                        >
                            {lang === 'en' ? 'ES' : 'EN'}
                        </button>
                    </div>
                    <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
                        <a href="#qualify" className="btn btn-electric" style={{ padding: '0.625rem 1.5rem', fontSize: '0.9375rem' }}>{t('Book a Free Call')}</a>
                        <button className="hamburger-btn" onClick={() => setMenu(true)} style={{ background: 'none', border: 'none', color: '#fff', cursor: 'pointer', padding: '0.5rem', display: 'flex', alignItems: 'center', justifyContent: 'center', background: 'rgba(255,255,255,0.05)', borderRadius: '8px' }}><IcoMenu /></button>
                    </div>
                </div>
            </nav>

            {/* MOBILE MENU */}
            {menu && (
                <div style={{ position: 'fixed', inset: 0, background: 'rgba(10,10,15,0.95)', backdropFilter: 'blur(32px)', zIndex: 200, display: 'flex', flexDirection: 'column', padding: '1.5rem' }}>
                    <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '3rem' }}>
                        <Wordmark />
                        <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
                            <button
                                onClick={() => setLang(lang === 'en' ? 'es' : 'en')}
                                style={{ background: 'transparent', border: '1px solid rgba(255,255,255,0.2)', color: '#fff', padding: '0.25rem 0.5rem', borderRadius: '4px', cursor: 'pointer', fontSize: '0.8125rem', fontWeight: 600 }}
                            >
                                {lang === 'en' ? 'ES' : 'EN'}
                            </button>
                            <button onClick={() => setMenu(false)} style={{ background: 'rgba(255,255,255,0.08)', borderRadius: '8px', border: 'none', color: '#fff', cursor: 'pointer', padding: '0.5rem', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><IcoX /></button>
                        </div>
                    </div>
                    {navLinks.map(l => <a key={l.href} href={l.href} onClick={() => setMenu(false)} style={{ fontWeight: 700, fontSize: '2rem', color: '#fff', textDecoration: 'none', padding: '1.25rem 0', borderBottom: '1px solid rgba(255,255,255,0.05)' }}>{t(l.l)}</a>)}
                    <a href="#qualify" onClick={() => setMenu(false)} className="btn btn-electric" style={{ padding: '1.25rem', fontSize: '1.125rem', marginTop: '3rem' }}>{t('Book a Free Call')}</a>
                </div>
            )}

            {/* HERO */}
            <section className="hero-section">
                <div className="gl-blob gl-blob-1" />
                <div className="gl-blob gl-blob-2" />
                <div className="gl-blob gl-blob-3" />
                <div className="gl-blob gl-blob-4" />
                <div className="hero-grid" />
                <div className="hero-content" style={{ paddingBottom: '5.5rem', marginTop: '4rem' }}>
                    <div className="hero-animate">
                        <span className="hero-badge" style={{ boxShadow: '0 4px 12px rgba(0,0,0,0.2)' }}>
                            <span style={{ width: 6, height: 6, borderRadius: '50%', background: '#00E5A0', boxShadow: '0 0 10px #00E5A0', display: 'inline-block' }} />
                            {t('Full-Stack Growth Partner for Local Services')}
                        </span>
                    </div>
                    <h1 className="hero-h1 hero-animate">
                        {t("We don't just run ")}
                        <RotatingText
                            words={[t('campaigns'), t('websites'), t('automation'), t('apps')]}
                            interval={3000}
                            style={{ color: '#00C2FF' }}
                        /><br />
                        {t("We win when you win.")}
                    </h1>
                    <p className="hero-sub hero-animate">
                        {t('Modern websites. Custom business apps. Smart AI automation. Accountable performance ads. We are in the game with you — and we only win when you win.')}
                    </p>
                    <div className="hero-animate" style={{ display: 'flex', gap: '1.25rem', flexWrap: 'wrap', justifyContent: 'center', marginTop: '1rem' }}>
                        <a href="#qualify" className="btn btn-electric" style={{ padding: '1.125rem 2.25rem', fontSize: '1.0625rem', gap: '0.625rem' }}>{t('Book a Free Call')} <IcoArrow s={18} /></a>
                        <a href="#services" className="btn btn-outline" style={{ padding: '1.125rem 2.25rem', fontSize: '1.0625rem' }}>{t('See What We Build')}</a>
                    </div>
                </div>
                <div className="hero-trust" style={{ gap: '1rem 2rem' }}>
                    {[
                        [<BrandGoogle s={22} />, t('Google Partner')],
                        [<BrandMeta s={22} />, t('Meta Business Partner')],
                        [<BrandReact s={22} />, t('React/Webflow Expert')]
                    ].map(([icon, label], i) => (
                        <div key={i} className="trust-item" style={{ gap: '0.625rem', fontSize: '0.8125rem' }}>
                            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', opacity: 0.9 }}>
                                {icon}
                            </div>
                            {label}
                        </div>
                    ))}
                </div>
            </section>

            {/* PROBLEM */}
            <section style={{ background: '#0A0A0F', padding: 'clamp(5rem,10vw,8rem) 1.5rem' }}>
                <div style={{ maxWidth: '1200px', margin: '0 auto' }}>
                    <div className="section-animate" style={{ maxWidth: '720px', marginBottom: '4rem' }}>
                        <span className="section-label">{t('The Problem')}</span>
                        <h2 className="section-h2">{t("You've been burned.")}<br /><span style={{ color: '#8892A4' }}>{t("We built this because of it.")}</span></h2>
                        <p className="section-body">
                            {t("Thousands of local business owners have paid for promises and gotten nothing. Retainers that kept billing. Templates that look like every competitor's. Decks full of jargon with no connection to actual revenue.")}
                        </p>
                    </div>
                    <div className="card-group" style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit,minmax(280px,1fr))', gap: '1.25rem', marginBottom: '3.5rem' }}>
                        {[
                            { icon: <VilBillingLoop />, t: 'Retainers for nothing', d: "Agencies keep billing month after month regardless of results. Your budget disappears. Your growth doesn't." },
                            { icon: <VilTemplates />, t: 'Templates everywhere', d: "Your site looks identical to your competitor's because they used the same cheap theme. Zero differentiation." },
                            { icon: <VilJargon />, t: 'Jargon without accountability', d: 'Decks full of "impressions" and "brand awareness" with zero connection to actual revenue.' },
                            { icon: <VilDisappear />, t: 'Disappear after launch', d: 'Big energy during the pitch. Radio silence after you sign. Support tickets go unanswered for weeks.' },
                        ].map((c, i) => (
                            <div key={i} className="villain-card">
                                <GlowingEffect spread={40} borderWidth={1.5} proximity={72} inactiveZone={0.01} />
                                <div style={{ position: 'relative', zIndex: 5, display: 'flex', gap: '1.25rem', alignItems: 'flex-start' }}>
                                    <div className="v-icon-wrap">{c.icon}</div>
                                    <div>
                                        <div style={{ fontWeight: 700, fontSize: '1.0625rem', color: '#fff', marginBottom: '0.5rem', letterSpacing: '-0.01em' }}>{t(c.t)}</div>
                                        <div style={{ fontSize: '0.9rem', color: '#8892A4', lineHeight: 1.65 }}>{t(c.d)}</div>
                                    </div>
                                </div>
                            </div>
                        ))}
                    </div>
                    <div className="section-animate" style={{ padding: '2.5rem 3rem', background: 'rgba(0,229,160,0.04)', border: '1px solid rgba(0,229,160,0.15)', borderRadius: '1.5rem', backdropFilter: 'blur(24px)', boxShadow: '0 8px 32px rgba(0,0,0,0.2)' }}>
                        <div style={{ fontWeight: 800, fontSize: 'clamp(1.25rem,3vw,1.5rem)', color: '#fff', marginBottom: '0.75rem', letterSpacing: '-0.02em' }}>{t("Adrian's Strategies Group is the response to that system.")}</div>
                        <p style={{ color: '#e2e8f0', lineHeight: 1.75, margin: 0, fontSize: '1.0625rem', maxWidth: '760px' }}>
                            {t('We are the clutch teammate — in the game with you, executing when it counts. Performance-based. Transparent. Built on one unbreakable rule: ')} <strong style={{ color: '#00E5A0' }}>{t('we only win when you win.')}</strong>
                        </p>
                    </div>
                </div>
            </section>

            {/* SERVICES */}
            <section id="services" style={{ background: '#091523', padding: 'clamp(5rem,10vw,8rem) 1.5rem', position: 'relative' }}>
                <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: '1px', background: 'linear-gradient(90deg, transparent, rgba(0,194,255,0.2), transparent)' }} />
                <div style={{ maxWidth: '1200px', margin: '0 auto' }}>
                    <div className="section-animate" style={{ textAlign: 'center', marginBottom: '4.5rem' }}>
                        <span className="section-label">{t('What We Build')}</span>
                        <h2 className="section-h2">{t('The full stack.')}<br />{t('Nothing missing.')}</h2>
                        <p className="section-body" style={{ margin: '0 auto' }}>
                            {t('We build the complete digital engine for local service businesses. Custom websites and apps, smart automation, and precise advertising all under one roof.')}
                        </p>
                    </div>
                    <div className="card-group" style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit,minmax(260px,1fr))', gap: '1.5rem' }}>
                        {SERVICES_DATA.map((s, i) => (
                            <div key={i} className="gl-card" style={{ padding: '2.5rem 2rem' }} onClick={() => setActiveModal(s)}>
                                <div className="service-icon-box" style={{ background: s.bg, boxShadow: `0 4px 16px ${s.bg}` }}>{s.icon}</div>
                                <div style={{ fontSize: '0.75rem', fontWeight: 700, letterSpacing: '0.12em', textTransform: 'uppercase', color: s.accent, marginBottom: '0.75rem' }}>{t(s.tag)}</div>
                                <h3 style={{ fontWeight: 800, fontSize: '1.375rem', letterSpacing: '-0.02em', color: '#fff', margin: '0 0 1rem' }}>{t(s.title)}</h3>
                                <p style={{ fontSize: '0.9375rem', color: '#8892A4', lineHeight: 1.7, margin: '0 0 1.75rem', flexGrow: 1 }}>{t(s.desc)}</p>
                                <ul style={{ margin: 0, padding: 0, listStyle: 'none', display: 'flex', flexDirection: 'column', gap: '0.625rem', marginTop: 'auto' }}>
                                    {s.bullets.map((b, j) => (
                                        <li key={j} style={{ display: 'flex', alignItems: 'center', gap: '0.75rem', fontSize: '0.875rem', color: 'rgba(255,255,255,0.8)', fontWeight: 500 }}>
                                            <IcoCheck s={16} c={s.accent} /> {t(b)}
                                        </li>
                                    ))}
                                </ul>
                                <div className="card-cta" style={{ color: s.accent }}>{t('Explore approach ')} <IcoArrow s={14} /></div>
                            </div>
                        ))}
                    </div>
                </div>
            </section>

            {/* HOW IT WORKS */}
            <section id="how-it-works" style={{ background: '#0A0A0F', padding: 'clamp(5rem,10vw,8rem) 1.5rem', position: 'relative' }}>
                <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: '1px', background: 'linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent)' }} />
                <div style={{ maxWidth: '1200px', margin: '0 auto' }}>
                    <div className="section-animate" style={{ textAlign: 'center', marginBottom: '5rem' }}>
                        <span className="section-label">{t('Our Process')}</span>
                        <h2 className="section-h2">{t('Four steps. Full clarity.')}<br /><span style={{ color: '#00E5A0' }}>{t('No surprises.')}</span></h2>
                        <p className="section-body" style={{ margin: '0 auto' }}>
                            {t("Every client moves through the same transparent four-step process. You know exactly where things are, what's next, and what it costs.")}
                        </p>
                    </div>
                    <div style={{ display: 'flex', flexWrap: 'wrap', gap: '1.5rem', alignItems: 'stretch' }}>
                        {[
                            { n: '01', t: 'Consultation', d: "We dissect your business, goals, and understand exactly where you're losing. We diagnose the pain before prescribing the cure." },
                            { n: '02', t: 'Scope & Quote', d: 'An itemized proposal where you see exactly what you\'re paying for. If the budget is tight, we rework it. No hidden fees.' },
                            { n: '03', t: 'Build Phase', d: "We design and develop with you in the loop. Regular check-ins and live previews. You track progress — absolutely no big-reveal surprises." },
                            { n: '04', t: 'Launch & Grow', d: "We deploy everything and stay in it. Ads tracked, AI active, full monthly reporting. We don't vanish after launch. This is the partnership." },
                        ].map((s, i, arr) => (
                            <React.Fragment key={i}>
                                <div className="step-card">
                                    <div className="step-num">{s.n}</div>
                                    <h3 style={{ fontWeight: 800, fontSize: '1.375rem', letterSpacing: '-0.02em', color: '#fff', margin: '0 0 1rem' }}>{t(s.t)}</h3>
                                    <p style={{ fontSize: '0.9375rem', color: '#8892A4', lineHeight: 1.7, margin: 0 }}>{t(s.d)}</p>
                                </div>
                                {i < arr.length - 1 && <div className="step-connector" />}
                            </React.Fragment>
                        ))}
                    </div>
                    <div className="section-animate" style={{ textAlign: 'center', marginTop: '4.5rem' }}>
                        <a href="#qualify" className="btn btn-electric" style={{ padding: '1.125rem 2.5rem', fontSize: '1.0625rem', gap: '0.625rem' }}>
                            {t('Start With a Free Consultation ')} <IcoArrow s={18} />
                        </a>
                    </div>
                </div>
            </section>

            {/* CUSTOM APPS */}
            <section id="apps" className="nexr-section" style={{ padding: 'clamp(5rem,10vw,8rem) 1.5rem' }}>
                <div className="nexr-blob nexr-blob-1" />
                <div className="nexr-blob nexr-blob-2" />
                <div style={{ maxWidth: '1200px', margin: '0 auto', position: 'relative', zIndex: 10 }}>
                    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit,minmax(min(340px,100%),1fr))', gap: '5rem', alignItems: 'center' }}>
                        <div className="section-animate">
                            <div style={{ display: 'inline-flex', flexWrap: 'wrap', alignItems: 'center', gap: '0.75rem', background: 'rgba(124,58,237,0.15)', border: '1px solid rgba(124,58,237,0.3)', borderRadius: '9999px', padding: '0.5rem 1.25rem', marginBottom: '1.75rem', boxShadow: '0 4px 16px rgba(124,58,237,0.2)' }}>
                                <span style={{ fontWeight: 800, fontSize: '0.875rem', letterSpacing: '0.08em', textTransform: 'uppercase', color: '#A78BFA' }}>{t('Custom Apps')}</span>
                                <span style={{ fontSize: '0.75rem', fontWeight: 600, color: 'rgba(255,255,255,0.4)', letterSpacing: '0.1em', textTransform: 'uppercase' }}>{t('Built Around Your Business')}</span>
                            </div>
                            <h2 className="section-h2" style={{ fontSize: 'clamp(2.5rem, 5vw, 3.5rem)' }}>{t('Apps that fit')}<br /><span style={{ background: 'linear-gradient(135deg, #A78BFA, #7C3AED)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>{t('how you work.')}</span></h2>
                            <p className="section-body" style={{ marginBottom: '1.5rem', fontSize: '1.125rem', color: '#e2e8f0', fontWeight: 500 }}>
                                {t('Most local businesses run on spreadsheets, text threads, and software that almost fits. A custom app puts the way you work in one place.')}
                            </p>
                            <p style={{ color: '#8892A4', fontSize: '1rem', lineHeight: 1.75, marginBottom: '2.5rem' }}>
                                {t('We design and build apps around your real day-to-day: booking, scheduling, customer records, quotes, and job tracking. They work on phones and computers, and we only build what your team will actually use.')}
                            </p>
                            <a href="#qualify" className="btn btn-purple" style={{ padding: '1.125rem 2.25rem', fontSize: '1.0625rem', gap: '0.625rem' }}>
                                {t('Plan My App ')} <IcoArrow s={18} />
                            </a>
                        </div>
                        <div className="card-group" style={{ display: 'flex', flexDirection: 'column', gap: '1.25rem' }}>
                            {[
                                { icon: <NexrCardIco />, n: 'Booking & Scheduling', d: 'Customers book online and your team sees one up-to-date calendar.' },
                                { icon: <NexrTapIco />, n: 'Customer Portals', d: 'Give customers one place to see appointments, quotes, and updates.' },
                                { icon: <NexrTiersIco />, n: 'Quotes & Invoices', d: 'Create, send, and track quotes and invoices from your phone.' },
                                { icon: <NexrPulseIco />, n: 'Team Dashboards', d: 'See jobs, leads, and follow-ups on one screen.' },
                            ].map((f, i) => (
                                <div key={i} className="nexr-feature">
                                    <GlowingEffect spread={30} borderWidth={1.5} proximity={64} inactiveZone={0.01} />
                                    <div style={{ position: 'relative', zIndex: 5, display: 'flex', gap: '1.5rem', alignItems: 'center' }}>
                                        <div className="n-icon-wrap" style={{ boxShadow: '0 4px 12px rgba(124,58,237,0.15)' }}>{f.icon}</div>
                                        <div>
                                            <div style={{ fontWeight: 700, fontSize: '1.0625rem', color: '#A78BFA', marginBottom: '0.375rem' }}>{t(f.n)}</div>
                                            <div style={{ fontSize: '0.9375rem', color: '#e2e8f0', lineHeight: 1.6 }}>{t(f.d)}</div>
                                        </div>
                                    </div>
                                </div>
                            ))}
                        </div>
                    </div>
                </div>
            </section>

            {/* QUALIFYING QUIZ */}
            <section id="qualify" style={{ background: '#091523', padding: 'clamp(5rem,10vw,8rem) 1.5rem', position: 'relative', overflow: 'hidden' }}>
                <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: '1px', background: 'linear-gradient(90deg, transparent, rgba(0,194,255,0.2), transparent)' }} />
                <div className="gl-blob gl-blob-1" style={{ opacity: 0.25, background: 'radial-gradient(circle, rgba(0,194,255,0.15) 0%, transparent 70%)' }} />
                <div className="gl-blob gl-blob-2" style={{ opacity: 0.25, background: 'radial-gradient(circle, rgba(0,229,160,0.1) 0%, transparent 70%)' }} />
                <div style={{ maxWidth: '1200px', margin: '0 auto', position: 'relative', zIndex: 10 }}>
                    <div className="section-animate" style={{ textAlign: 'center', marginBottom: '4rem' }}>
                        <span className="section-label">{t('Get Started')}</span>
                        <h2 className="section-h2">{t('Answer 5 quick questions.')}<br /><span style={{ color: '#00C2FF' }}>{t('Book your discovery call.')}</span></h2>
                        <p className="section-body" style={{ margin: '0 auto' }}>
                            {t('We review your answers prior to the call so we show up thoroughly prepared — not guessing what you actually need. Takes only 90 seconds.')}
                        </p>
                    </div>
                    <ROIEstimator />
                    <Quiz />
                </div>
            </section>

            {/* SERVICE MODAL */}
            <div className={`modal-overlay ${activeModal ? 'open' : ''}`} onClick={closeModal}>
                <div className="modal-content" onClick={e => e.stopPropagation()}>
                    <button className="modal-close" onClick={closeModal}><IcoX s={18} /></button>
                    {activeModal && (
                        <React.Fragment>
                            <div style={{ display: 'flex', alignItems: 'center', gap: '1.25rem', marginBottom: '1.5rem' }}>
                                <div className="service-icon-box" style={{ background: activeModal.bg, boxShadow: `0 4px 16px ${activeModal.bg}`, margin: 0 }}>{activeModal.icon}</div>
                                <div>
                                    <div style={{ fontSize: '0.75rem', fontWeight: 700, letterSpacing: '0.12em', textTransform: 'uppercase', color: activeModal.accent, marginBottom: '0.375rem' }}>{t(activeModal.tag)}</div>
                                    <h3 style={{ fontWeight: 800, fontSize: '1.75rem', letterSpacing: '-0.02em', color: '#fff', margin: 0 }}>{t(activeModal.title)}</h3>
                                </div>
                            </div>
                            <p style={{ fontSize: '1.0625rem', color: '#e2e8f0', lineHeight: 1.7, marginBottom: '2rem' }}>
                                {t(activeModal.approach)}
                            </p>

                            <h4 style={{ fontWeight: 700, fontSize: '0.875rem', letterSpacing: '0.1em', textTransform: 'uppercase', color: 'rgba(255,255,255,0.5)', margin: '0 0 1rem' }}>{t('Tech Stack & Capabilities')}</h4>
                            <div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.75rem' }}>
                                {activeModal.tech.map((tItem, i) => (
                                    <div key={i} style={{ padding: '0.5rem 1rem', background: 'rgba(255,255,255,0.05)', border: '1px solid rgba(255,255,255,0.1)', borderRadius: '9999px', fontSize: '0.875rem', color: '#fff', fontWeight: 500 }}>
                                        {tItem}
                                    </div>
                                ))}
                            </div>
                        </React.Fragment>
                    )}
                </div>
            </div>

            {/* FOOTER */}
            <footer style={{ padding: 'clamp(4rem,6vw,6rem) 1.5rem 2.5rem' }}>
                <div style={{ maxWidth: '1200px', margin: '0 auto' }}>
                    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit,minmax(220px,1fr))', gap: '4rem', marginBottom: '4rem' }}>
                        <div>
                            <div style={{ marginBottom: '1.25rem' }}><Wordmark /></div>
                            <p style={{ fontSize: '1rem', color: '#8892A4', lineHeight: 1.7, marginBottom: '1.5rem', maxWidth: '300px' }}>
                                {t('Building modern, high-performance digital experiences that elevate and scale local businesses.')}
                            </p>
                            <a href="tel:+13213148444" className="footer-link" style={{ fontSize: '1rem', marginBottom: '0.5rem' }}>📞 321-314-8444</a>
                            <a href="mailto:adrianstrategiesgroup@gmail.com" className="footer-link" style={{ fontSize: '0.8125rem', overflowWrap: 'anywhere' }}>✉ adrianstrategiesgroup@gmail.com</a>
                        </div>
                        <div>
                            <h4 style={{ fontWeight: 700, color: '#fff', fontSize: '0.875rem', letterSpacing: '0.12em', textTransform: 'uppercase', margin: '0 0 1.5rem', opacity: 0.9 }}>{t('Services')}</h4>
                            {['Custom Websites', 'AI Automation', 'Performance Ads', 'Custom Apps'].map((l, i) => <a key={i} href="#services" className="footer-link">{t(l)}</a>)}
                        </div>
                        <div>
                            <h4 style={{ fontWeight: 700, color: '#fff', fontSize: '0.875rem', letterSpacing: '0.12em', textTransform: 'uppercase', margin: '0 0 1.5rem', opacity: 0.9 }}>{t('Company')}</h4>
                            {[['How It Works', '#how-it-works'], ['Custom Apps', '#apps'], ['Get Started', '#qualify']].map(([l, h], i) => <a key={i} href={h} className="footer-link">{t(l)}</a>)}
                        </div>
                        <div>
                            <h4 style={{ fontWeight: 700, color: '#fff', fontSize: '0.875rem', letterSpacing: '0.12em', textTransform: 'uppercase', margin: '0 0 1.5rem', opacity: 0.9 }}>{t('Ready to grow?')}</h4>
                            <p style={{ fontSize: '0.9375rem', color: '#8892A4', lineHeight: 1.65, marginBottom: '1.5rem' }}>
                                {t('5 questions to help us understand where you are. Followed by a strategy call.')}
                            </p>
                            <a href="#qualify" className="btn btn-electric" style={{ padding: '1rem 1.75rem', fontSize: '1rem', gap: '0.5rem' }}>
                                {t('Book Free Call ')} <IcoArrow s={16} />
                            </a>
                        </div>
                    </div>
                    <div style={{ borderTop: '1px solid rgba(255,255,255,0.06)', paddingTop: '2rem', display: 'flex', flexWrap: 'wrap', justifyContent: 'space-between', alignItems: 'center', gap: '1rem' }}>
                        <p style={{ fontSize: '0.875rem', color: 'rgba(255,255,255,0.35)', margin: 0 }}>{t("© 2026 Adrian's Strategies Group. All rights reserved.")}</p>
                    </div>
                </div>
            </footer>
        </React.Fragment>
    );
}

ReactDOM.createRoot(document.getElementById('root')).render(<LanguageProvider><App /></LanguageProvider>);
