const { useEffect: useEffectCS } = React;

function CSCover() {
  return (
    <svg viewBox="0 0 1280 720" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
      <defs>
        <clipPath id="csCover"><rect width="1280" height="720" /></clipPath>
      </defs>
      <g clipPath="url(#csCover)">
        <rect width="1280" height="720" fill="var(--bg-panel)" />

        {/* Background grid */}
        {Array.from({ length: 21 }).map((_, i) => (
          <line key={`gv${i}`} x1={i * 64} y1="0" x2={i * 64} y2="720" stroke="var(--fg)" strokeOpacity="0.04" />
        ))}
        {Array.from({ length: 12 }).map((_, i) => (
          <line key={`gh${i}`} x1="0" y1={i * 64} x2="1280" y2={i * 64} stroke="var(--fg)" strokeOpacity="0.04" />
        ))}

        {/* Floating dashboard window */}
        <g transform="translate(180, 120)">
          <rect width="640" height="420" rx="22" fill="var(--graphite)" stroke="var(--fg)" strokeOpacity="0.22" />
          <rect x="0" y="0" width="640" height="44" rx="22" fill="var(--graphite)" />
          <rect x="0" y="22" width="640" height="22" fill="var(--graphite)" />
          <line x1="0" y1="44" x2="640" y2="44" stroke="var(--fg)" strokeOpacity="0.14" />
          <circle cx="22" cy="22" r="5" fill="var(--fg)" opacity="0.18" />
          <circle cx="40" cy="22" r="5" fill="var(--fg)" opacity="0.18" />
          <circle cx="58" cy="22" r="5" fill="var(--fg)" opacity="0.18" />
          <rect x="280" y="14" width="80" height="16" rx="8" fill="var(--fg)" opacity="0.1" />

          {/* Sidebar */}
          <rect x="0" y="44" width="156" height="376" fill="var(--soot)" />
          {[80, 110, 140, 170, 200, 230].map((y, i) => (
            <g key={i}>
              <rect x="20" y={y} width="14" height="14" rx="3" fill={i === 1 ? "var(--signal)" : "var(--fg)"} opacity={i === 1 ? 1 : 0.4} />
              <rect x="42" y={y + 4} width={62 + (i % 3) * 14} height="6" rx="2" fill="var(--fg)" opacity={i === 1 ? 0.9 : 0.5} />
            </g>
          ))}

          {/* Stats */}
          <g transform="translate(180, 64)">
            {[0, 1, 2].map(i => (
              <g key={i} transform={`translate(${i * 152}, 0)`}>
                <rect width="140" height="84" rx="10" fill="none" stroke="var(--fg)" strokeOpacity="0.18" />
                <rect x="14" y="14" width="40" height="4" rx="2" fill="var(--fg)" opacity="0.45" />
                <rect x="14" y="30" width={i === 0 ? 90 : 64} height="20" rx="3" fill="var(--fg)" opacity={i === 0 ? 1 : 0.7} />
                <rect x="14" y="62" width="40" height="4" rx="2" fill={i === 0 ? "var(--signal)" : "var(--fg)"} opacity={i === 0 ? 1 : 0.25} />
              </g>
            ))}
          </g>

          {/* Chart */}
          <g transform="translate(180, 168)">
            <rect width="444" height="232" rx="10" fill="none" stroke="var(--fg)" strokeOpacity="0.18" />
            <rect x="20" y="20" width="160" height="6" rx="2" fill="var(--fg)" opacity="0.7" />
            <rect x="20" y="34" width="92" height="4" rx="2" fill="var(--fg)" opacity="0.35" />
            {[0,1,2,3,4,5,6,7,8,9].map((i) => {
              const heights = [60, 92, 76, 120, 88, 144, 110, 76, 100, 130];
              const h = heights[i];
              const isFocus = i === 5;
              return <rect key={i} x={32 + i * 40} y={210 - h} width="28" height={h} rx="4" fill={isFocus ? "var(--signal)" : "var(--fg)"} opacity={isFocus ? 1 : 0.32 + (i % 3) * 0.08} />;
            })}
            <line x1="20" y1="212" x2="424" y2="212" stroke="var(--fg)" strokeOpacity="0.16" />
          </g>
        </g>

        {/* Floating side card (offset) */}
        <g transform="translate(860, 220)">
          <rect width="240" height="320" rx="22" fill="var(--graphite)" stroke="var(--fg)" strokeOpacity="0.22" />
          <rect x="0" y="0" width="240" height="44" rx="22" fill="var(--graphite)" />
          <line x1="0" y1="44" x2="240" y2="44" stroke="var(--fg)" strokeOpacity="0.14" />
          <rect x="20" y="16" width="80" height="12" rx="3" fill="var(--fg)" opacity="0.7" />

          <rect x="20" y="64" width="200" height="60" rx="10" fill="var(--signal)" />
          <rect x="34" y="78" width="40" height="4" rx="2" fill="var(--graphite)" opacity="0.5" />
          <rect x="34" y="92" width="140" height="14" rx="3" fill="var(--graphite)" />

          {[0,1,2].map(i => (
            <g key={i} transform={`translate(20, ${140 + i * 56})`}>
              <rect width="200" height="44" rx="8" fill="none" stroke="var(--fg)" strokeOpacity="0.16" />
              <circle cx="20" cy="22" r="8" fill="var(--fg)" opacity={i === 0 ? 0.6 : 0.3} />
              <rect x="38" y="14" width={70 + i * 14} height="5" rx="2" fill="var(--fg)" opacity="0.6" />
              <rect x="38" y="25" width="44" height="4" rx="2" fill="var(--fg)" opacity="0.32" />
            </g>
          ))}
        </g>

        {/* Period dot — signal */}
        <circle cx="1180" cy="600" r="22" fill="var(--signal)" />
      </g>
    </svg>
  );
}

