/* HeroDemoV7 — subset reducido del prototipo V7 para vivir DENTRO del hero
   post-loader de newgalaxia.com (Opción B).

   Porta SOLO el flujo Inmobiliaria > Audio · 2 propiedades:
     - audio del cliente con transcripción inline
     - 2 chips de capacidad bajo el primer mensaje del bot
     - Centro Operativo del Agente (5 slots) iluminando en vivo
     - email compacto final (5 campos · CTA)
   Sin selectores, sin scrubber, sin hitos, sin paneles A/B alternativos.
   Tamaño total: 1 archivo JSX ≤ 600 líneas. Comparte fonts/colors/tokens
   con la landing (Geist, Geist Mono, Instrument Serif, cyan, violet, ink, bg).
*/

const { useEffect: useEffectV7, useRef: useRefV7, useState: useStateV7, useMemo: useMemoV7 } = React;

/* ─── Timeline del flujo audio_principal (extraído de V7) ─────────────── */
const HERO_V7_DURATION = 18800;
const HERO_V7_TIMELINE = [
  { at:   400, row:'r1', k:'user_audio', dur:'0:14', tm:'10:23',
    transcript:'Hola, vi algunas propiedades en su página web que podrían interesarme. Me interesa la de Ramallo y Av. Italia y la de 8 de Octubre y Comercio.' },
  { at:  1500, row:'r1', k:'capability', slot:'entendio',
    label:'Entendió audio · CRM',
    text:'Entendió el audio y se conectó al CRM para verificar disponibilidad' },
  { at:  3600, row:'r3', k:'bot_typing' },
  { at:  4800, row:'r3', k:'bot_msg', tm:'10:23',
    text:'¡Hola! La de 8 de Octubre y Comercio ya no está disponible, pero la de Ramallo y Av. Italia sigue disponible. ¿Querés coordinar una visita?' },
  { at:  5500, row:'r3', k:'capability', slot:'consulto',
    label:'Consultó CRM',
    text:'Se conectó al CRM y respondió ambas preguntas de disponibilidad' },
  { at:  6200, row:'r3', k:'capability', slot:'detecto',
    label:'Detectó no disponible',
    text:'Detectó una propiedad no disponible y ofreció la alternativa disponible' },
  { at:  7000, row:'r4', k:'user_msg', tm:'10:24',
    text:'Sí, me interesa verla.' },
  { at:  7900, row:'r4', k:'capability', slot:'detecto',
    label:'Detectó intención de visita',
    text:'Detectó intención de visita' },
  { at:  9000, row:'r5', k:'bot_typing' },
  { at: 10000, row:'r5', k:'bot_msg', tm:'10:24',
    text:'Perfecto. ¿Qué día y franja horaria te quedaría cómoda para visitarla?' },
  { at: 10800, row:'r5', k:'capability', slot:'pidio',
    label:'Pidió datos clave',
    text:'Pidió datos para aumentar las posibilidades de contacto exitoso' },
  { at: 12100, row:'r6', k:'user_msg', tm:'10:25',
    text:'Podría ser mañana de tarde.' },
  { at: 12900, row:'r6', k:'capability', slot:'pidio',
    label:'Extrajo preferencia',
    text:'Extrajo preferencia de día y franja horaria' },
  { at: 14100, row:'r7', k:'bot_msg', tm:'10:25',
    text:'Genial. Te contactamos para coordinar la visita por Ramallo y Av. Italia.' },
  { at: 14900, row:'r7', k:'capability', slot:'aviso', tone:'violet',
    label:'Generó aviso al equipo',
    text:'Cerró con expectativa clara y generó aviso interno para una persona del equipo' },
  { at: 15800, k:'email_notice', label:'Nuevo aviso interno · coordinar visita' },
  { at: 17600, k:'email' },
];

const HERO_V7_EMAIL = {
  from: 'Agente · newGalaxIA',
  to:   'Equipo · inmobiliaria',
  subject: 'Lead solicita visita · Ramallo y Av. Italia',
  meta: 'hace 1 segundo · para el equipo',
  body: 'Cliente consultó por audio por dos propiedades…',
  labels: [{ k:'LEAD CON VISITA', tone:'ok' }],
  fields: [
    ['Disponible',     'Ramallo y Av. Italia'],
    ['No disponible',  '8 de Octubre y Comercio'],
    ['Preferencia',    'Mañana de tarde'],
    ['Próximo paso',   'Coordinar visita'],
    ['Más info',       'Abrir conversación en WhatsApp'],
  ],
  cta: 'Abrir conversación en WhatsApp',
};

