/** The Conscious Code — sections.jsx
 * Hero / Problem / Pillars / Services / AI Diagnosis / Cases / CTA / Footer.
 */

const { useEffect, useRef, useState } = React;

/* ────────────────────────────────────────────────────────────────────── HERO */
/* Scrollytelling hero: a tall section with a sticky inner. As you scroll,
   the header fades + translates up, the cube rotates and drifts up, and
   the asterisk glow intensifies. Driven by a RAF loop that writes inline
   style directly — bypasses React re-renders so it stays in sync with
   Lenis-interpolated scroll. */
function Hero() {
  const containerRef = useRef(null);
  const headerRef    = useRef(null);
  const cubeRef      = useRef(null);
  const hintRef      = useRef(null);
  const asteriskRef  = useRef(null);

  useEffect(() => {
    let rafId;
    let inView = true;
    // Pause RAF when hero is out of viewport — saves resources on long pages.
    const io = new IntersectionObserver(([e]) => { inView = e.isIntersecting; }, { threshold: 0 });
    if (containerRef.current) io.observe(containerRef.current);

    const tick = () => {
      const el = containerRef.current;
      if (el && inView) {
        const rect = el.getBoundingClientRect();
        const total = rect.height - window.innerHeight;
        const p = Math.max(0, Math.min(1, -rect.top / total));

        // Header — fade + drift in first 25%
        const headerProg = Math.min(1, p / 0.25);
        if (headerRef.current) {
          headerRef.current.style.opacity = String(1 - headerProg);
          headerRef.current.style.transform = `translateY(${-100 * headerProg}px)`;
        }
        if (hintRef.current) {
          hintRef.current.style.opacity = String(1 - headerProg);
        }
        // Cube — drift up, rotate 360°, fade at ends
        if (cubeRef.current) {
          const y = -160 * p + 80;
          const rot = 360 * p;
          const o  = p < 0.05 ? p / 0.05 : (p > 0.9 ? 1 - (p - 0.9) / 0.1 * 0.2 : 1);
          cubeRef.current.style.transform = `translate(-50%, ${y}px) rotate(${rot}deg)`;
          cubeRef.current.style.opacity = String(o);
        }
        // Asterisk glow grows
        if (asteriskRef.current) {
          const blur = 10 + p * 32;
          const a = Math.min(1, 0.6 + p * 0.4);
          asteriskRef.current.style.textShadow = `0 0 ${blur}px rgba(0,255,213,${a})`;
          asteriskRef.current.style.filter = `drop-shadow(0 0 ${blur}px rgba(0,255,213,${a}))`;
        }
      }
      rafId = requestAnimationFrame(tick);
    };
    rafId = requestAnimationFrame(tick);
    return () => { cancelAnimationFrame(rafId); io.disconnect(); };
  }, []);

  return (
    <section ref={containerRef} id="home" className="hero-scroll">
      <div className="hero-sticky">
        <div className="container" style={{ position: 'relative', zIndex: 4 }}>
          <div ref={headerRef} className="hero-header">
            <div style={{ marginBottom: 32, display: 'flex', justifyContent: 'center' }}>
              <EyebrowChip>Estrategia &amp; Arquitectura de IA</EyebrowChip>
            </div>
            <h1 className="tw-h" style={{
              fontSize: 'clamp(2.5rem, 7vw, 6.5rem)',
              lineHeight: 1.05,
              letterSpacing: '-0.025em',
              maxWidth: '18ch',
              margin: '0 auto'
            }}>
              <span className="tw-the">Tu puente entre el </span>
              <span className="tw-bold">código y la </span>
              <span className="tw-tail">rentabilidad.</span>
            </h1>
            <p className="lead" style={{ marginTop: 36, maxWidth: 640, marginInline: 'auto' }}>
              Estrategia, Diseño y Desarrollo de IA para Empresas Familiares y PyMEs.<br />
              Transformamos el caos de datos en un ecosistema asistido por AI.
            </p>
            <div style={{ marginTop: 48, display: 'flex', justifyContent: 'center', gap: 16, flexWrap: 'wrap' }}>
              <PrimaryButton onClick={() => document.getElementById('contacto').scrollIntoView()}>
                Agendar Auditoría Clínica
              </PrimaryButton>
              <GlassButton onClick={() => document.getElementById('servicios').scrollIntoView()}>
                Explorar Servicios
              </GlassButton>
            </div>
          </div>
        </div>
        {/* Cube drifts through the hero */}
        <div
          ref={cubeRef}
          className="hero-cube"
          style={{
            position: 'absolute',
            top: '60%',
            left: '50%',
            transform: 'translate(-50%, 80px)',
            pointerEvents: 'none',
            zIndex: 3,
            width: 220, height: 220,
            filter: 'drop-shadow(0 0 24px rgba(0,255,213,0.4))',
          }}
        >
          <CubeWithGlow asteriskRef={asteriskRef} />
        </div>
        <div ref={hintRef} style={{
          position: 'absolute', bottom: 32, left: '50%', transform: 'translateX(-50%)',
          display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8,
          color: 'rgba(189,203,194,0.35)',
        }}>
          <span style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, letterSpacing: '0.2em', textTransform: 'uppercase' }}>Explorar</span>
          <div style={{ width: 1, height: 48, background: 'linear-gradient(to bottom, rgba(0,255,204,0.4), transparent)' }} />
        </div>
      </div>
    </section>
  );
}

