// ---------- Marketing landing page — light, editorial ----------

const LandingPage = ({ onEnterApp, accent, onNav }) => {
  return (
    <div className="light-scroll" style={{
      background: "var(--paper)", color: "var(--ink)",
      minHeight: "100vh", fontFamily: "var(--sans)",
    }}>
      <MarketingNav active="landing" onNav={onNav} onEnterApp={onEnterApp} />
      <Hero onEnterApp={onEnterApp} accent={accent} />
      <Marquee />
      <ByTheNumbers />
      <ProblemSolution />
      <FeaturePreview accent={accent} />
      <WhoItsFor />
      <PricingPreview onEnterApp={onEnterApp} />
      <FinalCTA onEnterApp={onEnterApp} />
      <MarketingFooter onNav={onNav} />
    </div>
  );
};

const LandingNav = ({ onEnterApp }) => {
  const [scrolled, setScrolled] = React.useState(false);
  React.useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 24);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  return (
    <header style={{
      position: "sticky", top: 0, zIndex: 30,
      background: scrolled ? "rgba(250,248,244,0.88)" : "rgba(250,248,244,0)",
      backdropFilter: scrolled ? "blur(16px)" : "none",
      borderBottom: scrolled ? "1px solid rgba(8,12,16,0.06)" : "1px solid transparent",
      transition: "all 240ms ease",
    }}>
      <div className="container" style={{
        display: "flex", alignItems: "center", justifyContent: "space-between",
        height: 76,
      }}>
        <div style={{ display: "flex", alignItems: "center", gap: 40 }}>
          <HDLockup light markSize={28} />
          <nav style={{ display: "flex", gap: 28 }}>
            {["Product", "Workflow", "Studios", "Pricing", "Journal"].map(item => (
              <a key={item} href="#" style={{
                fontSize: 13, color: "rgba(8,12,16,0.65)", fontWeight: 400,
                transition: "color 120ms ease",
              }}
                onMouseEnter={(e) => (e.currentTarget.style.color = "var(--ink)")}
                onMouseLeave={(e) => (e.currentTarget.style.color = "rgba(8,12,16,0.65)")}
              >{item}</a>
            ))}
          </nav>
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
          <button onClick={onEnterApp} style={{
            background: "transparent", border: "none", padding: "8px 12px",
            fontSize: 13, color: "var(--ink)", cursor: "pointer", fontFamily: "var(--sans)",
          }}>Sign in</button>
          <Button variant="secondary" light size="md" onClick={onEnterApp}>
            Open portal
          </Button>
        </div>
      </div>
    </header>
  );
};

const Hero = ({ onEnterApp, accent }) => (
  <section style={{ padding: "56px 0 72px", position: "relative", overflow: "hidden" }} className="hd-landing-hero sm-pad-y">
    {/* subtle topographic background */}
    <svg style={{ position: "absolute", inset: 0, width: "100%", height: "100%", opacity: 0.05, pointerEvents: "none" }} viewBox="0 0 1280 800" preserveAspectRatio="xMidYMid slice">
      {Array.from({ length: 22 }).map((_, i) => {
        const y = 60 + i * 32;
        return <path key={i} d={`M -100 ${y} Q 320 ${y - 24 + (i % 3) * 8} 640 ${y} T 1380 ${y}`} stroke="var(--ink)" fill="none" strokeWidth="0.6" />;
      })}
    </svg>

    <div className="container" style={{ position: "relative" }}>
      <div style={{ display: "flex", alignItems: "center", gap: 10, marginBottom: 28 }}>
        <span style={{ width: 6, height: 6, borderRadius: 99, background: "var(--harbor)" }} className="hd-pulse" />
        <span className="micro" style={{ color: "rgba(8,12,16,0.55)" }}>ITERATION 04 · LIVE WITH FOUNDING STUDIOS</span>
      </div>

      <div style={{
        display: "grid", gridTemplateColumns: "1.15fr 1fr",
        gap: 72, alignItems: "center",
      }} className="md-stack">
        <div className="hd-landing-copy-column">
          <h1 className="hd-landing-title sm-h-hero" style={{
            margin: 0, fontFamily: "var(--serif)",
            fontSize: "clamp(56px, 7.4vw, 96px)", lineHeight: 0.98,
            fontWeight: 500, letterSpacing: "-0.03em",
            color: "var(--ink)",
          }}>
            <span className="hd-landing-title-main">Where <span>creativity</span></span><br className="hd-landing-title-break" />
            <span className="hd-landing-title-italic" style={{ fontStyle: "italic", color: "rgba(8,12,16,0.55)" }}>meets clarity.</span>
          </h1>

          <p className="hd-landing-copy" style={{
            fontSize: 18, lineHeight: 1.55, color: "rgba(8,12,16,0.72)",
            maxWidth: 480, margin: "32px 0 0",
          }}>
            A premium client portal for studios that take the work — and the experience around it — seriously.
            Project, draft, comment, revision, approval — one calm, branded workspace.
          </p>

          <div className="hd-landing-actions sm-stack-row" style={{ display: "flex", gap: 12, marginTop: 36 }}>
            <Button variant="secondary" light size="lg" onClick={onEnterApp} iconRight={<window.Icon.Arrow size={15} />}>
              Open the portal
            </Button>
            <Button variant="ghost" light size="lg" icon={<window.Icon.Play size={13} />}>
              90-second tour
            </Button>
          </div>
        </div>

        <div className="hd-hero-preview-column">
          <HeroPreview accent={accent} />
        </div>
      </div>
    </div>
  </section>
);

