// Work cards + testimonial carousel.

const WORK_PROJECTS = [
  // ── Shefa products ───────────────────────────────────────────────
  {
    key: "luxe",
    client: "Luxe",
    role: "Fashion e-commerce",
    color: "#B45309", accent: "#F59E0B",
    when: "Product", duration: "14 days",
    tags: ["Next.js", "Stripe", "Drizzle"],
    url: null,
    badge: "Built by Shefa",
    preview: "/assets/preview-luxe.png",
    description: "Editorial-first fashion store with seasonal lookbooks, full Stripe checkout, and a CMS-driven product catalogue.",
  },
  {
    key: "savor",
    client: "Savor",
    role: "Restaurant & reservations",
    color: "#78350F", accent: "#D97706",
    when: "Product", duration: "14 days",
    tags: ["Next.js", "Resend", "Vercel"],
    url: null,
    badge: "Built by Shefa",
    preview: "/assets/preview-savor.png",
    description: "A booking-first restaurant platform with menu management, private dining enquiries, and automated confirmation emails.",
  },
  {
    key: "domus",
    client: "Domus",
    role: "Real estate + map search",
    color: "#292524", accent: "#A16207",
    when: "Product", duration: "14 days",
    tags: ["Next.js", "Mapbox", "Drizzle"],
    url: null,
    badge: "Built by Shefa",
    preview: "/assets/preview-domus.png",
    description: "Boutique real estate with interactive Mapbox search, listing management, and advisor-led appointment booking.",
  },
  {
    key: "aura",
    client: "Aura",
    role: "Skincare DTC + funnels",
    color: "#44403C", accent: "#A8A29E",
    when: "Product", duration: "14 days",
    tags: ["Next.js", "Stripe", "Klaviyo"],
    url: null,
    badge: "Built by Shefa",
    preview: "/assets/preview-aura.png",
    description: "A science-led skincare brand selling eight peer-reviewed products with Stripe checkout and Klaviyo email flows.",
  },
  // ── Client sites ──────────────────────────────────────────────────
  {
    key: "sppd",
    client: "SPPD",
    role: "E-commerce store",
    color: "#6C3BFF", accent: "#A78BFA",
    when: "2025", duration: "14 days",
    tags: ["Next.js", "Vercel", "Supabase"],
    url: "https://sppd.amachree.dev/",
    badge: "Client",
    preview: "/assets/preview-sppd.png",
    description: "Consumer marketplace with product search, category filtering, and a smooth multi-step checkout.",
  },
  {
    key: "vintech",
    client: "Vintech Energies",
    role: "Brand site + lead gen",
    color: "#16A34A", accent: "#4ADE80",
    when: "2025", duration: "14 days",
    tags: ["Next.js", "Resend", "Vercel"],
    url: "https://www.vintechenergies.com/",
    badge: "Client",
    preview: "/assets/preview-vintech.png",
    description: "Solar energy brand site with solution explainer, lead capture form, and installation process walkthrough.",
  },
  {
    key: "atlas",
    client: "Atlas DAO",
    role: "NFT raffles + governance",
    color: "#0EA5E9", accent: "#38BDF8",
    when: "2025", duration: "14 days",
    tags: ["Next.js", "Wagmi", "Web3"],
    url: "https://app.atlasdao.zone/",
    badge: "Client",
    preview: "/assets/preview-atlas.png",
    description: "NFT raffle and DAO governance app with on-chain wallet authentication and live auction countdowns.",
  },
  {
    key: "soullightsystems",
    client: "Soul Light Systems",
    role: "Spiritual wellness platform",
    color: "#C4956A", accent: "#E8C4A0",
    when: "2025", duration: "14 days",
    tags: ["Next.js", "Stripe", "Resend"],
    url: "https://soullightsystems.com/",
    badge: "Client",
    preview: "/assets/preview-soullightsystems.png",
    description: "Healing and wellness platform offering energetic restoration protocols, curated sessions, and digital courses.",
  },
];