/* ─── Centro Operativo · 5 slots fijos ─────────────────────────────────── */
const HERO_V7_SLOTS = [
  { k:'entendio', label:'Entendió',           ic:'👁' },
  { k:'consulto', label:'Consultó',           ic:'🔎' },
  { k:'detecto',  label:'Detectó / Decidió',  ic:'⚡' },
  { k:'pidio',    label:'Pidió / Coordinó',   ic:'📅' },
  { k:'aviso',    label:'Generó / Avisó',     ic:'✉' },
];

/* ─── Subcomponentes WhatsApp-style ────────────────────────────────────── */
function HV7Bubble({ side, text, tm }) {
  const isUser = side === 'in';
  return (
    <div className={`flex ${isUser ? 'justify-start' : 'justify-end'} mb-1.5 px-2`}>
      <div className={`max-w-[88%] rounded-2xl px-3.5 py-2 text-[13.5px] leading-[1.42] ${
        isUser
          ? 'bg-white/[0.06] border border-line text-ink/95 rounded-bl-md'
          : 'bg-cyan/[0.14] border border-cyan/30 text-ink rounded-br-md'
      }`}>
        <div>{text}</div>
        <div className={`text-[9.5px] font-mono mt-1 uppercase tracking-[0.15em] ${isUser ? 'text-dim' : 'text-cyan/80'}`}>
          {tm}{isUser ? '' : ' ✓✓'}
        </div>
      </div>
    </div>
  );
}

function HV7Audio({ dur, tm, transcript }) {
  const bars = [4,8,6,10,12,8,5,11,9,6,7,12,8,4,9,11,6,5,8,4,7,9,5];
  return (
    <React.Fragment>
      <div className="flex justify-start mb-1.5 px-2">
        <div className="rounded-2xl px-3 py-2 bg-white/[0.06] border border-line rounded-bl-md max-w-[290px]">
          <div className="flex items-center gap-2.5">
            <div className="size-8 rounded-full bg-cyan/85 text-bg flex items-center justify-center text-[13px]">▶</div>
            <div className="flex items-end gap-[2.5px] flex-1 h-[22px]">
              {bars.map((h, i) =>
                <span key={i} style={{ height:`${h+4}px`, width:'2.5px', background:'rgba(51,194,234,0.55)', borderRadius:'2px' }} />
              )}
            </div>
          </div>
          <div className="flex justify-between mt-1 text-[10.5px] font-mono text-dim uppercase tracking-[0.15em]">
            <span>{dur}</span>
            <span>{tm}</span>
          </div>
        </div>
      </div>
      {transcript &&
        <div className="px-3 -mt-1 mb-2">
          <span className="inline-flex items-start gap-1.5 max-w-[86%] rounded-lg border border-cyan/30 bg-cyan/[0.08] px-2.5 py-1.5 text-[11px] leading-[1.38] text-ink/85">
            <span aria-hidden="true" className="text-cyan font-semibold text-[11px] mt-[1px]">🎙</span>
            <span>{transcript}</span>
          </span>
        </div>
      }
    </React.Fragment>
  );
}

function HV7Typing() {
  return (
    <div className="flex justify-start mb-1.5 px-2">
      <div className="rounded-2xl rounded-bl-md bg-white/[0.06] border border-line px-3.5 py-2.5 flex items-center gap-1.5">
        <span className="size-1.5 rounded-full bg-ink/60" style={{ animation:'hv7-typing 1.1s ease-in-out infinite', animationDelay:'0ms' }} />
        <span className="size-1.5 rounded-full bg-ink/60" style={{ animation:'hv7-typing 1.1s ease-in-out infinite', animationDelay:'160ms' }} />
        <span className="size-1.5 rounded-full bg-ink/60" style={{ animation:'hv7-typing 1.1s ease-in-out infinite', animationDelay:'320ms' }} />
      </div>
    </div>
  );
}