// Mini portal widget — an authentic miniature of the workspace dashboard
const HeroPreview = ({ accent }) => {
  // Same data the real dashboard renders
  const metrics = HD.metrics.slice(0, 4);
  const projects = HD.projects.slice(0, 3);
  const review = HD.reviewQueue[0];
  return (
    <div className="hd-hero-preview-shell" style={{ position: "relative" }}>
      {/* Surrounding chrome — like a window */}
      <div className="hd-hero-preview-window" style={{
        background: "var(--ink)", color: "var(--white)",
        borderRadius: 18, padding: 0,
        boxShadow: "0 50px 100px -40px rgba(8,12,16,0.55), 0 0 0 1px rgba(8,12,16,0.06)",
        overflow: "hidden",
        fontFamily: "var(--sans)",
      }}>
        {/* Window topbar */}
        <div style={{
          display: "flex", alignItems: "center", gap: 10,
          padding: "10px 14px",
          background: "rgba(11,15,19,0.95)",
          borderBottom: "1px solid rgba(255,255,255,0.06)",
        }}>
          <div style={{ display: "flex", gap: 5 }}>
            <span style={{ width: 9, height: 9, borderRadius: 99, background: "rgba(255,99,99,0.55)" }} />
            <span style={{ width: 9, height: 9, borderRadius: 99, background: "rgba(245,189,82,0.55)" }} />
            <span style={{ width: 9, height: 9, borderRadius: 99, background: "rgba(82,200,123,0.55)" }} />
          </div>
          <div className="mono" style={{ flex: 1, textAlign: "center", fontSize: 10, color: "var(--warm-gray)", letterSpacing: "0.04em" }}>
            harbor.dk/dashboard
          </div>
          <span style={{ display: "inline-flex", alignItems: "center", gap: 5 }}>
            <span style={{ width: 5, height: 5, borderRadius: 99, background: "var(--harbor-2)" }} className="hd-pulse" />
            <span className="micro" style={{ color: "var(--warm-gray)", fontSize: 8 }}>LIVE</span>
          </span>
        </div>

        {/* Two-column: mini sidebar + content */}
        <div style={{ display: "grid", gridTemplateColumns: "56px 1fr", minHeight: 380 }}>
          {/* Mini sidebar */}
          <div style={{
            background: "#0B0F13",
            borderRight: "1px solid rgba(255,255,255,0.06)",
            display: "flex", flexDirection: "column",
            padding: "12px 0", gap: 4, alignItems: "center",
          }}>
            <div style={{ marginBottom: 10 }}><HDMark size={26} /></div>
            {["Home", "Folder", "Upload", "Users", "Inbox", "Calendar"].map((ic, i) => {
              const I = window.Icon[ic];
              const active = i === 0;
              return (
                <div key={ic} style={{
                  width: 32, height: 32, borderRadius: 7,
                  display: "flex", alignItems: "center", justifyContent: "center",
                  background: active ? "rgba(29,78,216,0.16)" : "transparent",
                  border: active ? "1px solid rgba(29,78,216,0.34)" : "1px solid transparent",
                  color: active ? "var(--white)" : "var(--warm-gray)",
                }}>
                  <I size={13} />
                </div>
              );
            })}
            <div style={{ flex: 1 }} />
            <Avatar initials="WM" accent="harbor" size={26} />
          </div>

          {/* Main content */}
          <div style={{ padding: 16, display: "flex", flexDirection: "column", gap: 12 }}>
            {/* Top greeting strip */}
            <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
              <div>
                <div className="micro" style={{ color: "var(--warm-gray)", fontSize: 8, marginBottom: 3 }}>GOOD MORNING, ALEX</div>
                <div style={{ fontFamily: "var(--serif)", fontSize: 18, letterSpacing: "-0.01em", fontWeight: 500 }}>Here's what's moving today.</div>
              </div>
              <div style={{
                padding: "4px 8px", background: "var(--harbor)", color: "white",
                borderRadius: 7, fontSize: 10, fontWeight: 500,
                display: "inline-flex", alignItems: "center", gap: 4,
              }}>
                <window.Icon.Plus size={10} /> New
              </div>
            </div>

            {/* Metric strip — 4 real metrics */}
            <div style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 6 }}>
              {metrics.map((m, i) => {
                const tone = STATUS_TONES[m.tone];
                const I = window.Icon[m.icon];
                return (
                  <div key={i} style={{
                    background: "rgba(255,255,255,0.025)",
                    border: "1px solid rgba(255,255,255,0.06)",
                    borderRadius: 8, padding: "8px 9px",
                    position: "relative", overflow: "hidden",
                  }}>
                    <div style={{
                      position: "absolute", top: -10, right: -10,
                      width: 36, height: 36, borderRadius: "50%",
                      background: tone.bg, filter: "blur(16px)",
                    }} />
                    <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", position: "relative", marginBottom: 4 }}>
                      <span className="micro" style={{ color: "var(--warm-gray)", fontSize: 7.5, letterSpacing: "0.10em" }}>
                        {m.label.split(" ")[0].toUpperCase()}
                      </span>
                      <I size={9} color={tone.fg} />
                    </div>
                    <div style={{ fontFamily: "var(--serif)", fontSize: 20, letterSpacing: "-0.02em", color: tone.fg, position: "relative", fontWeight: 500, lineHeight: 1 }}>{m.value}</div>
                  </div>
                );
              })}
            </div>

            {/* Active projects */}
            <div>
              <div className="micro" style={{ color: "var(--warm-gray)", fontSize: 8, marginBottom: 6 }}>ACTIVE PROJECTS</div>
              <div style={{ display: "flex", flexDirection: "column", gap: 4 }}>
                {projects.map(p => {
                  const tone = STATUS_TONES[p.accent];
                  return (
                    <div key={p.id} style={{
                      display: "grid", gridTemplateColumns: "28px minmax(0,1fr) auto",
                      gap: 8, alignItems: "center",
                      padding: "7px 9px",
                      background: "rgba(255,255,255,0.025)",
                      border: "1px solid rgba(255,255,255,0.05)",
                      borderRadius: 7,
                    }}>
                      <div style={{
                        width: 28, height: 20, borderRadius: 4,
                        background: `linear-gradient(135deg, var(--charcoal), ${tone.bg})`,
                        border: `1px solid ${tone.bd}`,
                      }} />
                      <div style={{ minWidth: 0 }}>
                        <div style={{ fontSize: 10.5, fontWeight: 500, color: "var(--white)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", marginBottom: 2 }}>{p.name}</div>
                        <div style={{ display: "flex", alignItems: "center", gap: 6 }}>
                          <div style={{ flex: 1, height: 2, background: "rgba(255,255,255,0.06)", borderRadius: 99, overflow: "hidden" }}>
                            <div style={{ width: `${p.progress}%`, height: "100%", background: tone.dot, borderRadius: 99 }} />
                          </div>
                          <span className="mono" style={{ fontSize: 8.5, color: tone.fg, width: 22, textAlign: "right" }}>{p.progress}%</span>
                        </div>
                      </div>
                      <StatusBadge status={p.status} size="sm" />
                    </div>
                  );
                })}
              </div>
            </div>

            {/* Review queue ping */}
            <div style={{
              background: "rgba(29,78,216,0.10)",
              border: "1px solid rgba(29,78,216,0.24)",
              borderRadius: 8, padding: "9px 10px",
              display: "flex", alignItems: "center", gap: 10,
            }}>
              <div style={{
                width: 22, height: 22, borderRadius: 99,
                background: "rgba(29,78,216,0.20)",
                border: "1px solid rgba(29,78,216,0.40)",
                color: "#9CC1FF",
                display: "flex", alignItems: "center", justifyContent: "center",
                flexShrink: 0,
              }} className="hd-pulseRing">
                <window.Icon.Message size={11} />
              </div>
              <div style={{ flex: 1, minWidth: 0 }}>
                <div style={{ fontSize: 10.5, color: "var(--white)", fontWeight: 500 }}>{review.from} · {review.project}</div>
                <div style={{ fontSize: 9.5, color: "var(--warm-gray)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{review.message}</div>
              </div>
              <span className="mono" style={{ fontSize: 9, color: "var(--warm-gray)", flexShrink: 0 }}>{review.time}</span>
            </div>
          </div>
        </div>
      </div>

      {/* Floating "Open portal" indicator */}
      <div style={{
        position: "absolute", bottom: -16, right: -16, zIndex: 2,
        background: "var(--harbor)", color: "white",
        borderRadius: 99, padding: "8px 14px",
        fontSize: 11.5, fontWeight: 500,
        display: "inline-flex", alignItems: "center", gap: 6,
        boxShadow: "0 12px 28px -8px rgba(29,78,216,0.55), 0 0 0 4px rgba(250,248,244,0.95)",
      }}>
        <span style={{ width: 5, height: 5, borderRadius: 99, background: "white" }} className="hd-pulse" />
        Live from the portal
      </div>
    </div>
  );
};

