// ============================================================
// autoclient.io — shared content data + placeholder media
// ProjectThumb now renders contextual SVG illustrations per slug
// ============================================================

const CLIENTS = ["Enterprise SaaS", "Cloud Infrastructure", "National Ecommerce", "Cosmetic Surgery", "Multi-Location Law", "Local Service Brands"];

function ClientWordmark({ name, light }) {
  return (
    <span style={{ fontSize: 17, fontWeight: 600, letterSpacing: "-0.01em", whiteSpace: "nowrap", color: light ? "rgba(35,31,32,0.5)" : "var(--fg-on-dark-2)", opacity: 0.85 }}>{name}</span>
  );
}

const HUES = {
  purple: "linear-gradient(135deg,#8784FD,#CC99FF)",
  pink: "linear-gradient(135deg,#CC99FF,#FF99CC)",
  coral: "linear-gradient(135deg,#FF99CC,#FF6666)",
  mix: "linear-gradient(135deg,#8784FD,#FF99CC,#FF6666)",
  violet: "linear-gradient(135deg,#8784FD,#FF6666)",
};
function initials(name) { return name.split(" ").map((w) => w[0]).slice(0, 2).join(""); }

function Avatar({ name, hue = "purple", size = 56 }) {
  return (
    <span title={name} style={{ width: size, height: size, borderRadius: 99, flexShrink: 0, display: "inline-flex", alignItems: "center", justifyContent: "center", background: HUES[hue] || HUES.purple, color: "#fff", fontWeight: 600, fontSize: size * 0.34, letterSpacing: "-0.01em", boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.18)" }}>{initials(name)}</span>
  );
}

// ============================================================
// Contextual SVG thumbnail illustrations
// Each renders a mini-mockup of a real UI fitting the context
// ============================================================

/* ---- shared SVG primitives ---- */
const FF = "system-ui,-apple-system,sans-serif"; // font-family for SVG text

/* ---- SaaS / paid marketing analytics dashboard ---- */
function ThumbSaaS() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="sas-gh" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#FF6666"/></linearGradient>
        <linearGradient id="sas-gl" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#CC99FF"/></linearGradient>
        <linearGradient id="sas-ga" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stopColor="#8784FD" stopOpacity="0.38"/><stop offset="100%" stopColor="#8784FD" stopOpacity="0"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#1A1718"/>
      {/* topbar */}
      <rect width="800" height="46" fill="#252122"/>
      <rect x="16" y="14" width="18" height="18" rx="4" fill="url(#sas-gh)"/>
      <rect x="42" y="19" width="64" height="7" rx="3" fill="#fff" fillOpacity="0.7"/>
      {[130,184,238,292].map((x,i)=><rect key={i} x={x} y="20" width="42" height="6" rx="3" fill="#888" fillOpacity="0.45"/>)}
      <rect x="708" y="13" width="76" height="20" rx="10" fill="url(#sas-gh)"/>
      {/* sidebar */}
      <rect x="0" y="46" width="144" height="454" fill="#201D1E"/>
      {[0,1,2,3,4].map(i=>(
        <g key={i}>
          <rect x="16" y={74+i*38} width="12" height="12" rx="3" fill={i===0?"#8784FD":"#3a3540"} fillOpacity={i===0?1:0.8}/>
          <rect x="36" y={77+i*38} width={i===0?76:56} height="7" rx="3" fill={i===0?"#f9f8f6":"#666"} fillOpacity={i===0?0.9:0.5}/>
        </g>
      ))}
      {/* KPI cards */}
      {[{x:160,v:"4.7×",c:"#8784FD"},{x:344,v:"-38%",c:"#CC99FF"},{x:528,v:"3.2×",c:"#FF99CC"}].map(({x,v,c})=>(
        <g key={x}>
          <rect x={x} y="58" width="168" height="74" rx="10" fill="#2E2A2B"/>
          <rect x={x+12} y="74" width="4" height="24" rx="2" fill={c}/>
          <text x={x+24} y="93" fill={c} fontSize="21" fontWeight="700" fontFamily={FF}>{v}</text>
          <rect x={x+24} y="100" width="86" height="6" rx="3" fill="#fff" fillOpacity="0.22"/>
        </g>
      ))}
      {/* chart area */}
      <rect x="160" y="144" width="412" height="214" rx="10" fill="#2E2A2B"/>
      <rect x="172" y="158" width="110" height="8" rx="4" fill="#fff" fillOpacity="0.65"/>
      <rect x="172" y="172" width="68" height="6" rx="3" fill="#555"/>
      {[206,232,258,284,310,336].map(y=><line key={y} x1="172" y1={y} x2="560" y2={y} stroke="#fff" strokeWidth="0.5" strokeOpacity="0.07"/>)}
      <path d="M172,348 218,334 268,320 318,300 368,272 418,248 468,222 518,202 560,180 560,354 172,354Z" fill="url(#sas-ga)"/>
      <polyline points="172,348 218,334 268,320 318,300 368,272 418,248 468,222 518,202 560,180" fill="none" stroke="url(#sas-gl)" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"/>
      <circle cx="560" cy="180" r="5" fill="#CC99FF" fillOpacity="0.9"/>
      {/* bar chart panel */}
      <rect x="588" y="144" width="168" height="214" rx="10" fill="#2E2A2B"/>
      <rect x="600" y="158" width="80" height="8" rx="4" fill="#fff" fillOpacity="0.65"/>
      {[{h:60,c:"#8784FD"},{h:100,c:"#CC99FF"},{h:76,c:"#FF99CC"},{h:118,c:"#8784FD"}].map((b,i)=>(
        <rect key={i} x={600+i*32} y={340-b.h} width="24" height={b.h} rx="4" fill={b.c} fillOpacity="0.88"/>
      ))}
      {/* table rows */}
      {[0,1,2].map(i=>(
        <g key={i}>
          <rect x="160" y={370+i*34} width="596" height="26" rx="7" fill={i%2===0?"#2E2A2B":"#252122"}/>
          {[0,1,2,3].map(j=><rect key={j} x={172+j*108} y={381+i*34} width={[90,70,58,44][j]} height="7" rx="3" fill={["#8784FD","#CC99FF","#FF99CC","#888"][j]} fillOpacity={j<3?0.75:0.38}/>)}
        </g>
      ))}
    </svg>
  );
}

