/* global React */

function WhyUs() {
  const reasons = [
    {
      title: 'Verified suppliers, transparent deals',
      body: 'Every factory in our network passes a 47-point audit covering capacity, certifications, financials, and labor practices.',
    },
    {
      title: 'Full logistics and customs support',
      body: 'One contract for ocean, air, and land. We handle paperwork, duties, and last-mile delivery to your warehouse door.',
    },
    {
      title: 'Equipment and vehicles direct from factories',
      body: 'No intermediaries. We negotiate with manufacturers, inspect before shipping, and provide installation guidance.',
    },
    {
      title: 'Expert consulting at every step',
      body: 'Market analysis, supplier vetting, contract review, and cost optimization — guidance from people who live in this market.',
    },
  ];

  return (
    <section id="why-us" style={{ background: 'var(--paper)', padding: '140px 0 120px' }}>
      <div className="container">
        <div className="reveal" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 80, marginBottom: 72, alignItems: 'flex-end' }}>          <div>
            <div className="eyebrow" style={{ marginBottom: 18 }}>Why Choose Us</div>
            <h2 className="display" style={{ fontSize: 'clamp(40px, 5vw, 64px)' }}>
              The difference is in <em style={{ fontStyle: 'italic', color: 'var(--vermillion)' }}>the details</em> we don't skip.
            </h2>
          </div>
          <div style={{ fontSize: 16, color: 'var(--ash)', lineHeight: 1.7, maxWidth: 460 }}>
            Eleven years on the ground in Guangzhou, Shenzhen, and Shanghai. We answer to one stakeholder — you — and our incentives align around getting your shipment to your warehouse without surprises.
          </div>
        </div>

        <div style={{
          display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 0,
          border: '1px solid var(--line-strong)',
        }} className="why-grid">
          {reasons.map((r, i) => (
            <div key={i} className={`reveal reveal-delay-${i + 1}`} style={{
              padding: '48px 40px',
              borderRight: i % 2 === 0 ? '1px solid var(--line)' : 'none',
              borderBottom: i < 2 ? '1px solid var(--line)' : 'none',
              background: 'var(--paper)',
              transition: 'background 320ms ease',
              cursor: 'default',
              position: 'relative',
              minHeight: 220,
            }}
              onMouseEnter={e => e.currentTarget.style.background = 'var(--paper-warm)'}
              onMouseLeave={e => e.currentTarget.style.background = 'var(--paper)'}>
              <div style={{ display: 'flex', gap: 24, alignItems: 'flex-start' }}>
                <div className="mono" style={{
                  width: 56, height: 56, flexShrink: 0,
                  border: '1px solid var(--gold)',
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                  color: 'var(--vermillion)', fontSize: 16,
                  letterSpacing: '0.08em',
                  position: 'relative',
                }}>
                  0{i + 1}
                </div>
                <div style={{ flex: 1 }}>
                  <div className="mono" style={{ fontSize: 11, color: 'var(--vermillion)', letterSpacing: '0.22em', marginBottom: 14, textTransform: 'uppercase' }}>
                    Reason {i + 1}
                  </div>
                  <h3 className="display" style={{ fontSize: 'clamp(22px, 2vw, 28px)', marginBottom: 14, fontWeight: 500 }}>
                    {r.title}
                  </h3>
                  <p style={{ fontSize: 15, color: 'var(--ash)', lineHeight: 1.6 }}>
                    {r.body}
                  </p>
                </div>
              </div>
            </div>
          ))}
        </div>
      </div>
      <style>{`
        @media (max-width: 800px) {
          .why-grid { grid-template-columns: 1fr !important; }
          .why-grid > div { border-right: none !important; border-bottom: 1px solid var(--line) !important; }
          .why-grid > div:last-child { border-bottom: none !important; }
        }
      `}</style>
    </section>
  );
}