const Marquee = () => {
  const studios = ["WINTERHILL MEDIA", "ATRIUM AUDIO", "GLASSWING", "NORTHFALL", "OPEN CIRCUIT", "BAY & ROW", "MEZZANINE STUDIO", "FERRY POINT"];
  return (
    <section style={{ padding: "40px 0", borderTop: "1px solid rgba(8,12,16,0.06)", borderBottom: "1px solid rgba(8,12,16,0.06)", overflow: "hidden" }}>
      <div className="container" style={{ display: "flex", alignItems: "center", gap: 32 }}>
        <div className="micro" style={{ color: "rgba(8,12,16,0.45)", flexShrink: 0 }}>TRUSTED BY STUDIOS</div>
        <div style={{ flex: 1, overflow: "hidden", maskImage: "linear-gradient(to right, transparent, black 8%, black 92%, transparent)" }}>
          <div className="hd-marquee-track">
            {[...studios, ...studios].map((n, i) => (
              <span key={i} style={{
                fontFamily: "var(--serif)",
                fontSize: 16, letterSpacing: "0.22em", fontWeight: 500,
                color: "rgba(8,12,16,0.30)", whiteSpace: "nowrap",
              }}>{n}</span>
            ))}
          </div>
        </div>
      </div>
    </section>
  );
};