/* ---- Cloud / SEO organic-growth dashboard ---- */
function ThumbCloud() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="cld-gl" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#CC99FF"/></linearGradient>
        <linearGradient id="cld-ga" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stopColor="#CC99FF" stopOpacity="0.35"/><stop offset="100%" stopColor="#CC99FF" stopOpacity="0"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#1A1718"/>
      {/* header */}
      <rect width="800" height="46" fill="#252122"/>
      <rect x="16" y="14" width="18" height="18" rx="4" fill="url(#cld-gl)"/>
      <rect x="42" y="19" width="64" height="7" rx="3" fill="#fff" fillOpacity="0.7"/>
      {[130,184,238].map((x,i)=><rect key={i} x={x} y="20" width="42" height="6" rx="3" fill="#888" fillOpacity="0.4"/>)}
      {/* overline */}
      <rect x="24" y="60" width="90" height="7" rx="3" fill="#CC99FF" fillOpacity="0.7"/>
      {/* headline blocks */}
      <rect x="24" y="78" width="280" height="14" rx="5" fill="#fff" fillOpacity="0.82"/>
      <rect x="24" y="98" width="220" height="14" rx="5" fill="#fff" fillOpacity="0.82"/>
      <rect x="24" y="124" width="340" height="7" rx="3" fill="#666" fillOpacity="0.7"/>
      <rect x="24" y="138" width="300" height="7" rx="3" fill="#666" fillOpacity="0.7"/>
      {/* stat pills */}
      {[{l:"180%",s:"traffic",c:"#8784FD"},{l:"120+",s:"keywords",c:"#CC99FF"},{l:"4.1×",s:"org. leads",c:"#FF99CC"}].map(({l,s,c},i)=>(
        <g key={i}>
          <rect x={24+i*130} y="164" width="118" height="52" rx="10" fill="#2E2A2B"/>
          <text x={34+i*130} y="190" fill={c} fontSize="20" fontWeight="700" fontFamily={FF}>{l}</text>
          <rect x={34+i*130} y="198" width="72" height="6" rx="3" fill="#fff" fillOpacity="0.28"/>
        </g>
      ))}
      {/* big organic traffic chart */}
      <rect x="24" y="228" width="752" height="200" rx="12" fill="#2E2A2B"/>
      <rect x="40" y="246" width="120" height="9" rx="4" fill="#fff" fillOpacity="0.65"/>
      <rect x="40" y="260" width="80" height="6" rx="3" fill="#555"/>
      {[280,310,340,370,398].map(y=><line key={y} x1="40" y1={y} x2="760" y2={y} stroke="#fff" strokeWidth="0.5" strokeOpacity="0.07"/>)}
      <path d="M40,412 100,408 160,402 220,390 280,374 340,350 400,322 460,290 520,256 580,232 640,218 700,206 760,192 760,418 40,418Z" fill="url(#cld-ga)"/>
      <polyline points="40,412 100,408 160,402 220,390 280,374 340,350 400,322 460,290 520,256 580,232 640,218 700,206 760,192" fill="none" stroke="url(#cld-gl)" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"/>
      {/* keyword ranking mini-table inside chart */}
      {[{kw:"#1",c:"#CC99FF"},{kw:"#2",c:"#8784FD"},{kw:"#4",c:"#8784FD"}].map(({kw,c},i)=>(
        <g key={i}>
          <rect x={588+i*58} y="260" width="48" height="22" rx="6" fill={c} fillOpacity="0.18"/>
          <text x={612+i*58} y="276" fill={c} fontSize="12" fontWeight="700" fontFamily={FF} textAnchor="middle">{kw}</text>
        </g>
      ))}
    </svg>
  );
}