function FinalCTA() {
  return (
    <section id="contact" style={{
      position: 'relative',
      background: 'var(--ink)',
      color: 'var(--paper)',
      padding: '160px 0 140px',
      overflow: 'hidden',
    }}>
      {/* Decorative bg */}
      <div style={{
        position: 'absolute', inset: 0,
        backgroundImage: 'url(https://images.unsplash.com/photo-1511795409834-ef04bbd61622?w=2000&q=80)',
        backgroundSize: 'cover', backgroundPosition: 'center',
        opacity: 0.18,
      }} />
      <div style={{
        position: 'absolute', inset: 0,
        background: 'linear-gradient(180deg, var(--ink) 0%, rgba(10,22,40,0.7) 50%, var(--ink) 100%)',
      }} />
      {/* Big CN */}
      <div className="display" style={{
        position: 'absolute', left: '-2%', top: '14%',
        fontSize: 'clamp(180px, 24vw, 360px)',
        color: 'var(--gold)', opacity: 0.05, fontWeight: 300,
        fontStyle: 'italic',
        userSelect: 'none', pointerEvents: 'none', lineHeight: 0.8,
        letterSpacing: '-0.05em',
      }}>begin.</div>

      <div className="container reveal" style={{ position: 'relative', textAlign: 'center', maxWidth: 980, margin: '0 auto' }}>
        <div className="eyebrow" style={{ color: 'var(--gold)', marginBottom: 32, justifyContent: 'center' }}>
          Let's Begin
        </div>
        <h2 className="display" style={{ fontSize: 'clamp(48px, 7vw, 104px)', marginBottom: 36, fontWeight: 500 }}>
          Ready to expand your business <em style={{ fontStyle: 'italic', color: 'var(--gold)' }}>with China?</em>
        </h2>
        <p style={{ fontSize: 'clamp(17px, 1.4vw, 21px)', lineHeight: 1.5, color: 'rgba(245,241,232,0.75)', maxWidth: 640, margin: '0 auto 48px', fontWeight: 300 }}>
          Partner with Prime Global Trade and simplify your imports today. Tell us what you need — we'll respond within 24 hours with a tailored proposal.
        </p>
        <div style={{ display: 'flex', gap: 16, justifyContent: 'center', flexWrap: 'wrap', marginBottom: 64 }}>
          <a href="mailto:primeglobaltc@gmail.com" className="btn btn-primary">
            Get Started <span className="arrow">→</span>
          </a>
          <a href="#services" className="btn btn-ghost">
            Review Services
          </a>
        </div>
        <div style={{
          display: 'flex', justifyContent: 'center', gap: 64, flexWrap: 'wrap',
          paddingTop: 48, borderTop: '1px solid rgba(212, 168, 87, 0.2)',
          fontSize: 13, color: 'rgba(245,241,232,0.6)',
        }}>
          <div>
            <div style={{ fontSize: 11, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--gold)', marginBottom: 8 }}>Email</div>
            <a href="mailto:primeglobaltc@gmail.com" style={{ color: 'var(--paper)', textDecoration: 'none', fontSize: 16 }}>
              primeglobaltc@gmail.com
            </a>
          </div>
          <div>
            <div style={{ fontSize: 11, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--gold)', marginBottom: 8 }}>Office</div>
            <span style={{ color: 'var(--paper)', fontSize: 16 }}>Tin Hau, Hong Kong</span>
          </div>
          <div>
            <div style={{ fontSize: 11, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--gold)', marginBottom: 8 }}>Hours</div>
            <span style={{ color: 'var(--paper)', fontSize: 16 }}>Mon–Fri, 9am–7pm HKT</span>
          </div>
        </div>
      </div>
    </section>
  );
}

function Footer() {
  return (
    <footer style={{ background: '#06101e', color: 'rgba(245,241,232,0.6)', padding: '64px 0 40px', borderTop: '1px solid rgba(212,168,87,0.12)' }}>
      <div className="container">
        <div style={{ display: 'grid', gridTemplateColumns: '2fr 1fr 1fr 1fr', gap: 48, marginBottom: 56 }} className="footer-grid">
          <div>
            <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 20 }}>
              <svg width="36" height="36" viewBox="0 0 80 80">
                <defs>
                  <linearGradient id="footerGold" x1="0%" y1="0%" x2="100%" y2="100%">
                    <stop offset="0%" stopColor="#f4dc9a"/>
                    <stop offset="50%" stopColor="#d4a857"/>
                    <stop offset="100%" stopColor="#8a6420"/>
                  </linearGradient>
                </defs>
                <circle cx="40" cy="40" r="38" fill="none" stroke="#d4a857" strokeWidth="0.8"/>
                <circle cx="40" cy="40" r="35" fill="none" stroke="#d4a857" strokeWidth="0.4" opacity="0.55"/>
                <text x="46" y="56" textAnchor="middle" fontFamily="'Fraunces','Cormorant Garamond','Times New Roman',serif" fontWeight="500" fontSize="48" fill="url(#footerGold)" letterSpacing="-2">G</text>
                <text x="32" y="56" textAnchor="middle" fontFamily="'Fraunces','Cormorant Garamond','Times New Roman',serif" fontWeight="600" fontSize="48" fill="url(#footerGold)" letterSpacing="-2">P</text>
              </svg>
              <span className="display" style={{ fontSize: 22, color: 'var(--paper)' }}>Prime Global Trade</span>
            </div>
            <p style={{ fontSize: 14, lineHeight: 1.6, maxWidth: 360, marginBottom: 24 }}>
              International logistics, sourcing, and consulting from China. Connecting businesses worldwide with verified Chinese partners since 2014.
            </p>
            <div style={{ fontSize: 13, lineHeight: 1.7, color: 'rgba(245,241,232,0.55)' }}>
              <div>Unit G15, Tin Hau Apple Solo</div>
              <div>14 Kings Road, Tin Hau, Hong Kong</div>
              <a href="mailto:primeglobaltc@gmail.com" style={{ color: 'var(--gold)', textDecoration: 'none', marginTop: 6, display: 'inline-block' }}>
                primeglobaltc@gmail.com
              </a>
            </div>
          </div>
          <FooterCol title="Services" links={[
            { label: 'Logistics', href: '#services' },
            { label: 'Sourcing & Trade', href: '#services' },
            { label: 'Industrial Equipment', href: '#services' },
            { label: 'Consulting', href: '#services' },
          ]} />
          <FooterCol title="Company" links={[
            { label: 'Why Us', href: '#why-us' },
            { label: 'Capabilities', href: '#capabilities' },
            { label: 'Contact', href: '#contact' },
          ]} />
          <FooterCol title="Legal" links={[
            { label: 'Terms & Conditions', href: 'terms.html' },
            { label: 'Privacy Policy', href: 'privacy.html' },
          ]} />
        </div>
        <div style={{
          display: 'flex', justifyContent: 'space-between', alignItems: 'center',
          paddingTop: 32, borderTop: '1px solid rgba(212,168,87,0.1)', flexWrap: 'wrap', gap: 16,
          fontSize: 12, letterSpacing: '0.06em',
        }}>
          <div>© 2026 Prime Global Trade Ltd. All rights reserved.</div>
          <div style={{ display: 'flex', gap: 24 }}>
            <span className="mono" style={{ fontSize: 11, color: 'var(--gold)', letterSpacing: '0.22em', textTransform: 'uppercase' }}>Reliability · Efficiency · Trust</span>
          </div>
        </div>
      </div>
      <style>{`
        @media (max-width: 800px) {
          .footer-grid { grid-template-columns: 1fr 1fr !important; }
        }
      `}</style>
    </footer>
  );
}

function FooterCol({ title, links }) {
  return (
    <div>
      <div className="mono" style={{ fontSize: 11, letterSpacing: '0.2em', textTransform: 'uppercase', color: 'var(--gold)', marginBottom: 18 }}>
        {title}
      </div>
      <ul style={{ listStyle: 'none', display: 'flex', flexDirection: 'column', gap: 12 }}>
        {links.map(l => (
          <li key={l.label}>
            <a href={l.href} style={{ color: 'rgba(245,241,232,0.7)', textDecoration: 'none', fontSize: 14, transition: 'color 200ms ease' }}
              onMouseEnter={e => e.currentTarget.style.color = 'var(--paper)'}
              onMouseLeave={e => e.currentTarget.style.color = 'rgba(245,241,232,0.7)'}>
              {l.label}
            </a>
          </li>
        ))}
      </ul>
    </div>
  );
}

Object.assign(window, { WhyUs, FinalCTA, Footer });