function WorkSection() {
  const isMobile = useIsMobile();
  return (
    <section id="work" data-screen-label="05 Work" className="shefa-pad" style={{ padding: isMobile ? "80px 20px" : "120px 32px", background: "var(--page)", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1280, margin: "0 auto" }}>
        <Reveal>
          <div style={{ marginBottom: isMobile ? 32 : 56, display: "flex", alignItems: "flex-end", justifyContent: "space-between", gap: 24, flexWrap: "wrap" }}>
            <div>
              <Eyebrow>Selected work</Eyebrow>
              <h2 style={{
                fontFamily: "var(--font-display)", fontSize: isMobile ? 32 : 52, lineHeight: 1.05, color: "var(--text-strong)",
                letterSpacing: "-0.025em", fontWeight: 700, margin: 0,
              }}>
                Sites shipped. <span style={{ color: "var(--text-muted)" }}>Systems that run.</span>
              </h2>
            </div>
            <a href="#book" className="accent-color" style={{
              color: "#A78BFA", textDecoration: "none", fontSize: 14, fontWeight: 600,
              display: "inline-flex", alignItems: "center", gap: 8,
              padding: "10px 18px", borderRadius: 999,
              border: "1px solid var(--line-strong)", transition: "all 160ms",
            }}
            onMouseEnter={(e) => { e.currentTarget.style.borderColor = "#8A5CFF"; e.currentTarget.style.color = "#fff"; }}
            onMouseLeave={(e) => { e.currentTarget.style.borderColor = "var(--line-strong)"; e.currentTarget.style.color = "#A78BFA"; }}>
              Be next →
            </a>
          </div>
        </Reveal>
        <div style={{
          display: "grid",
          gridTemplateColumns: isMobile ? "1fr" : "repeat(auto-fill, minmax(340px, 1fr))",
          gap: 20,
        }}>
          {WORK_PROJECTS.map((p, i) => (
            <Reveal key={p.key} delay={i * 90}>
              <ProjectCard p={p} isMobile={isMobile} />
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

function ProjectCard({ p, isMobile }) {
  const [hover, setHover] = React.useState(false);
  const [tilt, setTilt] = React.useState({ x: 0, y: 0 });
  const isShefa = p.badge === "Built by Shefa";

  const handleMove = (e) => {
    if (isMobile) return;
    const r = e.currentTarget.getBoundingClientRect();
    const x = (e.clientX - r.left) / r.width  - 0.5;
    const y = (e.clientY - r.top)  / r.height - 0.5;
    setTilt({ x: y * -6, y: x * 6 });
  };

  const handleLeave = () => {
    setHover(false);
    setTilt({ x: 0, y: 0 });
  };

  return (
    <div
      onMouseEnter={() => setHover(true)}
      onMouseLeave={handleLeave}
      onMouseMove={handleMove}
      style={{
        display: "flex", flexDirection: "column",
        background: "var(--surface)",
        border: hover ? `1px solid ${p.color}66` : "1px solid var(--line)",
        borderRadius: 20,
        overflow: "hidden",
        transition: hover ? "border 240ms, box-shadow 240ms" : "all 300ms cubic-bezier(0.4,0,0.2,1)",
        transform: `perspective(900px) rotateX(${tilt.x}deg) rotateY(${tilt.y}deg) translateY(${hover ? -4 : 0}px)`,
        boxShadow: hover ? `0 16px 48px rgba(0,0,0,0.4), 0 0 40px ${p.color}33` : "none",
        height: "100%",
        willChange: "transform",
      }}>

      {/* Image header */}
      <div style={{
        height: 210,
        background: "var(--page)",
        position: "relative", overflow: "hidden", flex: "none",
      }}>
        {p.preview && (
          <img src={p.preview} alt={p.client} style={{
            width: "100%", height: "100%", objectFit: "cover", objectPosition: "top",
            display: "block",
            transform: hover ? "scale(1.06)" : "scale(1)",
            transition: "transform 500ms cubic-bezier(0.4,0,0.2,1), filter 300ms",
            filter: hover ? "brightness(1.0)" : "brightness(0.88)",
          }} />
        )}

        {/* Badge top-left */}
        <div style={{
          position: "absolute", top: 14, left: 14,
          background: p.badge === "Client" ? `${p.color}dd` : "rgba(10,14,26,0.80)",
          border: p.badge === "Client" ? "none" : "1px solid rgba(255,255,255,0.12)",
          padding: "4px 10px", borderRadius: 999,
          fontSize: 10, fontWeight: 700, letterSpacing: "0.14em", textTransform: "uppercase",
          color: "var(--text-strong)", backdropFilter: "blur(10px)",
        }}>
          {p.badge}
        </div>

        {/* Duration pill — only for client projects */}
        {!isShefa && (
          <div style={{
            position: "absolute", top: 14, right: 14,
            background: "rgba(10,14,26,0.80)", border: "1px solid rgba(255,255,255,0.12)",
            padding: "4px 10px", borderRadius: 999,
            fontSize: 10, fontWeight: 700, letterSpacing: "0.14em", textTransform: "uppercase",
            color: "var(--text-muted)", backdropFilter: "blur(10px)",
          }}>
            Shipped · {p.duration}
          </div>
        )}

        {/* Gradient overlay at bottom of image for text readability */}
        <div style={{
          position: "absolute", bottom: 0, left: 0, right: 0, height: 60,
          background: "linear-gradient(transparent, rgba(15,21,37,0.85))",
          pointerEvents: "none",
        }} />
      </div>

      {/* Card body */}
      <div style={{ padding: "20px 24px 24px", display: "flex", flexDirection: "column", flex: 1 }}>
        {/* Role + when */}
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 8 }}>
          <span style={{ fontSize: 11, letterSpacing: "0.16em", textTransform: "uppercase", color: p.accent, fontWeight: 700 }}>{p.role}</span>
          <span style={{ fontSize: 11, color: "#4B5563", fontFamily: "var(--font-mono)" }}>{p.when}</span>
        </div>

        {/* Client name */}
        <h3 style={{ fontFamily: "var(--font-display)", fontSize: 22, fontWeight: 700, margin: 0, marginBottom: 10, color: "var(--text-strong)", letterSpacing: "-0.01em" }}>
          {p.client}
        </h3>

        {/* Description */}
        <p style={{
          fontSize: 13.5, lineHeight: 1.55, color: "var(--text-muted)",
          margin: 0, marginBottom: 16,
          display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden",
        }}>
          {p.description}
        </p>

        {/* Tags */}
        <div style={{ display: "flex", gap: 6, flexWrap: "wrap", marginBottom: 18 }}>
          {p.tags.map((t) => (
            <span key={t} style={{
              fontSize: 11, color: "var(--text-faint)", fontFamily: "var(--font-mono)",
              background: "rgba(255,255,255,0.03)", border: "1px solid var(--line)",
              padding: "4px 10px", borderRadius: 6,
            }}>{t}</span>
          ))}
        </div>

        {/* CTA */}
        {p.url ? (
          <a href={p.url} target="_blank" rel="noopener noreferrer"
            style={{
              marginTop: "auto",
              display: "inline-flex", alignItems: "center", gap: 6,
              color: p.accent, fontSize: 13, fontWeight: 600, textDecoration: "none",
              transition: "opacity 160ms",
            }}
            onMouseEnter={(e) => e.currentTarget.style.opacity = "0.75"}
            onMouseLeave={(e) => e.currentTarget.style.opacity = "1"}>
            View live
            <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"
              style={{ transform: hover ? "translateX(3px)" : "translateX(0)", transition: "transform 200ms" }}>
              <path d="M2 10L10 2M10 2H6M10 2v4"/>
            </svg>
          </a>
        ) : (
          <span style={{
            marginTop: "auto",
            display: "inline-flex", alignItems: "center", gap: 6,
            color: "#4B5563", fontSize: 13, fontWeight: 600,
          }}>
            Coming soon
            <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round">
              <circle cx="6" cy="6" r="4.5"/><path d="M6 4v2.5l1.5 1.5"/>
            </svg>
          </span>
        )}
      </div>
    </div>
  );
}

// ---------- TEAM ----------
const TEAM = [
  {
    key: "prince",
    name: "Prince Amachree",
    role: "Founder · Design × Systems",
    bio: "Builds the sites. Wires the automations. Runs the 14 days.",
    linkedin: "https://www.linkedin.com/in/princeam/",
    initials: "PA",
    color: "#6C3BFF",
    accent: "#A78BFA",
    photo: null, // drop a file at /assets/team-prince.jpg to activate
  },
];

function TeamSection() {
  const isMobile = useIsMobile();
  return (
    <section id="team" data-screen-label="Team" className="shefa-pad" style={{
      padding: isMobile ? "80px 20px" : "120px 32px",
      background: "var(--page)", borderTop: "1px solid var(--line)",
    }}>
      <div style={{ maxWidth: 1280, margin: "0 auto" }}>
        <Reveal>
          <div style={{ marginBottom: isMobile ? 40 : 56 }}>
            <Eyebrow>The team</Eyebrow>
            <h2 style={{
              fontFamily: "var(--font-display)", fontSize: isMobile ? 36 : 52, lineHeight: 1.05, color: "var(--text-strong)",
              letterSpacing: "-0.025em", fontWeight: 700, margin: 0,
            }}>
              Built by people <span style={{ color: "var(--text-muted)" }}>who ship.</span>
            </h2>
          </div>
        </Reveal>

        <div style={{
          display: "grid",
          gridTemplateColumns: isMobile ? "1fr" : "repeat(auto-fill, minmax(280px, 1fr))",
          gap: 20, alignItems: "start",
        }}>
          {TEAM.map((m, i) => (
            <Reveal key={m.key} delay={i * 80}>
              <TeamCard m={m} />
            </Reveal>
          ))}

          {/* "More soon" placeholder */}
          <Reveal delay={80}>
            <div style={{
              background: "rgba(108,59,255,0.04)",
              border: "1px dashed var(--line)",
              borderRadius: 16,
              padding: 32,
              display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center",
              minHeight: 200, gap: 12,
            }}>
              <div style={{ width: 48, height: 48, borderRadius: 999, border: "1px dashed var(--line-strong)", display: "flex", alignItems: "center", justifyContent: "center" }}>
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--text-faint)" strokeWidth="1.8" strokeLinecap="round">
                  <path d="M12 5v14M5 12h14"/>
                </svg>
              </div>
              <div style={{ fontSize: 14, color: "var(--text-faint)", textAlign: "center" }}>
                More people incoming.
              </div>
            </div>
          </Reveal>
        </div>
      </div>
    </section>
  );
}

function TeamCard({ m }) {
  const [hover, setHover] = React.useState(false);
  return (
    <div
      onMouseEnter={() => setHover(true)}
      onMouseLeave={() => setHover(false)}
      style={{
        background: "var(--surface)",
        border: hover ? `1px solid ${m.color}55` : "1px solid var(--line)",
        borderRadius: 16,
        padding: 28,
        transition: "all 240ms var(--ease-std)",
        boxShadow: hover ? `0 0 40px ${m.color}22` : "none",
        transform: hover ? "translateY(-2px)" : "translateY(0)",
      }}
    >
      {/* Avatar */}
      <div style={{
        width: 72, height: 72, borderRadius: 999,
        background: m.photo ? "transparent" : `linear-gradient(135deg, ${m.color}, ${m.accent})`,
        display: "flex", alignItems: "center", justifyContent: "center",
        marginBottom: 20, overflow: "hidden", flex: "none",
        boxShadow: hover ? `0 0 28px ${m.color}55` : "none",
        transition: "box-shadow 240ms",
      }}>
        {m.photo ? (
          <img src={m.photo} alt={m.name} style={{ width: "100%", height: "100%", objectFit: "cover" }} />
        ) : (
          <span style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 22, color: "var(--text-strong)", letterSpacing: "-0.02em" }}>
            {m.initials}
          </span>
        )}
      </div>

      <h3 style={{ fontFamily: "var(--font-display)", fontSize: 20, fontWeight: 700, color: "var(--text-strong)", margin: 0, marginBottom: 4, letterSpacing: "-0.01em" }}>
        {m.name}
      </h3>
      <div className="accent-color" style={{ fontSize: 12, color: m.accent, fontWeight: 600, letterSpacing: "0.06em", marginBottom: 14 }}>
        {m.role}
      </div>
      <p style={{ fontSize: 14, lineHeight: 1.55, color: "var(--text-muted)", margin: 0, marginBottom: 22 }}>
        {m.bio}
      </p>

      <a href={m.linkedin} target="_blank" rel="noopener noreferrer"
        style={{
          display: "inline-flex", alignItems: "center", gap: 8,
          fontSize: 13, fontWeight: 600, color: "var(--text-muted)", textDecoration: "none",
          padding: "8px 14px", borderRadius: 8,
          border: "1px solid var(--line-strong)",
          background: "transparent",
          transition: "all 160ms",
        }}
        onMouseEnter={(e) => { e.currentTarget.style.borderColor = m.color; e.currentTarget.style.color = m.accent; }}
        onMouseLeave={(e) => { e.currentTarget.style.borderColor = "var(--line-strong)"; e.currentTarget.style.color = "var(--line)"; }}>
        <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
          <path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6zM2 9h4v12H2z"/>
          <circle cx="4" cy="4" r="2"/>
        </svg>
        LinkedIn
      </a>
    </div>
  );
}