/* Cube SVG with an asterisk whose glow is driven externally via ref. */
function CubeWithGlow({ asteriskRef }) {
  return (
    <div style={{ position: 'relative', width: '100%', height: '100%' }}>
      <svg viewBox="0 0 120 120" style={{ width: '100%', height: '100%' }}>
        <polygon fill="#1C3246" points="16.7,35 60,10 103.3,35 60,60" />
        <polygon fill="#142534" points="16.7,85 16.7,35 60,60 60,110" />
        <polygon fill="#0D1925" points="60,60 103.3,35 103.3,85 60,110" />
        <polygon fill="none" stroke="#00FFD5" strokeWidth="1.5" opacity="0.9"
                 points="60,10 103.3,35 103.3,85 60,110 16.7,85 16.7,35" />
      </svg>
      <div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#00FFD5', fontFamily: 'JetBrains Mono, monospace', fontWeight: 700, pointerEvents: 'none' }}>
        <span style={{ fontSize: 28 }}>{'{'}</span>
        <span ref={asteriskRef} style={{
          fontSize: 70,
          margin: '0 12px',
          textShadow: '0 0 10px rgba(0,255,213,0.6)',
          filter: 'drop-shadow(0 0 10px rgba(0,255,213,0.6))',
        }}>*</span>
        <span style={{ fontSize: 28 }}>{'}'}</span>
      </div>
    </div>
  );
}

/* ───────────────────────────────────────────────────────────────────  PROBLEM */
function ProblemSection() {
  const bullets = [
    'Los equipos pierden cientos de horas en tareas manuales y hojas de cálculo desconectadas.',
    'Las decisiones críticas se toman basadas en la intuición y no en datos en tiempo real.',
    'La dependencia de procesos arcaicos erosiona el margen de beneficio y limita la escalabilidad.',
  ];
  return (
    <section id="el-problema" className="section bg-low">
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', gap: 64, alignItems: 'center' }}>
          <Reveal>
            <TripleHeading the="¿El crecimiento digital de tu" bold="negocio" tail="está atorado?" size="h3" />
            <p className="lead" style={{ marginTop: 32, marginBottom: 40, maxWidth: 540 }}>
              El desarrollo tradicional y los procesos manuales están frenando tu potencial. Identificamos los cuellos de botella que erosionan tu rentabilidad.
            </p>
            <ul style={{ listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 28 }}>
              {bullets.map((b, i) => (
                <Reveal key={i} delay={100 * i} as="li">
                  <div style={{ display: 'flex', gap: 16, alignItems: 'flex-start' }}>
                    <div style={{
                      marginTop: 2,
                      width: 28, height: 28,
                      flexShrink: 0,
                      borderRadius: 4,
                      display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                      background: 'rgba(239,68,68,0.10)',
                      border: '1px solid rgba(239,68,68,0.30)',
                      color: '#f87171'
                    }}>
                      <span style={{ width: 14, height: 14 }}><Icon.X /></span>
                    </div>
                    <span style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 17, fontWeight: 500, color: 'var(--tcc-on-surface)', lineHeight: 1.5 }}>{b}</span>
                  </div>
                </Reveal>
              ))}
            </ul>
          </Reveal>

          <Reveal delay={300}>
            <div className="card-monolith" style={{ padding: 48 }}>
              <div className="hover-glow" />
              <div style={{ position: 'relative' }}>
                <div style={{ display: 'flex', alignItems: 'center', gap: 14, marginBottom: 24 }}>
                  <div style={{ width: 28, height: 28, color: 'var(--tcc-primary)' }}><Icon.ShieldCheck /></div>
                  <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 22, fontWeight: 700, color: 'var(--tcc-on-surface)', textTransform: 'uppercase', letterSpacing: '0.2em' }}>Nuestra Promesa</h3>
                </div>
                <p className="lead" style={{ marginBottom: 32 }}>
                  Protegemos el esfuerzo de tu vida transformando el conocimiento fragmentado en un activo institucional blindado.
                </p>
                <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 16 }}>
                  <PromiseCell icon={<Icon.TrendingUp />} title="ROI Tangible" desc="Alineación de la IA con objetivos financieros." />
                  <PromiseCell icon={<Icon.Lock />}        title="Seguridad"   desc="Arquitecturas de datos autónomas y seguras." />
                </div>
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

function PromiseCell({ icon, title, desc }) {
  return (
    <div style={{ background: 'var(--tcc-surface)', padding: 24, borderRadius: 4, borderTop: '1px solid rgba(255,255,255,0.05)' }}>
      <div style={{ width: 32, height: 32, color: 'var(--tcc-primary)', marginBottom: 16 }}>{icon}</div>
      <div style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 11, fontWeight: 700, textTransform: 'uppercase', letterSpacing: '0.2em', color: 'var(--tcc-on-surface)', marginBottom: 6 }}>{title}</div>
      <div style={{ fontSize: 12, color: 'var(--tcc-on-surface-variant)' }}>{desc}</div>
    </div>
  );
}

