// "The Real Problem" — premium B2B conversion section (Sayso).
// Structure: a subtle grid of compact pain items (problem) → a dominant
// transformation band ("The fix") that shows, in ~3 seconds, how one shoot
// becomes several genuinely useful campaign videos. Two simple tabs:
//   What you get  (default)  — the business outputs
//   How it works             — the four-step flow
// Real footage stills. Pink is rationed: accents, dots, connectors only.

const { useState: useStateG, useEffect: useEffectG, useRef: useRefG } = React;
const G_REDUCE = typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
function gAnim(kind, delay, play) {
  if (G_REDUCE) return {};
  const tr = { transition: `opacity 600ms cubic-bezier(.2,0,0,1) ${delay}ms, transform 600ms cubic-bezier(.2,0,0,1) ${delay}ms` };
  if (play) return { ...tr, opacity: 1, transform: "none" };
  const from = kind === "pop" ? "scale(.95)" : kind === "fade" ? "none" : "translateY(14px)";
  return { ...tr, opacity: 0, transform: from };
}

const G_STYLE = `
  @keyframes gb-sweep { 0% { left:6%; } 100% { left:94%; } }
  @keyframes gb-fill { 0% { transform:scaleX(0.06); } 100% { transform:scaleX(1); } }
  .gb-playhead { animation: gb-sweep 9s cubic-bezier(.45,0,.55,1) infinite alternate; }
  .gb-tickfill { transform-origin:left; transform:scaleX(0.06); animation: gb-fill 9s cubic-bezier(.45,0,.55,1) infinite alternate; }
  @media (prefers-reduced-motion: reduce) { .gb-playhead, .gb-tickfill { animation:none; } }
  .gb { position:relative; background:var(--bg-white); overflow:hidden; }
  .gb-wrap { position:relative; max-width:1240px; margin:0 auto; padding:0 56px; }

  /* problem area */
  .gb-prob { position:relative; overflow:hidden; }
  /* continuous editorial grid plane behind the whole problem section */
  .gb-prob::before { display:none; content:""; position:absolute; inset:0; pointer-events:none; z-index:0;
    background-image:
      url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='116'%20height='116'%3E%3Cpath%20d='M58%2051%20C58.4%2056%2060%2057.6%2065%2058%20C60%2058.4%2058.4%2060%2058%2065%20C57.6%2060%2056%2058.4%2051%2058%20C56%2057.6%2057.6%2056%2058%2051%20Z'%20fill='rgba(0,0,0,0.16)'/%3E%3C/svg%3E"),
      linear-gradient(to right, transparent 57px, rgba(0,0,0,0.04) 57px 58px, transparent 58px),
      linear-gradient(to bottom, transparent 57px, rgba(0,0,0,0.04) 57px 58px, transparent 58px);
    background-size:116px 116px, 116px 116px, 116px 116px;
    background-position:center top;
    -webkit-mask-image:linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
    mask-image:linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent); }
  .gb-guide { position:absolute; top:0; bottom:0; width:1px; background:rgba(0,0,0,0.04); z-index:0; }
  .gb-plus { position:absolute; width:14px; height:14px; z-index:4; transform:translate(-50%,-50%); pointer-events:none;
    background:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%201%20C12.6%208%2016%2011.4%2023%2012%20C16%2012.6%2012.6%2016%2012%2023%20C11.4%2016%208%2012.6%201%2012%20C8%2011.4%2011.4%208%2012%201%20Z'%20fill='%23C9C9C9'/%3E%3C/svg%3E") center/contain no-repeat; }
  .gb-plus::before, .gb-plus::after { content:none; }

  /* layer 2 — headline floats in a clean white pocket above the plane */
  .gb-head { position:relative; z-index:2; text-align:center; padding:60px 0 54px; }
  .gb-head::before { content:""; position:absolute; left:50%; top:46%; transform:translate(-50%,-50%);
    width:820px; height:300px; z-index:-1; pointer-events:none;
    background:radial-gradient(ellipse at center, #fff 0%, #fff 42%, rgba(255,255,255,0) 74%); }
  .gb-lbl { display:inline-flex; align-items:center; gap:10px; padding:8px 16px; border-radius:999px;
            background:#fff; border:1px solid var(--line); font:600 13px/1 var(--font-sans);
            letter-spacing:.16em; text-transform:uppercase; color:var(--text-secondary); white-space:nowrap; }
  .gb-lbl .d { width:6px; height:6px; border-radius:999px; background:var(--brand-600); flex:none; }
  .gb-lbl--fix { font-weight:600; font-size:13px; letter-spacing:.16em; color:var(--text-secondary); }
  .gb-h2 { font:700 clamp(40px,4.6vw,60px)/1.07 var(--font-sans); letter-spacing:-0.035em;
           color:var(--text-primary); margin:18px auto 0; max-width:860px; text-wrap:balance; }
  .gb-sub { font:400 clamp(18px,1.9vw,21px)/1.45 var(--font-sans); letter-spacing:-0.01em;
            color:var(--text-secondary); margin:16px auto 0; max-width:560px; }

  /* layer 1 — tiles carved out of the plane: they rest LIFTED, casting soft
     shadow so the depth (and the connection to the plane) is always felt */
  .gb-grid { position:relative; z-index:2; display:grid; grid-template-columns:repeat(4,1fr); gap:20px; }
  .gb-cell { position:relative; padding:28px 24px 30px; border-radius:16px; background:#fff;
             border:1px solid var(--line);
             box-shadow: var(--shadow-card);
             transition: transform 0.28s cubic-bezier(0.2,0,0,1), box-shadow 0.28s cubic-bezier(0.2,0,0,1); }
  .gb-cell:hover { transform: translateY(-4px); z-index:3;
                   box-shadow: var(--shadow-lift); }
  .gb-item { display:flex; flex-direction:column; gap:14px; align-items:flex-start; }
  .gb-ic { flex:none; width:24px; height:24px; color:var(--text-secondary);
           transition: color 0.25s cubic-bezier(0.4,0,0.2,1), transform 0.25s cubic-bezier(0.4,0,0.2,1); }
  .gb-cell:hover .gb-ic { color:#FF238C; transform: translateY(-2px) scale(1.04); }
  .gb-title { font:600 18px/1.3 var(--font-sans); letter-spacing:-0.02em; color:var(--text-primary); }
  .gb-desc { font:400 15px/1.45 var(--font-sans); color:var(--text-secondary); margin-top:7px; }
  @media (max-width:860px){ .gb-grid { grid-template-columns:1fr 1fr; } }
  @media (max-width:560px){ .gb-grid { grid-template-columns:1fr; } }

  /* transformation band — editorial grid (Firecrawl/Peec-style) */
  .gb-fix { position:relative; background:#fff; border-top:1px solid rgba(0,0,0,0.06); }
  .gb-fix::before { display:none; content:""; position:absolute; inset:0; pointer-events:none; z-index:0;
    background-image:
      url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='116'%20height='116'%3E%3Cpath%20d='M58%2051%20C58.4%2056%2060%2057.6%2065%2058%20C60%2058.4%2058.4%2060%2058%2065%20C57.6%2060%2056%2058.4%2051%2058%20C56%2057.6%2057.6%2056%2058%2051%20Z'%20fill='rgba(0,0,0,0.14)'/%3E%3C/svg%3E"),
      linear-gradient(to right, transparent 57px, rgba(0,0,0,0.045) 57px 58px, transparent 58px),
      linear-gradient(to bottom, transparent 57px, rgba(0,0,0,0.045) 57px 58px, transparent 58px);
    background-size:116px 116px, 116px 116px, 116px 116px;
    background-position:center top;
    -webkit-mask-image:radial-gradient(68% 38% at 50% 50%, #000 0%, #000 30%, rgba(0,0,0,0.35) 58%, transparent 80%);
    mask-image:radial-gradient(68% 38% at 50% 50%, #000 0%, #000 30%, rgba(0,0,0,0.35) 58%, transparent 80%); }
  .gb-fix-in { position:relative; z-index:1; max-width:1240px; margin:0 auto; padding:72px 56px 92px; text-align:center; }
  .gb-fix-h { font:700 clamp(28px,3vw,40px)/1.12 var(--font-sans); letter-spacing:-0.03em;
              color:var(--text-primary); margin:18px auto 0; max-width:760px; text-wrap:balance; }
  .gb-fix-p { font:400 clamp(16px,1.7vw,18px)/1.5 var(--font-sans); color:var(--text-secondary);
              margin:14px auto 0; max-width:640px; text-align:center; }

  /* tab toggle */
  .gb-seg { display:inline-flex; gap:4px; margin:30px auto 0; padding:5px; background:rgba(0,0,0,0.05); border-radius:999px; }
  .gb-seg button { appearance:none; border:none; cursor:pointer; background:transparent; color:var(--text-tertiary);
                   font:600 14.5px/1 var(--font-sans); letter-spacing:-0.01em; padding:11px 22px; border-radius:999px; white-space:nowrap;
                   transition:background .2s cubic-bezier(.2,0,0,1), color .2s cubic-bezier(.2,0,0,1); }
  .gb-seg button:hover:not(.on) { color:var(--text-secondary); }
  .gb-seg button.on { background:#fff; color:var(--text-primary); box-shadow:var(--shadow-card); }

  /* what you get — output cards */
  .gb-outs { display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
  .gb-more { margin-top:18px; display:flex; align-items:center; justify-content:center; gap:10px;
             border:1.5px dashed var(--line-strong); border-radius:18px; padding:16px 22px; }

  .gb-close { font:500 clamp(17px,1.9vw,20px)/1.4 var(--font-sans); letter-spacing:-0.015em;
              color:var(--text-secondary); text-wrap:balance; }
  .gb-close b { color:var(--text-primary); font-weight:600; }

  @media (max-width:900px) {
    .gb-wrap { padding:0 22px; }
    .gb-head { padding:72px 0 40px; }
    .gb-grid { grid-template-columns:1fr; }
    .gb-fix-in { padding:52px 22px 64px; }
    .gb-outs { grid-template-columns:1fr; max-width:420px; margin-left:auto; margin-right:auto; }
    .gb-arrow { display:none; }
  }
`;