/* ---- Medical / cosmetic-surgery booking UI ---- */
function ThumbCosmetic() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="med-gh" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#FF99CC"/><stop offset="100%" stopColor="#FF6666"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#F9F8F6"/>
      {/* header */}
      <rect width="800" height="58" fill="#fff"/>
      <rect x="20" y="16" width="22" height="22" rx="6" fill="url(#med-gh)"/>
      <rect x="50" y="22" width="80" height="9" rx="4" fill="#231F20" fillOpacity="0.7"/>
      {[200,262,320,378].map((x,i)=><rect key={i} x={x} y="24" width="48" height="8" rx="3" fill="#888" fillOpacity="0.5"/>)}
      <rect x="692" y="16" width="88" height="26" rx="13" fill="url(#med-gh)"/>
      {/* left: patient panel */}
      <rect x="0" y="58" width="200" height="442" fill="#fff"/>
      <rect x="0" y="58" width="200" height="1" fill="#eee"/>
      {/* patient card */}
      <circle cx="100" cy="110" r="30" fill="url(#med-gh)" fillOpacity="0.18"/>
      <circle cx="100" cy="100" r="18" fill="url(#med-gh)" fillOpacity="0.5"/>
      <rect x="40" y="132" width="120" height="10" rx="4" fill="#231F20" fillOpacity="0.7"/>
      <rect x="60" y="148" width="80" height="7" rx="3" fill="#888" fillOpacity="0.5"/>
      <rect x="16" y="172" width="168" height="1" fill="#eee"/>
      {/* appointment list */}
      {[0,1,2].map(i=>(
        <g key={i}>
          <rect x="16" y={186+i*52} width="168" height="42" rx="8" fill={i===0?"#FFF0F5":"#fafafa"}/>
          <rect x="26" y={196+i*52} width={i===0?8:5} height={i===0?22:18} rx="3" fill={i===0?"#FF99CC":"#ddd"}/>
          <rect x="42" y={198+i*52} width="100" height="8" rx="3" fill="#231F20" fillOpacity={i===0?0.7:0.4}/>
          <rect x="42" y={212+i*52} width="70" height="6" rx="3" fill="#888" fillOpacity="0.4"/>
        </g>
      ))}
      {/* main: booking calendar */}
      <rect x="206" y="70" width="582" height="300" rx="12" fill="#fff" strokeWidth="1" stroke="#eee"/>
      <rect x="224" y="86" width="140" height="9" rx="4" fill="#231F20" fillOpacity="0.7"/>
      <rect x="638" y="84" width="30" height="30" rx="8" fill="#FF99CC" fillOpacity="0.15"/>
      <rect x="676" y="84" width="30" height="30" rx="8" fill="#FF99CC" fillOpacity="0.15"/>
      {/* day headers */}
      {["M","T","W","T","F","S","S"].map((d,i)=>(
        <text key={i} x={236+i*74} y="136" fill="#888" fontSize="12" fontWeight="600" fontFamily={FF} textAnchor="middle">{d}</text>
      ))}
      {/* calendar grid */}
      {Array.from({length:35}).map((_,k)=>{
        const col=k%7, row=Math.floor(k/7);
        const day=k+1;
        const booked=[3,4,10,11,17,18,24].includes(day);
        const today=day===15;
        return (
          <g key={k}>
            <rect x={210+col*74} y={144+row*42} width="64" height="34" rx="7"
              fill={today?"url(#med-gh)":booked?"#FFF0F5":"transparent"}
              fillOpacity={today?1:booked?1:0}/>
            <text x={242+col*74} y={166+row*42} fill={today?"#fff":booked?"#FF6666":"#888"}
              fontSize="13" fontWeight={booked||today?"600":"400"} fontFamily={FF} textAnchor="middle">{day<=31?day:""}</text>
            {booked&&!today&&<circle cx={242+col*74} cy={174+row*42} r="3" fill="#FF99CC"/>}
          </g>
        );
      })}
      {/* stats bottom */}
      {[{l:"63%",s:"more bookings",c:"#FF99CC"},{l:"41%",s:"fewer no-shows",c:"#FF6666"},{l:"3×",s:"repeat patients",c:"#CC99FF"}].map(({l,s,c},i)=>(
        <g key={i}>
          <rect x={210+i*192} y="386" width="178" height="64" rx="10" fill="#fff" strokeWidth="1" stroke="#eee"/>
          <text x={220+i*192} y="412" fill={c} fontSize="22" fontWeight="700" fontFamily={FF}>{l}</text>
          <rect x={220+i*192} y="420" width="100" height="7" rx="3" fill="#888" fillOpacity="0.4"/>
        </g>
      ))}
    </svg>
  );
}