/* ──────────────────────────────────────────────────────────────────  PILLARS */
function IdentityPillars() {
  const pillars = [
    { icon: <Icon.Users />,    title: 'Liderazgo',    desc: "Actuamos como 'Fractional CDOs' aportando capacidad operativa y creativa a tu equipo directivo." },
    { icon: <Icon.Code />,     title: 'Código',       desc: 'Desarrollo de soluciones codificadas a la medida, eliminando la deuda técnica desde el primer día.' },
    { icon: <Icon.BarChart />, title: 'Rentabilidad', desc: 'Cada línea de código y cada agente desplegado está alineado con tus objetivos financieros.' },
  ];
  return (
    <section className="section">
      <div className="container">
        <Reveal>
          <Eyebrow>Nuestra Identidad</Eyebrow>
          <TripleHeading the="Expertos en" bold="Negocios" tail="& Arquitectos de Datos" size="h2" />
          <p className="lead" style={{ marginTop: 32, maxWidth: 640 }}>
            Desarrollamos tecnología con propósito, simplicidad absoluta y consciencia de negocio.
          </p>
        </Reveal>

        <div style={{ marginTop: 80, display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))', gap: 32, justifyItems: 'center' }}>
          {pillars.map((p, i) => (
            <Reveal key={p.title} delay={120 * i}>
              <HexCard>
                <div style={{ width: 36, height: 36, color: 'var(--tcc-primary)' }}>{p.icon}</div>
                <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 26, fontWeight: 700, color: 'var(--tcc-on-surface)' }}>{p.title}</h3>
                <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 13, color: 'var(--tcc-on-surface-variant)', fontWeight: 300, lineHeight: 1.55, maxWidth: 200 }}>{p.desc}</p>
              </HexCard>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

function HexCard({ children }) {
  const gid = 'hg-' + Math.random().toString(36).slice(2, 7);
  return (
    <div className="hex-card" style={{ width: 260, height: 320 }}>
      <svg className="hex-stroke" preserveAspectRatio="none">
        <defs>
          <linearGradient id={gid} x1="0%" y1="0%" x2="100%" y2="100%">
            <stop offset="0%" stopColor="#00ffcc" stopOpacity="0.4" />
            <stop offset="50%" stopColor="#00ffcc" stopOpacity="0.1" />
            <stop offset="100%" stopColor="#00ffcc" stopOpacity="0" />
          </linearGradient>
        </defs>
        <path d="M25,0 L75,0 L100,50 L75,100 L25,100 L0,50 Z" vectorEffect="non-scaling-stroke" fill="none" stroke={`url(#${gid})`} strokeWidth="2" />
      </svg>
      <div className="hex-body">{children}</div>
    </div>
  );
}

/* ─────────────────────────────────────────────────────────────────  SERVICES */
function ServicesSection() {
  const services = [
    { phase: 1, title: 'Blueprint Digital',     desc: 'Auditoría y mapa financiero para priorizar el ROI antes de programar una sola línea de código.' },
    { phase: 1, title: 'Gobernanza de Datos',   desc: 'Arquitectura auditable bajo estándares europeos (GDPR), lista para la orquestación de IA.' },
    { phase: 1, title: 'Talleres Funcionales',  desc: 'Entrenamiento operativo para el equipo directivo sobre el uso estratégico de la IA.' },
    { phase: 2, title: 'Desarrollo & Agentes',  desc: 'Aplicaciones y arquitecturas de datos de alto rendimiento a bajo costo, optimizando cada recurso.' },
    { phase: 2, title: 'Bóvedas de Conocimiento', desc: "Rescate del conocimiento fragmentado en un 'Knowledge Hub' institucional seguro y accesible." },
    { phase: 2, title: 'Dirección Estratégica', desc: 'Liderazgo tecnológico continuo y auditoría de modelos para asegurar la escalabilidad a largo plazo.' },
  ];
  return (
    <section id="servicios" className="section bg-low">
      <div className="container">
        <Reveal>
          <div style={{ textAlign: 'center' }}>
            <Eyebrow>Portafolio de Servicios</Eyebrow>
            <TripleHeading the="Arquitectura" bold="modular." tail="Implementación progresiva." size="h3" centered />
            <p className="lead" style={{ marginTop: 24, maxWidth: 540, marginInline: 'auto' }}>
              Resultados tangibles entregados por fases auditables.
            </p>
          </div>
        </Reveal>

        <div style={{ marginTop: 80, display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))', gap: 20 }}>
          {services.map((s, i) => (
            <Reveal key={s.title} delay={i * 80}>
              <div className="card-monolith click" style={{ padding: 32, minHeight: 220, display: 'flex', flexDirection: 'column', gap: 14 }}>
                <div className="hover-glow" />
                <div style={{ position: 'relative' }}>
                  <PhaseLabel phase={s.phase}>{s.phase === 1 ? 'Fase I: Los Cimientos' : 'Fase II: La Evolución'}</PhaseLabel>
                  <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 22, fontWeight: 700, color: 'var(--tcc-on-surface)', marginTop: 16, marginBottom: 12, letterSpacing: '-0.01em' }}>{s.title}</h3>
                  <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 14, color: 'var(--tcc-on-surface-variant)', fontWeight: 300, lineHeight: 1.6 }}>{s.desc}</p>
                </div>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────────────────────────────────────  AI DIAGNOSIS DEMO */
function AiDiagnosisSection() {
  const [query, setQuery] = useState('');
  const [response, setResponse] = useState('');
  const [loading, setLoading] = useState(false);

  // Static mock (no API key in this kit). Real site calls Gemini 2.0 Flash.
  const MOCK = `**Análisis de viabilidad.** El stack recomendado es Next.js + Postgres + un pipeline RAG con embeddings privados (gobernanza GDPR-by-default).\n\n**Aceleración con agentes.** Un agente de ingesta automatiza la extracción de inventarios desde tu ERP legacy; un segundo agente sincroniza el catálogo con tu front-end en tiempo real.\n\n**Estimación.** ~62% de reducción en tiempo de desarrollo · 40% menos coste operativo vs. equipo tradicional de 4 personas.`;

  const handleGenerate = () => {
    if (!query.trim()) return;
    setLoading(true); setResponse('');
    setTimeout(() => { setResponse(MOCK); setLoading(false); }, 1100);
  };

  return (
    <section id="diagnostico-ia" className="section" style={{ borderTop: '1px solid var(--tcc-outline-variant)', background: 'rgba(24,32,43,0.6)' }}>
      <div className="container-md">
        <Reveal>
          <div style={{ textAlign: 'center', marginBottom: 56 }}>
            <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 24 }}>
              <EyebrowChip pulse={false}><span style={{ width: 12, height: 12 }}><Icon.Sparkles /></span> Demostración en Vivo</EyebrowChip>
            </div>
            <h2 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 'clamp(2rem, 4vw, 3.25rem)', fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.02em', marginBottom: 16 }}>
              Diagnóstico de App a Medida
            </h2>
            <p className="lead" style={{ maxWidth: 560, marginInline: 'auto' }}>
              Cuéntanos qué aplicación necesitas construir. Nuestra IA analizará la complejidad y te dará una estimación de eficiencia.
            </p>
          </div>
        </Reveal>

        <Reveal delay={150}>
          <div className="card-monolith" style={{ padding: 40, position: 'relative' }}>
            <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(circle at top right, rgba(0,255,204,0.10) 0%, transparent 50%)', opacity: 0.4, pointerEvents: 'none' }} />
            <div style={{ position: 'relative', display: 'flex', flexDirection: 'column', gap: 28 }}>
              <div>
                <label className="field-label">¿Qué funcionalidad principal buscas y quiénes serán los usuarios?</label>
                <textarea
                  value={query}
                  onChange={(e) => setQuery(e.target.value)}
                  rows={4}
                  placeholder="Ej. Necesito un sistema de gestión de inventarios para 3 almacenes con una app móvil para los repartidores que funcione sin conexión…"
                  className="field"
                />
              </div>
              <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                <PrimaryButton onClick={handleGenerate} disabled={loading || !query.trim()}>
                  {loading
                    ? <><span style={{ width: 16, height: 16 }}><Icon.Loader /></span> Analizando infraestructura…</>
                    : <><span style={{ width: 16, height: 16 }}><Icon.Sparkles /></span> Generar Diagnóstico IA</>
                  }
                </PrimaryButton>
              </div>
              {response && (
                <div style={{ background: 'rgba(10,11,13,0.5)', border: '1px solid rgba(0,255,204,0.30)', borderRadius: 4, padding: 32 }}>
                  <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 18 }}>
                    <span style={{ width: 18, height: 18, color: 'var(--tcc-primary)' }}><Icon.BrainCircuit /></span>
                    <h4 style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 12, fontWeight: 700, color: 'var(--tcc-primary)', textTransform: 'uppercase', letterSpacing: '0.2em' }}>Diagnóstico Ejecutivo</h4>
                  </div>
                  <div style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 14, color: 'var(--tcc-on-surface-variant)', fontWeight: 300, lineHeight: 1.7, whiteSpace: 'pre-wrap' }}
                    dangerouslySetInnerHTML={{ __html: response.replace(/\*\*(.+?)\*\*/g, '<strong style="color:var(--tcc-on-surface);font-weight:600;">$1</strong>') }}
                  />
                </div>
              )}
            </div>
          </div>
        </Reveal>
      </div>
    </section>
  );
}

