// Section 3 (Pain) + Section 4 (3 Pillars)

// Helper : récupère le vocab (agent/agentPlural) selon le pays via window.useCountry,
// avec fallback CO si Provider absent.
const cbVocab = () => {
  if (typeof useCountry === 'function') {
    const c = useCountry();
    if (c && c.vocab) return c.vocab;
  }
  return (window.CO_LOCALE && window.CO_LOCALE.vocab) || { agent: 'agente', agentPlural: 'agentes' };
};

const getPainItems = (vocab) => [
  {
    n: '01',
    t: 'Tu sitio web no atrae ni convierte.',
    d: 'Pocas personas visitan tu sitio, y las que llegan no dejan sus datos. Tal vez ya hayas invertido en publicidad para atraer tráfico, pero los resultados no justifican el gasto.',
    tag: 'Web',
    icon: 'globe',
  },
  {
    n: '02',
    t: 'Tardas horas en contactar a un nuevo lead.',
    d: `Entre que llega el formulario, alguien lo ve, lo asigna a un ${vocab.agent} y el ${vocab.agent} lo contacta… pasan 30 minutos, 3 horas, a veces un día entero. El lead ya se enfrió, o ya está hablando con otra agencia.`,
    tag: 'Velocidad',
    icon: 'clock',
  },
  {
    n: '03',
    t: 'Los leads llegan mal calificados.',
    d: 'Pierdes horas con curiosos que nunca van a comprar. Y cuando contactas a uno bueno, ya no contesta.',
    tag: 'Calidad',
    icon: 'target',
  },
  {
    n: '04',
    t: 'WhatsApp es tu CRM real.',
    d: 'Toda la info de tus prospectos está en conversaciones imposibles de buscar. Cuando necesitas el historial de un cliente, tienes que scrollear durante 10 minutos en un chat infinito.',
    tag: 'Datos',
    icon: 'chat',
  },
  {
    n: '05',
    t: 'Repartes los leads "a ojo".',
    d: `Sin reglas claras. Algunos ${vocab.agentPlural} se saturan, otros se quedan sin nada. Y se pierden oportunidades en el camino.`,
    tag: 'Equipo',
    icon: 'users',
  },
  {
    n: '06',
    t: 'No sabes qué hace tu equipo.',
    d: '¿Quién llamó a quién? ¿Quién hizo seguimiento? ¿Quién está cerrando? Sin visibilidad real, no puedes liderar.',
    tag: 'Visibilidad',
    icon: 'chart',
  },
];