function HV7Chip({ c }) {
  return (
    <span className="inline-flex items-center gap-1.5 px-2.5 py-[3px] rounded-full text-[10.5px] font-mono"
      style={{
        background: c.tone === 'violet' ? 'rgba(158,123,255,0.12)' : 'rgba(51,194,234,0.12)',
        border: `1px solid ${c.tone === 'violet' ? 'rgba(158,123,255,0.32)' : 'rgba(51,194,234,0.34)'}`,
        color: 'rgba(244,241,234,0.92)',
        letterSpacing:'0.04em',
        whiteSpace:'nowrap',
      }}>
      <span aria-hidden="true" style={{ color: c.tone === 'violet' ? '#9E7BFF' : '#33C2EA', fontSize:'10px', fontWeight:600 }}>
        {c.tone === 'violet' ? '⚡' : '✓'}
      </span>
      <span>{c.label}</span>
    </span>
  );
}

/* ─── Centro Operativo (panel derecho) ──────────────────────────────────── */
function HV7OpsPanel({ slotsValues, activeSlot, showEmailNotice, showEmail }) {
  const headerMeta = showEmail ? 'resultado listo'
                    : showEmailNotice ? 'preparando aviso'
                    : 'en proceso';
  return (
    <div className="rounded-2xl border border-line bg-bg/60 backdrop-blur-md p-4 md:p-5"
      style={{ minHeight: 460 }}>
      <div className="flex items-center gap-2 pb-3 mb-3 border-b border-line">
        <span className="size-2 rounded-full bg-cyan pulse-node" />
        <span className="text-[10.5px] font-mono uppercase tracking-[0.22em] text-ink/85">Centro operativo del agente</span>
        <span className="ml-auto text-[10px] font-mono uppercase tracking-[0.20em] text-dim">{headerMeta}</span>
      </div>

      <div className="flex flex-col gap-2">
        {HERO_V7_SLOTS.map(slot => {
          const cap = slotsValues[slot.k];
          const state = !cap ? 'idle' : (slot.k === activeSlot ? 'active' : 'done');
          return (
            <div key={slot.k}
              className="rounded-xl border px-3 py-2 transition-all duration-300"
              style={{
                borderColor: state === 'active' ? 'rgba(51,194,234,0.65)'
                            : state === 'done'  ? 'rgba(51,194,234,0.22)'
                            :                      'rgba(244,241,234,0.10)',
                background: state === 'active' ? 'linear-gradient(180deg, rgba(51,194,234,0.10), rgba(51,194,234,0.02))'
                            : state === 'done' ? 'rgba(51,194,234,0.035)'
                            :                     'rgba(244,241,234,0.015)',
                boxShadow: state === 'active' ? '0 0 0 1px rgba(51,194,234,0.18), 0 12px 28px -18px rgba(51,194,234,0.45)' : 'none',
              }}>
              <div className="flex items-center gap-2 mb-1">
                <span aria-hidden="true" className="text-[13px] opacity-90">{slot.ic}</span>
                <span className="text-[10.5px] font-mono uppercase tracking-[0.18em] text-ink/85">{slot.label}</span>
                {state === 'active' &&
                  <span className="ml-auto inline-flex items-center gap-1 text-[9.5px] font-mono uppercase tracking-[0.18em] text-cyan">
                    <span className="size-1 rounded-full bg-cyan pulse-node" /> activo
                  </span>
                }
              </div>
              <div className={`text-[12.5px] leading-[1.42] ${cap ? 'text-ink/90' : 'text-dim italic'}`}>
                {cap ? cap.text : 'pendiente'}
              </div>
            </div>
          );
        })}
      </div>
    </div>
  );
}

