/* iPixelP — French slides 01-10 */

const TOTAL_SLIDES = 18;

// ============ 01 COVER ============
function Slide01_Cover({ lang }) {
  const t = lang === 'en' ? {
    tagline: "The beginning of a perfect production.",
    yr: "PORTFOLIO 2026", scope: "AGENCE 360 · TUNIS", contact: "CONTACT-PIXEL@IPIXELP.COM",
    label: "COVER",
  } : {
    tagline: "Le début d'une parfaite production.",
    yr: "PORTFOLIO 2026", scope: "AGENCE 360 · TUNIS", contact: "CONTACT-PIXEL@IPIXELP.COM",
    label: "COUVERTURE",
  };
  return (
    <Slide index={1} total={TOTAL_SLIDES} label={t.label}
      footL={t.scope}
      footR={t.contact}
      dataLabel="01 Cover"
    >
      {/* Big background placeholder image */}
      <div style={{ position: 'absolute', inset: 0 }}>
        <Placeholder
          variant="dark"
          label="STILL · STUDIO TV · TUNIS HQ"
          corner="01 / 20"
          style={{ position:'absolute', inset:0, border:'none' }}
        />
        <div style={{
          position: 'absolute', inset: 0,
          background: 'linear-gradient(180deg, rgba(10,10,10,0.6) 0%, rgba(10,10,10,0.2) 35%, rgba(10,10,10,0.95) 100%)'
        }}/>
      </div>

      {/* vertical red rule */}
      <div style={{ position: 'absolute', top: 60, bottom: 110, left: 60, width: 4, background: 'var(--ipp-red)' }}/>

      <div style={{ position: 'absolute', top: 60, left: 100, right: 60 }}>
        <div className="eyebrow-mute" style={{ display:'flex', gap: 18, alignItems:'center' }}>
          <span>{t.yr}</span><span style={{ opacity: 0.4 }}>·</span><span>{t.scope}</span>
        </div>
      </div>

      <div style={{ position: 'absolute', left: 100, bottom: 200, right: 60 }}>
        <img src="assets/logo-light.png" alt="iPixelP" style={{ height: 96, marginBottom: 56, display: 'block' }}/>
        <div className="display lg" style={{ maxWidth: 1500, color: 'var(--ipp-white)' }}>
          {t.tagline.split(' ').slice(0, -2).join(' ')}
          <span style={{ color: 'var(--ipp-red)' }}> {t.tagline.split(' ').slice(-2).join(' ')}</span>
        </div>
      </div>
    </Slide>
  );
}

// ============ 02 POSITIONING ============
function Slide02_Positioning({ lang }) {
  const t = lang === 'en' ? {
    label: "ABOUT",
    eyebrow: "WHO WE ARE",
    head: ["WE PRODUCE", "BROADCAST-GRADE", "WORK FOR BRANDS", "THAT WON'T", "COMPROMISE."],
    body: "Since 2013, iPixelP has built TV sets, shot historical series, and deployed national campaigns from our Tunis studios. Our network across ten countries means we deliver complex projects without compromise, under one roof, with one point of contact.",
    metrics: [
      ["2013", "FOUNDED"],
      ["10", "COUNTRIES"],
      ["500+", "PROJECTS DELIVERED"],
      ["12K+", "HOURS PRODUCED"],
    ]
  } : {
    label: "À PROPOS",
    eyebrow: "QUI SOMMES-NOUS",
    head: ["NOUS PRODUISONS", "DU CONTENU", "DE NIVEAU BROADCAST,", "POUR DES MARQUES", "EXIGEANTES."],
    body: "Depuis 2013, iPixelP construit des plateaux TV, tourne des séries historiques, et déploie des campagnes nationales depuis ses studios de Tunis. Notre réseau dans dix pays nous permet de livrer des projets complexes, sans compromis, avec un seul interlocuteur.",
    metrics: [
      ["2013", "FONDÉE"],
      ["10", "PAYS"],
      ["500+", "PROJETS LIVRÉS"],
      ["12K+", "HEURES PRODUITES"],
    ]
  };
  return (
    <Slide index={2} total={TOTAL_SLIDES} label={t.label} dataLabel="02 Positioning">
      <div className="frame" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 80 }}>
        <div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'space-between' }}>
          <div>
            <Eyebrow>{t.eyebrow}</Eyebrow>
            <h1 className="display sm" style={{ marginTop: 32, color: 'var(--ipp-white)', fontSize: 76 }}>
              {t.head.map((l, i) => (
                <div key={i} style={{ color: i === 1 ? 'var(--ipp-red)' : undefined }}>{l}</div>
              ))}
            </h1>
          </div>
          <div className="body-lg text-pretty" style={{ maxWidth: 720, color: 'var(--ipp-warm)' }}>
            {t.body}
          </div>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gridTemplateRows: '1fr 1fr', gap: 40 }}>
          {t.metrics.map(([num, label], i) => (
            <div key={i} className="metric" style={{ display: 'flex', flexDirection: 'column', justifyContent: 'flex-end' }}>
              <div className={`num ${i === 1 ? 'red' : ''}`} style={{ fontSize: 156 }}>{num}</div>
              <div className="label">{label}</div>
            </div>
          ))}
        </div>
      </div>
    </Slide>
  );
}