// ──────────────────────────────────────────────────────────────
// Variante A — Grilla 2×3 compacta
// ──────────────────────────────────────────────────────────────
const PainEditorial = () => {
  const vocab = cbVocab();
  const PAIN_ITEMS = getPainItems(vocab);
  return (
    <section style={{ background: 'var(--bg-soft)' }}>
      <div className="container">
        {/* Headline */}
        <div className="reveal" style={{ textAlign: 'center', marginBottom: 56 }}>
          <h2 style={{
            fontSize: 'clamp(32px, 4vw, 48px)',
            fontWeight: 500,
            letterSpacing: '-0.02em',
            lineHeight: 1.05,
          }}>
            <span className="serif" style={{ fontStyle: 'italic', fontWeight: 400 }}>¿Te suena</span>{' '}
            familiar?
          </h2>
        </div>

        {/* Grilla 2×3 */}
        <div className="pain-grid" style={{
          display: 'grid',
          gridTemplateColumns: 'repeat(2, 1fr)',
          gap: 1,
          background: 'var(--border)',
          border: '1px solid var(--border)',
          borderRadius: 16,
          overflow: 'hidden',
        }}>
          {PAIN_ITEMS.map((p, i) => (
            <div
              key={p.n}
              className="reveal pain-cell"
              style={{
                background: '#fff',
                padding: '32px 32px',
                transitionDelay: `${i * 0.04}s`,
              }}
            >
              <div className="mono" style={{
                fontSize: 11,
                color: 'var(--fg-faint)',
                letterSpacing: '0.08em',
                marginBottom: 14,
              }}>
                {p.n}
              </div>
              <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 10 }}>
                <div style={{
                  width: 32, height: 32, borderRadius: 8,
                  background: 'var(--bg-soft)',
                  border: '1px solid var(--border-soft)',
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                  flexShrink: 0,
                }}>
                  <Icon name={p.icon} size={16} color="var(--fg)" strokeWidth={1.7} />
                </div>
                <div style={{
                  fontSize: 18,
                  fontWeight: 600,
                  letterSpacing: '-0.01em',
                  lineHeight: 1.3,
                  color: 'var(--fg)',
                  textWrap: 'balance',
                }}>
                  {p.t}
                </div>
              </div>
              <div style={{
                fontSize: 14,
                color: 'var(--fg-muted)',
                lineHeight: 1.55,
                textWrap: 'pretty',
              }}>
                {p.d}
              </div>
            </div>
          ))}
        </div>

        {/* Closing — la velocidad mata o vende */}
        <div className="reveal" style={{ marginTop: 56, display: 'flex', justifyContent: 'center' }}>
          <div style={{
            maxWidth: 820,
            padding: '32px 40px',
            background: '#fff',
            border: '1px solid var(--border)',
            borderRadius: 16,
            position: 'relative',
            boxShadow: 'var(--shadow-sm)',
          }}>
            {/* Accent bar */}
            <div style={{
              position: 'absolute',
              top: 0, left: 0, bottom: 0,
              width: 3,
              background: 'var(--grad)',
              borderRadius: '16px 0 0 16px',
            }} />
            <div style={{
              fontSize: 16,
              lineHeight: 1.65,
              color: 'var(--fg-soft)',
              textWrap: 'pretty',
            }}>
              <span style={{ color: 'var(--fg)', fontWeight: 500 }}>¿Crees que los leads de Meta o Google Ads son "leads basura"?</span>{' '}
              Lo escuchamos todos los días. Pero un lead contactado en los primeros{' '}
              <span style={{ color: 'var(--fg)', fontWeight: 600 }}>5 minutos</span>{' '}
              tiene hasta{' '}
              <span className="grad-text" style={{ fontWeight: 600 }}>100x más probabilidades</span>{' '}
              de convertir que uno contactado a los 30. Si tardas horas, hasta el mejor lead se enfría.{' '}
              <span className="serif" style={{ fontStyle: 'italic', color: 'var(--fg)', fontSize: 17 }}>
                La velocidad mata o vende — no la fuente.
              </span>
            </div>
          </div>
        </div>
      </div>

      <style>{`
        .pain-cell { transition: background 0.2s ease; }
        .pain-cell:hover { background: var(--bg-soft); }
        @media (max-width: 720px) {
          .pain-grid { grid-template-columns: 1fr !important; }
        }
      `}</style>
    </section>
  );
};

// ──────────────────────────────────────────────────────────────
// Variante B — Conversación (zigzag, citas)
// ──────────────────────────────────────────────────────────────
const getPainVoices = (vocab) => ({
  '01': '"Pago anuncios y me llegan dos formularios al mes."',
  '02': '"Para cuando le llamo, ya está con otra agencia."',
  '03': '"Los buenos leads ya no contestan."',
  '04': '"Tengo que scrollear 10 minutos para encontrar algo."',
  '05': `"Le caen todos los leads al mismo ${vocab.agent}."`,
  '06': '"No sé quién está cerrando ni quién no llama."',
});

