// Site sections — trust strip, services, pillars, process, CTA, footer.

// ─────────────────────────────────────────────────────────────────────────
// Trust strip
// ─────────────────────────────────────────────────────────────────────────
function TrustStrip() {
  const isMobile = window.useIsMobile ? useIsMobile() : false;
  // Brand-evocative wordmark approximations. Each uses font weight + tracking
  // + a muted brand-aligned color to nod toward the company's real logo
  // without literally reproducing it. Colors are picked to sit on both bone
  // (light) and ink (dark) backgrounds.
  const logos = [
    // Grill'd — heavy rounded warm-red, lowercase, signature apostrophe accent
    {
      key: 'grilld',
      name: <>grill<span style={{ color: '#c2611f' }}>’</span>d</>,
      style: {
        fontWeight: 900, letterSpacing: '-0.045em', fontSize: 22,
        color: '#a83a2a', textTransform: 'lowercase',
      },
    },
    // Kokoblack — minimal lowercase sans, wide tracking, light weight
    {
      key: 'kokoblack',
      name: 'kokoblack',
      style: {
        fontWeight: 400, letterSpacing: '0.12em', fontSize: 14,
        textTransform: 'lowercase',
      },
    },
    // WSP — heavy uppercase red
    {
      key: 'wsp',
      name: 'WSP',
      style: {
        fontWeight: 900, letterSpacing: '-0.02em', fontSize: 24,
        color: '#d6261d',
      },
    },
    // AHPRA — clean uppercase, regulatory navy, wide tracking
    {
      key: 'ahpra',
      name: 'AHPRA',
      style: {
        fontWeight: 600, letterSpacing: '0.18em', fontSize: 15,
        color: '#2a6b8e',
      },
    },
    // UNOPS — clean uppercase UN-blue
    {
      key: 'unops',
      name: 'UNOPS',
      style: {
        fontWeight: 700, letterSpacing: '0.08em', fontSize: 17,
        color: '#5b92e5',
      },
    },
    // Genus — modern minimal sans, capitalised
    {
      key: 'genus',
      name: 'Genus',
      style: {
        fontWeight: 500, letterSpacing: '0.02em', fontSize: 18,
      },
    },
  ];
  return (
    <section style={{ background: 'var(--bg-alt)', borderBottom: '1px solid var(--line)' }}>
      <div className="container" style={{
        padding: isMobile ? '22px 20px' : '28px 32px',
        display: 'flex', alignItems: isMobile ? 'flex-start' : 'center',
        gap: isMobile ? 14 : 32,
        flexDirection: isMobile ? 'column' : 'row',
      }}>
        <span className="mono" style={{
          fontSize: 11, color: 'var(--fg-muted)', letterSpacing: '0.18em',
          textTransform: 'uppercase', whiteSpace: 'nowrap',
        }}>
          trusted by teams globally
        </span>
        <div style={{
          flex: 1, width: '100%',
          display: 'grid',
          gridTemplateColumns: isMobile ? 'repeat(3, 1fr)' : `repeat(${logos.length}, 1fr)`,
          gap: isMobile ? 14 : 24,
          alignItems: 'center',
        }}>
          {logos.map(l => (
            <span key={l.key} style={{
              fontFamily: '"Hanken Grotesk", sans-serif',
              color: 'var(--fg-muted)', textAlign: 'center',
              opacity: 0.88, lineHeight: 1,
              ...l.style,
            }}>{l.name}</span>
          ))}
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Services grid
// ─────────────────────────────────────────────────────────────────────────
const SERVICES = [
  {
    n: '01',
    name: 'AI & Automation',
    desc: 'Custom AI assistants, document intelligence, and automation that takes repetitive work off your team\'s plate.',
    proof: 'avg 60% time saved on triage',
  },
  {
    n: '02',
    name: 'Custom Software',
    desc: 'Web apps, internal tools, and integrations engineered to fit your business — not the other way around.',
    proof: 'shipped in weeks, not quarters',
  },
  {
    n: '03',
    name: 'Software as a Service',
    desc: 'Fully managed software, built and run by us — hosting, security, and compliance handled as part of the service.',
    proof: '99.98% uptime, audited',
  },
  {
    n: '04',
    name: 'Integrations',
    desc: 'Connect CRM, accounting, marketing, and custom apps so data flows automatically — nobody re-keys.',
    proof: '40+ integrations live in production',
  },
  {
    n: '05',
    name: 'Data & Analytics',
    desc: 'Pipelines and dashboards that turn scattered data into the answers leadership actually needs.',
    proof: 'from raw to read in 2 weeks',
  },
  {
    n: '06',
    name: 'IT Strategy',
    desc: 'Independent advice and roadmaps to align technology with where the business is actually heading.',
    proof: 'senior practitioner, not a slideware deck',
  },
];

function Services() {
  const isMobile = window.useIsMobile ? useIsMobile() : false;
  return (
    <section id="services" style={{ background: 'var(--bg)' }}>
      <div className="container" style={{ padding: isMobile ? '64px 20px' : '96px 32px' }}>
        <FadeUp>
          <div style={{
            display: 'grid',
            gridTemplateColumns: isMobile ? '1fr' : '1fr 1.4fr',
            gap: isMobile ? 18 : 56,
            alignItems: 'end',
            marginBottom: isMobile ? 32 : 48,
          }}>
            <div>
              <SectionLabel accent="01">What we do</SectionLabel>
              <h2 style={{
                fontSize: 'clamp(34px, 6vw, 56px)',
                fontWeight: 800, letterSpacing: '-0.035em',
                lineHeight: 1.02, margin: '20px 0 0', textWrap: 'balance',
              }}>
                Outcomes, {isMobile ? ' ' : <br/>}not just output.
              </h2>
            </div>
            <p style={{
              fontSize: isMobile ? 16 : 17, lineHeight: 1.55,
              color: 'var(--fg-muted)', maxWidth: 560, margin: 0, textWrap: 'pretty',
            }}>
              From AI-powered automation to custom platforms and cloud architecture, every engagement starts with the business outcome — then we engineer the right solution to get there.
            </p>
          </div>
        </FadeUp>

        <FadeUp delay={80}>
          <div style={{
            display: 'grid',
            gridTemplateColumns: isMobile ? '1fr' : 'repeat(3, 1fr)',
            gap: 0,
            borderTop: '1px solid var(--line)',
            borderLeft: isMobile ? 'none' : '1px solid var(--line)',
          }}>
            {SERVICES.map(s => (
              <ServiceCard key={s.n} {...s} mobile={isMobile} />
            ))}
          </div>
        </FadeUp>

        <div style={{ marginTop: isMobile ? 24 : 32, display: 'flex', justifyContent: isMobile ? 'flex-start' : 'flex-end' }}>
          <a href="services.html" className="hf-ulink" style={{ display: 'inline-flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}>
            See all services <Arrow />
          </a>
        </div>
      </div>
    </section>
  );
}

function ServiceCard({ n, name, desc, proof, mobile }) {
  return (
    <article className="hf-lift" style={{
      padding: mobile ? '22px 0' : '28px 28px 28px',
      borderRight: mobile ? 'none' : '1px solid var(--line)',
      borderBottom: '1px solid var(--line)',
      background: 'transparent',
      display: 'flex', flexDirection: 'column', gap: 14,
      minHeight: mobile ? 0 : 240,
      position: 'relative',
      cursor: 'pointer',
    }}>
      <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
        <span className="mono" style={{ fontSize: 11, color: 'var(--fg-muted)', letterSpacing: '0.14em' }}>{n}</span>
        <Arrow size={16} color="var(--fg-muted)" />
      </div>
      <h3 style={{ fontSize: 22, fontWeight: 700, letterSpacing: '-0.02em', margin: 0 }}>{name}</h3>
      <p style={{ fontSize: 14, lineHeight: 1.55, color: 'var(--fg-muted)', margin: 0, flex: 1, textWrap: 'pretty' }}>{desc}</p>
      <div style={{
        marginTop: 4, paddingTop: 12, borderTop: '1px dashed var(--line)',
        display: 'flex', alignItems: 'center', gap: 8,
      }}>
        <span style={{ width: 5, height: 5, borderRadius: '50%', background: 'var(--ember)' }} />
        <span className="mono" style={{ fontSize: 11, color: 'var(--fg)', letterSpacing: '0.02em' }}>{proof}</span>
      </div>
    </article>
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Built-for-outcomes pillars + receipts
// ─────────────────────────────────────────────────────────────────────────
function Pillars() {
  const isMobile = window.useIsMobile ? useIsMobile() : false;
  const items = [
    { t: 'Senior-only delivery.', d: 'The person scoping the work also ships the work.' },
    { t: 'Measurable success.',    d: 'Every project has clear success criteria up front.' },
    { t: 'Right-sized engagements.', d: 'Tailored to your stage — from startup to enterprise.' },
    { t: 'No lock-in.', d: 'Clean code, documented systems, knowledge transfer baked in.' },
  ];
  const receipts = [
    { k: '20+ yrs', v: 'per project lead' },
    { k: '1:1', v: 'same lead, end-to-end' },
    { k: 'weekly', v: 'working software' },
    { k: '100%', v: 'docs + code handed over' },
  ];
  return (
    <section id="approach" style={{ background: 'var(--bg-inverted)', color: 'var(--fg-on-inverted)' }}>
      <div className="container" style={{ padding: isMobile ? '64px 20px' : '96px 32px' }}>
        <FadeUp>
          <div style={{
            display: 'grid',
            gridTemplateColumns: isMobile ? '1fr' : '1fr 1.2fr',
            gap: isMobile ? 36 : 64,
          }}>
          <div>
            <div className="eyebrow" style={{ color: 'rgba(243,238,228,0.6)' }}>
              <span style={{ color: 'var(--ember)' }}>02</span> &nbsp;&nbsp; Built for outcomes
            </div>
            <h2 style={{
              fontSize: 'clamp(34px, 6vw, 56px)',
              fontWeight: 800, letterSpacing: '-0.035em', lineHeight: 1.02,
              margin: '20px 0 0', textWrap: 'balance',
            }}>
              Senior engineers. Modern tools. <span style={{ color: 'var(--ember)' }}>Real accountability.</span>
            </h2>
            <p style={{ fontSize: isMobile ? 15 : 16, lineHeight: 1.6, color: 'rgba(243,238,228,0.7)', margin: '20px 0 0', maxWidth: 460, textWrap: 'pretty' }}>
              We don't believe in bloated teams or buzzword tech. Every HyperFocus engagement is led by a senior practitioner who stays accountable end-to-end — and we use AI as a force multiplier, not a marketing line.
            </p>

            <div style={{ marginTop: isMobile ? 28 : 36, display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 1, background: 'rgba(243,238,228,0.10)' }}>
              {receipts.map(r => (
                <div key={r.k} style={{ background: 'var(--bg-inverted)', padding: isMobile ? '16px 18px' : '20px 22px' }}>
                  <div style={{ fontSize: isMobile ? 24 : 28, fontWeight: 800, letterSpacing: '-0.02em', color: 'var(--fg-on-inverted)' }}>{r.k}</div>
                  <div className="mono" style={{ fontSize: 10, color: 'rgba(243,238,228,0.55)', letterSpacing: '0.08em', marginTop: 4 }}>{r.v}</div>
                </div>
              ))}
            </div>
          </div>

          <div style={{ display: 'flex', flexDirection: 'column', gap: 14, paddingTop: isMobile ? 0 : 36 }}>
            {items.map((it, i) => (
              <div key={i} style={{
                background: 'rgba(243,238,228,0.04)',
                border: '1px solid rgba(243,238,228,0.10)',
                borderRadius: 14, padding: isMobile ? '18px 20px' : '22px 24px',
                display: 'flex', gap: 18, alignItems: 'flex-start',
              }}>
                <div style={{
                  width: 32, height: 32, borderRadius: 999, background: 'var(--ember)',
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                  fontWeight: 700, color: '#fff', fontSize: 13, flex: '0 0 32px',
                }}>{String(i + 1).padStart(2, '0')}</div>
                <div>
                  <div style={{ fontSize: isMobile ? 16 : 18, fontWeight: 700, letterSpacing: '-0.015em', color: 'var(--fg-on-inverted)' }}>{it.t}</div>
                  <div style={{ fontSize: 14, color: 'rgba(243,238,228,0.7)', marginTop: 4, lineHeight: 1.5 }}>{it.d}</div>
                </div>
              </div>
            ))}
          </div>
        </div>
        </FadeUp>
      </div>
    </section>
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Process — 4 steps
// ─────────────────────────────────────────────────────────────────────────
function Process() {
  const isMobile = window.useIsMobile ? useIsMobile() : false;
  const steps = [
    { n: '01', title: 'Discovery call', meta: '30 minutes · no charge',     blurb: 'A conversation about your goals, constraints, and stack. We listen first, sales pitch later.' },
    { n: '02', title: 'Scoped proposal', meta: 'outcomes · timeline · price', blurb: 'A written plan with success criteria and a fixed price. You see exactly what you\'re getting before you sign.' },
    { n: '03', title: 'Iterative delivery', meta: 'working software, weekly', blurb: 'Real software in your hands every week, with check-ins. No big-bang surprises at the end.' },
    { n: '04', title: 'Handover & support', meta: 'documented · owned by you', blurb: 'Runbooks, code, and decision logs all handed over. Optional ongoing support if you want us.' },
  ];
  return (
    <section id="process" style={{ background: 'var(--bg)', borderTop: '1px solid var(--line)' }}>
      <div className="container" style={{ padding: isMobile ? '64px 20px' : '96px 32px' }}>
        <FadeUp>
          <div style={{
            display: 'grid',
            gridTemplateColumns: isMobile ? '1fr' : '1fr 1.4fr',
            gap: isMobile ? 18 : 56,
            alignItems: 'end',
            marginBottom: isMobile ? 36 : 56,
          }}>
            <div>
              <SectionLabel accent="03">How we engage</SectionLabel>
              <h2 style={{
                fontSize: 'clamp(34px, 6vw, 56px)',
                fontWeight: 800, letterSpacing: '-0.035em', lineHeight: 1.02,
                margin: '20px 0 0', textWrap: 'balance',
              }}>
                A simple, four-step path {isMobile ? '' : <br/>}from idea to live.
              </h2>
            </div>
            <p style={{ fontSize: isMobile ? 16 : 17, lineHeight: 1.55, color: 'var(--fg-muted)', maxWidth: 560, margin: 0, textWrap: 'pretty' }}>
              Every engagement follows the same pattern — short, scoped, accountable. You'll know exactly what you're getting and what comes next at every stage.
            </p>
          </div>
        </FadeUp>

        {/* Step diagram — 4 columns desktop, vertical timeline mobile */}
        <div style={{ position: 'relative' }}>
          {/* Connecting line — horizontal on desktop, vertical on mobile */}
          {!isMobile ? (
            <div style={{
              position: 'absolute', top: 28, left: '12%', right: '12%', height: 2,
              background: 'repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px)',
              zIndex: 0,
            }} />
          ) : (
            <div style={{
              position: 'absolute', top: 24, bottom: 24, left: 27, width: 2,
              background: 'repeating-linear-gradient(180deg, var(--line) 0 8px, transparent 8px 14px)',
              zIndex: 0,
            }} />
          )}
          <div style={{
            display: 'grid',
            gridTemplateColumns: isMobile ? '1fr' : 'repeat(4, 1fr)',
            gap: isMobile ? 28 : 24, position: 'relative', zIndex: 1,
          }}>
            {steps.map((s, i) => (
              <FadeUp key={s.n} delay={i * 90}>
                <div style={{
                  display: 'flex',
                  flexDirection: isMobile ? 'row' : 'column',
                  gap: isMobile ? 16 : 14,
                  alignItems: isMobile ? 'flex-start' : 'stretch',
                }}>
                  <div style={{
                    width: 56, height: 56, borderRadius: '50%',
                    background: 'var(--bg-elevated)', border: '1px solid var(--line)',
                    display: 'flex', alignItems: 'center', justifyContent: 'center',
                    fontWeight: 800, letterSpacing: '-0.02em', fontSize: 18,
                    position: 'relative', flex: '0 0 56px',
                  }}>
                    {s.n}
                    <span className="hf-pulse" style={{
                      position: 'absolute', bottom: -3, right: -3,
                      width: 12, height: 12, borderRadius: '50%', background: 'var(--ember)',
                      border: '2px solid var(--bg)',
                    }} />
                  </div>
                  <div style={{ flex: 1 }}>
                    <div style={{ fontSize: isMobile ? 18 : 20, fontWeight: 700, letterSpacing: '-0.02em' }}>{s.title}</div>
                    <div className="mono" style={{ fontSize: 11, color: 'var(--ember)', letterSpacing: '0.06em', marginTop: 4 }}>{s.meta}</div>
                    <p style={{ fontSize: 14, lineHeight: 1.55, color: 'var(--fg-muted)', margin: '8px 0 0', textWrap: 'pretty' }}>{s.blurb}</p>
                  </div>
                </div>
              </FadeUp>
            ))}
          </div>
        </div>

        <div style={{ marginTop: isMobile ? 32 : 48, display: 'flex', justifyContent: isMobile ? 'flex-start' : 'flex-end' }}>
          <a href="services.html" className="hf-ulink" style={{ display: 'inline-flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}>
            See the full process <Arrow />
          </a>
        </div>
      </div>
    </section>
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Final CTA
// ─────────────────────────────────────────────────────────────────────────
function FinalCTA() {
  const isMobile = window.useIsMobile ? useIsMobile() : false;
  return (
    <section id="contact" style={{ background: 'var(--ember)', color: '#fff', position: 'relative', overflow: 'hidden' }}>
      <div aria-hidden="true" style={{
        position: 'absolute',
        top: isMobile ? -180 : -240,
        right: isMobile ? -160 : -160,
        width: isMobile ? 480 : 640,
        height: isMobile ? 480 : 640,
        borderRadius: '50%', background: '#fff', opacity: 0.08, pointerEvents: 'none',
      }} />
      <div className="container" style={{ padding: isMobile ? '64px 20px' : '96px 32px', position: 'relative' }}>
        <FadeUp>
          <div style={{
            display: 'grid',
            gridTemplateColumns: isMobile ? '1fr' : '1.4fr 1fr',
            gap: isMobile ? 36 : 56,
            alignItems: 'center',
          }}>
            <div>
              <div className="mono" style={{ fontSize: 11, letterSpacing: '0.22em', textTransform: 'uppercase', opacity: 0.8 }}>
                // accepting Q3 engagements
              </div>
              <h2 style={{
                fontSize: 'clamp(36px, 7vw, 64px)',
                fontWeight: 800, letterSpacing: '-0.035em', lineHeight: 1.0,
                margin: '20px 0 0', textWrap: 'balance',
              }}>
                Have a problem worth solving?
              </h2>
              <p style={{ fontSize: isMobile ? 16 : 18, lineHeight: 1.55, margin: '20px 0 0', maxWidth: 560, opacity: 0.92, textWrap: 'pretty' }}>
                Tell us what you're trying to achieve. We'll tell you whether we're the right team and — either way — point you in the right direction.
              </p>
              <div style={{ display: 'flex', gap: 10, marginTop: 28, flexWrap: 'wrap' }}>
                <Btn className="hf-btn" size="lg" variant="onDark" as="a" href="contact.html">Start the conversation <Arrow /></Btn>
                <Btn className="hf-btn" size="lg" variant="ghost" as="a" href="contact.html" style={{ borderColor: 'rgba(255,255,255,0.4)', color: '#fff' }}>Book a call</Btn>
              </div>
            </div>

            {/* Mini contact card */}
            <div style={{
              background: 'rgba(255,255,255,0.10)', border: '1px solid rgba(255,255,255,0.25)',
              backdropFilter: 'blur(10px)',
              borderRadius: 14, padding: isMobile ? 22 : 28,
            }}>
              <div className="mono" style={{ fontSize: 10, letterSpacing: '0.18em', textTransform: 'uppercase', opacity: 0.8 }}>quick details</div>
              <div style={{ display: 'flex', flexDirection: 'column', gap: 14, marginTop: 18 }}>
                <CTARow k="response" v="usually within 1 business day" />
                <CTARow k="format" v="30-min discovery call · no charge" />
                <CTARow k="based" v="Australia · projects worldwide" />
                <CTARow k="from" v="hello@hyperfocusoz.com" />
              </div>
            </div>
          </div>
        </FadeUp>
      </div>
    </section>
  );
}

function CTARow({ k, v }) {
  return (
    <div style={{ display: 'flex', alignItems: 'baseline', gap: 12, paddingBottom: 12, borderBottom: '1px dashed rgba(255,255,255,0.25)' }}>
      <span className="mono" style={{ fontSize: 11, opacity: 0.7, letterSpacing: '0.1em', textTransform: 'uppercase', minWidth: 80 }}>{k}</span>
      <span style={{ fontSize: 14, fontWeight: 500, flex: 1 }}>{v}</span>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────────────────
// Footer lives in site-shell.jsx (shared across pages).
// ─────────────────────────────────────────────────────────────────────────

Object.assign(window, { TrustStrip, Services, Pillars, Process, FinalCTA });