const ByTheNumbers = () => (
  <section style={{ padding: "80px 0" }} className="sm-pad-y">
    <div className="container">
      <Reveal>
        <div className="md-2col sm-1col" style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0 }}>
          {[
            { v: "184", l: "STUDIOS ONBOARDED" },
            { v: "2.4×", l: "FASTER APPROVALS" },
            { v: "96%", l: "CLIENT RETENTION" },
            { v: "12.4M", l: "ASSETS UNDER REVIEW" },
          ].map((s, i, arr) => (
            <div key={i} style={{
              padding: "20px 32px",
              borderRight: i === arr.length - 1 ? "none" : "1px solid rgba(8,12,16,0.10)",
              borderBottom: "1px solid rgba(8,12,16,0)",
            }}>
              <div style={{
                fontFamily: "var(--serif)", fontSize: 56, fontWeight: 500,
                letterSpacing: "-0.025em", lineHeight: 1, color: "var(--ink)",
              }}>{s.v}</div>
              <div className="micro" style={{ color: "rgba(8,12,16,0.55)", marginTop: 12 }}>{s.l}</div>
            </div>
          ))}
        </div>
      </Reveal>
    </div>
  </section>
);

const ProblemSolution = () => (
  <section style={{ padding: "100px 0 80px" }}>
    <div className="container">
      <div className="md-stack" style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 80 }}>
        <Reveal>
          <div className="micro" style={{ color: "rgba(8,12,16,0.45)" }}>01 — THE PROBLEM</div>
          <h2 style={{
            fontFamily: "var(--serif)", fontSize: 44, lineHeight: 1.05,
            margin: "16px 0 24px", letterSpacing: "-0.02em", fontWeight: 500, maxWidth: 520,
          }}>
            Creative work doesn't<br />
            live in <span style={{ fontStyle: "italic" }}>twelve tabs.</span>
          </h2>
          <p style={{ fontSize: 16, lineHeight: 1.6, color: "rgba(8,12,16,0.65)", maxWidth: 480 }}>
            Most studios still run the most important part of their business — the part the
            client actually sees — through a duct-taped chain of Drive folders, WeTransfer links,
            spreadsheet trackers, and "did you get my note?" text threads.
          </p>
          <div style={{ marginTop: 28, display: "flex", flexDirection: "column", gap: 12 }}>
            {[
              "Versions tracked in filename suffixes nobody trusts.",
              "Comments scattered across email, Slack, and the phone.",
              "Final deliverables emailed at 2 AM the night they're due.",
              "Clients lost between four logins and a download cap.",
            ].map((t, i) => (
              <div key={i} style={{ display: "flex", alignItems: "flex-start", gap: 12 }}>
                <div style={{ width: 18, height: 18, borderRadius: 99, border: "1px solid rgba(8,12,16,0.16)", marginTop: 2, flexShrink: 0, display: "flex", alignItems: "center", justifyContent: "center" }}>
                  <window.Icon.X size={10} stroke={2} color="rgba(8,12,16,0.45)" />
                </div>
                <span style={{ fontSize: 14.5, color: "rgba(8,12,16,0.72)" }}>{t}</span>
              </div>
            ))}
          </div>
        </Reveal>

        <Reveal delay={120}>
          <div className="micro" style={{ color: "var(--harbor)" }}>02 — THE HARBORDOCK WAY</div>
          <h2 style={{
            fontFamily: "var(--serif)", fontSize: 44, lineHeight: 1.05,
            margin: "16px 0 24px", letterSpacing: "-0.02em", fontWeight: 500, maxWidth: 520,
          }}>
            One portal.<br />
            <span style={{ fontStyle: "italic" }}>One source of truth.</span>
          </h2>
          <p style={{ fontSize: 16, lineHeight: 1.6, color: "rgba(8,12,16,0.65)", maxWidth: 480 }}>
            Project, draft, comment, revision, deliverable — every step of the client review
            lives in one calm, branded workspace. You move from kickoff to final delivery in a
            straight line, with a paper trail you'd be proud to show anyone.
          </p>
          <div style={{ marginTop: 28, display: "flex", flexDirection: "column", gap: 12 }}>
            {[
              "Frame-accurate comments, locked to the timecode they were left on.",
              "Versioned drafts with full revision history and reviewer state.",
              "Client-facing portal that looks like it was built by your studio.",
              "Approval log a court reporter could read.",
            ].map((t, i) => (
              <div key={i} style={{ display: "flex", alignItems: "flex-start", gap: 12 }}>
                <div style={{ width: 18, height: 18, borderRadius: 99, background: "var(--harbor)", marginTop: 2, flexShrink: 0, display: "flex", alignItems: "center", justifyContent: "center" }}>
                  <window.Icon.Check size={10} stroke={2.4} color="white" />
                </div>
                <span style={{ fontSize: 14.5, color: "rgba(8,12,16,0.85)" }}>{t}</span>
              </div>
            ))}
          </div>
        </Reveal>
      </div>
    </div>
  </section>
);