/* ─────────────────────────────────────────────────────────  ARCHITECTURE/TERMINAL */
function ArchitectureSection() {
  const items = [
    { icon: <Icon.Database />,     title: 'Bóvedas de Datos',  desc: 'Bases de datos institucionales de alta integridad para la seguridad de tu información.' },
    { icon: <Icon.BrainCircuit />, title: 'Motores Cognitivos', desc: 'Orquestación avanzada de modelos de lenguaje para el procesamiento de lógica compleja.' },
    { icon: <Icon.Layout />,       title: 'Entorno Operativo',  desc: 'Sistemas propietarios diseñados para el despliegue seguro de agentes en entornos B2B.' },
  ];
  return (
    <section className="section" style={{ borderTop: '1px solid var(--tcc-outline-variant)', borderBottom: '1px solid var(--tcc-outline-variant)', background: 'rgba(24,32,43,0.4)' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(320px, 1fr))', gap: 64, alignItems: 'center' }}>
          <Reveal>
            <Eyebrow>Ecosistema Asistido por AI</Eyebrow>
            <h2 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 'clamp(2rem, 4vw, 3.25rem)', fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.02em', lineHeight: 1.1, marginBottom: 20 }}>
              Del Caos de Datos a la<br />Rentabilidad Operativa
            </h2>
            <p className="lead" style={{ marginBottom: 36 }}>
              Transformamos el desorden de información en un ecosistema inteligente que reemplaza la memoria tribal por conocimiento institucional auditable.
            </p>
            <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
              {items.map(t => (
                <div key={t.title} style={{ display: 'flex', gap: 16 }}>
                  <div style={{ width: 22, height: 22, color: 'var(--tcc-primary)', marginTop: 2, flexShrink: 0 }}>{t.icon}</div>
                  <div>
                    <h4 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 16, fontWeight: 700, color: 'var(--tcc-on-surface)', marginBottom: 4 }}>{t.title}</h4>
                    <p style={{ fontSize: 14, color: 'var(--tcc-on-surface-variant)', lineHeight: 1.55 }}>{t.desc}</p>
                  </div>
                </div>
              ))}
            </div>
          </Reveal>

          <Reveal delay={200}>
            <Terminal />
          </Reveal>
        </div>
      </div>
    </section>
  );
}