function CSShot({ kind }) {
  // Three different illustrative screens
  if (kind === 1) {
    return (
      <svg viewBox="0 0 1280 800" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <rect width="1280" height="800" fill="var(--bg-panel)" />
        {/* Catalog: grid of campaign cards */}
        <rect x="0" y="0" width="1280" height="64" fill="var(--soot)" />
        <rect x="40" y="22" width="120" height="14" rx="3" fill="var(--fg)" opacity="0.8" />
        <rect x="1140" y="18" width="100" height="28" rx="14" fill="var(--signal)" />

        <rect x="40" y="100" width="220" height="40" rx="20" fill="none" stroke="var(--fg)" strokeOpacity="0.2" />
        <rect x="60" y="113" width="120" height="14" rx="3" fill="var(--fg)" opacity="0.55" />
        <rect x="280" y="100" width="120" height="40" rx="20" fill="none" stroke="var(--fg)" strokeOpacity="0.2" />
        <rect x="300" y="113" width="80" height="14" rx="3" fill="var(--fg)" opacity="0.55" />

        {[0,1,2].map(row => (
          [0,1,2,3].map(col => (
            <g key={`${row}-${col}`} transform={`translate(${40 + col * 304}, ${184 + row * 200})`}>
              <rect width="280" height="176" rx="14" fill="none" stroke="var(--fg)" strokeOpacity="0.18" />
              <rect x="14" y="14" width="252" height="92" rx="8" fill="var(--fg)" opacity={(row + col) % 4 === 0 ? 0.15 : 0.08} />
              <rect x="14" y="120" width={120 + (col * 18)} height="9" rx="3" fill="var(--fg)" opacity="0.85" />
              <rect x="14" y="138" width="80" height="6" rx="2" fill="var(--fg)" opacity="0.45" />
              <rect x="200" y="138" width={(col === 1 && row === 0) ? 56 : 42} height="18" rx="9" fill={(col === 1 && row === 0) ? "var(--signal)" : "none"} stroke="var(--fg)" strokeOpacity={(col === 1 && row === 0) ? 0 : 0.25} />
            </g>
          ))
        ))}
      </svg>
    );
  }
  if (kind === 2) {
    return (
      <svg viewBox="0 0 1280 800" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
        <rect width="1280" height="800" fill="var(--bg-panel)" />
        {/* Request queue / detail screen */}
        <rect x="0" y="0" width="1280" height="64" fill="var(--soot)" />
        <rect x="40" y="22" width="180" height="14" rx="3" fill="var(--fg)" opacity="0.8" />

        {/* Left detail */}
        <g transform="translate(40, 100)">
          <rect width="720" height="640" rx="14" fill="var(--graphite)" stroke="var(--fg)" strokeOpacity="0.18" />
          <rect x="32" y="32" width="200" height="20" rx="3" fill="var(--fg)" opacity="0.4" />
          <rect x="32" y="64" width="500" height="36" rx="3" fill="var(--fg)" opacity="0.92" />
          <rect x="32" y="108" width="380" height="36" rx="3" fill="var(--fg)" opacity="0.92" />
          <rect x="32" y="172" width="640" height="280" rx="10" fill="var(--fg)" opacity="0.06" />
          <rect x="32" y="172" width="40" height="280" fill="var(--signal)" />
          <rect x="32" y="476" width="80" height="14" rx="3" fill="var(--fg)" opacity="0.5" />
          <rect x="32" y="500" width="640" height="9" rx="3" fill="var(--fg)" opacity="0.6" />
          <rect x="32" y="516" width="540" height="9" rx="3" fill="var(--fg)" opacity="0.6" />
          <rect x="32" y="532" width="420" height="9" rx="3" fill="var(--fg)" opacity="0.6" />
          <rect x="32" y="580" width="180" height="42" rx="21" fill="var(--signal)" />
        </g>

        {/* Right summary */}
        <g transform="translate(800, 100)">
          <rect width="440" height="640" rx="14" fill="var(--graphite)" stroke="var(--fg)" strokeOpacity="0.18" />
          <rect x="24" y="24" width="120" height="14" rx="3" fill="var(--fg)" opacity="0.5" />
          {[0,1,2,3,4].map(i => (
            <g key={i} transform={`translate(24, ${64 + i * 80})`}>
              <rect width="392" height="64" rx="10" fill="none" stroke="var(--fg)" strokeOpacity={i === 0 ? 0.4 : 0.14} />
              <rect x="16" y="16" width="32" height="32" rx="6" fill="var(--fg)" opacity={i === 0 ? 0.9 : 0.3} />
              <rect x="60" y="20" width={160 + i * 8} height="8" rx="3" fill="var(--fg)" opacity="0.7" />
              <rect x="60" y="34" width="100" height="6" rx="2" fill="var(--fg)" opacity="0.35" />
              <circle cx="380" cy="32" r="6" fill={i === 0 ? "var(--signal)" : "var(--fg)"} opacity={i === 0 ? 1 : 0.3} />
            </g>
          ))}
          <rect x="24" y="500" width="392" height="100" rx="10" fill="none" stroke="var(--fg)" strokeOpacity="0.14" />
          <rect x="40" y="516" width="80" height="6" rx="2" fill="var(--fg)" opacity="0.45" />
          <rect x="40" y="532" width="180" height="20" rx="3" fill="var(--fg)" opacity="0.9" />
          <rect x="40" y="568" width="120" height="22" rx="11" fill="none" stroke="var(--signal)" />
        </g>
      </svg>
    );
  }
  // kind 3 — confirmation
  return (
    <svg viewBox="0 0 1280 800" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
      <rect width="1280" height="800" fill="var(--bg-panel)" />
      <rect x="0" y="0" width="1280" height="64" fill="var(--soot)" />
      <rect x="40" y="22" width="180" height="14" rx="3" fill="var(--fg)" opacity="0.8" />

      <g transform="translate(280, 140)">
        <rect width="720" height="540" rx="22" fill="var(--graphite)" stroke="var(--fg)" strokeOpacity="0.22" />
        <circle cx="60" cy="80" r="24" fill="var(--signal)" />
        <rect x="100" y="68" width="40" height="6" rx="2" fill="var(--fg)" opacity="0.5" />
        <rect x="100" y="82" width="200" height="14" rx="3" fill="var(--fg)" opacity="0.95" />

        <rect x="32" y="140" width="656" height="1" fill="var(--fg)" opacity="0.14" />

        <rect x="32" y="172" width="80" height="6" rx="2" fill="var(--fg)" opacity="0.45" />
        <rect x="32" y="190" width="380" height="32" rx="3" fill="var(--fg)" opacity="0.95" />

        {[0,1,2,3].map(i => (
          <g key={i} transform={`translate(32, ${260 + i * 56})`}>
            <rect width="656" height="44" rx="10" fill="none" stroke="var(--fg)" strokeOpacity="0.14" />
            <rect x="16" y="14" width="80" height="16" rx="3" fill="var(--fg)" opacity="0.45" />
            <rect x="200" y="14" width={140 + i * 18} height="16" rx="3" fill="var(--fg)" opacity="0.85" />
            <rect x="560" y="14" width={i === 0 ? 56 : 80} height="16" rx="8" fill={i === 0 ? "var(--signal)" : "none"} stroke="var(--fg)" strokeOpacity={i === 0 ? 0 : 0.28} />
          </g>
        ))}

        <rect x="32" y="492" width="200" height="44" rx="22" fill="var(--signal)" />
        <rect x="252" y="492" width="160" height="44" rx="22" fill="none" stroke="var(--fg)" strokeOpacity="0.3" />
      </g>
    </svg>
  );
}

