/* /closed-call-sprint — the sections of The Closed Call Sprint page, the same layout as /the-sprint
   (the-sprint/sprint.css). Words: content/closed-call-sprint.json. The "I need to think about it"
   section is the homepage's own (sections/S2.jsx, words in content/homepage.json s2), not a copy.
   Since 2026-11-10 (JC: the other pages take the homepage's look) the hero sits on the hero band (.j-hb), the three
   parts are a list that picks a picture (components/PickList.jsx) with pictures from content/homepage.json, the
   commitment is a grey card with the glare and wave, and How to join is the close card with the Closed Sprint's
   outcomes picture from homepage.json s7. */

function CHero({ d, book }) {
  return (
    <div className="j-hb">
      <Section id="c1" label="C1 Hero" width={1040} pt={88} pb={80}>
        <p className="j-meta" style={{ marginBottom: 16 }}><strong style={{ fontWeight: 600 }}>{d.name}.</strong> {d.audience}</p>
        <h1 className="j-h1" style={{ maxWidth: 820 }}>{d.headline}</h1>
        <p className="j-h2 j-sprint-sub j-hb-sub" style={{ marginTop: 16, maxWidth: 700 }}>{d.sub}</p>
        <div className="j-sprint-ctas" style={{ marginTop: 40 }}>
          <a className="j-cta j-cta--warm" href={book}>{d.cta}</a>
          <span className="j-small j-hb-quiet">{d.note}</span>
        </div>
      </Section>
    </div>
  );
}

function COpening({ d }) {
  return (
    <Section id="c3" label="C3 Opening" width={680} pb={72}>
      <div style={{ display: "flex", flexDirection: "column", gap: 26 }}>
        {d.map((t, i) => <p key={i} className="j-body j-measure">{t}</p>)}
      </div>
    </Section>
  );
}

/* the three parts, each with a picture from the homepage: Sally's score card, the Next call, the call map */
function CParts({ d, home }) {
  const pics = home ? [home.s3.rows[2].picture, home.s1.journey.cards[2].picture, home.s3.rows[1].picture] : [];
  const rows = d.rows.map((x, i) => ({
    title: x.h, picture: pics[i],
    body: <React.Fragment>
      {x.bodies.map((t, k) => <p key={k}>{t}</p>)}
      {x.list && <ul>{x.list.map((t, k) => <li key={k}>{t}</li>)}</ul>}
    </React.Fragment>
  }));
  return (
    <Section id="c4" label="C4 Parts" width={1080} pt={112} pb={0}>
      <PickList headline={d.headline} rows={rows} stack />
    </Section>
  );
}

function CKeep({ d, book, cta }) {
  return (
    <Section id="c6" label="C6 What you keep" width={1100} className="j-band">
      <h2 className="j-h2">{d.headline}</h2>
      <ul className="j-dfy" style={{ marginTop: 40 }}>
        {d.items.map((a, i) => (
          <li key={i} className="j-dfy-item">
            <span className="j-dfy-mark" />
            <p className="j-body" style={{ margin: 0 }}>{a}</p>
          </li>
        ))}
      </ul>
      <div style={{ marginTop: 56 }}>
        <a className="j-cta j-cta--warm" href={book}>{cta}</a>
      </div>
    </Section>
  );
}

function CCommit({ commit, after }) {
  return (
    <Section id="c7" label="C7 Commitment" width={860}>
      <h2 className="j-h2">{commit.headline}</h2>
      <GlareCard glare="orange" className="j-commit j-gcard--foot">
        <p className="j-commit-lead">{commit.lead}</p>
        <p className="j-commit-body">{commit.body}</p>
      </GlareCard>
      <p className="j-body j-measure" style={{ marginTop: 36 }}>{commit.note}</p>
      <h2 className="j-h2" style={{ marginTop: 64 }}>{after.headline}</h2>
      {after.bodies.map((t, i) => <p key={i} className="j-body j-measure" style={{ marginTop: i ? 12 : 20 }}>{t}</p>)}
    </Section>
  );
}

function CFounder({ d }) {
  return (
    <Section id="c8" label="C8 Founder" width={1040}>
      <div className="j-founder">
        <img src="/images/founder.png" alt="Jean Carlo Him, founder of Journify" className="j-founder-ph" style={{ objectFit: "cover", objectPosition: "top", display: "block" }} />
        <div className="j-founder-body">
          <h2 className="j-h2">{d.headline}</h2>
          {d.bodies.map((t, i) => <p key={i} className="j-body j-measure" style={{ marginTop: i ? 18 : 24 }}>{t}</p>)}
          <div className="j-founder-logos">
            <img src="/images/adidas.png" alt="adidas" />
            <img src="/images/dell.png" alt="Dell" />
            <img src="/images/heineken.jpeg" alt="Heineken" />
          </div>
        </div>
      </div>
    </Section>
  );
}

function CJoin({ d, book, cta, note, home }) {
  const pic = home && home.s7 && home.s7.cards[1] ? home.s7.cards[1].picture : null;
  return (
    <Section id="c9" label="C9 Join" width={1080} pt={112} pb={160}>
      <GlareCard glare="orange" className="j-close">
        <div>
          <h2 className="j-close-line">{d.headline}</h2>
          <p className="j-close-note">{d.lead}</p>
          <ol className="j-steps">
            {d.steps.map((s, i) => (
              <li key={i} className="j-step">
                <p className="j-body" style={{ margin: 0 }}>{s}</p>
              </li>
            ))}
          </ol>
          <a className="j-cta j-cta--warm" href={book}>{cta}</a>
          <p className="j-close-note" style={{ fontSize: 15 }}>{note}</p>
        </div>
        <div aria-hidden="true">{pic && <Pic p={pic} />}</div>
      </GlareCard>
    </Section>
  );
}

Object.assign(window, { CHero, COpening, CParts, CKeep, CCommit, CFounder, CJoin });