function Terminal() {
  return (
    <div style={{ position: 'relative' }}>
      <div style={{ position: 'absolute', inset: -16, background: 'rgba(0,255,204,0.20)', filter: 'blur(48px)', borderRadius: '50%', opacity: 0.2 }} />
      <div style={{
        position: 'relative',
        background: 'var(--tcc-surface-deep)',
        border: '1px solid var(--tcc-outline-variant)',
        borderRadius: 12,
        padding: 28,
        fontFamily: 'JetBrains Mono, monospace',
        fontSize: 12,
        lineHeight: 1.75,
        boxShadow: 'var(--tcc-shadow-deep)'
      }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 8, paddingBottom: 14, marginBottom: 14, borderBottom: '1px solid var(--tcc-outline-variant)' }}>
          <span style={{ width: 12, height: 12, borderRadius: '50%', background: 'rgba(239,68,68,0.5)' }} />
          <span style={{ width: 12, height: 12, borderRadius: '50%', background: 'rgba(250,204,21,0.5)' }} />
          <span style={{ width: 12, height: 12, borderRadius: '50%', background: 'rgba(34,197,94,0.5)' }} />
          <span style={{ marginLeft: 8, color: 'var(--tcc-on-surface-dim)', opacity: 0.6, fontSize: 11 }}>system_orchestration.sh</span>
        </div>
        <div style={{ color: 'var(--tcc-primary)' }}># Inicializando Orquestación de Procesos</div>
        <div style={{ color: 'var(--tcc-on-surface)' }}>DEPLOYING: RAG_Knowledge_Engine_v2...</div>
        <div style={{ color: 'var(--tcc-on-surface-dim)' }}>STATUS: [OK] Vector_DB_Connected</div>
        <div style={{ color: 'var(--tcc-on-surface-dim)' }}>STATUS: [OK] Logic_Layer_Validated</div>
        <div style={{ color: 'var(--tcc-on-surface)' }}>ORCHESTRATING: Task_Specific_Handlers...</div>
        <div style={{ color: 'var(--tcc-primary)' }}>&gt;&gt; Flujos operativos: 14</div>
        <div style={{ color: 'var(--tcc-primary)' }}>&gt;&gt; Latencia de respuesta: &lt;200ms</div>
        <div style={{ height: 3, background: 'var(--tcc-outline-variant)', marginTop: 14, borderRadius: 9999, overflow: 'hidden' }}>
          <div style={{ height: '100%', width: '72%', background: 'var(--tcc-primary)', boxShadow: '0 0 8px var(--tcc-primary)', animation: 'fill 3s var(--tcc-ease-out) infinite alternate' }} />
        </div>
      </div>
    </div>
  );
}

/* ────────────────────────────────────────────────────────────  CASES */
function CasesSection() {
  const cases = [
    {
      tag: 'Madrid · High-End Jewelry',
      title: 'Experts Gold ERP: El Blindaje Traslacional del Lujo',
      body: 'Transformamos una marca de alta joyería en Madrid en una potencia digital mediante el desarrollo de una arquitectura propietaria para la gestión de activos e inventarios en tiempo real.',
      tags: ['Financial Back-end', 'BI Dashboard', 'API Mesh', 'UX/UI Design'],
      quote: '"Implementamos Agentes Autónomos de Vigilancia que monitorizan el mercado del oro 24/7 y orquestan la cotización dinámica de mercancía, eliminando la volatilidad del error humano."',
      icon: <Icon.Rocket />,
    },
    {
      tag: 'Guadalajara · Boutique Clinical Aesthetics',
      title: 'DermimedSystem: Orquestación a Cero Clics',
      body: 'Diseñamos el protocolo MCP para una integración fluida con ERPs legacy, elevando la eficiencia operativa de una de las clínicas estéticas más exclusivas de México.',
      tags: ['MCP Protocol', 'Legacy ERP Connection', 'BI Insights', 'Agile Ops'],
      quote: '"Red neuronal de agentes que capturan cotizaciones directamente del email, ejecutan análisis comparativos de mercado y disparan órdenes de compra automáticas vía API."',
      icon: <Icon.Layers />,
    },
  ];
  return (
    <section id="casos" className="section bg-low">
      <div className="container">
        <Reveal>
          <Eyebrow>Portafolio de Impacto</Eyebrow>
          <h2 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 'clamp(2.5rem, 5.5vw, 5rem)', fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.025em', lineHeight: 1, marginBottom: 24 }}>Casos de Éxito</h2>
          <p className="lead" style={{ maxWidth: 600 }}>
            Demostramos que la arquitectura de datos institucional y el desarrollo de aplicaciones de alto nivel es posible a <span style={{ color: 'var(--tcc-primary)', fontWeight: 500 }}>bajo costo</span> mediante la orquestación inteligente.
          </p>
        </Reveal>
        <div style={{ marginTop: 80, display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(380px, 1fr))', gap: 32 }}>
          {cases.map((c, i) => (
            <Reveal key={c.title} delay={i * 150}>
              <article className="card-monolith" style={{ padding: 48, height: '100%', display: 'flex', flexDirection: 'column' }}>
                <div className="hover-glow" />
                <div style={{ position: 'absolute', top: 24, right: 24, color: 'var(--tcc-primary)', opacity: 0.3, width: 40, height: 40 }}>{c.icon}</div>
                <div style={{ flex: 1, position: 'relative' }}>
                  <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 10, color: 'var(--tcc-primary)', letterSpacing: '0.2em', textTransform: 'uppercase', marginBottom: 20 }}>{c.tag}</div>
                  <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 28, fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.015em', lineHeight: 1.15, marginBottom: 18 }}>{c.title}</h3>
                  <p className="body" style={{ fontSize: 15, marginBottom: 24 }}>{c.body}</p>
                  <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', marginBottom: 28 }}>
                    {c.tags.map(t => <span key={t} className="tag">{t}</span>)}
                  </div>
                </div>
                <div style={{ position: 'relative', background: 'rgba(0,255,204,0.05)', border: '1px solid rgba(0,255,204,0.20)', padding: 22, borderRadius: 4 }}>
                  <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
                    <span style={{ width: 14, height: 14, color: 'var(--tcc-primary)' }}><Icon.Zap /></span>
                    <h4 style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, fontWeight: 700, color: 'var(--tcc-primary)', textTransform: 'uppercase', letterSpacing: '0.2em' }}>Factor Diferencial AI</h4>
                  </div>
                  <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 14, color: 'var(--tcc-on-surface)', fontWeight: 500, fontStyle: 'italic', lineHeight: 1.55 }}>{c.quote}</p>
                </div>
              </article>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────────────────────────────────────────────────  CTA */