// Tiny white play triangle on a blurred dark circle (generic video mark).
function PlayDot({ d = 28 }) {
  return (
    <span style={{ position: "absolute", top: "50%", left: "50%", transform: "translate(-50%,-50%)", width: d, height: d, borderRadius: 999, background: "rgba(0,0,0,0.24)", backdropFilter: "blur(14px)", WebkitBackdropFilter: "blur(14px)", display: "flex", alignItems: "center", justifyContent: "center" }}>
      <svg width={Math.round(d * 0.34)} height={Math.round(d * 0.34)} viewBox="0 0 24 24" fill="#fff"><path d="M8 5v14l11-7z" /></svg>
    </span>
  );
}

// Subtle, monochrome platform hints (never brand-colored, per the system).
const GS = { fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round" };
function GlyphInstagram({ s = 15 }) {
  return <svg width={s} height={s} viewBox="0 0 24 24" {...GS}><rect x="3" y="3" width="18" height="18" rx="5" /><circle cx="12" cy="12" r="4" /><circle cx="17.2" cy="6.8" r="1" fill="currentColor" stroke="none" /></svg>;
}
function GlyphMeta({ s = 15 }) {
  return <svg width={s} height={s} viewBox="0 0 24 24" {...GS}><path d="M3 16c1.6 0 2.8-1.6 4-3.6 1.4-2.4 2.6-4.4 4-4.4 1.6 0 2.6 2 3.6 4 1 1.9 1.9 4 3.8 4 1.6 0 2.2-1.6 2.2-3.2 0-3.8-2.3-8.8-5.6-8.8-2.3 0-4 2.6-5.2 5" /></svg>;
}
function GlyphYouTube({ s = 15 }) {
  return <svg width={s} height={s} viewBox="0 0 24 24" {...GS}><rect x="2.5" y="6" width="19" height="12" rx="3.5" /><path d="M10.5 9.2v5.6L15 12z" fill="currentColor" stroke="none" /></svg>;
}
function GlyphSalesLink({ s = 15 }) {
  return <svg width={s} height={s} viewBox="0 0 24 24" {...GS}><path d="M9.5 14.5l5-5" /><path d="M8 11.5 6.2 13.3a3.1 3.1 0 0 0 4.4 4.4l1.8-1.8" /><path d="M16 12.5l1.8-1.8a3.1 3.1 0 0 0-4.4-4.4l-1.8 1.8" /></svg>;
}

// Reveal-on-scroll: fires once when the element scrolls into view. Capture-phase
// scroll listener + immediate in-view check + safety fallback so content can
// never stay hidden if no scroll event arrives.
function useReveal() {
  const ref = useRefG(null);
  const [shown, setShown] = useStateG(G_REDUCE);
  useEffectG(() => {
    if (G_REDUCE) { setShown(true); return; }
    const el = ref.current;
    if (!el) return;
    let done = false;
    const reveal = () => { if (done) return; done = true; setShown(true); cleanup(); };
    const check = () => {
      if (done) return;
      const r = el.getBoundingClientRect();
      const vh = window.innerHeight || document.documentElement.clientHeight || 0;
      if (r.top < vh * 0.88 && r.bottom > 0) reveal();
    };
    const cleanup = () => {
      window.removeEventListener("scroll", check, true);
      window.removeEventListener("resize", check);
      clearTimeout(timer);
    };
    window.addEventListener("scroll", check, true);
    window.addEventListener("resize", check);
    const raf = requestAnimationFrame(check);
    const timer = setTimeout(reveal, 1500);
    return () => { cleanup(); cancelAnimationFrame(raf); };
  }, []);
  return [ref, shown];
}
function vReveal(shown, delay = 0, dist = 20) {
  if (G_REDUCE) return {};
  const tr = { transition: `opacity 600ms cubic-bezier(.2,0,0,1) ${delay}ms, transform 600ms cubic-bezier(.2,0,0,1) ${delay}ms` };
  return shown ? { ...tr, opacity: 1, transform: "none" } : { ...tr, opacity: 0, transform: dist ? `translateY(${dist}px)` : "none" };
}

// ─── SOURCE — horizontal shooting-day footage strip / editing timeline ───────
function FilmStripWide() {
  const frames = [
    "assets/footage/r-source.png", "assets/footage/r-169.png", "assets/footage/r-916.png",
    "assets/footage/r-11.png", "assets/footage/r-source.png", "assets/footage/r-169.png",
    "assets/footage/r-916.png", "assets/footage/r-11.png",
  ];
  const sprockets = "repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,255,255,0.38) 7px 13px, transparent 13px 21px)";
  const ticks = "repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 34px)";
  return (
    <div style={{ width: "100%", background: "#fff", border: "1px solid var(--line)", borderRadius: 26, padding: 24, boxShadow: "var(--shadow-lift)" }}>
      <div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", marginBottom: 17, gap: 16, flexWrap: "wrap" }}>
        <div style={{ textAlign: "left" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 9 }}>
            <span style={{ width: 8, height: 8, borderRadius: 999, background: "var(--brand-600)", flex: "none" }} />
            <span style={{ font: "600 19px/1 var(--font-sans)", letterSpacing: "-0.02em", color: "var(--text-primary)", whiteSpace: "nowrap" }}>Shooting-day footage</span>
          </div>
          <div style={{ font: "400 14px/1.4 var(--font-sans)", color: "var(--text-tertiary)", marginTop: 6, whiteSpace: "nowrap" }}>Captured once. Used for multiple clips.</div>
        </div>
        <span style={{ display: "inline-flex", alignItems: "center", gap: 8, border: "1px dashed var(--line-strong)", borderRadius: 999, padding: "6px 13px", font: "500 12px/1 var(--font-sans)", color: "var(--text-tertiary)", whiteSpace: "nowrap" }}>
          <span style={{ width: 14, height: 14, color: "var(--text-tertiary)", display: "flex" }}><svg width="14" height="14" viewBox="0 0 24 24" {...GS}><path d="m9 8 7 4-7 4V8Z" /><circle cx="12" cy="12" r="9.2" /></svg></span>
          Also used for the main testimonial
        </span>
      </div>
      <div style={{ position: "relative", background: "#1a1614", borderRadius: 12, padding: "13px 0", overflow: "hidden" }}>
        <div style={{ position: "absolute", top: 0, left: 0, right: 0, height: 8, background: sprockets }} />
        <div style={{ position: "absolute", bottom: 0, left: 0, right: 0, height: 8, background: sprockets }} />
        <div style={{ display: "flex", gap: 4, padding: "0 14px" }}>
          {frames.map((src, i) => (
            <div key={i} style={{ position: "relative", flex: "1 1 0", minWidth: 0, height: 100, borderRadius: 4, overflow: "hidden", background: "#100d0c" }}>
              <img src={src} alt="" draggable="false" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
            </div>
          ))}
        </div>
        {/* playhead */}
        <div className="gb-playhead" style={{ position: "absolute", top: 4, bottom: 4, left: "38%", width: 2, background: "rgba(255,255,255,0.9)" }}>
          <span style={{ position: "absolute", top: -1, left: "50%", transform: "translateX(-50%)", width: 9, height: 9, borderRadius: 999, background: "#fff" }} />
        </div>
      </div>
      <div style={{ marginTop: 15, display: "flex", alignItems: "center", gap: 14 }}>
        <span style={{ font: "500 11px/1 var(--font-mono, monospace)", letterSpacing: ".05em", color: "var(--text-tertiary)" }}>0:00</span>
        <div style={{ flex: 1, height: 9, background: ticks, opacity: 0.7, position: "relative", overflow: "hidden" }}>
          <div className="gb-tickfill" style={{ position: "absolute", inset: 0, background: "var(--brand-600)", opacity: 0.5 }} />
        </div>
        <span style={{ font: "500 11px/1 var(--font-mono, monospace)", letterSpacing: ".05em", color: "var(--text-tertiary)" }}>0:42</span>
      </div>
    </div>
  );
}

// One-to-many fork: a single feeder from the strip splits to three card columns.
// All segments are axis-aligned, so the SVG scales responsively (non-uniform).
function Fork({ shown }) {
  const ease = "cubic-bezier(.2,0,0,1)";
  return (
    <div aria-hidden style={{ width: "100%", height: 64, position: "relative", opacity: shown ? 1 : 0, transition: G_REDUCE ? undefined : `opacity 500ms ${ease} 120ms` }}>
      <svg width="100%" height="64" viewBox="0 0 1000 64" preserveAspectRatio="none" style={{ display: "block" }}>
        <g fill="none" stroke="var(--brand-600)" strokeWidth="1.5" strokeLinecap="round" vectorEffect="non-scaling-stroke">
          <path d="M500 0 V 26" />
          <path d="M167 26 H 833" />
          <path d="M167 26 V 64" />
          <path d="M500 26 V 64" />
          <path d="M833 26 V 64" />
        </g>
        <circle cx="500" cy="26" r="4" fill="var(--brand-600)" />
      </svg>
    </div>
  );
}

// One output clip card. Every card shares the SAME media-well height, title
// position, description position, and bottom-aligned metadata — but the clip
// INSIDE the well takes the use-case's real shape (9:16 / 1:1 / 16:9), so the
// format reads visually, not just in text. Platform hints are quiet glyphs.
const WELL_H = 196;
function OutputCard({ src, shape, Icon, title, desc, platforms }) {
  const dims = shape === "9:16" ? { w: 96, h: 170 } : shape === "1:1" ? { w: 156, h: 156 } : { w: 250, h: 141 };
  return (
    <div style={{ display: "flex", flexDirection: "column", background: "#fff", border: "1px solid var(--line)", borderRadius: 20, overflow: "hidden", boxShadow: "var(--shadow-card)", height: "100%" }}>
      <div style={{ position: "relative", width: "100%", height: WELL_H, background: "#15110f", display: "flex", alignItems: "center", justifyContent: "center", overflow: "hidden" }}>
        {/* soft blurred fill so letterboxed shapes never look empty */}
        <img src={src} alt="" draggable="false" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", filter: "blur(18px) brightness(.4)", transform: "scale(1.15)" }} />
        <div style={{ position: "relative", width: dims.w, height: dims.h, borderRadius: 10, overflow: "hidden", boxShadow: "0 6px 18px rgba(0,0,0,0.35)", background: "#1a1614" }}>
          <img src={src} alt="" draggable="false" style={{ position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover", display: "block" }} />
          <div style={{ position: "absolute", inset: 0, background: "linear-gradient(rgba(0,0,0,0) 55%, rgba(0,0,0,0.4))" }} />
          <PlayDot d={32} />
        </div>
        <span style={{ position: "absolute", top: 11, left: 12, font: "600 11px/1 var(--font-sans)", letterSpacing: ".02em", color: "#fff", background: "rgba(0,0,0,0.4)", backdropFilter: "blur(8px)", WebkitBackdropFilter: "blur(8px)", borderRadius: 6, padding: "5px 8px" }}>{shape}</span>
      </div>
      <div style={{ padding: "20px 20px 20px", textAlign: "left", display: "flex", flexDirection: "column", flex: 1 }}>
        <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
          <span style={{ flex: "none", width: 20, height: 20, color: "var(--text-primary)", display: "flex" }}><Icon size={20} /></span>
          <span style={{ font: "600 19px/1.25 var(--font-sans)", letterSpacing: "-0.02em", color: "var(--text-primary)", whiteSpace: "nowrap" }}>{title}</span>
        </div>
        <p style={{ margin: "9px 0 0", font: "400 15px/1.45 var(--font-sans)", color: "var(--text-secondary)" }}>{desc}</p>
        <div style={{ marginTop: "auto", paddingTop: 16, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 10, borderTop: "1px solid var(--line-subtle)" }}>
          <span style={{ font: "500 12.5px/1 var(--font-sans)", color: "var(--text-tertiary)", whiteSpace: "nowrap" }}>15–45 sec · 9:16 · 1:1 · 16:9</span>
          <span style={{ display: "inline-flex", alignItems: "center", gap: 8, color: "var(--text-inactive)", flex: "none" }}>
            {platforms.map((P, i) => <P key={i} s={15} />)}
          </span>
        </div>
      </div>
    </div>
  );
}

// ─── TAB 1 — WHAT YOU GET ────────────────────────────────────────────────────
function WhatYouGet() {
  const [ref, shown] = useReveal();
  const outs = [
    { src: "assets/footage/r-916.png", shape: "9:16", Icon: IconMegaphone, title: "Paid ad clip", desc: "Short customer proof for campaigns.", platforms: [GlyphMeta, GlyphInstagram] },
    { src: "assets/footage/r-11.png", shape: "1:1", Icon: IconHash, title: "Social proof clip", desc: "A strong customer moment for organic and social.", platforms: [GlyphInstagram, GlyphYouTube] },
    { src: "assets/footage/r-169.png", shape: "16:9", Icon: IconSend, title: "Sales follow-up clip", desc: "A short video your sales team can send after calls.", platforms: [GlyphSalesLink] },
  ];
  return (
    <div ref={ref} style={{ width: "100%", maxWidth: 1040, margin: "0 auto" }}>
      <div style={vReveal(shown, 0)}><FilmStripWide /></div>
      <Fork shown={shown} />
      <div className="gb-outs">
        {outs.map((o, i) => (
          <div key={i} style={vReveal(shown, 180 + i * 90)}><OutputCard {...o} /></div>
        ))}
      </div>
      <div className="gb-more" style={vReveal(shown, 470)}>
        <span style={{ font: "300 22px/1 var(--font-sans)", color: "var(--brand-600)" }}>+</span>
        <span style={{ font: "500 15px/1.3 var(--font-sans)", color: "var(--text-secondary)" }}>More clips when the footage supports it</span>
      </div>
    </div>
  );
}

// ─── TAB 2 — HOW IT WORKS ────────────────────────────────────────────────────
function StepArrow() {
  return (
    <span style={{ alignSelf: "center", color: "var(--brand-600)", display: "flex", padding: "0 4px" }}>
      <svg width="22" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M5 12h13M13 6l6 6-6 6" /></svg>
    </span>
  );
}
function HowItWorks() {
  const [ref, shown] = useReveal();
  const steps = [
    { n: "01", t: "We scan the shoot day", d: "Interview, b-roll, and real moments beyond the main film." },
    { n: "02", t: "You get 3 directions", d: "Suggested clip angles from the strongest campaign moments." },
    { n: "03", t: "You choose or build", d: "Pick one, choose several, or create your own mix." },
    { n: "04", t: "We produce the clips", d: "Delivered in 9:16, 1:1, and 16:9, with review and comments." },
  ];
  return (
    <div ref={ref} style={{ width: "100%", maxWidth: 1060, margin: "0 auto" }}>
      <div style={{ display: "flex", alignItems: "stretch", justifyContent: "center", gap: 6, flexWrap: "wrap" }}>
        {steps.map((s, i) => (
          <React.Fragment key={s.n}>
            <div style={{ flex: "1 1 200px", minWidth: 184, maxWidth: 244, textAlign: "left", background: "#fff", border: "1px solid var(--line)", borderRadius: 20, padding: "22px 22px 24px", boxShadow: "var(--shadow-card)", ...vReveal(shown, i * 110) }}>
              <div style={{ font: "600 13px/1 var(--font-sans)", letterSpacing: ".12em", color: "var(--brand-600)" }}>{s.n}</div>
              <div style={{ font: "600 18px/1.28 var(--font-sans)", letterSpacing: "-0.02em", color: "var(--text-primary)", marginTop: 14, textWrap: "balance" }}>{s.t}</div>
              <p style={{ margin: "8px 0 0", font: "400 14px/1.45 var(--font-sans)", color: "var(--text-tertiary)" }}>{s.d}</p>
            </div>
            {i < steps.length - 1 && <div className="gb-arrow" style={vReveal(shown, i * 110 + 55, 0)}><StepArrow /></div>}
          </React.Fragment>
        ))}
      </div>
    </div>
  );
}

// ─── STANDALONE: visual product demo (one testimonial → 3-format pack) ───────
function FixVisual() {
  const [play, setPlay] = useStateG(false);
  useEffectG(() => { const t = setTimeout(() => setPlay(true), 140); return () => clearTimeout(t); }, []);
  return (
    <section className="gb">
      <div className="gb-fix">
        <div className="gb-fix-in">
          <span className="gb-lbl gb-lbl--fix" style={gAnim("rise", 0, play)}><span className="d"></span>The Fix<span className="d"></span></span>
          <h3 className="gb-fix-h" style={gAnim("rise", 60, play)}>From one approved testimonial to <span style={{ color: "var(--brand-600)" }}>campaign-ready clips.</span></h3>
          <p className="gb-fix-p" style={gAnim("rise", 120, play)}>One customer story becomes paid ads, sales follow-ups, and social proof assets.</p>
          <div style={{ marginTop: 52 }}><WhatYouGet /></div>
        </div>
      </div>
    </section>
  );
}

// ─── STANDALONE: the real problem (parameterized 4-card grid) ────────────────
function ProblemGrid({ label, headline, sub, cards }) {
  const [play, setPlay] = useStateG(false);
  useEffectG(() => { const t = setTimeout(() => setPlay(true), 120); return () => clearTimeout(t); }, []);
  return (
    <section className="gb" style={{ background: "#fff" }}>
      <div className="gb-prob">
        <div className="gb-wrap">
          <header className="gb-head">
            <span className="gb-lbl" style={gAnim("rise", 0, play)}><span className="d"></span>{label}<span className="d"></span></span>
            <h2 className="gb-h2" style={gAnim("rise", 70, play)} dangerouslySetInnerHTML={{ __html: headline }} />
            <p className="gb-sub" style={gAnim("rise", 140, play)}>{sub}</p>
          </header>
          <div className="gb-grid">
            {cards.map((p, i) => (
              <div key={i} className="gb-cell" style={gAnim("rise", 210 + i * 60, play)}>
                <div className="gb-item">
                  <span className="gb-ic"><p.Icon size={22} /></span>
                  <div>
                    <div className="gb-title">{p.t}</div>
                    <div className="gb-desc">{p.d}</div>
                  </div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
}

function GridBuild() {
  const [play, setPlay] = useStateG(false);
  useEffectG(() => { const t = setTimeout(() => setPlay(true), 140); return () => clearTimeout(t); }, []);
  const [tab, setTab] = useStateG(() => {
    try { const v = localStorage.getItem("gb-fix-tab"); return v === "how" ? "how" : "get"; } catch (e) { return "get"; }
  });
  useEffectG(() => { try { localStorage.setItem("gb-fix-tab", tab); } catch (e) {} }, [tab]);

  const pains = [
    { Icon: IconSend, t: "Sales teams need proof", d: "Short customer videos they can send right now." },
    { Icon: IconMegaphone, t: "Paid campaigns need fresh creative", d: "New angles, new cuts, less ad fatigue." },
    { Icon: IconHash, t: "Social channels need constant content", d: "Always-on channels need a steady flow." },
    { Icon: IconClock, t: "New shoots don’t scale", d: "Every new production adds time, cost, and coordination." },
  ];

  return (
    <section className="gb">
      <style>{G_STYLE}</style>

      <div className="gb-prob">
        <div className="gb-wrap">
          <header className="gb-head">
            <span className="gb-lbl" style={gAnim("rise", 0, play)}><span className="d"></span>The Real Problem<span className="d"></span></span>
            <h2 className="gb-h2" style={gAnim("rise", 70, play)}>
              Marketing and sales teams never have enough <span style={{ color: "var(--brand-600)" }}>video assets.</span>
            </h2>
            <p className="gb-sub" style={gAnim("rise", 140, play)}>Campaigns need fresh creative. New productions don’t scale.</p>
          </header>

          <div className="gb-grid">
            {pains.map((p, i) => (
              <div key={i} className="gb-cell" style={gAnim("rise", 210 + i * 60, play)}>
                {i === 0 && <span className="gb-plus" style={{ left: "100%", top: 0 }}></span>}
                {i === 0 && <span className="gb-plus" style={{ left: "100%", top: "100%" }}></span>}
                <div className="gb-item">
                  <span className="gb-ic"><p.Icon size={22} /></span>
                  <div>
                    <div className="gb-title">{p.t}</div>
                    <div className="gb-desc">{p.d}</div>
                  </div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>

      <div className="gb-fix">
        <div className="gb-fix-in">
          <span className="gb-lbl gb-lbl--fix" style={gAnim("rise", 120, play)}><span className="d"></span>How it works<span className="d"></span></span>
          <h3 className="gb-fix-h" style={gAnim("rise", 180, play)}>Your film is done. Your next clips are <span style={{ color: "var(--brand-600)" }}>already mapped out.</span></h3>
          <p className="gb-fix-p" style={gAnim("rise", 240, play)}>The main film tells the story. The other strong moments from your shoot day become proof for paid, social, and sales.</p>
          <div className="gb-seg" role="tablist" style={gAnim("rise", 300, play)}>
            <button type="button" className={tab === "get" ? "on" : ""} onClick={() => setTab("get")}>What you get</button>
            <button type="button" className={tab === "how" ? "on" : ""} onClick={() => setTab("how")}>How it works</button>
          </div>
          <div style={{ marginTop: 52 }}>{tab === "get" ? <WhatYouGet /> : <HowItWorks />}</div>
          <p className="gb-close" style={{ margin: "48px auto 0", maxWidth: 600 }}>
            <b>You already have the material.</b> Sayso finds the campaign value inside it.
          </p>
        </div>
      </div>
    </section>
  );
}

window.GridBuild = GridBuild;
Object.assign(window, { GB_STYLE: G_STYLE, FixVisual, ProblemGrid, GbWhatYouGet: WhatYouGet });