const PainConversation = () => {
  const vocab = cbVocab();
  const PAIN_ITEMS = getPainItems(vocab);
  const PAIN_VOICES = getPainVoices(vocab);
  return (
    <section style={{ background: 'var(--bg-soft)', overflow: 'hidden' }}>
      <div className="container">
        <div className="reveal" style={{ textAlign: 'center', marginBottom: 64 }}>
          <h2 style={{ fontSize: 'clamp(32px, 4vw, 48px)', fontWeight: 500, letterSpacing: '-0.02em', lineHeight: 1.05 }}>
            <span className="serif" style={{ fontStyle: 'italic', fontWeight: 400 }}>¿Te suena</span> familiar?
          </h2>
        </div>

        <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
          {PAIN_ITEMS.map((p, i) => {
            const flip = i % 2 === 1;
            return (
              <div
                key={p.n}
                className="reveal"
                style={{
                  display: 'grid',
                  gridTemplateColumns: '1fr 1fr',
                  alignItems: 'center',
                  gap: 48,
                  padding: '32px 0',
                  borderBottom: i === PAIN_ITEMS.length - 1 ? 'none' : '1px solid var(--border-soft)',
                  transitionDelay: `${i * 0.05}s`,
                }}
              >
                <div style={{ order: flip ? 2 : 1 }}>
                  <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 14 }}>
                    <div className="mono" style={{ fontSize: 13, color: 'var(--fg-faint)' }}>{p.n}</div>
                    <div style={{ flex: 1, height: 1, background: 'var(--border)' }} />
                    <div className="mono" style={{ fontSize: 11, color: 'var(--fg-muted)', textTransform: 'uppercase', letterSpacing: '0.1em' }}>
                      {p.tag}
                    </div>
                  </div>
                  <div style={{ fontSize: 22, fontWeight: 600, letterSpacing: '-0.02em', lineHeight: 1.2, marginBottom: 10, textWrap: 'balance' }}>
                    {p.t}
                  </div>
                  <div style={{ fontSize: 14, color: 'var(--fg-soft)', lineHeight: 1.6, textWrap: 'pretty' }}>
                    {p.d}
                  </div>
                </div>

                <div style={{ order: flip ? 1 : 2, display: 'flex', justifyContent: flip ? 'flex-start' : 'flex-end' }}>
                  <div style={{
                    maxWidth: 360,
                    padding: '18px 22px',
                    background: '#fff',
                    border: '1px solid var(--border)',
                    borderRadius: '18px 18px 18px 4px',
                    boxShadow: 'var(--shadow-sm)',
                  }}>
                    <div className="serif" style={{ fontStyle: 'italic', fontSize: 17, lineHeight: 1.45, color: 'var(--fg)', textWrap: 'pretty' }}>
                      {PAIN_VOICES[p.n]}
                    </div>
                    <div className="mono" style={{ fontSize: 10, color: 'var(--fg-faint)', textTransform: 'uppercase', letterSpacing: '0.12em', marginTop: 10 }}>
                      — Agente · Real
                    </div>
                  </div>
                </div>
              </div>
            );
          })}
        </div>

        <div className="reveal" style={{ marginTop: 64, display: 'flex', justifyContent: 'center' }}>
          <div style={{
            maxWidth: 820, padding: '28px 36px', background: '#fff',
            border: '1px solid var(--border)', borderRadius: 16, position: 'relative',
            boxShadow: 'var(--shadow-sm)',
          }}>
            <div style={{ position: 'absolute', top: 0, left: 0, bottom: 0, width: 3, background: 'var(--grad)', borderRadius: '16px 0 0 16px' }} />
            <div style={{ fontSize: 16, lineHeight: 1.65, color: 'var(--fg-soft)', textWrap: 'pretty' }}>
              <span style={{ color: 'var(--fg)', fontWeight: 500 }}>¿Crees que los leads de Meta o Google Ads son "leads basura"?</span>{' '}
              Lo escuchamos todos los días. Pero un lead contactado en los primeros{' '}
              <span style={{ color: 'var(--fg)', fontWeight: 600 }}>5 minutos</span>{' '}
              tiene hasta{' '}
              <span className="grad-text" style={{ fontWeight: 600 }}>100x más probabilidades</span>{' '}
              de convertir que uno contactado a los 30.{' '}
              <span className="serif" style={{ fontStyle: 'italic', color: 'var(--fg)', fontSize: 17 }}>
                La velocidad mata o vende — no la fuente.
              </span>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
};