function CSImageSlot({ label }) {
  return (
    <div className="cs-img-slot">
      <span className="cs-img-slot__icon">+</span>
      <span className="cs-img-slot__lbl">{label || "Add image here"}</span>
    </div>
  );
}

const CS2_BASE = "assets/2-works/Bradesco/work-tiu-diu/";
const CS3_BASE = "assets/2-works/BYU/work-app-elc-apply/";

function CS2Stage({ srcs, back, ratio = "16/9", cover = false, bleedBottom = false }) {
  const backdrop = back || srcs[0];
  const cls = [
    "cs2-stage",
    cover       ? "cs2-stage--cover"       : "",
    bleedBottom ? "cs2-stage--bleed-bottom" : "",
  ].filter(Boolean).join(" ");
  return (
    <div className={cls} style={{ aspectRatio: ratio }}>
      <div
        className="cs2-stage__bg"
        style={{ backgroundImage: `url(${backdrop})` }}
      />
      <div className="cs2-stage__screens">
        {srcs.map((src, i) => (
          <img key={i} src={src} className="cs2-stage__screen" alt="" draggable="false" />
        ))}
      </div>
    </div>
  );
}


function CaseCarousel({ slides }) {
  const [idx, setIdx] = React.useState(0);
  const [prevIdx, setPrevIdx] = React.useState(null);
  const [dir, setDir] = React.useState('left');
  const [animating, setAnimating] = React.useState(false);
  const total = slides.length;

  function goTo(next, direction) {
    if (animating || next === idx) return;
    setDir(direction);
    setPrevIdx(idx);
    setAnimating(true);
    setIdx(next);
    setTimeout(() => { setPrevIdx(null); setAnimating(false); }, 520);
  }
  function goPrev() { goTo((idx - 1 + total) % total, 'right'); }
  function goNext() { goTo((idx + 1) % total, 'left'); }

  return (
    <div className="case-carousel">
      <div className="case-carousel__stage">
        {prevIdx !== null && (
          <div key={`out-${prevIdx}`} className={`case-carousel__slide case-carousel__slide--out-${dir}`}>
            {slides[prevIdx]}
          </div>
        )}
        <div key={`in-${idx}`} className={`case-carousel__slide${animating ? ` case-carousel__slide--in-${dir}` : ''}`}>
          {slides[idx]}
        </div>
        <button className="cs2-carousel__btn cs2-carousel__btn--prev" onClick={goPrev} aria-label="Anterior">←</button>
        <button className="cs2-carousel__btn cs2-carousel__btn--next" onClick={goNext} aria-label="Próximo">→</button>
        <div className="cs2-carousel__dots">
          {slides.map((_, i) => (
            <button
              key={i}
              className={`cs2-carousel__dot${i === idx ? " cs2-carousel__dot--on" : ""}`}
              onClick={() => goTo(i, i > idx ? 'left' : 'right')}
              aria-label={`Slide ${i + 1}`}
            />
          ))}
        </div>
      </div>
    </div>
  );
}