const FeaturePreview = ({ accent }) => {
  const steps = [
    { n: "01", t: "Create the project", body: "Kick off a portal with branding, deadlines, and your client's reviewers — in under a minute." },
    { n: "02", t: "Receive client assets", body: "Reviewers drop interview selects, brand files, and brief docs into one structured intake." },
    { n: "03", t: "Upload drafts", body: "Push versioned cuts with a single command. Every draft gets a frame-accurate review surface." },
    { n: "04", t: "Frame-locked comments", body: "Clients leave timestamped notes against the exact moment they're talking about." },
    { n: "05", t: "Track every revision", body: "Round 01 through final lock — see who owns what, when it's due, and what's been signed off." },
    { n: "06", t: "Deliver and archive", body: "Hand off the final masters with a tap; archive the project as a permanent client record." },
  ];
  return (
    <section style={{ padding: "100px 0", background: "var(--sand-soft)", borderTop: "1px solid rgba(8,12,16,0.06)", borderBottom: "1px solid rgba(8,12,16,0.06)" }}>
      <div className="container">
        <Reveal style={{ maxWidth: 720, marginBottom: 56 }}>
          <div className="micro" style={{ color: "rgba(8,12,16,0.45)" }}>03 — THE WORKFLOW</div>
          <h2 style={{
            fontFamily: "var(--serif)", fontSize: 48, lineHeight: 1.05,
            margin: "16px 0 16px", letterSpacing: "-0.02em", fontWeight: 500,
          }}>
            From kickoff to final delivery<br />
            in <span style={{ fontStyle: "italic" }}>one straight line.</span>
          </h2>
          <p style={{ fontSize: 17, lineHeight: 1.55, color: "rgba(8,12,16,0.65)", maxWidth: 560 }}>
            Six steps. No tabs. Every artifact archived against the project, every approval
            timestamped, every revision rounded up automatically.
          </p>
        </Reveal>

        <Reveal delay={80}>
          <div className="md-2col sm-1col" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0, borderTop: "1px solid rgba(8,12,16,0.10)", borderLeft: "1px solid rgba(8,12,16,0.10)" }}>
            {steps.map((s, i) => (
              <div key={s.n} style={{
                padding: "32px 28px",
                borderRight: "1px solid rgba(8,12,16,0.10)",
                borderBottom: "1px solid rgba(8,12,16,0.10)",
                background: "var(--paper)",
                position: "relative",
                minHeight: 220,
                transition: "background 200ms ease",
              }}
                onMouseEnter={(e) => (e.currentTarget.style.background = "var(--white)")}
                onMouseLeave={(e) => (e.currentTarget.style.background = "var(--paper)")}
              >
                <div className="mono" style={{ fontSize: 11, color: "var(--harbor)", letterSpacing: "0.06em" }}>{s.n}</div>
                <div style={{
                  fontFamily: "var(--serif)", fontSize: 22, marginTop: 16, fontWeight: 500, letterSpacing: "-0.01em",
                }}>{s.t}</div>
                <div style={{ fontSize: 14, lineHeight: 1.55, color: "rgba(8,12,16,0.62)", marginTop: 8, maxWidth: 320 }}>
                  {s.body}
                </div>
              </div>
            ))}
          </div>
        </Reveal>
      </div>
    </section>
  );
};