// ──────────────────────────────────────────────────────────────
// Variante C — Timeline scroll-driven (alternada izq/der)
// ──────────────────────────────────────────────────────────────
const PainTimeline = () => {
  const vocab = cbVocab();
  const PAIN_ITEMS = getPainItems(vocab);
  const sectionRef = React.useRef(null);
  const trackRef = React.useRef(null);
  const [progress, setProgress] = React.useState(0);
  const [reduced, setReduced] = React.useState(false);

  // Respect prefers-reduced-motion
  React.useEffect(() => {
    const mq = window.matchMedia('(prefers-reduced-motion: reduce)');
    const update = () => setReduced(mq.matches);
    update();
    mq.addEventListener?.('change', update);
    return () => mq.removeEventListener?.('change', update);
  }, []);

  // Track scroll progress along the timeline track (0→1)
  React.useEffect(() => {
    if (reduced) { setProgress(1); return; }
    let raf = 0;
    const compute = () => {
      raf = 0;
      const el = trackRef.current;
      if (!el) return;
      const rect = el.getBoundingClientRect();
      const vh = window.innerHeight;
      // Start filling when track top hits 65% of viewport
      // Finish when track bottom hits 40% of viewport
      const start = vh * 0.65;
      const end = vh * 0.4;
      const total = (rect.height) + (start - end);
      const passed = start - rect.top;
      const p = Math.max(0, Math.min(1, passed / total));
      setProgress(p);
    };
    const onScroll = () => { if (!raf) raf = requestAnimationFrame(compute); };
    compute();
    window.addEventListener('scroll', onScroll, { passive: true });
    window.addEventListener('resize', onScroll);
    return () => {
      window.removeEventListener('scroll', onScroll);
      window.removeEventListener('resize', onScroll);
      if (raf) cancelAnimationFrame(raf);
    };
  }, [reduced]);

  return (
    <section ref={sectionRef} style={{ background: 'var(--bg-soft)', overflow: 'hidden' }}>
      <div className="container">
        {/* Headline */}
        <div className="reveal" style={{ textAlign: 'center', marginBottom: 72 }}>
          <h2 style={{
            fontSize: 'clamp(32px, 4vw, 48px)',
            fontWeight: 500,
            letterSpacing: '-0.02em',
            lineHeight: 1.05,
          }}>
            <span className="serif" style={{ fontStyle: 'italic', fontWeight: 400 }}>¿Te suena</span>{' '}
            familiar?
          </h2>
        </div>

        {/* Timeline track */}
        <div ref={trackRef} className="pain-timeline" style={{ position: 'relative', maxWidth: 1080, margin: '0 auto' }}>
          {/* Vertical line — background (gray) */}
          <div className="pain-tl-line" aria-hidden="true" style={{
            position: 'absolute',
            top: 0, bottom: 0,
            left: '50%',
            width: 2,
            transform: 'translateX(-50%)',
            background: 'var(--border)',
            borderRadius: 2,
          }} />
          {/* Vertical line — gradient fill (animated by scroll) */}
          <div className="pain-tl-fill" aria-hidden="true" style={{
            position: 'absolute',
            top: 0,
            left: '50%',
            width: 2,
            height: `${progress * 100}%`,
            transform: 'translateX(-50%)',
            background: 'linear-gradient(180deg, #54B5E3, #C69CFF)',
            borderRadius: 2,
            transition: reduced ? 'none' : 'height 0.15s linear',
          }} />

          {/* Items */}
          {PAIN_ITEMS.map((p, i) => {
            const right = i % 2 === 0; // 01,03,05 → right
            return (
              <PainTimelineRow
                key={p.n}
                item={p}
                right={right}
                index={i}
                reduced={reduced}
              />
            );
          })}
        </div>

        {/* Closing — la velocidad mata o vende */}
        <div className="reveal" style={{ marginTop: 72, display: 'flex', justifyContent: 'center' }}>
          <div style={{
            maxWidth: 820,
            padding: '32px 40px',
            background: '#fff',
            border: '1px solid var(--border)',
            borderRadius: 16,
            position: 'relative',
            boxShadow: 'var(--shadow-sm)',
          }}>
            <div style={{
              position: 'absolute',
              top: 0, left: 0, bottom: 0,
              width: 3,
              background: 'var(--grad)',
              borderRadius: '16px 0 0 16px',
            }} />
            <div style={{
              fontSize: 16,
              lineHeight: 1.65,
              color: 'var(--fg-soft)',
              textWrap: 'pretty',
            }}>
              <span style={{ color: 'var(--fg)', fontWeight: 500 }}>¿Crees que los leads de Meta o Google Ads son "leads basura"?</span>{' '}
              Lo escuchamos todos los días. Pero un lead contactado en los primeros{' '}
              <span style={{ color: 'var(--fg)', fontWeight: 600 }}>5 minutos</span>{' '}
              tiene hasta{' '}
              <span className="grad-text" style={{ fontWeight: 600 }}>100x más probabilidades</span>{' '}
              de convertir que uno contactado a los 30. Si tardas horas, hasta el mejor lead se enfría.{' '}
              <span className="serif" style={{ fontStyle: 'italic', color: 'var(--fg)', fontSize: 17 }}>
                La velocidad mata o vende — no la fuente.
              </span>
            </div>
          </div>
        </div>
      </div>

      <style>{`
        .pain-tl-row {
          position: relative;
          display: grid;
          grid-template-columns: 1fr 60px 1fr;
          align-items: center;
          padding: 8px 0;
        }
        .pain-tl-bullet {
          grid-column: 2;
          width: 56px;
          height: 56px;
          border-radius: 50%;
          background: #fff;
          border: 2px solid transparent;
          background-image: linear-gradient(#fff, #fff), linear-gradient(135deg, #54B5E3, #C69CFF);
          background-origin: border-box;
          background-clip: padding-box, border-box;
          display: flex;
          align-items: center;
          justify-content: center;
          box-shadow: 0 2px 12px -4px rgba(84, 181, 227, 0.3), 0 1px 2px rgba(15, 23, 42, 0.04);
          margin: 0 auto;
          z-index: 2;
          opacity: 0;
          transform: scale(0.8);
          transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        }
        .pain-tl-row.in .pain-tl-bullet {
          opacity: 1;
          transform: scale(1);
        }
        .pain-tl-card {
          background: #fff;
          border: 1px solid var(--border);
          border-radius: 16px;
          padding: 24px 28px;
          box-shadow: var(--shadow-sm);
          max-width: 440px;
          opacity: 0;
          transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
          position: relative;
        }
        .pain-tl-card.right { grid-column: 3; transform: translateX(40px); justify-self: start; margin-right: auto; }
        .pain-tl-card.left  { grid-column: 1; transform: translateX(-40px); justify-self: end; margin-left: auto; }
        .pain-tl-row.in .pain-tl-card { opacity: 1; transform: translateX(0); }

        /* Connector — small horizontal line between bullet and card */
        .pain-tl-card::before {
          content: '';
          position: absolute;
          top: 50%;
          width: 32px;
          height: 1px;
          background: linear-gradient(90deg, rgba(198, 156, 255, 0.5), rgba(84, 181, 227, 0.3));
          transform: translateY(-50%);
        }
        .pain-tl-card.right::before { left: -32px; }
        .pain-tl-card.left::before  { right: -32px; background: linear-gradient(270deg, rgba(198, 156, 255, 0.5), rgba(84, 181, 227, 0.3)); }

        @media (max-width: 860px) {
          .pain-timeline .pain-tl-line,
          .pain-timeline .pain-tl-fill {
            left: 28px !important;
          }
          .pain-tl-row {
            grid-template-columns: 56px 1fr !important;
            gap: 0 !important;
            padding: 8px 0 !important;
          }
          .pain-tl-bullet {
            grid-column: 1 !important;
            margin: 0 !important;
            justify-self: center;
          }
          .pain-tl-card.right,
          .pain-tl-card.left {
            grid-column: 2 !important;
            justify-self: stretch !important;
            margin: 0 0 0 24px !important;
            max-width: none !important;
            transform: translateX(40px);
          }
          .pain-tl-card.left::before {
            right: auto !important;
            left: -24px !important;
            background: linear-gradient(90deg, rgba(198, 156, 255, 0.5), rgba(84, 181, 227, 0.3)) !important;
          }
          .pain-tl-card.right::before {
            left: -24px !important;
            width: 24px !important;
          }
          .pain-tl-card.left::before {
            width: 24px !important;
          }
        }

        @media (prefers-reduced-motion: reduce) {
          .pain-tl-bullet,
          .pain-tl-card,
          .pain-tl-card.right,
          .pain-tl-card.left {
            opacity: 1 !important;
            transform: none !important;
            transition: none !important;
          }
        }
      `}</style>
    </section>
  );
};