// Desktop: mostra pares (2 imagens lado a lado)
// Mobile: mostra imagens individualmente (1 por vez)
function CS2Carousel({ pairs }) {
  const allSlides = pairs.flat();

  const [isMobile, setIsMobile] = React.useState(() => window.innerWidth <= 640);
  React.useEffect(() => {
    const check = () => setIsMobile(window.innerWidth <= 640);
    window.addEventListener('resize', check);
    return () => window.removeEventListener('resize', check);
  }, []);

  const [idx, setIdx] = React.useState(0);
  const [prevIdx, setPrevIdx] = React.useState(null);
  const [dir, setDir] = React.useState('left');
  const [animating, setAnimating] = React.useState(false);

  const total = isMobile ? allSlides.length : pairs.length;

  React.useEffect(() => { setIdx(0); setPrevIdx(null); }, [isMobile]);

  function goTo(next, direction) {
    if (animating || next === idx) return;
    setDir(direction);
    setPrevIdx(idx);
    setAnimating(true);
    setIdx(next);
    setTimeout(() => { setPrevIdx(null); setAnimating(false); }, 520);
  }
  function goPrev() { goTo((idx - 1 + total) % total, 'right'); }
  function goNext() { goTo((idx + 1) % total, 'left'); }

  const currPair = isMobile ? [allSlides[idx]] : pairs[idx];
  const prevPair = prevIdx !== null ? (isMobile ? [allSlides[prevIdx]] : pairs[prevIdx]) : null;
  const ratio = isMobile ? "9/16" : "16/9";

  return (
    <div className="cs2-carousel">
      <div className="cs2-carousel__stage" style={{ aspectRatio: ratio }}>
        <div className="cs2-stage__bg" style={{ backgroundImage: `url(${pairs[0][0]})` }} />
        <div className="cs2-stage__screens">
          {prevPair && (
            <div className={`cs2-carousel__pair${prevPair.length === 3 ? " cs2-carousel__pair--trio" : ""} cs2-carousel__pair--out-${dir}`}>
              {prevPair.map((src, i) => (
                <img key={i} src={src} className="cs2-stage__screen" alt="" draggable="false" />
              ))}
            </div>
          )}
          <div className={`cs2-carousel__pair${currPair.length === 3 ? " cs2-carousel__pair--trio" : ""}${animating ? ` cs2-carousel__pair--in-${dir}` : ''}`}>
            {currPair.map((src, i) => (
              <img key={i} src={src} className="cs2-stage__screen" alt="" draggable="false" />
            ))}
          </div>
        </div>
        <button className="cs2-carousel__btn cs2-carousel__btn--prev" onClick={goPrev} aria-label="Anterior">←</button>
        <button className="cs2-carousel__btn cs2-carousel__btn--next" onClick={goNext} aria-label="Próximo">→</button>
        <div className="cs2-carousel__dots">
          {Array.from({ length: total }).map((_, i) => (
            <button
              key={i}
              className={`cs2-carousel__dot${i === idx ? " cs2-carousel__dot--on" : ""}`}
              onClick={() => goTo(i, i > idx ? 'left' : 'right')}
              aria-label={`Slide ${i + 1}`}
            />
          ))}
        </div>
      </div>
    </div>
  );
}