const WhoItsFor = () => {
  const audiences = [
    { t: "Videographers", body: "Cinematic listings, brand films, and event recap reels — with frame-accurate review.", icon: "Film" },
    { t: "Photographers",  body: "Gallery deliveries with selects, ratings, and approval state in a single shared link.", icon: "Image" },
    { t: "Podcast teams",  body: "Episode drops, transcript review, and per-segment commenting for hosts and producers.", icon: "Mic" },
    { t: "Creative agencies", body: "Multi-client studios with per-project portals, branded for every account.", icon: "Layers" },
    { t: "Production studios", body: "From boards to picture lock to final master — one calm operations layer.", icon: "Compass" },
    { t: "Content creators", body: "Retainer cadences, sponsor cuts, and platform-ready exports without the spreadsheet.", icon: "Sparkle" },
  ];
  return (
    <section style={{ padding: "120px 0" }}>
      <div className="container">
        <Reveal>
          <div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginBottom: 56, gap: 40 }}>
            <div style={{ maxWidth: 540 }}>
              <div className="micro" style={{ color: "rgba(8,12,16,0.45)" }}>04 — WHO IT'S FOR</div>
              <h2 style={{
                fontFamily: "var(--serif)", fontSize: 44, lineHeight: 1.05,
                margin: "16px 0 0", letterSpacing: "-0.02em", fontWeight: 500,
              }}>
                Built for the studios<br />
                <span style={{ fontStyle: "italic" }}>who care how it feels.</span>
              </h2>
            </div>
            <div style={{ maxWidth: 380 }}>
              <p style={{ fontSize: 15, lineHeight: 1.55, color: "rgba(8,12,16,0.62)", margin: 0 }}>
                HarborDock is a tool for the people who already know that the experience around
                the work is part of the work.
              </p>
            </div>
          </div>
        </Reveal>

        <div className="md-2col sm-1col" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16 }}>
          {audiences.map((a, i) => {
            const IconComp = window.Icon[a.icon];
            return (
              <Reveal key={a.t} delay={i * 60}>
                <div style={{
                  padding: 28, background: "var(--white)",
                  border: "1px solid rgba(8,12,16,0.08)", borderRadius: 14,
                  transition: "transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease",
                  height: "100%",
                }}
                  onMouseEnter={(e) => { e.currentTarget.style.borderColor = "rgba(8,12,16,0.18)"; e.currentTarget.style.transform = "translateY(-3px)"; e.currentTarget.style.boxShadow = "0 20px 40px -28px rgba(8,12,16,0.20)"; }}
                  onMouseLeave={(e) => { e.currentTarget.style.borderColor = "rgba(8,12,16,0.08)"; e.currentTarget.style.transform = "translateY(0)"; e.currentTarget.style.boxShadow = "none"; }}
                >
                  <div style={{
                    width: 36, height: 36, borderRadius: 9,
                    background: "var(--ink)", color: "var(--white)",
                    display: "flex", alignItems: "center", justifyContent: "center",
                  }}><IconComp size={16} /></div>
                  <div style={{ fontFamily: "var(--serif)", fontSize: 22, marginTop: 20, fontWeight: 500, letterSpacing: "-0.01em" }}>{a.t}</div>
                  <div style={{ fontSize: 13.5, lineHeight: 1.55, color: "rgba(8,12,16,0.62)", marginTop: 8 }}>{a.body}</div>
                </div>
              </Reveal>
            );
          })}
        </div>
      </div>
    </section>
  );
};