const PainTimelineRow = ({ item, right, index, reduced }) => {
  const ref = React.useRef(null);
  const [inView, setInView] = React.useState(false);

  React.useEffect(() => {
    if (reduced) { setInView(true); return; }
    const el = ref.current;
    if (!el) return;
    const obs = new IntersectionObserver(
      (entries) => entries.forEach(e => { if (e.isIntersecting) { setInView(true); obs.disconnect(); } }),
      { threshold: 0.25, rootMargin: '0px 0px -10% 0px' }
    );
    obs.observe(el);
    return () => obs.disconnect();
  }, [reduced]);

  return (
    <div
      ref={ref}
      className={`pain-tl-row ${inView ? 'in' : ''}`}
      style={{ transitionDelay: `${index * 0.04}s` }}
    >
      <div className="pain-tl-bullet">
        <Icon name={item.icon} size={22} color="#54B5E3" strokeWidth={1.7} />
      </div>
      <div className={`pain-tl-card ${right ? 'right' : 'left'}`}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 12 }}>
          <div className="mono" style={{ fontSize: 11, color: 'var(--fg-faint)', letterSpacing: '0.08em' }}>
            {item.n}
          </div>
          <div style={{ flex: 1, height: 1, background: 'var(--border-soft)' }} />
          <div className="mono" style={{ fontSize: 10, color: 'var(--fg-muted)', textTransform: 'uppercase', letterSpacing: '0.12em' }}>
            {item.tag}
          </div>
        </div>
        <div style={{
          fontSize: 19,
          fontWeight: 600,
          letterSpacing: '-0.01em',
          lineHeight: 1.3,
          color: 'var(--fg)',
          textWrap: 'balance',
          marginBottom: 10,
        }}>
          {item.t}
        </div>
        <div style={{
          fontSize: 14,
          color: 'var(--fg-muted)',
          lineHeight: 1.6,
          textWrap: 'pretty',
        }}>
          {item.d}
        </div>
      </div>
    </div>
  );
};

