// partners.jsx - Página dedicada de Fundadores.
// Acessada via hash route #socios (renderizada condicionalmente no app.jsx).
// Mantém header e footer; substitui o miolo (Hero/Manifesto/etc).
//
// Estrutura por fundador:
//   - Retrato em círculo (placeholder com iniciais até as fotos chegarem)
//   - Nome (Fraunces display)
//   - Função (mono uppercase gold)
//   - Bio em parágrafos (Inter body)
//
// Quando o usuário enviar as fotos:
//   1. Salvar em `assets/partners/israel-souza.jpg` e `rafael-nunes.jpg`
//   2. Remover `useFallback` ou trocar `photo: null` por path real
//   3. As iniciais somem automaticamente
const { useEffect: useEffectP } = React;

const PartnersPage = () => {
  const { lang } = useLang();

  useEffectP(() => {
    // Scroll to top sempre que a página de fundadores montar
    window.scrollTo({ top: 0, behavior: 'instant' in window ? 'instant' : 'auto' });
    // Atualiza o <title> contextualmente
    const prevTitle = document.title;
    document.title = lang === 'pt'
      ? 'Fundadores | Souza Nunes & Cia'
      : 'Founders | Souza Nunes & Cia';
    return () => { document.title = prevTitle; };
  }, [lang]);

  const T = lang === 'pt' ? {
    eyebrow: 'Fundadores',
    pageTitle: (<>A casa é dos fundadores. <em>Cada parecer leva nossa assinatura.</em></>),
    intro: 'Souza Nunes & Cia é uma boutique constituída em torno da biografia e do selo moral de seus fundadores. Não há divisão entre a casa e quem assina. Cada parecer carrega responsabilidade pessoal. Esta é a definição que nos antecede.',
    role: 'Fundador'
  } : {
    eyebrow: 'Founders',
    pageTitle: (<>The firm is its founders. <em>Every opinion bears our signature.</em></>),
    intro: 'Souza Nunes & Cia is a boutique built around the biography and moral seal of its founders. There is no separation between the firm and those who sign. Each opinion carries personal accountability. This is the definition that precedes us.',
    role: 'Founder'
  };

  const partners = [
    {
      name: 'Israel Souza',
      photo: 'assets/partners/israel-souza.jpg',
      initials: 'IS',
      linkedin: 'https://www.linkedin.com/in/prof-israel-v-de-souza-b2870162/',
      bio: lang === 'pt' ? [
        <><strong>Fundador da Souza Nunes & Cia.</strong>, e da <strong>Golden Bridge Business School</strong>, acumula mais de <strong>26 anos de experiência em posições C-Level</strong> em multinacionais e instituições de grande porte. Sua trajetória percorre setores de alta complexidade, como a indústria eletroeletrônica (com passagens por <strong>LG Electronics e Flex</strong>), a construção civil verticalizada e a administração hospitalar de alta performance. Tal vivência consolidou sua convicção de que finanças corporativas, quando estruturadas com excelência, transcendem o reporte para se tornarem o motor de criação de valor.</>,
        <><strong>CFO e Conselheiro Certificado pela Fundação Dom Cabral</strong>, fundamenta seu juízo estratégico em uma tríade de rigor intelectual: a <strong>disciplina administrativa de Fayol</strong>, a <strong>ortodoxia estratégica de Michael Porter</strong> e a <strong>precisão da teoria financeira de Aswath Damodaran</strong>. Essa base teórica, aplicada à prática executiva, permite que seus pareceres técnicos ofereçam uma defesa competitiva sustentável e um critério absoluto na geração de riqueza excedente.</>,
        <>Especialista em <strong>Estratégia Competitiva e Valuation</strong>, dedica-se à modelagem financeira, reestruturação de capital e governança corporativa, sempre com o foco na mitigação de custos patrimoniais onerosos. Paralelamente à atuação consultiva, exerce a docência em programas de pós-graduação e educação executiva, onde desenvolve em gestores a distinção entre a administração operacional e o pensamento estratégico de alto nível.</>,
        <>Sua formação executiva inclui mais de <strong>500 horas na Fundação Dom Cabral</strong>, com extensões internacionais na <strong>Porto Business School</strong> (Portugal) e na <strong>ESCP Business School</strong> (França), conferindo uma visão global às soluções entregues pela Souza Nunes & Cia.</>
      ] : [
        <><strong>Founder of Souza Nunes & Cia.</strong> and <strong>Golden Bridge Business School</strong>, with over <strong>26 years of experience in C-Level positions</strong> at multinationals and large institutions. His career spans high-complexity sectors: the electronics industry (with passages through <strong>LG Electronics and Flex</strong>), vertical construction, and high-performance hospital administration. This experience consolidated his conviction that corporate finance, when structured with excellence, transcends reporting to become the engine of value creation.</>,
        <><strong>CFO and Certified Board Member by Fundação Dom Cabral</strong>, he grounds his strategic judgment in a triad of intellectual rigor: <strong>Fayol's administrative discipline</strong>, <strong>Michael Porter's strategic orthodoxy</strong>, and the <strong>precision of Aswath Damodaran's financial theory</strong>. This theoretical base, applied to executive practice, allows his technical opinions to offer sustainable competitive defense and an absolute criterion for the creation of excess wealth.</>,
        <>Specialist in <strong>Competitive Strategy and Valuation</strong>, he dedicates himself to financial modeling, capital restructuring and corporate governance, always focused on mitigating onerous patrimonial costs. Alongside consultative practice, he teaches in graduate and executive education programs, where he develops in managers the distinction between operational administration and high-level strategic thinking.</>,
        <>His executive training includes over <strong>500 hours at Fundação Dom Cabral</strong>, with international extensions at <strong>Porto Business School</strong> (Portugal) and <strong>ESCP Business School</strong> (France), bringing a global vision to the solutions delivered by Souza Nunes & Cia.</>
      ],
      quote: lang === 'pt' ? {
        text: 'O valor de uma organização não reside no que ela reporta, mas na robustez da estratégia que sustenta sua geração de riqueza e na integridade dos pareceres que orientam seu futuro.',
        attribution: 'Israel Souza'
      } : {
        text: 'The value of an organization does not lie in what it reports, but in the robustness of the strategy that sustains its wealth generation and the integrity of the opinions that guide its future.',
        attribution: 'Israel Souza'
      }
    },
    {
      name: 'Rafael Nunes',
      photo: 'assets/partners/rafael-nunes.jpg',
      initials: 'RN',
      linkedin: 'https://www.linkedin.com/in/rafael-nunes-57263a219/',
      bio: lang === 'pt' ? [
        <><strong>Fundador da Souza Nunes & Cia.</strong>, com sólida formação em <strong>Ciências Contábeis e Gestão Financeira</strong> e uma trajetória consolidada em <strong>Finanças Corporativas, Controladoria e Governança</strong>. Sua atuação é pautada pela busca da eficiência operacional e pela conformidade, servindo como suporte técnico essencial para a tomada de decisões estratégicas de alta liderança.</>,
        <>Com experiência robusta em <strong>planejamento financeiro e análise de investimentos</strong>, dedica-se à estruturação e melhoria contínua de processos, promovendo automação e ganho de produtividade através da inovação tecnológica. Sua visão estratégica em finanças assegura não apenas a sustentabilidade, mas o crescimento estruturado das organizações atendidas pela firma.</>,
        <>À frente da <strong>gestão de riscos e conformidade regulatória</strong>, implementa políticas internas que reforçam a transparência e o alinhamento entre as áreas administrativas e os objetivos de negócio. Através da liderança de equipes multidisciplinares e do uso de metodologias ágeis, promove a transformação de processos internos, elevando o nível de controle e competitividade no mercado.</>,
        <>Para o fundador, a excelência na gestão é o resultado da união entre <strong>rigor técnico e visão de futuro</strong>, princípios que definem o DNA da Souza Nunes & Cia.</>
      ] : [
        <><strong>Founder of Souza Nunes & Cia.</strong>, with a strong background in <strong>Accounting and Financial Management</strong> and a consolidated track record in <strong>Corporate Finance, Controllership and Governance</strong>. His work is guided by the pursuit of operational efficiency and compliance, serving as essential technical support for senior leadership's strategic decisions.</>,
        <>With robust experience in <strong>financial planning and investment analysis</strong>, he is dedicated to structuring and continuously improving processes, promoting automation and productivity gains through technological innovation. His strategic vision in finance ensures not only the sustainability, but the structured growth of the firm's clients.</>,
        <>Leading <strong>risk management and regulatory compliance</strong>, he implements internal policies that reinforce transparency and the alignment between administrative areas and business objectives. Through leadership of multidisciplinary teams and the use of agile methodologies, he drives the transformation of internal processes, elevating control and market competitiveness.</>,
        <>For the founder, excellence in management is the result of uniting <strong>technical rigor and forward vision</strong>, principles that define the DNA of Souza Nunes & Cia.</>
      ],
      quote: lang === 'pt' ? {
        text: 'A tecnologia e a inovação são os motores da transformação, mas é a estratégia financeira sólida e a governança que constroem o alicerce para um crescimento extraordinário e verdadeiramente sustentável.',
        attribution: 'Rafael Nunes'
      } : {
        text: 'Technology and innovation are the engines of transformation, but it is solid financial strategy and governance that build the foundation for extraordinary and truly sustainable growth.',
        attribution: 'Rafael Nunes'
      }
    }
  ];

  const goBack = (e) => {
    e.preventDefault();
    window.location.hash = '';
  };

  return (
    <section className="partners-page" id="socios-page">
      {/* Breadcrumb / back link */}
      <a href="#" className="partners-back" onClick={goBack}>
        <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
          <path d="M11 12 L5 8 L11 4"/>
        </svg>
        <span>{lang === 'pt' ? 'Voltar ao início' : 'Back to home'}</span>
      </a>

      {/* Intro */}
      <div className="partners-intro">
        <Reveal><div className="eyebrow">{T.eyebrow}</div></Reveal>
        <Reveal delay={1}><h1 className="partners-page-title">{T.pageTitle}</h1></Reveal>
        <Reveal delay={2}><p className="partners-page-intro">{T.intro}</p></Reveal>
      </div>

      {/* Partner list */}
      <div className="partners-list">
        {partners.map((p, i) => (
          <Reveal key={i} delay={Math.min(i+1, 4)} as="article" className="partner">
            <div className="partner-portrait">
              <img
                src={p.photo}
                alt={p.name}
                onError={(e) => {
                  // Falls back to initials placeholder if photo missing
                  e.target.style.display = 'none';
                  e.target.parentNode.classList.add('no-photo');
                }}
              />
              <span className="partner-initials" aria-hidden="true">{p.initials}</span>
            </div>
            <div className="partner-content">
              <h2 className="partner-name">{p.name}</h2>
              <p className="partner-role">{T.role}</p>
              {p.linkedin && (
                <a
                  className="partner-linkedin"
                  href={p.linkedin}
                  target="_blank"
                  rel="noopener noreferrer"
                  aria-label={`LinkedIn de ${p.name}`}
                >
                  <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                    <path d="M20.45 20.45h-3.55v-5.57c0-1.33-.03-3.04-1.85-3.04-1.86 0-2.14 1.45-2.14 2.94v5.67H9.36V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28zM5.34 7.43a2.06 2.06 0 1 1 0-4.12 2.06 2.06 0 0 1 0 4.12zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.72v20.56C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.72V1.72C24 .77 23.2 0 22.22 0z"/>
                  </svg>
                  <span>LinkedIn</span>
                </a>
              )}
              <div className="partner-bio">
                {p.bio.map((para, j) => <p key={j}>{para}</p>)}
              </div>
              {p.quote && (
                <blockquote className="partner-quote">
                  <p>{p.quote.text}</p>
                  <cite>({p.quote.attribution})</cite>
                </blockquote>
              )}
            </div>
          </Reveal>
        ))}
      </div>

      {/* Footer call-to-action */}
      <div className="partners-cta">
        <p className="partners-cta-text">
          {lang === 'pt'
            ? 'Para conversar diretamente com um dos fundadores:'
            : 'To speak directly with one of the founders:'}
        </p>
        <a href="#contact" className="cta-btn" onClick={(e) => {
          e.preventDefault();
          window.location.hash = '';
          setTimeout(() => {
            const el = document.getElementById('contact');
            if (el) el.scrollIntoView({ behavior: 'smooth' });
          }, 100);
        }}>
          {lang === 'pt' ? 'Agendar diagnóstico' : 'Book a diagnostic'}
          <ArrowIcon/>
        </a>
      </div>
    </section>
  );
};

window.PartnersPage = PartnersPage;