/* ─── Email compacto (aparece al final del flujo) ──────────────────────── */
function HV7Email({ email }) {
  return (
    <div className="rounded-2xl border overflow-hidden"
      style={{
        background:'#FFFFFF',
        borderColor:'rgba(244,241,234,0.18)',
        boxShadow:'0 18px 50px -22px rgba(51,194,234,0.45), 0 0 0 1px rgba(51,194,234,0.10)',
      }}>
      <div className="px-4 py-3 flex items-center gap-3 border-b" style={{ borderColor:'#E8EAED' }}>
        <div className="size-9 rounded-full text-white text-[11.5px] font-mono flex items-center justify-center"
          style={{ background:'linear-gradient(135deg, #33C2EA, #9E7BFF)' }}>NG</div>
        <div className="flex-1 min-w-0">
          <div className="text-[13px] font-medium" style={{ color:'#202124' }}>{email.from}</div>
          <div className="text-[11.5px]" style={{ color:'#5F6368' }}>{email.meta}</div>
        </div>
        <div className="flex flex-wrap gap-1.5 max-w-[55%] justify-end">
          {email.labels.map((l, i) =>
            <span key={i} className="px-2 py-[3px] rounded-full text-[10px] font-mono uppercase tracking-[0.10em]"
              style={{
                background: l.tone === 'ok'     ? '#E6F4EA'
                          : l.tone === 'violet' ? '#F3E8FD'
                          : l.tone === 'warn'   ? '#FCE8E6'
                          :                       '#E8F0FE',
                color:     l.tone === 'ok'     ? '#137333'
                          : l.tone === 'violet' ? '#7B1FA2'
                          : l.tone === 'warn'   ? '#C5221F'
                          :                       '#1A73E8',
              }}>
              {l.k}
            </span>
          )}
        </div>
      </div>
      <div className="px-4 pt-3 pb-2">
        <div className="text-[15px] font-medium" style={{ color:'#202124', fontFamily:'Geist, system-ui, sans-serif' }}>{email.subject}</div>
        <div className="text-[12px] mt-1.5" style={{ color:'#5F6368' }}>
          <span className="font-medium" style={{ color:'#202124' }}>Para:</span> {email.to}
        </div>
        <div className="text-[13px] mt-2.5 leading-[1.5]" style={{ color:'#3C4043' }}>{email.body}</div>
      </div>
      <div className="px-4 pb-3">
        {email.fields.map(([k, v], i) =>
          <div key={i} className="grid grid-cols-[120px_1fr] gap-3 py-1.5 border-b last:border-b-0" style={{ borderColor:'#F1F3F4' }}>
            <span className="text-[10.5px] uppercase tracking-[0.10em] font-mono" style={{ color:'#5F6368' }}>{k}</span>
            <span className="text-[12.5px]" style={{ color:'#202124' }}>{v}</span>
          </div>
        )}
      </div>
      <div className="px-4 pb-4">
        <button className="w-full rounded-full px-4 py-2.5 text-[12.5px] font-medium inline-flex items-center justify-center gap-2"
          style={{ background:'#E8F0FE', color:'#1A73E8', border:'1px solid #BBD0FF' }}>
          <span aria-hidden="true">📱</span>
          <span>{email.cta}</span>
        </button>
      </div>
    </div>
  );
}

/* ─── Email pre-card (notice mientras se genera el correo) ─────────────── */
function HV7EmailNotice({ label }) {
  return (
    <div className="rounded-2xl border border-cyan/35 bg-bg/70 backdrop-blur-md p-5 flex items-center gap-4"
      style={{ boxShadow:'0 16px 40px -18px rgba(51,194,234,0.45), 0 0 0 1px rgba(51,194,234,0.12)' }}>
      <div className="size-12 rounded-2xl flex items-center justify-center text-[22px]"
        style={{ background:'linear-gradient(135deg, rgba(51,194,234,0.95), rgba(158,123,255,0.85))', color:'#fff' }}>✉</div>
      <div className="flex-1 min-w-0">
        <div className="text-[10.5px] font-mono uppercase tracking-[0.22em] text-cyan">Correo nuevo</div>
        <div className="text-[14px] mt-1 text-ink/92 leading-[1.35]">{label || 'Generando aviso interno…'}</div>
      </div>
      <span className="flex items-center gap-1">
        <span className="size-1.5 rounded-full bg-cyan" style={{ animation:'hv7-typing 1.4s ease-in-out infinite', animationDelay:'0ms' }} />
        <span className="size-1.5 rounded-full bg-cyan" style={{ animation:'hv7-typing 1.4s ease-in-out infinite', animationDelay:'220ms' }} />
        <span className="size-1.5 rounded-full bg-cyan" style={{ animation:'hv7-typing 1.4s ease-in-out infinite', animationDelay:'440ms' }} />
      </span>
    </div>
  );
}