// ──────────────────────────────────────────────────────────────
// Switcher
// ──────────────────────────────────────────────────────────────
const PainSection = ({ variant = 'editorial' }) => {
  if (variant === 'conversation') return <PainConversation />;
  if (variant === 'timeline') return <PainTimeline />;
  return <PainEditorial />;
};

const PillarsSection = () => {
  const vocab = cbVocab();
  const pillars = [
    {
      n: '01',
      label: 'Capta',
      title: 'Más leads, mejor calificados, contactados al instante.',
      d: 'Un sitio web que sí atrae tráfico y convierte. Lead scoring automático para identificar quién está listo para comprar. Y cada nuevo lead recibe un primer mensaje automático por WhatsApp desde tu agencia, en segundos.',
    },
    {
      n: '02',
      label: 'Gestiona',
      title: 'El control que WhatsApp y otros CRMs nunca te dieron.',
      d: `Todo el historial de cada cliente en un solo lugar, fácil de buscar. Pipelines visuales por tipo de prospecto. Reglas claras de distribución de leads entre tus ${vocab.agentPlural}. Y reportes en tiempo real de qué hace cada miembro de tu equipo.`,
    },
    {
      n: '03',
      label: 'Cierra',
      title: 'Menos fricción, más comisiones.',
      d: 'Automatizaciones que hacen el seguimiento por ti — sin perder el toque humano. IA que redacta descripciones y artículos en segundos. Bolsa inmobiliaria con co-brokerage para multiplicar tu inventario sin captar una propiedad más.',
    },
  ];
  return (
    <section>
      <div className="container">
        <div style={{ textAlign: 'center', maxWidth: 760, margin: '0 auto 64px' }} className="reveal">
          <div className="eyebrow" style={{ marginBottom: 20 }}><span className="eyebrow-dot" />La solución</div>
          <h2 className="h2" style={{ marginBottom: 16, textWrap: 'balance' }}>
            Una sola plataforma. <span className="grad-text">Todo lo que tu agencia necesita.</span>
          </h2>
          <p style={{ fontSize: 17, color: 'var(--fg-soft)', textWrap: 'pretty' }}>
            CloserBroker no es otro CRM con funcionalidades pegadas. Es una herramienta diseñada desde cero para el trabajo real de una agencia inmobiliaria.
          </p>
        </div>

        <div className="pillars-grid" style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 20 }}>
          {pillars.map((p, i) => (
            <div key={i} className="reveal pillar-card" style={{
              padding: '36px 32px',
              borderRadius: 20,
              background: '#fff',
              border: '1px solid var(--border)',
              position: 'relative',
              overflow: 'hidden',
              transitionDelay: `${i * 0.08}s`,
              display: 'flex',
              flexDirection: 'column',
            }}>
              {/* Top gradient accent line */}
              <div style={{ position: 'absolute', top: 0, left: 0, right: 0, height: 3, background: 'var(--grad)', opacity: 0.25 + i * 0.25 }} />

              {/* Big number */}
              <div className="pillar-number" style={{
                fontSize: 'clamp(40px, 5vw, 64px)',
                fontWeight: 700,
                lineHeight: 1,
                letterSpacing: '-0.04em',
                background: 'var(--grad)',
                WebkitBackgroundClip: 'text',
                backgroundClip: 'text',
                color: 'transparent',
                opacity: 0.55,
                marginBottom: 8,
                fontVariantNumeric: 'tabular-nums',
              }}>
                {p.n}
              </div>

              {/* Label */}
              <div className="mono" style={{
                fontSize: 12,
                color: 'var(--fg-muted)',
                textTransform: 'uppercase',
                letterSpacing: '0.12em',
                marginBottom: 20,
              }}>
                {p.label}
              </div>

              {/* Title */}
              <div style={{
                fontSize: 22,
                fontWeight: 600,
                letterSpacing: '-0.02em',
                lineHeight: 1.25,
                marginBottom: 14,
                color: 'var(--fg)',
                textWrap: 'balance',
              }}>
                {p.title}
              </div>

              {/* Description */}
              <p style={{
                fontSize: 15,
                color: 'var(--fg-soft)',
                lineHeight: 1.6,
                textWrap: 'pretty',
              }}>
                {p.d}
              </p>
            </div>
          ))}
        </div>
      </div>

      <style>{`
        .pillar-card { transition: transform 0.8s ease, opacity 0.8s ease, box-shadow 0.25s ease; }
        .pillar-card.in:hover {
          transform: translateY(-4px);
          box-shadow: 0 20px 40px -16px rgba(0,0,0,0.12);
        }
        @media (max-width: 960px) {
          .pillars-grid { grid-template-columns: 1fr 1fr !important; }
        }
        @media (max-width: 640px) {
          .pillars-grid { grid-template-columns: 1fr !important; }
          .pillar-number { font-size: 40px !important; }
        }
      `}</style>
    </section>
  );
};

window.PainSection = PainSection;
window.PillarsSection = PillarsSection;