function CtaSection() {
  const phases = [
    { pct: '40% Inicio',          desc: 'Compromiso y arranque de arquitectura.' },
    { pct: '40% Infraestructura', desc: 'Entrega de cimientos y gobernanza.' },
    { pct: '20% Validación',      desc: 'Cierre y despliegue final de agentes.' },
  ];
  return (
    <section id="contacto" className="section" style={{ borderTop: '1px solid var(--tcc-outline-variant)', textAlign: 'center', position: 'relative', overflow: 'hidden' }}>
      <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(circle at center, rgba(0,255,204,0.06) 0%, transparent 70%)', zIndex: 0 }} />
      <div className="container-md" style={{ position: 'relative', zIndex: 2 }}>
        <Reveal>
          <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 32 }}>
            <span className="eyebrow eyebrow-chip">Modelo de Inversión 40/40/20</span>
          </div>
          <h2 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 'clamp(2.5rem, 6vw, 5.25rem)', fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.025em', lineHeight: 1.05, marginBottom: 28 }}>
            El Diagnóstico Clínico
          </h2>
          <p className="lead" style={{ maxWidth: 600, marginInline: 'auto', marginBottom: 48 }}>
            Agendemos una sesión estratégica de 45 minutos para identificar fugas de capital y evaluar el potencial real de la IA en tu negocio.
          </p>
          <PrimaryButton>
            Agendar Sesión Estratégica <span style={{ width: 18, height: 18 }}><Icon.ChevronRight /></span>
          </PrimaryButton>
        </Reveal>
        <Reveal delay={250}>
          <div style={{ marginTop: 80, paddingTop: 48, borderTop: '1px solid rgba(58,74,68,0.4)', display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 32, textAlign: 'left' }}>
            {phases.map(p => (
              <div key={p.pct}>
                <h4 style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: 'var(--tcc-primary)', letterSpacing: '0.2em', textTransform: 'uppercase', fontWeight: 700, marginBottom: 8 }}>{p.pct}</h4>
                <p style={{ fontSize: 13, color: 'var(--tcc-on-surface-variant)' }}>{p.desc}</p>
              </div>
            ))}
          </div>
        </Reveal>
      </div>
    </section>
  );
}

/* ──────────────────────────────────────────────────────────────────  FOOTER */
function Footer() {
  return (
    <footer style={{ background: 'rgba(24,32,43,0.8)', backdropFilter: 'blur(12px)', borderTop: '1px solid var(--tcc-outline-variant)', padding: '48px 0', position: 'relative', zIndex: 4 }}>
      <div className="container" style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 24, flexWrap: 'wrap' }}>
        <Logo />
        <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: 'var(--tcc-on-surface-dim)', textAlign: 'right' }}>
          <p>© {new Date().getFullYear()} The Conscious Code. Todos los derechos reservados.</p>
          <p style={{ marginTop: 4 }}>HQ: Países Bajos · Operaciones Globales</p>
        </div>
      </div>
    </footer>
  );
}