/* ─── Componente principal ─────────────────────────────────────────────── */
function HeroDemoV7() {
  const reduced = typeof window !== 'undefined' &&
    window.matchMedia &&
    window.matchMedia('(prefers-reduced-motion: reduce)').matches;

  const [t, setT] = useStateV7(reduced ? HERO_V7_DURATION : 0);
  const rafRef = useRefV7(0);
  const startRef = useRefV7(0);
  const wrapRef = useRefV7(null);
  const [paused, setPaused] = useStateV7(false);

  // RAF loop con auto-loop (pausa breve al final y reinicia).
  useEffectV7(() => {
    if (reduced) return;
    let cancelled = false;

    function loop(ts) {
      if (cancelled) return;
      if (!startRef.current) startRef.current = ts;
      const elapsed = ts - startRef.current;
      const LOOP_TAIL = 3500;
      const total = HERO_V7_DURATION + LOOP_TAIL;
      const local = elapsed % total;
      if (!paused) setT(Math.min(local, HERO_V7_DURATION));
      rafRef.current = requestAnimationFrame(loop);
    }

    rafRef.current = requestAnimationFrame(loop);
    return () => {
      cancelled = true;
      cancelAnimationFrame(rafRef.current);
      startRef.current = 0;
    };
  }, [reduced, paused]);

  // Pausar cuando sale del viewport para no comer CPU.
  useEffectV7(() => {
    if (!wrapRef.current || typeof IntersectionObserver === 'undefined') return;
    const io = new IntersectionObserver(
      (entries) => setPaused(!entries[0].isIntersecting),
      { threshold: 0.05 }
    );
    io.observe(wrapRef.current);
    return () => io.disconnect();
  }, []);

  // Derivados a partir de t.
  const visible = useMemoV7(() => HERO_V7_TIMELINE.filter(e => t >= e.at), [t]);
  const visibleCaps = visible.filter(e => e.k === 'capability');
  const activeCap = visibleCaps[visibleCaps.length - 1];
  const slotsValues = {};
  for (const c of visibleCaps) slotsValues[c.slot] = c;

  const emailNoticeEv = HERO_V7_TIMELINE.find(e => e.k === 'email_notice');
  const emailEv      = HERO_V7_TIMELINE.find(e => e.k === 'email');
  const showEmailNotice = emailNoticeEv && t >= emailNoticeEv.at && (!emailEv || t < emailEv.at);
  const showEmail       = emailEv && t >= emailEv.at;

  // Filas de chat (excluyo capabilities — esos son chips bajo cada fila).
  const rows = useMemoV7(() => {
    const byRow = new Map();
    const order = [];
    for (const ev of HERO_V7_TIMELINE) {
      if (!ev.row) continue;
      if (!byRow.has(ev.row)) { byRow.set(ev.row, { rowId: ev.row, events: [] }); order.push(ev.row); }
      byRow.get(ev.row).events.push(ev);
    }
    return order.map(id => byRow.get(id));
  }, []);

  return (
    <div ref={wrapRef} className="w-full max-w-[1280px] mx-auto">
      <style>{`
        @keyframes hv7-typing { 0%,100% { opacity:0.35; transform: translateY(0); } 50% { opacity:1; transform: translateY(-2px); } }
        @keyframes hv7-fade-in { 0% { opacity:0; transform: translateY(6px); } 100% { opacity:1; transform: translateY(0); } }
        .hv7-fade-in { animation: hv7-fade-in 360ms cubic-bezier(0.65,0,0.35,1) both; }
        @media (prefers-reduced-motion: reduce){
          .hv7-fade-in { animation: none !important; }
        }
      `}</style>

      <div className="grid grid-cols-1 lg:grid-cols-[1.05fr_0.95fr] gap-6 md:gap-8 items-start">
        {/* ─── Columna izquierda: WhatsApp chat + email final ─── */}
        <div className="rounded-2xl border border-line overflow-hidden flex flex-col"
          style={{
            background:'linear-gradient(180deg, rgba(244,241,234,0.025), rgba(244,241,234,0.005))',
            backdropFilter:'blur(8px) saturate(110%)',
          }}>
          {/* Mini header tipo contact */}
          <div className="flex items-center gap-3 px-4 py-3 border-b border-line">
            <div className="size-9 rounded-full flex items-center justify-center text-[11px] font-mono bg-gradient-to-br from-cyan/30 to-violet/20">GP</div>
            <div className="flex-1 min-w-0">
              <div className="text-[13.5px] truncate">Galaxia Propiedades</div>
              <div className="text-[10px] font-mono uppercase tracking-[0.15em] text-dim truncate">en línea · demo en vivo</div>
            </div>
            <div className="rounded-full border border-cyan/30 px-2.5 py-1 text-[10px] font-mono uppercase tracking-[0.15em] text-cyan/95">online</div>
          </div>

          {/* Cuerpo del chat o email final */}
          <div className="relative px-2 py-3" style={{ height: 460 }}>
            {showEmail
              ? (
                <div className="absolute inset-0 overflow-auto px-3 py-2 hv7-fade-in">
                  <HV7Email email={HERO_V7_EMAIL} />
                </div>
              )
              : showEmailNotice
              ? (
                <div className="absolute inset-0 flex items-center justify-center px-3 hv7-fade-in">
                  <HV7EmailNotice label={emailNoticeEv && emailNoticeEv.label} />
                </div>
              )
              : (
                <div className="absolute inset-0 overflow-auto px-1 py-2">
                  {rows.map((row) => {
                    const rowEvents = row.events.filter(e => t >= e.at);
                    if (rowEvents.length === 0) return null;
                    const rowCaps = row.events.filter(e => e.k === 'capability' && t >= e.at);
                    return (
                      <React.Fragment key={row.rowId}>
                        {rowEvents.map((ev, i) => {
                          if (ev.k === 'user_msg')  return <HV7Bubble key={i} side="in"  text={ev.text} tm={ev.tm} />;
                          if (ev.k === 'bot_msg')   return <HV7Bubble key={i} side="out" text={ev.text} tm={ev.tm} />;
                          if (ev.k === 'user_audio')return <HV7Audio  key={i} dur={ev.dur} tm={ev.tm} transcript={ev.transcript} />;
                          if (ev.k === 'bot_typing'){
                            const botMsg = row.events.find(e => e.k === 'bot_msg');
                            if (botMsg && t >= botMsg.at) return null;
                            return <HV7Typing key={i} />;
                          }
                          return null;
                        })}
                        {rowCaps.length > 0 &&
                          <div className="flex flex-wrap gap-1.5 px-3 pb-2 hv7-fade-in">
                            {rowCaps.slice(0, 2).map((c, i) => <HV7Chip key={i} c={c} />)}
                          </div>
                        }
                      </React.Fragment>
                    );
                  })}
                </div>
              )}
          </div>
        </div>

        {/* ─── Columna derecha: Centro Operativo ─── */}
        <div className="lg:sticky lg:top-28">
          <HV7OpsPanel
            slotsValues={slotsValues}
            activeSlot={activeCap ? activeCap.slot : null}
            showEmailNotice={showEmailNotice}
            showEmail={showEmail}
          />

          {/* Lo que resolvió / Por qué importa — versión compacta */}
          <div className="mt-4 rounded-2xl border border-line bg-bg/40 p-4 md:p-5 backdrop-blur-md">
            <div className="flex items-center gap-2 mb-2">
              <span aria-hidden="true" className="text-cyan">✓</span>
              <span className="text-[10.5px] font-mono uppercase tracking-[0.20em] text-ink/85">Lo que resolvió</span>
            </div>
            <p className="text-[12.5px] leading-[1.5] text-ink/82">
              Entendió un audio del cliente, consultó el CRM, detectó una propiedad no disponible y dejó la visita lista para coordinar — sin que el equipo tipee.
            </p>
            <div className="flex items-center gap-2 mt-4 mb-2">
              <span aria-hidden="true" className="text-violet">★</span>
              <span className="text-[10.5px] font-mono uppercase tracking-[0.20em] text-ink/85">Por qué importa</span>
            </div>
            <p className="text-[12.5px] leading-[1.5] text-ink/82">
              Tu equipo recibe consultas filtradas, con contexto y próximo paso claro — y solo aparece cuando hace falta una persona.
            </p>
          </div>
        </div>
      </div>

      {/* Header narrativo + CTA arriba del demo (debajo del typewriter del hero) */}
      <div className="mt-7 md:mt-9 flex flex-col md:flex-row md:items-end md:justify-between gap-4">
        <p className="text-[14px] md:text-[15.5px] leading-[1.55] text-ink/72 max-w-[640px]">
          Esto es lo que pasa <span className="text-ink">detrás</span> de un solo audio: el agente entiende, consulta tu CRM, decide, coordina y avisa al equipo — todo en menos de 20&nbsp;segundos.
        </p>
        <a href="#contacto"
          className="btn-cta rounded-full bg-ink text-bg px-6 py-3 text-sm font-medium inline-flex items-center justify-center gap-2 self-start md:self-auto">
          Reservar diagnóstico
          <span aria-hidden="true" className="btn-arrow">→</span>
        </a>
      </div>
    </div>
  );
}

/* Exponer en window (Babel-standalone deja los top-level como globales,
   pero hacemos explícito el contrato para que sections.jsx pueda invocar
   <window.HeroDemoV7 /> sin depender del orden de transpilación). */
Object.assign(window, { HeroDemoV7 });