// ============ 03 APPROACH / PROCESS ============
function Slide03_Approach({ lang }) {
  const t = lang === 'en' ? {
    label: "METHOD",
    eyebrow: "HOW WE WORK",
    title: ["FOUR STEPS,", "FROM BRIEF TO BROADCAST."],
    sub: "Each step is owned by a named lead. No handoffs into voids.",
    steps: [
      ["01", "BRIEF & STRATEGY", "Understand the objective, define scope, agree the metric that matters."],
      ["02", "CONCEPT & CREATION", "Scripts, storyboards, art direction, casting. Sign-off before any camera rolls."],
      ["03", "PRODUCTION & DELIVERY", "Shoot, post-production, color, audio. Delivered on the format you broadcast on."],
      ["04", "DEPLOYMENT & MEASURE", "Multi-channel rollout, performance tracking, post-campaign report."],
    ],
  } : {
    label: "MÉTHODE",
    eyebrow: "COMMENT NOUS TRAVAILLONS",
    title: ["QUATRE ÉTAPES,", "DU BRIEF À LA DIFFUSION."],
    sub: "Chaque étape a un responsable nommé. Aucune zone de transfert.",
    steps: [
      ["01", "BRIEF & STRATÉGIE", "Comprendre l'objectif, définir le cadre, fixer la métrique qui compte."],
      ["02", "CONCEPTION & CRÉATION", "Scripts, storyboards, direction artistique, casting. Validation avant tournage."],
      ["03", "PRODUCTION & LIVRAISON", "Tournage, post-production, étalonnage, audio. Livré au format de diffusion."],
      ["04", "DIFFUSION & MESURE", "Déploiement multi-canal, suivi des performances, rapport post-campagne."],
    ],
  };

  const [active, setActive] = useState(0);

  return (
    <Slide index={3} total={TOTAL_SLIDES} label={t.label} dataLabel="03 Method">
      <div className="frame" style={{ display: 'flex', flexDirection: 'column', gap: 60 }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
          <div style={{ maxWidth: 1100 }}>
            <Eyebrow>{t.eyebrow}</Eyebrow>
            <h1 className="display md" style={{ marginTop: 28 }}>
              {t.title.map((l, i) => <div key={i} style={{ color: i === 1 ? 'var(--ipp-red)' : 'inherit' }}>{l}</div>)}
            </h1>
          </div>
          <div className="body-sm" style={{ maxWidth: 360, color: 'var(--ipp-mute-2)' }}>{t.sub}</div>
        </div>

        <div className="hairline strong" />

        <div style={{ position: 'relative', display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 40, marginTop: 30 }}>
          {/* connecting line */}
          <div style={{ position: 'absolute', top: 40, left: 60, right: 60, height: 1, background: 'var(--ipp-rule-strong)', zIndex: 0 }} />
          {t.steps.map(([num, head, body], i) => (
            <div
              key={i}
              onMouseEnter={() => setActive(i)}
              style={{ cursor: 'pointer' }}
            >
              <div style={{ display: 'flex', justifyContent: 'flex-start' }}>
                <div className={`step-circle ${active === i ? 'active' : ''}`}>{num}</div>
              </div>
              <div style={{ marginTop: 32 }}>
                <div className="display sm" style={{ fontSize: 32, lineHeight: 1.05 }}>{head}</div>
                <div className="body" style={{ marginTop: 18, color: 'var(--ipp-warm)' }}>{body}</div>
              </div>
              {active === i && (
                <div style={{ marginTop: 24, display: 'flex', alignItems: 'center', gap: 10 }}>
                  <span className="pulse-dot"/>
                  <span style={{ fontFamily: 'var(--ipp-mono)', fontSize: 11, letterSpacing: '0.2em', color: 'var(--ipp-red)' }}>
                    {lang === 'en' ? 'CURRENT' : 'EN COURS'}
                  </span>
                </div>
              )}
            </div>
          ))}
        </div>
      </div>
    </Slide>
  );
}

// ============ 04 SERVICES OVERVIEW ============
function Slide04_Services({ lang }) {
  const t = lang === 'en' ? {
    label: "EXPERTISE",
    eyebrow: "WHAT WE DO",
    title: "SIX DISCIPLINES.\nONE PRODUCTION COMPANY.",
    services: [
      ["video",    "AUDIOVISUAL PRODUCTION", "Spots, films, series. From script to broadcast-ready master."],
      ["strategy", "COMMUNICATION STRATEGY", "Brand positioning, message architecture, multi-channel planning."],
      ["offline",  "OFFLINE COMMUNICATION",  "National outdoor, print, in-store, packaging."],
      ["press",    "PRESS RELATIONS",         "Press kits, conferences, journalist relations across MENA."],
      ["event",    "EVENT PRODUCTION",        "Launches, conferences, gala nights. Logistics included."],
      ["web",      "WEB & DIGITAL",            "Sites, social-first content, paid media, analytics."],
    ],
  } : {
    label: "EXPERTISES",
    eyebrow: "CE QUE NOUS FAISONS",
    title: "SIX MÉTIERS.\nUNE SEULE MAISON.",
    services: [
      ["video",    "PRODUCTION AUDIOVISUELLE","Spots, films, séries. Du scénario au master prêt à diffuser."],
      ["strategy", "STRATÉGIE DE COMMUNICATION","Positionnement, architecture de message, plan multi-canal."],
      ["offline",  "COMMUNICATION OFFLINE",   "Affichage national, print, PLV, packaging."],
      ["press",    "RELATIONS PRESSE",         "Dossiers, conférences, relations journalistes au Maghreb et MENA."],
      ["event",    "ÉVÉNEMENTIEL",             "Lancements, conférences, soirées de gala. Logistique comprise."],
      ["web",      "WEB & DIGITAL",            "Sites, contenus social-first, achat média, analyse."],
    ],
  };
  return (
    <Slide index={4} total={TOTAL_SLIDES} label={t.label} dataLabel="04 Services">
      <div className="frame">
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 56 }}>
          <div>
            <Eyebrow>{t.eyebrow}</Eyebrow>
            <h1 className="display md" style={{ marginTop: 28, whiteSpace: 'pre-line' }}>
              {t.title.split('\n').map((l,i) => (
                <div key={i} style={{ color: i === 1 ? 'var(--ipp-red)' : 'inherit' }}>{l}</div>
              ))}
            </h1>
          </div>
          <div style={{ fontFamily: 'var(--ipp-mono)', fontSize: 14, letterSpacing: '0.24em', color: 'var(--ipp-mute-2)' }}>
            06 / 06
          </div>
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gridTemplateRows: '1fr 1fr', gap: 0, border: '1px solid var(--ipp-rule)' }}>
          {t.services.map(([icon, head, body], i) => (
            <div key={i} className="service-tile" style={{
              border: 'none',
              borderRight: (i % 3 !== 2) ? '1px solid var(--ipp-rule)' : 'none',
              borderBottom: i < 3 ? '1px solid var(--ipp-rule)' : 'none',
              minHeight: 320,
            }}>
              <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
                <span className="tile-num">{String(i+1).padStart(2,'0')}</span>
                <ServiceIcon kind={icon} />
              </div>
              <h3>{head}</h3>
              <p>{body}</p>
            </div>
          ))}
        </div>
      </div>
    </Slide>
  );
}

Object.assign(window, {
  Slide01_Cover, Slide02_Positioning, Slide03_Approach, Slide04_Services,
  TOTAL_SLIDES,
});