/* ---- Law firm local-search landing page ---- */
function ThumbLaw() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="law-gh" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#FF99CC"/></linearGradient>
        <linearGradient id="law-gv" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#FF6666"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#1A1718"/>
      {/* header */}
      <rect width="800" height="46" fill="#252122"/>
      <rect x="16" y="14" width="18" height="18" rx="4" fill="url(#law-gv)"/>
      <rect x="42" y="20" width="120" height="7" rx="3" fill="#fff" fillOpacity="0.7"/>
      {[280,332,384,436].map((x,i)=><rect key={i} x={x} y="20" width="40" height="6" rx="3" fill="#888" fillOpacity="0.4"/>)}
      <rect x="680" y="14" width="104" height="18" rx="9" fill="url(#law-gv)"/>
      {/* hero left */}
      <rect x="24" y="62" width="60" height="7" rx="3" fill="#CC99FF" fillOpacity="0.8"/>
      <rect x="24" y="78" width="340" height="18" rx="5" fill="#fff" fillOpacity="0.88"/>
      <rect x="24" y="104" width="300" height="18" rx="5" fill="#fff" fillOpacity="0.88"/>
      <rect x="24" y="130" width="260" height="18" rx="5" fill="#fff" fillOpacity="0.88"/>
      <rect x="24" y="160" width="340" height="8" rx="3" fill="#666" fillOpacity="0.6"/>
      <rect x="24" y="174" width="300" height="8" rx="3" fill="#666" fillOpacity="0.6"/>
      <rect x="24" y="188" width="260" height="8" rx="3" fill="#666" fillOpacity="0.6"/>
      <rect x="24" y="210" width="130" height="34" rx="10" fill="url(#law-gv)"/>
      <rect x="164" y="210" width="130" height="34" rx="10" fill="transparent" strokeWidth="1.5" stroke="rgba(249,248,246,0.3)"/>
      {/* intake form */}
      <rect x="470" y="56" width="300" height="248" rx="14" fill="#2E2A2B"/>
      <rect x="486" y="72" width="110" height="9" rx="4" fill="#fff" fillOpacity="0.7"/>
      {[{l:"Full Name"},{l:"Phone"},{l:"Practice Area"},{l:"What happened?"},{l:""}].map(({l},i)=>(
        <g key={i}>
          {i<4&&<rect key={"lbl"+i} x="486" y={100+i*46} width={i===3?70:55} height="6" rx="3" fill="#888" fillOpacity="0.5"/>}
          <rect x="486" y={114+i*46} width={i===4?268:268} height={i===3?34:24} rx="7" fill={i===4?"url(#law-gv)":"#252122"}/>
          {i<4&&<rect x="498" y={122+i*46} width={[100,70,90,120][i]} height="6" rx="3" fill="#fff" fillOpacity="0.2"/>}
        </g>
      ))}
      {/* map pack */}
      <rect x="24" y="262" width="430" height="186" rx="12" fill="#2E2A2B"/>
      <rect x="40" y="278" width="120" height="8" rx="4" fill="#fff" fillOpacity="0.6"/>
      {/* search bar */}
      <rect x="40" y="296" width="398" height="28" rx="8" fill="#252122"/>
      <rect x="54" y="307" width="14" height="14" rx="3" fill="#888" fillOpacity="0.5"/>
      <rect x="76" y="310" width="130" height="6" rx="3" fill="#888" fillOpacity="0.4"/>
      {/* map pack listings */}
      {[{h:"#8784FD",r:"★★★★★",n:1},{h:"#CC99FF",r:"★★★★",n:2},{h:"#FF99CC",r:"★★★★★",n:3}].map(({h,r,n},i)=>(
        <g key={i}>
          <rect x="40" y={332+i*36} width="398" height="28" rx="7" fill={i%2===0?"#2A2728":"#252122"}/>
          <rect x="52" y="340" width="18" height="18" rx="4" fill={h} fillOpacity="0.0" style={{transform:`translateY(${i*36}px)`}}/>
          <circle cx="60" cy={346+i*36} r="8" fill={h} fillOpacity="0.25"/>
          <text x="60" y={350+i*36} fill={h} fontSize="10" fontWeight="700" fontFamily={FF} textAnchor="middle">{n}</text>
          <rect x="78" y={341+i*36} width="120" height="7" rx="3" fill="#fff" fillOpacity="0.65"/>
          <rect x="78" y={352+i*36} width="70" height="5" rx="3" fill="#888" fillOpacity="0.4"/>
          <rect x="350" y={343+i*36} width="80" height="6" rx="3" fill={h} fillOpacity="0.5"/>
        </g>
      ))}
      {/* cost per case metric */}
      <rect x="24" y="458" width="200" height="34" rx="10" fill="#2E2A2B"/>
      <rect x="36" y="470" width="40" height="10" rx="3" fill="#8784FD"/>
      <rect x="84" y="472" width="110" height="7" rx="3" fill="#fff" fillOpacity="0.4"/>
      <rect x="234" y="458" width="220" height="34" rx="10" fill="#2E2A2B"/>
      <rect x="246" y="470" width="50" height="10" rx="3" fill="#FF99CC"/>
      <rect x="304" y="472" width="120" height="7" rx="3" fill="#fff" fillOpacity="0.4"/>
    </svg>
  );
}