// ---------- TESTIMONIALS (carousel) ----------
const TESTIMONIALS = [
  {
    quote: "We had a deadline that made every other agency say no. Shefa; said yes on the call and shipped in 14 days. We've been compounding off that work ever since.",
    name: "Maya Okafor", role: "Founder, Northwind Studio",
    metric: "+218%", metricLabel: "lead-to-call",
  },
  {
    quote: "The automation layer is the part nobody else does. We launched on a Friday and by Monday morning every order, every form, every review was flowing into the right place.",
    name: "Daniel Reyes", role: "Ops Lead, Lumen Coffee",
    metric: "3.4×", metricLabel: "repeat rate",
  },
  {
    quote: "Fixed price. Calendar locked. Loom walkthrough every Friday. I never wondered where we were. That alone was worth it.",
    name: "Priya Shah", role: "COO, Axis Health",
    metric: "42 hrs/wk", metricLabel: "ops time saved",
  },
];

function TestimonialsSection() {
  const isMobile = useIsMobile();
  const [idx, setIdx] = React.useState(0);
  const [paused, setPaused] = React.useState(false);

  React.useEffect(() => {
    if (paused) return;
    const t = setInterval(() => setIdx((i) => (i + 1) % TESTIMONIALS.length), 6000);
    return () => clearInterval(t);
  }, [paused]);

  const t = TESTIMONIALS[idx];
  return (
    <section id="testimonials" data-screen-label="06 Testimonials" className="shefa-pad" style={{ padding: isMobile ? "80px 20px" : "120px 32px", background: "var(--page)" }}
      onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}>
      <div style={{ maxWidth: 1280, margin: "0 auto" }}>
        <Reveal>
          <div style={{ marginBottom: 48, maxWidth: 760 }}>
            <Eyebrow>What clients say</Eyebrow>
            <h2 style={{
              fontFamily: "var(--font-display)", fontSize: isMobile ? 32 : 52, lineHeight: 1.05, color: "var(--text-strong)",
              letterSpacing: "-0.025em", fontWeight: 700, margin: 0,
            }}>
              The same three things, <span style={{ color: "var(--text-muted)" }}>every time.</span>
            </h2>
          </div>
        </Reveal>

        <Reveal delay={120}>
          <div style={{
            background: "linear-gradient(180deg, rgba(108,59,255,0.10), rgba(108,59,255,0))",
            border: "1px solid rgba(138,92,255,0.32)",
            borderRadius: 24, padding: isMobile ? "32px 24px 28px" : "56px 56px 40px",
            position: "relative", overflow: "hidden",
          }}>
            <svg width="48" height="36" viewBox="0 0 32 24" fill="none" aria-hidden="true" style={{ marginBottom: 24, opacity: 0.9 }} className="accent-fill">
              <path d="M0 24V14C0 6.27 4.78 0.92 12 0L13 4.69C8.59 6.36 6.36 9.33 6.27 13.66H12V24H0ZM18 24V14C18 6.27 22.78 0.92 30 0L31 4.69C26.59 6.36 24.36 9.33 24.27 13.66H30V24H18Z" fill="#8A5CFF" />
            </svg>

            <div style={{ position: "relative", minHeight: 160 }}>
              {TESTIMONIALS.map((q, i) => (
                <div key={i} style={{
                  position: i === idx ? "relative" : "absolute",
                  inset: 0,
                  opacity: i === idx ? 1 : 0,
                  transform: i === idx ? "translateY(0)" : "translateY(8px)",
                  transition: "opacity 500ms var(--ease-std), transform 500ms var(--ease-std)",
                  pointerEvents: i === idx ? "auto" : "none",
                }}>
                  <p style={{
                    fontFamily: "var(--font-display)", fontWeight: 500,
                    fontSize: isMobile ? 18 : 28, lineHeight: 1.4, color: "var(--text-strong)",
                    margin: 0, marginBottom: 28, textWrap: "pretty", letterSpacing: "-0.01em",
                  }}>
                    “{q.quote}”
                  </p>
                </div>
              ))}
            </div>

            <div style={{
              display: "flex", justifyContent: "space-between", alignItems: "center", gap: 24,
              paddingTop: 28, borderTop: "1px solid rgba(255,255,255,0.06)",
              flexWrap: "wrap",
            }}>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 16, fontWeight: 700, color: "var(--text-strong)" }}>{t.name}</div>
                <div style={{ fontSize: 13, color: "var(--text-muted)", marginTop: 2 }}>{t.role}</div>
              </div>
              <div style={{ display: "flex", alignItems: "center", gap: 28 }}>
                <div style={{ textAlign: "right" }}>
                  <div style={{ fontFamily: "var(--font-display)", fontSize: 24, fontWeight: 800, color: "var(--accent-faint)", letterSpacing: "-0.02em" }}>{t.metric}</div>
                  <div style={{ fontSize: 10, color: "var(--text-faint)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600, marginTop: 2 }}>{t.metricLabel}</div>
                </div>
                <div style={{ display: "flex", gap: 6 }}>
                  {TESTIMONIALS.map((_, i) => (
                    <button key={i} onClick={() => setIdx(i)} aria-label={`Quote ${i+1}`}
                      style={{
                        width: i === idx ? 28 : 10, height: 10, borderRadius: 99,
                        background: i === idx ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "rgba(255,255,255,0.10)",
                        border: 0, cursor: "pointer", padding: 0,
                        transition: "all 300ms var(--ease-std)",
                      }} />
                  ))}
                </div>
              </div>
            </div>
          </div>
        </Reveal>
      </div>
    </section>
  );
}

Object.assign(window, { WorkSection, TestimonialsSection, TeamSection });

// Pricing cards + FAQ accordion.

function PricingSection() {
  const isMobile = useIsMobile();
  const items = [
    { title: "The 14-day site", price: "$14,000", cadence: "Fixed. One invoice.", best: true,
      bullets: [
        "Up to 6 pages, hi-fi design",
        "Framer or Next.js, your choice",
        "CMS + blog set up",
        "Automation layer (forms, CRM, Slack)",
        "Analytics + UTM map + dashboard",
        "Social profile design + launch kit",
        "2 rounds of revisions",
        "Loom walkthrough on launch day",
      ],
      foot: "Start any Monday. Live by the second Friday.",
    },
    { title: "Care plan", price: "$1,800", cadence: "/ month · optional",
      bullets: [
        "Hosting, monitoring, backups",
        "Up to 8 hrs of changes per month",
        "Quarterly site + funnel review",
        "Priority Slack response",
        "Cancel anytime, no notice",
      ],
      foot: "Most teams add this. Some don't — we don't push it.",
    },
  ];
  return (
    <section id="pricing" data-screen-label="07 Pricing" className="shefa-pad" style={{ padding: isMobile ? "80px 20px" : "120px 32px", background: "var(--page)", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 1100, margin: "0 auto" }}>
        <Reveal>
          <div style={{ marginBottom: isMobile ? 32 : 56, textAlign: "center" }}>
            <div style={{ display: "inline-block" }}><Eyebrow>Pricing</Eyebrow></div>
            <h2 style={{
              fontFamily: "var(--font-display)", fontSize: isMobile ? 36 : 52, lineHeight: 1.05, color: "var(--text-strong)",
              letterSpacing: "-0.025em", fontWeight: 700, margin: 0, marginBottom: 14,
            }}>
              One package. <span style={{ color: "var(--text-muted)" }}>One number.</span>
            </h2>
            <p style={{ fontSize: isMobile ? 15 : 17, color: "var(--text-muted)", maxWidth: 580, margin: "0 auto", lineHeight: 1.6 }}>
              No SOW gymnastics. No add-on fees. The 14-day site is one fixed price; the care plan is optional and starts the month after launch.
            </p>
          </div>
        </Reveal>

        <div style={{ display: "grid", gridTemplateColumns: isMobile ? "1fr" : "1.15fr 1fr", gap: 18 }}>
          {items.map((it, i) => (
            <Reveal key={it.title} delay={i * 100}>
              <PriceCard it={it} />
            </Reveal>
          ))}
        </div>
      </div>
    </section>
  );
}