/* ──────────────────────────────────────────  DIFFERENTIATORS (El Enfoque) */
function DifferentiatorsSection() {
  return (
    <section id="el-enfoque" className="section bg-low">
      <div className="container">
        <Reveal>
          <Eyebrow>Diferenciadores Clave</Eyebrow>
          <TripleHeading the="Combinamos el" bold="rigor institucional" tail="con agilidad local." size="h3" />
        </Reveal>

        <div style={{ marginTop: 64, display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: 24 }}>
          {/* Main bento card */}
          <Reveal delay={100}>
            <div className="card-monolith" style={{ gridColumn: 'span 8', padding: 48, minHeight: 320 }}>
              <div className="hover-glow" />
              <div style={{ position: 'relative' }}>
                <div style={{ width: 44, height: 44, color: 'var(--tcc-primary)', marginBottom: 28 }}><Icon.Globe2 /></div>
                <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 32, fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.015em', marginBottom: 18 }}>Rigor Corporativo para PyMEs</h3>
                <p className="lead" style={{ maxWidth: 520 }}>
                  Traducimos los estándares de cumplimiento más estrictos del mundo (GDPR y AI Act) a tu realidad operativa. Blindamos el capital intelectual de tu empresa familiar con el rigor de una multinacional.
                </p>
              </div>
            </div>
          </Reveal>

          {/* Two stacked small cards */}
          <div style={{ gridColumn: 'span 4', display: 'flex', flexDirection: 'column', gap: 24 }}>
            <Reveal delay={200}>
              <div className="card-monolith" style={{ padding: 28 }}>
                <div className="hover-glow" />
                <div style={{ position: 'relative' }}>
                  <div style={{ width: 28, height: 28, color: 'var(--tcc-primary)', marginBottom: 18 }}><Icon.Database /></div>
                  <h4 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 18, fontWeight: 700, color: 'var(--tcc-on-surface)', marginBottom: 8 }}>Adiós a la Memoria Tribal</h4>
                  <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 13, fontWeight: 300, color: 'var(--tcc-on-surface-variant)', lineHeight: 1.55 }}>Reemplazamos procesos manuales con arquitecturas autónomas.</p>
                </div>
              </div>
            </Reveal>
            <Reveal delay={280}>
              <div className="card-monolith" style={{ padding: 28 }}>
                <div className="hover-glow" />
                <div style={{ position: 'relative' }}>
                  <div style={{ width: 28, height: 28, color: 'var(--tcc-primary)', marginBottom: 18 }}><Icon.ShieldCheck /></div>
                  <h4 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 18, fontWeight: 700, color: 'var(--tcc-on-surface)', marginBottom: 8 }}>Seguridad por Diseño</h4>
                  <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 13, fontWeight: 300, color: 'var(--tcc-on-surface-variant)', lineHeight: 1.55 }}>Privacidad y gobernanza bajo normativas internacionales.</p>
                </div>
              </div>
            </Reveal>
          </div>

          {/* Bottom wide card with orbiting agents */}
          <Reveal delay={350}>
            <div className="card-monolith" style={{ gridColumn: 'span 12', padding: 48, display: 'flex', alignItems: 'center', gap: 56, flexWrap: 'wrap' }}>
              <div className="hover-glow" />
              <div style={{ flex: '1 1 360px', position: 'relative' }}>
                <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 28, fontWeight: 700, color: 'var(--tcc-on-surface)', marginBottom: 18, letterSpacing: '-0.015em' }}>ADN Latinoamericano</h3>
                <p className="lead" style={{ marginBottom: 28, fontSize: 16 }}>
                  Entendemos la cultura y la resistencia al cambio. Orquestamos flujos de trabajo inteligentes que resuelven el trabajo pesado real.
                </p>
                <div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
                  <PrimaryButton onClick={() => document.getElementById('metodologia-video')?.scrollIntoView()}>Nuestra Metodología</PrimaryButton>
                  <GlassButton onClick={() => document.getElementById('casos')?.scrollIntoView()}>Casos de Éxito</GlassButton>
                </div>
              </div>
              <div style={{ flex: '1 1 320px', position: 'relative', minHeight: 320, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
                <OrbitingAgents />
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

/* Orbiting agents — two concentric circular paths with attached icons */
function OrbitingAgents() {
  return (
    <div style={{ position: 'relative', width: 320, height: 320, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <div style={{ position: 'absolute', zIndex: 3, padding: 12, background: 'var(--tcc-surface)', border: '1px solid var(--tcc-outline-variant)', borderRadius: '50%', boxShadow: '0 0 30px rgba(0,255,204,0.2)' }}>
        <Logo iconOnly minimized />
      </div>
      {/* Inner orbit */}
      <div style={{ position: 'absolute', width: 200, height: 200, borderRadius: '50%', border: '1px solid rgba(0,255,204,0.30)', animation: 'orbit-spin 12s linear infinite' }}>
        <div style={{ position: 'absolute', top: -18, left: '50%', transform: 'translateX(-50%)', width: 36, height: 36, borderRadius: '50%', background: 'var(--tcc-surface-container)', border: '1px solid var(--tcc-primary)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--tcc-primary)', boxShadow: '0 0 12px rgba(0,255,204,0.4)' }}>
          <div style={{ width: 18, height: 18 }}><Icon.BrainCircuit /></div>
        </div>
        <div style={{ position: 'absolute', bottom: -18, left: '50%', transform: 'translateX(-50%)', width: 36, height: 36, borderRadius: '50%', background: 'var(--tcc-surface-container)', border: '1px solid var(--tcc-primary)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--tcc-primary)', boxShadow: '0 0 12px rgba(0,255,204,0.4)' }}>
          <div style={{ width: 18, height: 18 }}><Icon.Database /></div>
        </div>
      </div>
      {/* Outer orbit */}
      <div style={{ position: 'absolute', width: 300, height: 300, borderRadius: '50%', border: '1px dashed rgba(148,163,184,0.30)', animation: 'orbit-spin-rev 20s linear infinite' }}>
        <div style={{ position: 'absolute', top: '50%', left: -18, transform: 'translateY(-50%)', width: 36, height: 36, borderRadius: '50%', background: 'var(--tcc-surface-container)', border: '1px solid var(--tcc-outline-variant)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--tcc-on-surface-dim)' }}>
          <div style={{ width: 18, height: 18 }}><Icon.Workflow /></div>
        </div>
        <div style={{ position: 'absolute', top: '50%', right: -18, transform: 'translateY(-50%)', width: 36, height: 36, borderRadius: '50%', background: 'var(--tcc-surface-container)', border: '1px solid var(--tcc-outline-variant)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--tcc-on-surface-dim)' }}>
          <div style={{ width: 18, height: 18 }}><Icon.Cpu /></div>
        </div>
      </div>
    </div>
  );
}

/* ──────────────────────────────────────────────────────────────  BENEFITS */
function BenefitsSection() {
  const benefits = [
    { icon: <Icon.Zap />,         title: 'Eficiencia Operativa',  desc: 'Automatización de flujos críticos para liberar cientos de horas de trabajo manual y repetitivo.' },
    { icon: <Icon.ShieldCheck />, title: 'Mitigación de Riesgos', desc: 'Gobernanza institucional que elimina el error humano y blinda los activos intelectuales de tu empresa.' },
    { icon: <Icon.TrendingUp />,  title: 'ROI Tangible',          desc: 'Reducción de costos operativos y mayor escalabilidad sin necesidad de inflar la nómina administrativa.' },
  ];
  return (
    <section className="section" style={{ borderTop: '1px solid var(--tcc-outline-variant)', borderBottom: '1px solid var(--tcc-outline-variant)', background: 'rgba(24,32,43,0.30)' }}>
      <div className="container">
        <Reveal>
          <div style={{ textAlign: 'center', marginBottom: 64 }}>
            <h2 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 'clamp(2rem, 4vw, 3.25rem)', fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.02em', marginBottom: 16 }}>Beneficios Directos</h2>
            <p className="lead" style={{ fontSize: 20 }}>Impacto real en tu operación y rentabilidad.</p>
          </div>
        </Reveal>
        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))', gap: 32 }}>
          {benefits.map((b, i) => (
            <Reveal key={b.title} delay={i * 120}>
              <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center', padding: 24 }}>
                <div style={{ width: 64, height: 64, padding: 16, background: 'rgba(0,255,204,0.05)', border: '1px solid rgba(0,255,204,0.10)', borderRadius: '50%', color: 'var(--tcc-primary)', display: 'flex', alignItems: 'center', justifyContent: 'center', marginBottom: 24 }}>
                  <div style={{ width: 28, height: 28 }}>{b.icon}</div>
                </div>
                <h3 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 22, fontWeight: 700, color: 'var(--tcc-on-surface)', marginBottom: 14, letterSpacing: '-0.01em' }}>{b.title}</h3>
                <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 14, color: 'var(--tcc-on-surface-variant)', fontWeight: 300, lineHeight: 1.6, maxWidth: 320 }}>{b.desc}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* ────────────────────────────────────────────────────────  VIDEO / MANIFESTO */
function VideoSection() {
  const steps = [
    { n: '01', t: 'Extracción',  d: 'Digitalizamos el conocimiento crítico atrapado en procesos manuales.' },
    { n: '02', t: 'Codificación', d: 'Inyectamos las reglas de tu negocio en una arquitectura de agentes autónomos.' },
    { n: '03', t: 'Rentabilidad', d: 'Transformamos el caos en un ecosistema escalable y auditable 24/7.' },
  ];
  return (
    <section id="metodologia-video" className="section" style={{ position: 'relative', overflow: 'hidden' }}>
      <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(circle at center, rgba(0,255,204,0.03) 0%, transparent 70%)', pointerEvents: 'none' }} />
      <div className="container-md" style={{ position: 'relative', zIndex: 2 }}>
        <Reveal>
          <div style={{ textAlign: 'center', marginBottom: 56 }}>
            <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 24 }}>
              <EyebrowChip pulse={false}><span style={{ width: 12, height: 12 }}><Icon.Layout /></span> Metodología</EyebrowChip>
            </div>
            <h2 style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 'clamp(2rem, 4vw, 3.25rem)', fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.02em', marginBottom: 16 }}>Del Caos a la Arquitectura Institucional</h2>
            <p className="lead" style={{ maxWidth: 640, marginInline: 'auto', fontSize: 18 }}>
              Descubre cómo <strong style={{ color: 'var(--tcc-on-surface)', fontWeight: 600 }}>The Conscious Code OS</strong> y nuestro ecosistema de agentes orquestados con <strong style={{ color: 'var(--tcc-on-surface)', fontWeight: 600 }}>Harness</strong> blindan el patrimonio intelectual de tu empresa.
            </p>
          </div>
        </Reveal>

        <Reveal delay={150}>
          <VideoPoster />
        </Reveal>

        <div style={{ marginTop: 56, display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 32 }}>
          {steps.map((s, i) => (
            <Reveal key={s.n} delay={i * 100}>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
                <h4 style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: 'var(--tcc-primary)', textTransform: 'uppercase', letterSpacing: '0.2em', fontWeight: 700 }}>{s.n}. {s.t}</h4>
                <p style={{ fontFamily: 'var(--tcc-font-body)', fontSize: 14, color: 'var(--tcc-on-surface-variant)', lineHeight: 1.55 }}>{s.d}</p>
              </div>
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

/* Stylized video placeholder — real site embeds <video src="/video.mp4">. */
function VideoPoster() {
  const [playing, setPlaying] = useState(false);
  return (
    <div style={{
      position: 'relative',
      aspectRatio: '16/9',
      width: '100%',
      maxWidth: 960,
      margin: '0 auto',
      borderRadius: 16,
      overflow: 'hidden',
      border: '1px solid var(--tcc-outline-variant)',
      boxShadow: 'var(--tcc-shadow-deep)',
      background: 'linear-gradient(135deg, #0a0b0d 0%, #18202b 50%, #0c141f 100%)',
      cursor: 'pointer'
    }}
      onClick={() => setPlaying(p => !p)}
    >
      <div style={{ position: 'absolute', inset: 0, background: 'radial-gradient(circle at 30% 30%, rgba(0,255,204,0.15) 0%, transparent 55%), radial-gradient(circle at 75% 70%, rgba(0,255,204,0.10) 0%, transparent 55%)' }} />
      {/* Scanlines */}
      <div style={{ position: 'absolute', inset: 0, backgroundImage: 'repeating-linear-gradient(0deg, rgba(0,255,204,0.04) 0px, rgba(0,255,204,0.04) 1px, transparent 1px, transparent 4px)' }} />
      {/* Title text */}
      <div style={{ position: 'absolute', top: 32, left: 32, right: 32 }}>
        <div style={{ fontFamily: 'JetBrains Mono, monospace', fontSize: 11, color: 'var(--tcc-primary)', letterSpacing: '0.25em', textTransform: 'uppercase', marginBottom: 10 }}>● Manifiesto · 02:47</div>
        <div style={{ fontFamily: 'var(--tcc-font-display)', fontSize: 28, fontWeight: 700, color: 'var(--tcc-on-surface)', letterSpacing: '-0.015em', maxWidth: 500 }}>The Conscious Code OS</div>
      </div>
      {/* Play button */}
      <div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
        <div style={{
          width: 88, height: 88, borderRadius: '50%',
          background: 'var(--tcc-primary)', color: 'var(--tcc-primary-ink)',
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          boxShadow: '0 0 32px rgba(0,255,204,0.6), 0 0 80px rgba(0,255,204,0.2)',
          transform: playing ? 'scale(0.9)' : 'scale(1)',
          transition: 'transform 300ms var(--tcc-ease-out)'
        }}>
          {playing
            ? <svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="5" width="4" height="14"/><rect x="14" y="5" width="4" height="14"/></svg>
            : <svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor" style={{ marginLeft: 4 }}><polygon points="6 4 20 12 6 20" /></svg>
          }
        </div>
      </div>
      {/* Bottom scrubber */}
      <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, padding: '20px 32px', background: 'linear-gradient(to top, rgba(0,0,0,0.7), transparent)' }}>
        <div style={{ height: 3, background: 'rgba(255,255,255,0.15)', borderRadius: 9999, overflow: 'hidden' }}>
          <div style={{ height: '100%', width: playing ? '42%' : '14%', background: 'var(--tcc-primary)', transition: 'width 600ms var(--tcc-ease-out)' }} />
        </div>
      </div>
    </div>
  );
}

Object.assign(window, {
  Hero, ProblemSection, IdentityPillars, DifferentiatorsSection,
  BenefitsSection, ServicesSection, VideoSection,
  AiDiagnosisSection, ArchitectureSection, CasesSection, CtaSection, Footer,
});