/* ---- National ecommerce / retail product grid ---- */
function ThumbRetail() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="ret-gh" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#FF99CC"/><stop offset="100%" stopColor="#FF6666"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#F9F8F6"/>
      {/* store header */}
      <rect width="800" height="60" fill="#fff"/>
      <rect x="0" y="60" width="800" height="1" fill="#e8e6e3"/>
      <rect x="20" y="18" width="22" height="22" rx="6" fill="url(#ret-gh)"/>
      <rect x="50" y="23" width="90" height="9" rx="4" fill="#231F20" fillOpacity="0.7"/>
      {/* search bar */}
      <rect x="220" y="16" width="300" height="28" rx="8" fill="#f4f3f1"/>
      <rect x="234" y="25" width="14" height="10" rx="3" fill="#aaa" fillOpacity="0.6"/>
      <rect x="254" y="27" width="110" height="6" rx="3" fill="#aaa" fillOpacity="0.5"/>
      {/* nav right */}
      <rect x="688" y="19" width="40" height="9" rx="3" fill="#888" fillOpacity="0.5"/>
      <rect x="736" y="16" width="28" height="28" rx="8" fill="#f4f3f1"/>
      <rect x="748" y="25" width="14" height="10" rx="3" fill="#aaa" fillOpacity="0.5"/>
      {/* category bar */}
      <rect x="0" y="60" width="800" height="36" fill="#fff"/>
      {["All","Clothing","Shoes","Accessories","Sale"].map((c,i)=>(
        <g key={c}>
          <rect x={20+i*100} y="70" width={i===0?30:c.length*9} height="16" rx="8" fill={i===0?"url(#ret-gh)":"transparent"} strokeWidth={i>0?1:0} stroke="#ddd"/>
          <rect x={26+i*100} y="76" width={i===0?20:c.length*7} height="5" rx="3" fill={i===0?"#fff":"#aaa"} fillOpacity={i===0?0.9:0.6}/>
        </g>
      ))}
      {/* product grid 3×2 */}
      {Array.from({length:6}).map((_,k)=>{
        const col=k%3, row=Math.floor(k/3);
        const COLS=["#FFCCCC","#E8E5FF","#FFE8F5","#E5E8FF","#FFE5E5","#F5E8FF"];
        const accents=["#FF6666","#8784FD","#FF99CC","#CC99FF","#FF99CC","#8784FD"];
        const x=20+col*258, y=110+row*180;
        return (
          <g key={k}>
            <rect x={x} y={y} width="240" height="170" rx="12" fill="#fff" strokeWidth="1" stroke="#e8e6e3"/>
            {/* product image area */}
            <rect x={x+8} y={y+8} width="224" height="104" rx="8" fill={COLS[k]}/>
            <circle cx={x+112} cy={y+60} r="28" fill={accents[k]} fillOpacity="0.22"/>
            <circle cx={x+112} cy={y+60} r="16" fill={accents[k]} fillOpacity="0.4"/>
            {/* title + price */}
            <rect x={x+12} y={y+122} width="130" height="8" rx="3" fill="#231F20" fillOpacity="0.65"/>
            <rect x={x+12} y={y+136} width="90" height="7" rx="3" fill="#888" fillOpacity="0.45"/>
            <rect x={x+170} y={y+120} width="62" height="20" rx="8" fill={accents[k]} fillOpacity="0.12"/>
            <rect x={x+180} y={y+127} width="44" height="7" rx="3" fill={accents[k]} fillOpacity="0.7"/>
            {/* ROAS badge on first */}
            {k===0&&<rect x={x+8} y={y+8} width="70" height="20" rx="6" fill="url(#ret-gh)"/>}
            {k===0&&<rect x={x+16} y={y+15} width="54" height="6" rx="3" fill="#fff" fillOpacity="0.85"/>}
          </g>
        );
      })}
    </svg>
  );
}