function PriceCard({ it }) {
  return (
    <div style={{
      background: it.best
        ? "linear-gradient(180deg, rgba(108,59,255,0.18) 0%, rgba(108,59,255,0.04) 60%, var(--surface) 100%)"
        : "var(--surface)",
      border: it.best ? "1px solid rgba(138,92,255,0.55)" : "1px solid var(--line)",
      borderRadius: 22,
      padding: 36,
      position: "relative",
      boxShadow: it.best ? "0 0 60px rgba(108,59,255,0.18)" : "none",
      height: "100%",
      display: "flex", flexDirection: "column",
    }}>
      {it.best && (
        <div className="accent-grad" style={{
          position: "absolute", top: 24, right: 28,
          padding: "5px 12px",
          background: "linear-gradient(135deg,#6C3BFF,#8A5CFF)",
          color: "var(--text-strong)", borderRadius: 999,
          fontSize: 10, fontWeight: 700, letterSpacing: "0.14em", textTransform: "uppercase",
        }}>
          The product
        </div>
      )}
      <h3 style={{ fontFamily: "var(--font-display)", fontSize: 24, fontWeight: 700, color: "var(--text-strong)", margin: 0, marginBottom: 6, letterSpacing: "-0.01em" }}>
        {it.title}
      </h3>
      <div style={{ display: "flex", alignItems: "baseline", gap: 12, marginBottom: 6 }}>
        <span style={{ fontFamily: "var(--font-display)", fontSize: 56, fontWeight: 800, color: "var(--text-strong)", letterSpacing: "-0.03em" }}>
          {it.price}
        </span>
      </div>
      <div className="accent-color" style={{ fontSize: 12, letterSpacing: "0.14em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700, marginBottom: 28 }}>
        {it.cadence}
      </div>
      <ul style={{ margin: 0, padding: 0, listStyle: "none", display: "flex", flexDirection: "column", gap: 12, marginBottom: 32, flex: 1 }}>
        {it.bullets.map((b) => (
          <li key={b} style={{ display: "flex", alignItems: "flex-start", gap: 12, fontSize: 14, color: "var(--text-muted)", lineHeight: 1.5 }}>
            <span className="accent-dot" style={{ width: 6, height: 6, borderRadius: 999, background: "#8A5CFF", flex: "none", marginTop: 8, boxShadow: "0 0 8px rgba(138,92,255,0.6)" }}></span>
            {b}
          </li>
        ))}
      </ul>
      <div style={{
        paddingTop: 22, borderTop: "1px solid var(--line)",
        fontSize: 13, color: "var(--text-muted)", lineHeight: 1.5,
      }}>
        {it.foot}
      </div>
    </div>
  );
}

// ---------- FAQ ----------
const FAQ_ITEMS = [
  { q: "Why 14 days? Aren't most sites built in 6–8 weeks?",
    a: "Because most of that time is calendar drift, not work. We pre-build the system (components, automation patterns, analytics scaffolding) so the days you pay for are spent on your site, not on ours. The schedule is the product." },
  { q: "What if my brand isn't ready?",
    a: "Day 1 is voice + content map; day 3 is moodboard + tokens. If you have a logo and a sense of who you're for, we have enough. If you don't, we'll flag it on the discovery call and either pre-work the brand or recommend you build that first." },
  { q: "Can you build in [my favorite stack]?",
    a: "Framer and Next.js are our defaults. Webflow on request. We've also shipped on Astro and Remix. We won't build on WordPress, Wix, or Squarespace — the automation layer doesn't fit cleanly into those." },
  { q: "What if it slips past day 14?",
    a: "It hasn't, on 40+ projects. If a delay is on us, the care plan is free for the first 3 months. If it's on you (delayed sign-offs, missing content), we hold the schedule and resume when you're ready." },
  { q: "Do you do redesigns or only net-new sites?",
    a: "Both. About 60% of our 14-day projects are redesigns. The schedule is the same — kick-off Monday, live the second Friday." },
  { q: "Who owns the work?",
    a: "You. Code, designs, accounts, integrations — all transferred to your ownership on launch day. The Loom walkthrough explains every part of the system you now own." },
];

function FaqSection() {
  const isMobile = useIsMobile();
  const [open, setOpen] = React.useState(0);
  return (
    <section id="faq" data-screen-label="08 FAQ" className="shefa-pad" style={{ padding: isMobile ? "80px 20px" : "120px 32px", background: "var(--page)", borderTop: "1px solid var(--line)" }}>
      <div style={{ maxWidth: 880, margin: "0 auto" }}>
        <Reveal>
          <div style={{ marginBottom: 40 }}>
            <Eyebrow>Frequently asked</Eyebrow>
            <h2 style={{
              fontFamily: "var(--font-display)", fontSize: isMobile ? 36 : 52, lineHeight: 1.05, color: "var(--text-strong)",
              letterSpacing: "-0.025em", fontWeight: 700, margin: 0,
            }}>
              The honest answers.
            </h2>
          </div>
        </Reveal>

        <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
          {FAQ_ITEMS.map((it, i) => {
            const isOpen = open === i;
            return (
              <div key={i} style={{
                background: isOpen ? "linear-gradient(180deg, rgba(108,59,255,0.10), rgba(108,59,255,0))" : "var(--surface)",
                border: isOpen ? "1px solid rgba(138,92,255,0.4)" : "1px solid var(--line)",
                borderRadius: 14, overflow: "hidden",
                transition: "all 200ms var(--ease-std)",
              }}>
                <button onClick={() => setOpen(isOpen ? -1 : i)} style={{
                  width: "100%", textAlign: "left", background: "transparent",
                  border: 0, padding: "22px 26px", cursor: "pointer",
                  color: "var(--text-strong)", fontFamily: "var(--font-display)", fontSize: 17, fontWeight: 600,
                  display: "flex", justifyContent: "space-between", alignItems: "center", gap: 16,
                }}>
                  <span style={{ textWrap: "pretty" }}>{it.q}</span>
                  <span className={isOpen ? "accent-grad" : ""} style={{
                    width: 30, height: 30, borderRadius: 8,
                    background: isOpen ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "rgba(255,255,255,0.04)",
                    color: "var(--text-strong)", flex: "none",
                    display: "inline-flex", alignItems: "center", justifyContent: "center",
                    fontSize: 18, fontWeight: 400,
                    transition: "all 200ms var(--ease-std)",
                    transform: isOpen ? "rotate(45deg)" : "rotate(0)",
                  }}>+</span>
                </button>
                <div style={{
                  maxHeight: isOpen ? 280 : 0,
                  opacity: isOpen ? 1 : 0,
                  overflow: "hidden",
                  transition: "max-height 300ms var(--ease-std), opacity 200ms var(--ease-std)",
                }}>
                  <div style={{ padding: "0 26px 26px", fontSize: 15, lineHeight: 1.62, color: "var(--accent-faint)", textWrap: "pretty" }}>
                    {it.a}
                  </div>
                </div>
              </div>
            );
          })}
        </div>
      </div>
    </section>
  );
}

Object.assign(window, { PricingSection, FaqSection });

// Plan-your-launch wizard — 4 steps with persistent summary side-rail.
// Steps: Project type → Scope → Pick your Monday → Confirm.

const PROJECT_TYPES = [
  { key: "new",      title: "New brand site",         body: "Marketing site for a new brand or a fresh chapter.", pagesDefault: ["home","about","services","work","contact"] },
  { key: "redesign", title: "Redesign",                body: "You have a site. It's tired. The team has outgrown it.", pagesDefault: ["home","about","services","work","blog","contact"] },
  { key: "dtc",      title: "DTC store + funnels",     body: "Sell products. The site has to convert and ship.",       pagesDefault: ["home","shop","product","cart","about","contact"] },
  { key: "internal", title: "Internal tool + automations", body: "Dashboards, ops layers, the system behind the brand.", pagesDefault: ["home","dashboard","docs","contact"] },
];

const PAGE_OPTIONS = [
  { key: "home",      label: "Home" },
  { key: "about",     label: "About" },
  { key: "services",  label: "Services" },
  { key: "work",      label: "Work / case studies" },
  { key: "blog",      label: "Blog / writing" },
  { key: "contact",   label: "Contact" },
  { key: "pricing",   label: "Pricing" },
  { key: "shop",      label: "Shop index" },
  { key: "product",   label: "Product page" },
  { key: "cart",      label: "Cart + checkout" },
  { key: "dashboard", label: "Dashboard shell" },
  { key: "docs",      label: "Docs / changelog" },
];

const ADD_ONS = [
  { key: "care",   label: "Care plan",       price: "+$1,800/mo", body: "Hosting, monitoring, 8 hrs/mo of changes." },
  { key: "social", label: "Social hand-off", price: "Included",   body: "Profile design + 2-week launch content kit." },
  { key: "va",     label: "VA on-boarding",  price: "+$1,200",    body: "We hand-off + train your VA on the new system." },
];

// Generate the next ~8 Mondays from today.
function nextMondays(count = 8, startOffset = 0) {
  const out = [];
  const d = new Date();
  d.setHours(0, 0, 0, 0);
  // walk to next Monday
  while (d.getDay() !== 1) d.setDate(d.getDate() + 1);
  d.setDate(d.getDate() + startOffset * 7);
  for (let i = 0; i < count; i++) {
    const c = new Date(d);
    out.push(c);
    d.setDate(d.getDate() + 7);
  }
  return out;
}

function fmtDate(d) {
  return d.toLocaleDateString(undefined, { weekday: "short", month: "short", day: "numeric" });
}
function fmtDateLong(d) {
  return d.toLocaleDateString(undefined, { weekday: "long", month: "long", day: "numeric", year: "numeric" });
}
function addDays(d, n) { const c = new Date(d); c.setDate(c.getDate() + n); return c; }

function WizardSection({ accentMode }) {
  const isMobile = useIsMobile();
  const mondays = React.useMemo(() => nextMondays(8, 0), []);
  // mark first 2 as taken to feel real
  const taken = React.useMemo(() => new Set([mondays[0].toDateString(), mondays[2].toDateString()]), [mondays]);

  const [step, setStep] = React.useState(1);
  const [pType, setPType] = React.useState("new");
  const [pages, setPages] = React.useState(["home","about","services","work","contact"]);
  const [addOns, setAddOns] = React.useState(["social"]);
  const [monday, setMonday] = React.useState(null);
  const [name, setName] = React.useState("");
  const [email, setEmail] = React.useState("");
  const [brand, setBrand] = React.useState("");
  const [notes, setNotes] = React.useState("");
  const [submitted, setSubmitted] = React.useState(false);

  // when project type changes, reset page defaults
  const setTypeAndPages = (k) => {
    setPType(k);
    const t = PROJECT_TYPES.find((x) => x.key === k);
    setPages(t.pagesDefault);
  };

  const togglePage = (k) => setPages((p) => p.includes(k) ? p.filter((x) => x !== k) : [...p, k]);
  const toggleAddon = (k) => setAddOns((p) => p.includes(k) ? p.filter((x) => x !== k) : [...p, k]);

  const basePrice = 14000;
  const addonCost = addOns.reduce((acc, k) => {
    const a = ADD_ONS.find((x) => x.key === k);
    if (!a) return acc;
    if (a.price.startsWith("+$")) return acc + parseInt(a.price.replace(/[^\d]/g, ""), 10) * (a.price.includes("/mo") ? 0 : 1);
    return acc;
  }, 0);
  const total = basePrice + addonCost;
  const monthlyTotal = addOns.includes("care") ? 1800 : 0;

  const canNext =
    (step === 1) ||
    (step === 2 && pages.length > 0) ||
    (step === 3 && monday) ||
    (step === 4 && name && email.includes("@") && brand);

  const submit = (e) => {
    e?.preventDefault();
    if (!canNext) return;
    setSubmitted(true);
  };

  const stepTitles = ["Project type", "Scope", "Kick-off Monday", "You"];

  return (
    <section id="book" data-screen-label="09 Plan your launch — wizard" className="shefa-pad" style={{ padding: isMobile ? "80px 20px 100px" : "120px 32px 140px", background: "var(--page)", borderTop: "1px solid var(--line)", position: "relative", overflow: "hidden" }}>
      {/* big background glow */}
      <div style={{
        position: "absolute", inset: 0,
        background: "radial-gradient(80% 60% at 50% 0%, rgba(108,59,255,0.16), transparent 60%)",
        pointerEvents: "none",
      }}></div>
      <NodesBg density={20} opacity={0.30} />

      <div style={{ maxWidth: 1200, margin: "0 auto", position: "relative", zIndex: 1 }}>
        <Reveal>
          <div style={{ textAlign: "center", marginBottom: isMobile ? 32 : 56 }}>
            <div style={{ display: "inline-block" }}><Eyebrow>Plan your launch</Eyebrow></div>
            <h2 style={{
              fontFamily: "var(--font-display)", fontSize: isMobile ? 36 : 60, lineHeight: 1.02, color: "var(--text-strong)",
              letterSpacing: "-0.03em", fontWeight: 800, margin: 0, marginBottom: 14,
            }}>
              Pick a Monday. <span style={{
                background: accentMode === "red"
                  ? "linear-gradient(135deg,#FF4D4F,#FF8B8E)"
                  : "linear-gradient(135deg,#8A5CFF,var(--accent-faint))",
                WebkitBackgroundClip: "text", backgroundClip: "text", color: "transparent",
              }}>Launch the second Friday.</span>
            </h2>
            <p style={{ fontSize: 17, color: "var(--text-muted)", maxWidth: 600, margin: "0 auto", lineHeight: 1.6 }}>
              Four questions. Two minutes. You'll leave with a fixed quote, a calendar slot, and a Slack invite waiting in your inbox.
            </p>
          </div>
        </Reveal>

        <Reveal delay={80}>
          {submitted ? (
            <Confirmation
              data={{ pType, pages, addOns, monday, name, email, brand, notes, total, monthlyTotal }}
            />
          ) : (
            <div style={{
              background: "rgba(15,21,37,0.85)",
              backdropFilter: "blur(12px)",
              WebkitBackdropFilter: "blur(12px)",
              border: "1px solid rgba(138,92,255,0.32)",
              borderRadius: 24,
              overflow: "hidden",
              display: "grid",
              gridTemplateColumns: isMobile ? "1fr" : "1.55fr 1fr",
              boxShadow: "0 30px 80px rgba(0,0,0,0.45), 0 0 60px rgba(108,59,255,0.12)",
            }}>
              {/* LEFT — current step */}
              <div style={{ padding: isMobile ? "28px 20px 24px" : "40px 44px 36px" }}>
                {/* Progress */}
                <div style={{ display: "flex", gap: 8, marginBottom: 32, alignItems: "center" }}>
                  {[1,2,3,4].map((s) => (
                    <React.Fragment key={s}>
                      <button onClick={() => s <= step && setStep(s)} style={{
                        background: s <= step ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "rgba(255,255,255,0.05)",
                        color: s <= step ? "var(--on-accent)" : "var(--text-faint)",
                        border: s === step ? "1px solid #A78BFA" : "1px solid transparent",
                        borderRadius: 999,
                        padding: "5px 12px",
                        fontFamily: "var(--font-mono)", fontSize: 11, fontWeight: 700,
                        cursor: s <= step ? "pointer" : "default",
                        letterSpacing: "0.06em",
                        transition: "all 200ms",
                        boxShadow: s === step ? "0 0 12px rgba(138,92,255,0.45)" : "none",
                      }}>0{s} · {stepTitles[s-1]}</button>
                      {s < 4 && <span style={{ flex: 1, height: 1, background: s < step ? "linear-gradient(90deg,#8A5CFF,#6C3BFF44)" : "var(--line)" }}></span>}
                    </React.Fragment>
                  ))}
                </div>

                <div style={{ minHeight: 380 }}>
                  {step === 1 && <StepProjectType value={pType} onChange={setTypeAndPages} />}
                  {step === 2 && <StepScope pages={pages} togglePage={togglePage} addOns={addOns} toggleAddon={toggleAddon} />}
                  {step === 3 && <StepMonday mondays={mondays} taken={taken} value={monday} onChange={setMonday} />}
                  {step === 4 && <StepContact name={name} setName={setName} email={email} setEmail={setEmail} brand={brand} setBrand={setBrand} notes={notes} setNotes={setNotes} />}
                </div>

                {/* Footer nav */}
                <div style={{
                  display: "flex", justifyContent: "space-between", alignItems: "center",
                  marginTop: 36, paddingTop: 24, borderTop: "1px solid rgba(255,255,255,0.06)",
                }}>
                  <button onClick={() => setStep(Math.max(1, step - 1))} disabled={step === 1} style={{
                    background: "transparent", border: 0, color: step === 1 ? "var(--line-strong)" : "var(--text-muted)",
                    cursor: step === 1 ? "default" : "pointer", fontFamily: "inherit",
                    fontSize: 14, fontWeight: 600, padding: "12px 4px",
                    display: "inline-flex", alignItems: "center", gap: 8,
                    transition: "color 160ms",
                  }}
                  onMouseEnter={(e) => { if (step !== 1) e.currentTarget.style.color = "#fff"; }}
                  onMouseLeave={(e) => { if (step !== 1) e.currentTarget.style.color = "var(--text-muted)"; }}>
                    ← Back
                  </button>

                  {step < 4 ? (
                    <button onClick={() => canNext && setStep(step + 1)} disabled={!canNext}
                      className={canNext ? "accent-grad" : ""}
                      style={{
                        background: canNext ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "rgba(255,255,255,0.05)",
                        color: canNext ? "var(--on-accent)" : "var(--text-faint)", border: 0,
                        cursor: canNext ? "pointer" : "default",
                        padding: "14px 26px", borderRadius: 10,
                        fontFamily: "inherit", fontWeight: 600, fontSize: 14,
                        display: "inline-flex", alignItems: "center", gap: 10,
                        transition: "all 200ms",
                      }}
                      onMouseEnter={(e) => { if (canNext) { e.currentTarget.style.filter = "brightness(1.08)"; e.currentTarget.style.boxShadow = "0 0 24px rgba(108,59,255,0.45)"; }}}
                      onMouseLeave={(e) => { if (canNext) { e.currentTarget.style.filter = "brightness(1)"; e.currentTarget.style.boxShadow = "none"; }}}>
                      Continue →
                    </button>
                  ) : (
                    <button onClick={submit} disabled={!canNext}
                      className={canNext ? "accent-grad" : ""}
                      style={{
                        background: canNext ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "rgba(255,255,255,0.05)",
                        color: canNext ? "var(--on-accent)" : "var(--text-faint)", border: 0,
                        cursor: canNext ? "pointer" : "default",
                        padding: "14px 26px", borderRadius: 10,
                        fontFamily: "inherit", fontWeight: 700, fontSize: 14,
                        display: "inline-flex", alignItems: "center", gap: 10,
                        letterSpacing: "0.04em",
                        transition: "all 200ms",
                      }}
                      onMouseEnter={(e) => { if (canNext) { e.currentTarget.style.filter = "brightness(1.08)"; e.currentTarget.style.boxShadow = "0 0 32px rgba(108,59,255,0.5)"; }}}
                      onMouseLeave={(e) => { if (canNext) { e.currentTarget.style.filter = "brightness(1)"; e.currentTarget.style.boxShadow = "none"; }}}>
                      Lock my Monday →
                    </button>
                  )}
                </div>
              </div>

              {/* RIGHT — live summary rail (desktop only) */}
              {!isMobile && (
                <SummaryRail
                  pType={pType} pages={pages} addOns={addOns} monday={monday}
                  total={total} monthlyTotal={monthlyTotal}
                />
              )}
            </div>
          )}
        </Reveal>
      </div>
    </section>
  );
}

// ---------- STEP 1: Project Type ----------
function StepProjectType({ value, onChange }) {
  return (
    <div>
      <h3 style={{ fontFamily: "var(--font-display)", fontSize: 28, fontWeight: 700, color: "var(--text-strong)", margin: 0, marginBottom: 8, letterSpacing: "-0.02em" }}>
        What are we building?
      </h3>
      <p style={{ fontSize: 14, color: "var(--text-muted)", margin: 0, marginBottom: 28 }}>
        Pick the closest match. We'll tune the scope on the kick-off call.
      </p>
      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 12 }}>
        {PROJECT_TYPES.map((t) => {
          const active = value === t.key;
          return (
            <button key={t.key} onClick={() => onChange(t.key)} style={{
              textAlign: "left",
              background: active ? "linear-gradient(180deg, rgba(108,59,255,0.20), rgba(108,59,255,0.05))" : "rgba(255,255,255,0.02)",
              border: active ? "1px solid rgba(138,92,255,0.55)" : "1px solid var(--line)",
              borderRadius: 14, padding: 22, cursor: "pointer",
              transition: "all 200ms var(--ease-std)",
              color: "inherit", fontFamily: "inherit",
              boxShadow: active ? "0 0 24px rgba(108,59,255,0.22)" : "none",
              position: "relative",
            }}>
              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 10 }}>
                <div style={{
                  width: 18, height: 18, borderRadius: 99,
                  background: active ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "transparent",
                  border: active ? "1px solid #fff" : "1.5px solid var(--line-strong)",
                  display: "flex", alignItems: "center", justifyContent: "center",
                  transition: "all 200ms",
                }}>
                  {active && <svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="4" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12"/></svg>}
                </div>
              </div>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 18, fontWeight: 700, color: "var(--text-strong)", letterSpacing: "-0.01em", marginBottom: 6 }}>
                {t.title}
              </div>
              <div style={{ fontSize: 13, color: "var(--text-muted)", lineHeight: 1.5, textWrap: "pretty" }}>
                {t.body}
              </div>
            </button>
          );
        })}
      </div>
    </div>
  );
}