const PricingPreview = ({ onEnterApp }) => {
  const tiers = [
    {
      name: "Studio",
      price: "$48",
      cadence: "per editor / month",
      tag: null,
      body: "For small studios and freelance teams just moving off Drive.",
      bullets: ["Up to 5 active projects", "10 client reviewers", "100 GB storage", "Branded client portals"],
      cta: "Start a studio",
      featured: false,
    },
    {
      name: "Atelier",
      price: "$96",
      cadence: "per editor / month",
      tag: "MOST POPULAR",
      body: "For agencies running multiple clients on parallel retainers.",
      bullets: ["Unlimited active projects", "Unlimited reviewers", "1 TB storage + cold archive", "Custom domains + white-label", "Approval audit log"],
      cta: "Open an atelier",
      featured: true,
    },
    {
      name: "Production",
      price: "Talk",
      cadence: "annual contract",
      tag: null,
      body: "For full production houses with security and SLA needs.",
      bullets: ["SSO + SCIM", "Dedicated success engineer", "EU + US storage residency", "Custom retention policies", "99.99% SLA"],
      cta: "Speak with the team",
      featured: false,
    },
  ];
  return (
    <section style={{ padding: "100px 0", background: "var(--sand-soft)" }}>
      <div className="container">
        <Reveal style={{ textAlign: "center", marginBottom: 64 }}>
          <div className="micro" style={{ color: "rgba(8,12,16,0.45)" }}>05 — PRICING</div>
          <h2 style={{
            fontFamily: "var(--serif)", fontSize: 48, lineHeight: 1.05,
            margin: "16px 0 12px", letterSpacing: "-0.02em", fontWeight: 500,
          }}>
            Priced like a tool.<br />
            <span style={{ fontStyle: "italic" }}>Felt like a studio.</span>
          </h2>
          <p style={{ fontSize: 15, color: "rgba(8,12,16,0.62)", maxWidth: 500, margin: "0 auto" }}>
            All plans include unlimited drafts, unlimited comments, and the entire client portal experience.
          </p>
        </Reveal>

        <Reveal delay={120}>
          <div className="md-stack sm-1col" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16, maxWidth: 1100, margin: "0 auto", alignItems: "stretch" }}>
            {tiers.map(t => (
              <div key={t.name} style={{
                background: t.featured ? "var(--ink)" : "var(--white)",
                color: t.featured ? "var(--white)" : "var(--ink)",
                border: t.featured ? "1px solid var(--ink)" : "1px solid rgba(8,12,16,0.08)",
                borderRadius: 16, padding: 32,
                position: "relative",
                boxShadow: t.featured ? "0 30px 60px -30px rgba(8,12,16,0.45)" : "none",
                display: "flex", flexDirection: "column",
              }}>
                {t.tag && (
                  <div style={{
                    position: "absolute", top: -12, left: 24,
                    padding: "4px 10px", borderRadius: 99,
                    background: "var(--harbor)", color: "white",
                    fontSize: 10, fontWeight: 600, letterSpacing: "0.12em",
                  }}>{t.tag}</div>
                )}
                <div style={{ fontFamily: "var(--serif)", fontSize: 24, fontWeight: 500, letterSpacing: "-0.01em" }}>{t.name}</div>
                <div style={{ fontSize: 13, color: t.featured ? "rgba(255,255,255,0.62)" : "rgba(8,12,16,0.55)", marginTop: 8, minHeight: 38 }}>{t.body}</div>
                <div style={{ display: "flex", alignItems: "baseline", gap: 6, marginTop: 24 }}>
                  <span style={{ fontFamily: "var(--serif)", fontSize: 56, fontWeight: 500, letterSpacing: "-0.025em", lineHeight: 1 }}>{t.price}</span>
                  {t.price !== "Talk" && <span style={{ fontSize: 13, color: t.featured ? "rgba(255,255,255,0.62)" : "rgba(8,12,16,0.55)" }}>{t.cadence}</span>}
                </div>
                <Divider light={!t.featured} style={{ marginTop: 24, marginBottom: 20, background: t.featured ? "rgba(255,255,255,0.10)" : undefined }} />
                <div style={{ display: "flex", flexDirection: "column", gap: 10, marginBottom: 24, flex: 1 }}>
                  {t.bullets.map((b, i) => (
                    <div key={i} style={{ display: "flex", alignItems: "flex-start", gap: 10, fontSize: 13.5 }}>
                      <window.Icon.Check size={13} stroke={2.2} color={t.featured ? "#9CC1FF" : "var(--harbor)"} />
                      <span style={{ color: t.featured ? "rgba(255,255,255,0.86)" : "rgba(8,12,16,0.78)" }}>{b}</span>
                    </div>
                  ))}
                </div>
                <Button
                  variant={t.featured ? "secondary" : "ghost"}
                  light={!t.featured}
                  size="md"
                  full
                  onClick={onEnterApp}
                  iconRight={<window.Icon.Arrow size={13} />}
                >{t.cta}</Button>
              </div>
            ))}
          </div>
        </Reveal>
      </div>
    </section>
  );
};