/* ---- Auto-parts ecommerce catalog ---- */
function ThumbAuto() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="aut-gl" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#CC99FF"/></linearGradient>
        <linearGradient id="aut-gv" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#FF6666"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#1A1718"/>
      {/* header */}
      <rect width="800" height="46" fill="#252122"/>
      <rect x="16" y="14" width="18" height="18" rx="4" fill="url(#aut-gv)"/>
      <rect x="42" y="20" width="88" height="7" rx="3" fill="#fff" fillOpacity="0.7"/>
      <rect x="148" y="12" width="460" height="22" rx="8" fill="#2E2A2B"/>
      <rect x="162" y="19" width="14" height="8" rx="3" fill="#555"/>
      <rect x="182" y="21" width="130" height="6" rx="3" fill="#555"/>
      <rect x="700" y="12" width="84" height="22" rx="8" fill="url(#aut-gv)"/>
      {/* sidebar categories */}
      <rect x="0" y="46" width="160" height="454" fill="#201D1E"/>
      <rect x="12" y="60" width="90" height="7" rx="3" fill="#fff" fillOpacity="0.5"/>
      {["Brakes","Engine Parts","Suspension","Electrical","Body Parts","Wheels"].map((c,i)=>(
        <g key={c}>
          <rect x="12" y={78+i*36} width={i===0?136:i===2?124:i===4?108:112} height="24" rx="7" fill={i===0?"rgba(135,132,253,0.18)":"transparent"}/>
          <rect x="22" y={86+i*36} width={i===0?5:0} height="8" rx="2" fill="#8784FD"/>
          <rect x={i===0?34:22} y={88+i*36} width={[82,80,72,74,68,60][i]} height="7" rx="3" fill={i===0?"#8784FD":"#666"} fillOpacity={i===0?0.9:0.55}/>
        </g>
      ))}
      {/* parts list */}
      {[{n:"Brake Pad Set – Front",sku:"BP-2847",pr:"$48.99",c:"#8784FD"},{n:"Performance Brake Rotors",sku:"RT-1920",pr:"$89.50",c:"#CC99FF"},{n:"Ceramic Brake Pads – Rear",sku:"BP-3104",pr:"$42.00",c:"#FF99CC"},{n:"Caliper Rebuild Kit",sku:"CL-0092",pr:"$31.25",c:"#8784FD"}].map(({n,sku,pr,c},i)=>(
        <g key={i}>
          <rect x="166" y={54+i*96} width="620" height="86" rx="10" fill={i%2===0?"#2E2A2B":"#252122"}/>
          {/* product image */}
          <rect x="180" y="66" width="72" height="62" rx="8" fill={c} fillOpacity="0.15" style={{transform:`translateY(${i*96}px)`}}/>
          <circle cx="216" cy={97+i*96} r="20" fill={c} fillOpacity="0.2"/>
          <circle cx="216" cy={97+i*96} r="12" fill={c} fillOpacity="0.35"/>
          {/* product details */}
          <rect x="266" y={68+i*96} width="220" height="9" rx="4" fill="#fff" fillOpacity="0.72"/>
          <rect x="266" y={84+i*96} width="80" height="7" rx="3" fill="#555"/>
          <rect x="266" y={98+i*96} width="60" height="7" rx="3" fill={c} fillOpacity="0.6"/>
          {/* price + add */}
          <text x="644" y={96+i*96} fill="#fff" fontSize="18" fontWeight="700" fontFamily={FF} fillOpacity="0.88">{pr}</text>
          <rect x="692" y={78+i*96} width="80" height="28" rx="8" fill="url(#aut-gl)"/>
          <rect x="706" y={89+i*96} width="52" height="7" rx="3" fill="#fff" fillOpacity="0.85"/>
        </g>
      ))}
    </svg>
  );
}

/* ---- Generic ValueProps illustration (mini analytics panel) ---- */
const VALUE_COLORS = {
  purple: ["#8784FD","#CC99FF"],
  violet: ["#CC99FF","#8784FD"],
  coral: ["#FF6666","#FF99CC"],
  pink: ["#FF99CC","#FF6666"],
  mix: ["#8784FD","#FF6666"],
};
function ValueThumb({ hue = "purple", label = "ROAS ▲" }) {
  const [c1, c2] = VALUE_COLORS[hue] || VALUE_COLORS.purple;
  const pts = "32,230 80,218 130,205 180,188 230,165 280,140 330,118 380,98 420,82 460,70";
  const areaD = `M32,230 80,218 130,205 180,188 230,165 280,140 330,118 380,98 420,82 460,70 460,240 32,240Z`;
  return (
    <svg viewBox="0 0 490 270" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id={`vt-gl-${hue}`} x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor={c1}/><stop offset="100%" stopColor={c2}/></linearGradient>
        <linearGradient id={`vt-ga-${hue}`} x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stopColor={c1} stopOpacity="0.36"/><stop offset="100%" stopColor={c1} stopOpacity="0"/></linearGradient>
      </defs>
      <rect width="490" height="270" fill="#1A1718"/>
      {/* grid */}
      {[60,100,140,180,220].map(y=><line key={y} x1="32" y1={y} x2="462" y2={y} stroke="#fff" strokeWidth="0.5" strokeOpacity="0.07"/>)}
      {/* area + line */}
      <path d={areaD} fill={`url(#vt-ga-${hue})`}/>
      <polyline points={pts} fill="none" stroke={`url(#vt-gl-${hue})`} strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"/>
      <circle cx="460" cy="70" r="6" fill={c2} fillOpacity="0.9"/>
      {/* metric pill */}
      <rect x="32" y="18" width="180" height="36" rx="10" fill="#2E2A2B"/>
      <rect x="44" y="26" width="6" height="20" rx="3" fill={c1}/>
      <rect x="58" y="30" width="100" height="10" rx="4" fill={c1} fillOpacity="0.85"/>
      <rect x="58" y="34" width="70" height="6" rx="3" fill="#fff" fillOpacity="0.22" style={{marginTop:4}}/>
      {/* label */}
      <rect x="330" y="18" width="130" height="36" rx="10" fill={c1} fillOpacity="0.14"/>
      <rect x="344" y="30" width="90" height="10" rx="4" fill={c1} fillOpacity="0.75"/>
    </svg>
  );
}