// ---------- STEP 2: Scope ----------
function StepScope({ pages, togglePage, addOns, toggleAddon }) {
  return (
    <div>
      <h3 style={{ fontFamily: "var(--font-display)", fontSize: 28, fontWeight: 700, color: "var(--text-strong)", margin: 0, marginBottom: 8, letterSpacing: "-0.02em" }}>
        What's in scope?
      </h3>
      <p style={{ fontSize: 14, color: "var(--text-muted)", margin: 0, marginBottom: 22 }}>
        Up to 6 pages is included in the fixed price. Add-ons are optional.
      </p>

      <div className="accent-color" style={{ fontSize: 11, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700, marginBottom: 12 }}>
        Pages · {pages.length} selected
      </div>
      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 8, marginBottom: 24 }}>
        {PAGE_OPTIONS.map((p) => {
          const active = pages.includes(p.key);
          return (
            <button key={p.key} onClick={() => togglePage(p.key)} style={{
              background: active ? "rgba(108,59,255,0.18)" : "rgba(255,255,255,0.02)",
              border: active ? "1px solid rgba(138,92,255,0.5)" : "1px solid var(--line)",
              borderRadius: 10, padding: "12px 14px", textAlign: "left", cursor: "pointer",
              fontFamily: "inherit", fontSize: 13, fontWeight: 500,
              color: active ? "var(--on-accent)" : "var(--accent-faint)",
              display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8,
              transition: "all 160ms",
            }}>
              <span>{p.label}</span>
              <span style={{
                width: 16, height: 16, borderRadius: 4,
                background: active ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "transparent",
                border: active ? "1px solid #8A5CFF" : "1.5px solid var(--line-strong)",
                display: "flex", alignItems: "center", justifyContent: "center",
                transition: "all 160ms",
              }}>
                {active && <svg width="9" height="9" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="4" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12"/></svg>}
              </span>
            </button>
          );
        })}
      </div>

      <div className="accent-color" style={{ fontSize: 11, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700, marginBottom: 12 }}>
        Add-ons
      </div>
      <div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
        {ADD_ONS.map((a) => {
          const active = addOns.includes(a.key);
          return (
            <button key={a.key} onClick={() => toggleAddon(a.key)} style={{
              background: active ? "rgba(108,59,255,0.14)" : "rgba(255,255,255,0.02)",
              border: active ? "1px solid rgba(138,92,255,0.5)" : "1px solid var(--line)",
              borderRadius: 12, padding: "16px 18px", textAlign: "left", cursor: "pointer",
              fontFamily: "inherit",
              display: "grid", gridTemplateColumns: "20px 1fr auto", gap: 14, alignItems: "center",
              transition: "all 160ms",
            }}>
              <span style={{
                width: 18, height: 18, borderRadius: 4,
                background: active ? "linear-gradient(135deg,#6C3BFF,#8A5CFF)" : "transparent",
                border: active ? "1px solid #8A5CFF" : "1.5px solid var(--line-strong)",
                display: "flex", alignItems: "center", justifyContent: "center",
              }}>
                {active && <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="4" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12"/></svg>}
              </span>
              <div>
                <div style={{ fontFamily: "var(--font-display)", fontSize: 15, fontWeight: 700, color: "var(--text-strong)", marginBottom: 2, letterSpacing: "-0.01em" }}>
                  {a.label}
                </div>
                <div style={{ fontSize: 12.5, color: "var(--text-muted)", lineHeight: 1.45 }}>{a.body}</div>
              </div>
              <div style={{ fontFamily: "var(--font-mono)", fontSize: 12, color: a.price === "Included" ? "#A78BFA" : "#fff", whiteSpace: "nowrap", fontWeight: 600 }}>
                {a.price}
              </div>
            </button>
          );
        })}
      </div>
    </div>
  );
}