const FinalCTA = ({ onEnterApp }) => (
  <section style={{ padding: "140px 0", position: "relative", overflow: "hidden" }}>
    <div style={{
      position: "absolute", left: "50%", top: "50%", transform: "translate(-50%, -50%)",
      width: 720, height: 720, opacity: 0.04, pointerEvents: "none",
    }}>
      <img src="assets/harbordock-mark.png" alt="" style={{ width: "100%", height: "100%", objectFit: "contain" }} />
    </div>
    <div className="container" style={{ textAlign: "center", position: "relative" }}>
      <Reveal>
        <div className="micro" style={{ color: "rgba(8,12,16,0.45)" }}>06 — BEGIN</div>
        <h2 style={{
          fontFamily: "var(--serif)", fontSize: "clamp(64px, 8vw, 96px)", lineHeight: 1,
          margin: "24px 0 32px", letterSpacing: "-0.03em", fontWeight: 500, maxWidth: 980, marginLeft: "auto", marginRight: "auto",
        }}>
          All your projects.<br />
          All your feedback.<br />
          <span style={{ fontStyle: "italic" }}>All in one place.</span>
        </h2>
        <p style={{ fontSize: 17, color: "rgba(8,12,16,0.62)", maxWidth: 560, margin: "0 auto 36px" }}>
          Open the demo portal. Click around. Bring your team in when you're ready.
          No card, no setup, no clutter.
        </p>
        <div style={{ display: "inline-flex", gap: 12 }}>
          <Button variant="secondary" light size="lg" onClick={onEnterApp} iconRight={<window.Icon.Arrow size={15} />}>
            Open the demo portal
          </Button>
          <Button variant="ghost" light size="lg">
            Book a walk-through
          </Button>
        </div>
      </Reveal>
    </div>
  </section>
);

const LandingFooter = () => (
  <footer style={{ borderTop: "1px solid rgba(8,12,16,0.08)", padding: "56px 0 32px", background: "var(--paper)" }}>
    <div className="container md-stack" style={{ display: "grid", gridTemplateColumns: "1.5fr repeat(4, 1fr)", gap: 40 }}>
      <div>
        <HDLockup light markSize={28} />
        <p style={{ fontSize: 12.5, color: "rgba(8,12,16,0.55)", lineHeight: 1.6, marginTop: 20, maxWidth: 260 }}>
          Premium client portals for the studios telling the stories worth telling.
        </p>
      </div>
      {[
        { t: "Product", l: ["Overview", "Workflow", "Brand kits", "Changelog", "Roadmap"] },
        { t: "Studios", l: ["Atelier program", "Customer stories", "Founding studios", "Partner with us"] },
        { t: "Resources", l: ["Documentation", "Templates", "Journal", "Press kit"] },
        { t: "Company", l: ["About", "Careers", "Security", "Contact"] },
      ].map(col => (
        <div key={col.t}>
          <div className="micro" style={{ color: "rgba(8,12,16,0.55)", marginBottom: 14 }}>{col.t}</div>
          <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
            {col.l.map(item => (
              <a key={item} href="#" style={{ fontSize: 13, color: "rgba(8,12,16,0.75)", transition: "color 120ms ease" }}
                onMouseEnter={(e) => (e.currentTarget.style.color = "var(--ink)")}
                onMouseLeave={(e) => (e.currentTarget.style.color = "rgba(8,12,16,0.75)")}
              >{item}</a>
            ))}
          </div>
        </div>
      ))}
    </div>
    <div className="container" style={{ marginTop: 48, paddingTop: 24, borderTop: "1px solid rgba(8,12,16,0.06)", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
      <div style={{ fontSize: 12, color: "rgba(8,12,16,0.45)" }}>© 2026 HarborDock Studio Inc. · Built for creative teams.</div>
      <div style={{ display: "flex", gap: 20, fontSize: 12 }}>
        <a href="#" style={{ color: "rgba(8,12,16,0.55)" }}>Privacy</a>
        <a href="#" style={{ color: "rgba(8,12,16,0.55)" }}>Terms</a>
        <a href="#" style={{ color: "rgba(8,12,16,0.55)" }}>DPA</a>
      </div>
    </div>
  </footer>
);

window.LandingPage = LandingPage;