/* ---- Ecommerce performance thumb ---- */
function ThumbEcommerce() {
  return (
    <svg viewBox="0 0 800 500" width="100%" height="100%" preserveAspectRatio="xMidYMid slice" style={{ display: "block", position: "absolute", inset: 0 }}>
      <defs>
        <linearGradient id="ec-gh" x1="0" y1="0" x2="1" y2="0"><stop offset="0%" stopColor="#8784FD"/><stop offset="100%" stopColor="#FF6666"/></linearGradient>
        <linearGradient id="ec-ga" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stopColor="#FF99CC" stopOpacity="0.35"/><stop offset="100%" stopColor="#FF99CC" stopOpacity="0"/></linearGradient>
      </defs>
      <rect width="800" height="500" fill="#1A1718"/>
      {/* header */}
      <rect width="800" height="46" fill="#252122"/>
      <rect x="16" y="14" width="18" height="18" rx="4" fill="url(#ec-gh)"/>
      <rect x="42" y="19" width="80" height="7" rx="3" fill="#fff" fillOpacity="0.7"/>
      {[230,280,330,380].map((x,i)=><rect key={i} x={x} y="20" width="38" height="6" rx="3" fill="#888" fillOpacity="0.4"/>)}
      <rect x="680" y="13" width="104" height="20" rx="10" fill="url(#ec-gh)"/>
      {/* ROAS metric */}
      <rect x="24" y="58" width="160" height="76" rx="12" fill="#2E2A2B"/>
      <rect x="36" y="72" width="50" height="7" rx="3" fill="#FF99CC" fillOpacity="0.75"/>
      <text x="36" y="104" fill="#FF99CC" fontSize="28" fontWeight="700" fontFamily={FF}>3.8×</text>
      <rect x="36" y="114" width="80" height="6" rx="3" fill="#fff" fillOpacity="0.2"/>
      {/* CPL metric */}
      <rect x="196" y="58" width="160" height="76" rx="12" fill="#2E2A2B"/>
      <rect x="208" y="72" width="50" height="7" rx="3" fill="#CC99FF" fillOpacity="0.75"/>
      <text x="208" y="104" fill="#CC99FF" fontSize="28" fontWeight="700" fontFamily={FF}>-41%</text>
      <rect x="208" y="114" width="80" height="6" rx="3" fill="#fff" fillOpacity="0.2"/>
      {/* Revenue metric */}
      <rect x="368" y="58" width="160" height="76" rx="12" fill="#2E2A2B"/>
      <rect x="380" y="72" width="60" height="7" rx="3" fill="#8784FD" fillOpacity="0.75"/>
      <text x="380" y="104" fill="#8784FD" fontSize="28" fontWeight="700" fontFamily={FF}>+127%</text>
      <rect x="380" y="114" width="80" height="6" rx="3" fill="#fff" fillOpacity="0.2"/>
      {/* big revenue chart */}
      <rect x="24" y="146" width="750" height="230" rx="12" fill="#2E2A2B"/>
      <rect x="40" y="162" width="130" height="9" rx="4" fill="#fff" fillOpacity="0.65"/>
      <rect x="40" y="178" width="80" height="6" rx="3" fill="#555"/>
      {[210,240,270,300,330,358].map(y=><line key={y} x1="40" y1={y} x2="758" y2={y} stroke="#fff" strokeWidth="0.5" strokeOpacity="0.07"/>)}
      {/* dual lines: ROAS + Revenue */}
      <path d="M40,368 100,360 160,348 220,332 280,310 340,286 400,258 460,230 520,206 580,186 640,168 700,154 758,142 758,368 40,368Z" fill="url(#ec-ga)"/>
      <polyline points="40,368 100,360 160,348 220,332 280,310 340,286 400,258 460,230 520,206 580,186 640,168 700,154 758,142" fill="none" stroke="#FF99CC" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"/>
      <polyline points="40,358 100,352 160,345 220,336 280,328 340,316 400,300 460,280 520,258 580,238 640,218 700,198 758,176" fill="none" stroke="#8784FD" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" strokeDasharray="6,4"/>
      <circle cx="758" cy="142" r="5" fill="#FF99CC"/>
      {/* platform pills */}
      {[{l:"Google Shopping",c:"#8784FD"},{l:"Meta Ads",c:"#CC99FF"},{l:"TikTok",c:"#FF99CC"},{l:"Email",c:"#FF6666"}].map(({l,c},i)=>(
        <g key={i}>
          <rect x={24+i*190} y="388" width="178" height="32" rx="8" fill="#252122"/>
          <circle cx={40+i*190} cy="404" r="6" fill={c} fillOpacity="0.8"/>
          <rect x={54+i*190} y="398" width="100" height="7" rx="3" fill="#fff" fillOpacity="0.5"/>
          <rect x={54+i*190} y="410" width={[60,50,40,45][i]} height="5" rx="3" fill={c} fillOpacity="0.6"/>
        </g>
      ))}
      {/* campaign table */}
      {[0,1,2].map(i=>(
        <g key={i}>
          <rect x="24" y={434+i*22} width="750" height="18" rx="5" fill={i%2===0?"#2A2728":"transparent"}/>
          <rect x="36" y={439+i*22} width="120" height="6" rx="3" fill="#fff" fillOpacity="0.5"/>
          <rect x="240" y={439+i*22} width="60" height="6" rx="3" fill="#FF99CC" fillOpacity={0.5+i*0.1}/>
          <rect x="380" y={439+i*22} width="50" height="6" rx="3" fill="#8784FD" fillOpacity="0.6"/>
          <rect x="520" y={439+i*22} width="70" height="6" rx="3" fill="#CC99FF" fillOpacity="0.5"/>
        </g>
      ))}
    </svg>
  );
}