// ---------- STEP 3: Pick Monday ----------
function StepMonday({ mondays, taken, value, onChange }) {
  return (
    <div>
      <h3 style={{ fontFamily: "var(--font-display)", fontSize: 28, fontWeight: 700, color: "var(--text-strong)", margin: 0, marginBottom: 8, letterSpacing: "-0.02em" }}>
        Pick your kick-off Monday.
      </h3>
      <p style={{ fontSize: 14, color: "var(--text-muted)", margin: 0, marginBottom: 24 }}>
        We start a Monday at 10am. The selected Friday is when your site goes live.
      </p>

      <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 10 }}>
        {mondays.map((m, i) => {
          const isTaken = taken.has(m.toDateString());
          const isSelected = value && value.toDateString() === m.toDateString();
          return (
            <button key={i}
              onClick={() => !isTaken && onChange(m)}
              disabled={isTaken}
              style={{
                background: isSelected ? "linear-gradient(180deg, rgba(108,59,255,0.30), rgba(108,59,255,0.10))"
                  : isTaken ? "rgba(255,255,255,0.02)" : "rgba(255,255,255,0.03)",
                border: isSelected ? "1px solid rgba(138,92,255,0.6)"
                  : isTaken ? "1px dashed var(--line)" : "1px solid var(--line)",
                borderRadius: 14,
                padding: "16px 14px",
                cursor: isTaken ? "not-allowed" : "pointer",
                textAlign: "left",
                fontFamily: "inherit",
                color: isTaken ? "var(--line-strong)" : "var(--line)",
                position: "relative",
                transition: "all 200ms var(--ease-std)",
                boxShadow: isSelected ? "0 0 24px rgba(108,59,255,0.32)" : "none",
                transform: isSelected ? "translateY(-1px)" : "translateY(0)",
              }}>
              <div style={{ fontSize: 10, letterSpacing: "0.16em", textTransform: "uppercase", color: isTaken ? "var(--line-strong)" : "#A78BFA", fontWeight: 700, marginBottom: 6 }}>
                {isTaken ? "Booked" : (isSelected ? "Selected" : "Open")}
              </div>
              <div style={{ fontFamily: "var(--font-display)", fontSize: 20, fontWeight: 700, color: isTaken ? "var(--line-strong)" : "#fff", letterSpacing: "-0.01em" }}>
                {m.toLocaleDateString(undefined, { month: "short", day: "numeric" })}
              </div>
              <div style={{ fontSize: 11, color: isTaken ? "var(--line-strong)" : "var(--text-faint)", marginTop: 4, fontFamily: "var(--font-mono)" }}>
                → ships {addDays(m, 11).toLocaleDateString(undefined, { month: "short", day: "numeric" })}
              </div>
              {isSelected && (
                <div className="accent-dot" style={{
                  position: "absolute", top: 12, right: 12,
                  width: 8, height: 8, borderRadius: 99, background: "#8A5CFF",
                  boxShadow: "0 0 10px rgba(138,92,255,0.9)",
                }}></div>
              )}
            </button>
          );
        })}
      </div>

      <div style={{ marginTop: 22, display: "flex", gap: 18, fontSize: 11, color: "var(--text-faint)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600 }}>
        <span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
          <span style={{ width: 10, height: 10, borderRadius: 3, background: "rgba(108,59,255,0.30)", border: "1px solid rgba(138,92,255,0.6)" }}></span>
          Open
        </span>
        <span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
          <span style={{ width: 10, height: 10, borderRadius: 3, background: "rgba(255,255,255,0.02)", border: "1px dashed var(--line)" }}></span>
          Booked
        </span>
      </div>
    </div>
  );
}