function CaseStudy({ slug, lang, onBack, onNext }) {
  const slugMap = { "marketing-materials": "cs", "regulatory-app": "cs2", "campaign-management": "cs3" };
  const key = slugMap[slug] || "cs";
  const I = window.I18N[key];
  const isCs1 = key === "cs";
  const isCs2 = key === "cs2";
  const isCs3 = key === "cs3";
  useEffectCS(() => { window.scrollTo({ top: 0, behavior: "instant" }); }, [slug]);

  return (
    <main>
      <div className="col" style={{ paddingTop: 56 }}>

        {/* Back */}
        <Reveal>
          <button className="cs-back" onClick={onBack}>← {t(I.back, lang)}</button>
        </Reveal>

        {/* Eyebrow + Title */}
        <Reveal>
          <div className="cs-eyebrow">↳ {t(I.label, lang)}</div>
        </Reveal>
        <Reveal delay={60}>
          <h1 className="cs-title">{t(I.title, lang).replace(/\.$/, "")}<span className="period">.</span></h1>
        </Reveal>

        {/* Meta bar — Company · Role · Timeline · Tools */}
        <Reveal delay={120}>
          <div className="cs-meta">
            <div className="cs-meta__cell">
              <span className="cs-meta__lbl">{t(I.metaCompanyLbl, lang)}</span>
              <span className="cs-meta__val">{t(I.metaCompanyVal, lang)}</span>
            </div>
            <div className="cs-meta__cell">
              <span className="cs-meta__lbl">{t(I.metaRoleLbl, lang)}</span>
              <span className="cs-meta__val">{t(I.metaRoleVal, lang)}</span>
            </div>
            <div className="cs-meta__cell">
              <span className="cs-meta__lbl">{t(I.metaTimeLbl, lang)}</span>
              <span className="cs-meta__val">{t(I.metaTimeVal, lang)}</span>
            </div>
            <div className="cs-meta__cell">
              <span className="cs-meta__lbl">{t(I.metaYearLbl, lang)}</span>
              <span className="cs-meta__val">{t(I.metaYearVal, lang)}</span>
            </div>
          </div>
        </Reveal>

        {/* Cover */}
        <Reveal delay={160}>
          {isCs1 ? (
            <div className="cs-cover"><CSCover /></div>
          ) : isCs2 ? (
            <CS2Stage
              cover
              bleedBottom
              srcs={[CS2_BASE + "tiu-menu.jpg"]}
              back={CS2_BASE + "tiu-menu.jpg"}
            />
          ) : isCs3 ? (
            <CS2Stage
              cover
              bleedBottom
              srcs={[CS3_BASE + "byu-login.png"]}
              back={CS3_BASE + "byu-login.png"}
            />
          ) : (
            <div className="cs-cover"><CSImageSlot label="Cover image" /></div>
          )}
        </Reveal>

        {/* § 01 — CONTEXT */}
        {!isCs3 && (
          <Reveal as="section" className="cs-section">
            <div className="cs-section__split">
              <div className="cs-section__split-left">
                <div className="cs-section__lbl">{t(I.contextLbl, lang)}</div>
                <h2 className="cs-section__h">{t(I.contextH, lang)}</h2>
              </div>
              <div className="cs-section__split-right">
                <p className="cs-section__p">{t(I.contextP1, lang)}</p>
              </div>
            </div>
            {isCs2 ? (
              <CS2Stage
                srcs={[CS2_BASE + "tiu-old.png"]}
                back={CS2_BASE + "tiu-old.png"}
                bleedBottom
              />
            ) : <CSImageSlot label="Context image" />}
          </Reveal>
        )}

        {/* § 01+02 cs3 — Context & Problem side by side in 2 columns */}
        {isCs3 && (
          <Reveal as="section" className="cs-section">
            <div className="cs-ctx-problem">
              <div className="cs-ctx-problem__col">
                <div className="cs-section__lbl">{t(I.contextLbl, lang)}</div>
                <h2 className="cs-section__h">{t(I.contextH, lang)}</h2>
                <p className="cs-section__p">{t(I.contextP1, lang)}</p>
              </div>
              <div className="cs-ctx-problem__col">
                <div className="cs-section__lbl">{t(I.problemLbl, lang)}</div>
                <h2 className="cs-section__h">{t(I.problemH, lang)}</h2>
                <p className="cs-section__p">{t(I.problemP, lang)}</p>
              </div>
            </div>
          </Reveal>
        )}

        {/* § 02 — THE PROBLEM (hidden for cs3 — shown alongside context above) */}
        {!isCs3 && <Reveal as="section" className="cs-section">
          <div className="cs-section__split">
            <div className="cs-section__split-left">
              <div className="cs-section__lbl">{t(I.problemLbl, lang)}</div>
              <h2 className="cs-section__h">{t(I.problemH, lang)}</h2>
            </div>
            <div className="cs-section__split-right">
              <p className="cs-section__p">{t(I.problemP, lang)}</p>
            </div>
          </div>
          {isCs2 ? (
            <div className="cs2-old-trio">
              {[CS2_BASE + "tiu-old-1.png", CS2_BASE + "tiu-old-2.png", CS2_BASE + "tiu-old-3.png"].map((src, i) => (
                <CS2Stage key={i} srcs={[src]} back={src} bleedBottom ratio="3/4" />
              ))}
            </div>
          ) : <CSImageSlot label="Problem image" />}
        </Reveal>}

        {/* § 03 — WHAT I DID */}
        <Reveal as="section" className="cs-section">
          <div className="cs-section__lbl">{t(I.whatididLbl, lang)}</div>
          <h2 className="cs-section__h">{t(I.whatididH, lang)}</h2>
          <div className="cs-process">
            {I.process.map((p, i) => (
              <div className="cs-process__card" key={i}>
                <span className="cs-process__num">↳ {p.n}</span>
                <h3 className="cs-process__h">{t(p.h, lang)}</h3>
                <p className="cs-process__p">{t(p.p, lang)}</p>
              </div>
            ))}
          </div>
          {isCs2 ? (
            <>
              <div className="cs-section__lbl" style={{ marginTop: 48 }}>↳ {t(I.resultLbl, lang)}</div>
              <CS2Carousel pairs={[
                [CS2_BASE + "tiu-menu.jpg",              CS2_BASE + "tiu-cartaz-pf.jpg"],
                [CS2_BASE + "frames/tiu-2.jpg",          CS2_BASE + "tiu-3.jpg"],
                [CS2_BASE + "frames/frame-menu-full.jpg", CS2_BASE + "frames/frame-04.jpg"],
              ]} />
            </>
          ) : isCs3 ? (
            <>
              <div className="cs-section__lbl" style={{ marginTop: 48 }}>↳ {t(I.resultLbl, lang)}</div>
              <CS2Carousel pairs={[
                [CS3_BASE + "buy-login-2.png?v=2",  CS3_BASE + "byu-cadastro.png"],
                [CS3_BASE + "byu-inicio-2.png",  CS3_BASE + "byu-etapas.png",   CS3_BASE + "byu-etapas-2.png"],
                [CS3_BASE + "byu-visto.png",    CS3_BASE + "byu-links.png"],
              ]} />
            </>
          ) : (
            <>
              <div className="cs-section__lbl" style={{ marginTop: 48 }}>↳ {t(I.resultLbl, lang)}</div>
              <CaseCarousel slides={isCs1 ? [
                <CSShot kind={1} />,
                <CSShot kind={2} />,
                <CSShot kind={3} />,
              ] : [
                <CSImageSlot label="Solution image 1" />,
                <CSImageSlot label="Solution image 2" />,
              ]} />
            </>
          )}
        </Reveal>

        {/* § 04 — IMPACT */}
        <Reveal as="section" className="cs-section">
          <div className="cs-section__lbl">{t(I.impactLbl, lang)}</div>
          <h2 className="cs-section__h">{t(I.impactH, lang)}</h2>
          <div className="cs-results">
            <div className="cs-result cs-result--feature">
              <div className="cs-result__n">{I.r1n}</div>
              <div className="cs-result__l">{t(I.r1l, lang)}</div>
            </div>
            <div className="cs-result">
              <div className="cs-result__n">{I.r2n}</div>
              <div className="cs-result__l">{t(I.r2l, lang)}</div>
            </div>
            <div className="cs-result">
              <div className="cs-result__n">{I.r3n}</div>
              <div className="cs-result__l">{t(I.r3l, lang)}</div>
            </div>
          </div>
        </Reveal>

        {/* Next */}
        <Reveal as="div" className="cs-next" onClick={onNext}>
          <div>
            <div className="cs-next__lbl">{t(I.nextLbl, lang)} →</div>
            <div className="cs-next__title">{t(I.nextTitle, lang).replace(/\.$/, "")}<span className="period">.</span></div>
          </div>
          <span className="cs-next__arrow">→</span>
        </Reveal>

      </div>
    </main>
  );
}

Object.assign(window, { CaseStudy });