/* ---- Master ProjectThumb — contextual SVG or gradient fallback ---- */
const PROJECT_SVGS = {
  saas: ThumbSaaS,
  cloud: ThumbCloud,
  cosmetic: ThumbCosmetic,
  law: ThumbLaw,
  retail: ThumbRetail,
  auto: ThumbAuto,
  ecommerce: ThumbEcommerce,
};

function ProjectThumb({ hue = "mix", ratio = 62, label, icon, slug }) {
  const SvgComp = slug && PROJECT_SVGS[slug];
  return (
    <div style={{ position: "relative", width: "100%", paddingTop: ratio + "%", borderRadius: "var(--radius-md)", overflow: "hidden", background: SvgComp ? "#1A1718" : (HUES[hue] || HUES.mix) }}>
      {SvgComp ? (
        <div style={{ position: "absolute", inset: 0 }}><SvgComp /></div>
      ) : (
        <>
          <div style={{ position: "absolute", inset: 0, background: "radial-gradient(120% 120% at 78% 12%, rgba(255,255,255,0.34), transparent 46%)" }} />
          <div style={{ position: "absolute", inset: 0, opacity: 0.16, backgroundImage: "linear-gradient(rgba(255,255,255,.5) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.5) 1px,transparent 1px)", backgroundSize: "34px 34px" }} />
          <div style={{ position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", gap: 12 }}>
            {icon && <span style={{ color: "rgba(255,255,255,0.95)", display: "inline-flex" }}><Icon name={icon} size={34} /></span>}
            {label && <span style={{ color: "rgba(255,255,255,0.92)", fontWeight: 300, fontSize: 30, letterSpacing: "-0.02em" }}>{label}</span>}
          </div>
        </>
      )}
    </div>
  );
}

const TESTIMONIALS = [
  { name: "Christy D.", role: "Marketing Lead, enterprise SaaS", hue: "purple", quote: "Autoclient rebuilt our acquisition funnel from the ground up. The reporting alone changed how our leadership thinks about spend. Every dollar is now accountable to a number." },
  { name: "Alejandro C.", role: "Director, cosmetic-surgery group", hue: "coral", quote: "Their email and CRM automation books our calendar while we sleep. Consult requests are up and our front desk finally has time to breathe." },
  { name: "Kathryn M.", role: "Founder, local practice", hue: "pink", quote: "I came in skeptical of “AI marketing.” Six weeks later our cost per lead was down by a third and I had a dashboard I actually understood." },
  { name: "Esther H.", role: "Director, ecommerce brand", hue: "violet", quote: "The team moves fast and tells the truth. They killed two channels that weren't working and doubled down on the one that was. ROAS followed." },
  { name: "John K.", role: "Partner, multi-location law firm", hue: "mix", quote: "We've worked with three agencies. Autoclient is the first that talks about cases signed, not impressions. That difference is everything." },
];

const HOME_FAQ = [
  { q: "What services does autoclient offer?", a: "We run the full growth stack: paid advertising (Google, Meta, TikTok and more), SEO and local SEO, lead generation, email & SMS marketing, and marketing automation. Every channel is engineered with AI so your pipeline compounds without growing headcount." },
  { q: "How do you measure ROI?", a: "Every engagement starts by modeling your unit economics. Then we report on the metrics that move your business: cost per lead, ROAS, leads per month, and revenue, never vanity impressions. You get a live dashboard from day one." },
  { q: "What types of clients do you work with?", a: "Service companies, ecommerce brands, and local businesses, with deep experience in law firms, medical and dental practices, cosmetic practices, and enterprise tech and retail." },
  { q: "How long until we see results?", a: "Paid channels can show signal in the first 2 to 4 weeks. SEO and content compound over 3 to 6 months. We ship a growth plan in days and set realistic milestones before any spend goes live." },
  { q: "Can you customize a plan for my business?", a: "Always. We don't sell one-size-fits-all retainers. After a free strategy session we propose a channel-by-channel plan scoped to your goals, budget, and timeline." },
];

const SERVICE_FAQ = [
  { q: "Do I need a minimum ad budget to start?", a: "No hard minimum, though most clients see the strongest returns at $10k+/month in media. We'll tell you honestly whether paid is the right first move or whether SEO and automation should lead." },
  { q: "Do you have experience in my industry?", a: "Very likely. We've delivered for enterprise tech and retail, ecommerce, medical and dental practices, cosmetic practices, and law firms. Vertical expertise shapes everything from creative to bidding." },
  { q: "Who manages my account day to day?", a: "A dedicated specialist plus our AI optimization layer. You'll have a direct line to the human running your channel and a dashboard that's always current." },
  { q: "How is AI actually used?", a: "AI agents test creative, audiences, and bids around the clock, surface anomalies before they cost you, and automate the reporting and follow-up that usually eats your team's time. Humans set strategy; AI handles the grind." },
];

Object.assign(window, { CLIENTS, ClientWordmark, HUES, Avatar, ProjectThumb, ValueThumb, TESTIMONIALS, HOME_FAQ, SERVICE_FAQ, initials });