// ---------- STEP 4: Contact ----------
function StepContact({ name, setName, email, setEmail, brand, setBrand, notes, setNotes }) {
  const fieldStyle = {
    width: "100%", background: "rgba(10,14,26,0.6)",
    border: "1px solid var(--line)", color: "var(--text-strong)",
    padding: "14px 16px", borderRadius: 10,
    fontFamily: "inherit", fontSize: 14, outline: "none",
    transition: "border-color 160ms, box-shadow 160ms",
  };
  const onFocus = (e) => { e.currentTarget.style.borderColor = "#8A5CFF"; e.currentTarget.style.boxShadow = "0 0 0 3px rgba(138,92,255,0.18)"; };
  const onBlur  = (e) => { e.currentTarget.style.borderColor = "var(--line)"; e.currentTarget.style.boxShadow = "none"; };

  const labelStyle = { fontSize: 11, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700, marginBottom: 8, display: "block" };

  return (
    <div>
      <h3 style={{ fontFamily: "var(--font-display)", fontSize: 28, fontWeight: 700, color: "var(--text-strong)", margin: 0, marginBottom: 8, letterSpacing: "-0.02em" }}>
        And you?
      </h3>
      <p style={{ fontSize: 14, color: "var(--text-muted)", margin: 0, marginBottom: 24 }}>
        We'll reply within a day with a one-pager, the Slack invite, and your kick-off calendar hold.
      </p>

      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 14, marginBottom: 14 }}>
        <div>
          <label className="accent-color" style={labelStyle}>Your name</label>
          <input value={name} onChange={(e) => setName(e.target.value)} placeholder="Maya Okafor" style={fieldStyle} onFocus={onFocus} onBlur={onBlur} />
        </div>
        <div>
          <label className="accent-color" style={labelStyle}>Brand</label>
          <input value={brand} onChange={(e) => setBrand(e.target.value)} placeholder="Northwind Studio" style={fieldStyle} onFocus={onFocus} onBlur={onBlur} />
        </div>
      </div>

      <div style={{ marginBottom: 14 }}>
        <label className="accent-color" style={labelStyle}>Work email</label>
        <input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="you@brand.com" type="email" style={fieldStyle} onFocus={onFocus} onBlur={onBlur} />
      </div>

      <div>
        <label className="accent-color" style={labelStyle}>Anything we should know? <span style={{ color: "var(--text-faint)", letterSpacing: "normal", textTransform: "none", fontWeight: 400 }}>(optional)</span></label>
        <textarea value={notes} onChange={(e) => setNotes(e.target.value)} placeholder="Hard launch date, existing brand kit, integrations…"
          style={{ ...fieldStyle, resize: "vertical", minHeight: 84, fontFamily: "inherit" }} onFocus={onFocus} onBlur={onBlur} />
      </div>
    </div>
  );
}

// ---------- SUMMARY RAIL ----------
function SummaryRail({ pType, pages, addOns, monday, total, monthlyTotal }) {
  const t = PROJECT_TYPES.find((x) => x.key === pType);
  return (
    <div style={{
      background: "rgba(10,14,26,0.7)",
      borderLeft: "1px solid var(--line)",
      padding: "40px 36px",
      position: "relative",
      display: "flex", flexDirection: "column", gap: 22,
    }}>
      <div className="accent-color" style={{ fontSize: 11, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700 }}>
        Your launch · live summary
      </div>

      <div>
        <div style={{ fontSize: 11, color: "var(--text-faint)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600, marginBottom: 6 }}>Project</div>
        <div style={{ fontFamily: "var(--font-display)", fontSize: 18, fontWeight: 700, color: "var(--text-strong)", letterSpacing: "-0.01em" }}>{t.title}</div>
      </div>

      <div>
        <div style={{ fontSize: 11, color: "var(--text-faint)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600, marginBottom: 8 }}>Pages · {pages.length}</div>
        <div style={{ display: "flex", flexWrap: "wrap", gap: 6 }}>
          {pages.length === 0 && <span style={{ fontSize: 12, color: "var(--text-faint)" }}>None yet</span>}
          {pages.map((p) => {
            const label = PAGE_OPTIONS.find((x) => x.key === p)?.label || p;
            return (
              <span key={p} style={{
                fontSize: 11, color: "var(--accent-faint)", fontFamily: "var(--font-mono)",
                background: "rgba(108,59,255,0.10)", border: "1px solid rgba(138,92,255,0.32)",
                padding: "3px 9px", borderRadius: 999,
              }}>{label}</span>
            );
          })}
        </div>
      </div>

      <div>
        <div style={{ fontSize: 11, color: "var(--text-faint)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600, marginBottom: 8 }}>Add-ons · {addOns.length}</div>
        {addOns.length === 0 ? (
          <div style={{ fontSize: 12, color: "var(--text-faint)" }}>None — just the 14-day site</div>
        ) : (
          <ul style={{ margin: 0, padding: 0, listStyle: "none", display: "flex", flexDirection: "column", gap: 6 }}>
            {addOns.map((k) => {
              const a = ADD_ONS.find((x) => x.key === k);
              return (
                <li key={k} style={{ display: "flex", justifyContent: "space-between", fontSize: 13, color: "var(--text-muted)" }}>
                  <span>{a.label}</span>
                  <span style={{ fontFamily: "var(--font-mono)", color: a.price === "Included" ? "#A78BFA" : "var(--text-muted)" }}>{a.price}</span>
                </li>
              );
            })}
          </ul>
        )}
      </div>

      <div>
        <div style={{ fontSize: 11, color: "var(--text-faint)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600, marginBottom: 6 }}>Schedule</div>
        {monday ? (
          <div>
            <div style={{ fontFamily: "var(--font-display)", fontSize: 17, fontWeight: 700, color: "var(--text-strong)", letterSpacing: "-0.01em" }}>
              Kick-off · {fmtDate(monday)}
            </div>
            <div style={{ fontSize: 12.5, color: "#A78BFA", marginTop: 4 }}>
              Goes live · {fmtDate(addDays(monday, 11))}
            </div>
          </div>
        ) : (
          <div style={{ fontSize: 13, color: "var(--text-faint)" }}>Pick a Monday in step 3 →</div>
        )}
      </div>

      <div style={{ marginTop: "auto", paddingTop: 24, borderTop: "1px solid var(--line)" }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 4 }}>
          <span style={{ fontSize: 11, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700 }} className="accent-color">Fixed price</span>
          <span style={{ fontFamily: "var(--font-display)", fontSize: 36, fontWeight: 800, color: "var(--text-strong)", letterSpacing: "-0.03em" }}>
            ${total.toLocaleString()}
          </span>
        </div>
        {monthlyTotal > 0 && (
          <div style={{ display: "flex", justifyContent: "space-between", fontSize: 12, color: "var(--text-muted)" }}>
            <span>Then care plan</span>
            <span style={{ fontFamily: "var(--font-mono)", color: "var(--accent-faint)" }}>+${monthlyTotal.toLocaleString()}/mo</span>
          </div>
        )}
        <div style={{ fontSize: 11, color: "var(--text-faint)", marginTop: 12, lineHeight: 1.5 }}>
          One invoice on Monday. No retainer. No add-ons after kick-off.
        </div>
      </div>
    </div>
  );
}

// ---------- CONFIRMATION ----------
function Confirmation({ data }) {
  const { brand, name, email, monday, pages, addOns, pType, total, monthlyTotal, notes } = data;
  const t = PROJECT_TYPES.find((x) => x.key === pType);
  return (
    <div style={{
      background: "linear-gradient(180deg, rgba(108,59,255,0.18), rgba(108,59,255,0.02))",
      border: "1px solid rgba(138,92,255,0.55)",
      borderRadius: 24,
      overflow: "hidden",
      boxShadow: "0 30px 80px rgba(0,0,0,0.45), 0 0 80px rgba(108,59,255,0.22)",
    }}>
      <div style={{ padding: "56px 56px 40px", position: "relative", overflow: "hidden" }}>
        <NodesBg density={16} opacity={0.35} />
        <div style={{ position: "relative", zIndex: 1, display: "grid", gridTemplateColumns: "1.4fr 1fr", gap: 48, alignItems: "flex-start" }}>
          <div>
            <div className="accent-color" style={{ fontSize: 12, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700, marginBottom: 18, display: "inline-flex", alignItems: "center", gap: 10 }}>
              <span style={{
                width: 24, height: 24, borderRadius: "50%",
                background: "linear-gradient(135deg,#6C3BFF,#8A5CFF)",
                display: "inline-flex", alignItems: "center", justifyContent: "center",
                animation: "shefaPulseGlow 1.8s infinite",
              }}>
                <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="#fff" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
              </span>
              Locked in
            </div>
            <h3 style={{
              fontFamily: "var(--font-display)", fontSize: 44, lineHeight: 1.05, color: "var(--text-strong)",
              letterSpacing: "-0.03em", fontWeight: 800, margin: 0, marginBottom: 14,
            }}>
              See you Monday, {name.split(" ")[0]}.
            </h3>
            <p style={{ fontSize: 17, color: "var(--accent-faint)", margin: 0, marginBottom: 28, lineHeight: 1.6 }}>
              Your kick-off for <b style={{ color: "var(--text-strong)" }}>{brand}</b> is held for {monday ? fmtDateLong(monday) : "your Monday"} at 10am.
              We'll reply to <b style={{ color: "var(--text-strong)" }}>{email}</b> within a day with a one-pager, the Slack invite, and a calendar hold.
            </p>

            <div style={{ display: "flex", gap: 12, flexWrap: "wrap" }}>
              <a href="#home" className="accent-grad" style={{
                background: "linear-gradient(135deg,#6C3BFF,#8A5CFF)", color: "var(--text-strong)", textDecoration: "none",
                padding: "14px 22px", borderRadius: 10, fontWeight: 600, fontSize: 14,
              }}>Back to top ↑</a>
              <a href="#process" style={{
                background: "transparent", color: "var(--accent-faint)", textDecoration: "none",
                padding: "14px 22px", borderRadius: 10, fontWeight: 600, fontSize: 14,
                border: "1px solid var(--line-strong)",
              }}>Walk through the 14 days →</a>
            </div>
          </div>

          {/* Receipt */}
          <div style={{
            background: "rgba(10,14,26,0.65)",
            border: "1px solid var(--line)",
            borderRadius: 18, padding: 28,
            backdropFilter: "blur(8px)",
          }}>
            <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 18 }}>
              <ShefaWordmark size={20} />
              <span style={{ fontSize: 10, color: "var(--text-faint)", letterSpacing: "0.18em", textTransform: "uppercase", fontWeight: 700 }}>Hold</span>
            </div>
            <div style={{ display: "flex", flexDirection: "column", gap: 12, fontSize: 13, marginBottom: 22 }}>
              <Row k="Project" v={t.title} />
              <Row k="Pages"   v={`${pages.length} included`} />
              <Row k="Add-ons" v={addOns.length === 0 ? "—" : addOns.map((a) => ADD_ONS.find((x) => x.key === a).label).join(", ")} />
              <Row k="Kick-off" v={monday ? fmtDate(monday) : "—"} />
              <Row k="Goes live" v={monday ? fmtDate(addDays(monday, 11)) : "—"} />
            </div>
            <div style={{ paddingTop: 18, borderTop: "1px solid var(--line)", display: "flex", flexDirection: "column", gap: 10 }}>
              <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline" }}>
                <span style={{ fontSize: 11, letterSpacing: "0.18em", textTransform: "uppercase", color: "#A78BFA", fontWeight: 700 }} className="accent-color">Fixed price</span>
                <span style={{ fontFamily: "var(--font-display)", fontSize: 32, fontWeight: 800, color: "var(--text-strong)", letterSpacing: "-0.03em" }}>${total.toLocaleString()}</span>
              </div>
              {monthlyTotal > 0 && (
                <div style={{ display: "flex", justifyContent: "space-between", fontSize: 12, color: "var(--text-muted)" }}>
                  <span>Then care plan</span>
                  <span style={{ fontFamily: "var(--font-mono)", color: "var(--accent-faint)" }}>+${monthlyTotal.toLocaleString()}/mo</span>
                </div>
              )}
              <div style={{ fontSize: 11, color: "var(--text-faint)", marginTop: 4, fontFamily: "var(--font-mono)" }}>
                Ref · SHEFA-{Math.floor(100000 + Math.random() * 900000)}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}

function Row({ k, v }) {
  return (
    <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: 12 }}>
      <span style={{ color: "var(--text-faint)", fontSize: 11, letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 600 }}>{k}</span>
      <span style={{ color: "var(--text-strong)", textAlign: "right", maxWidth: "65%", textWrap: "pretty" }}>{v}</span>
    </div>
  );
}

Object.assign(window, { WizardSection });
