// Section components for the OrgPlease! landing page

const ACCENT_PALETTES = {
  forest:     { accent: "#1b7a43", soft: "#d6ead9", ink: "#0c3a20" },
  midnight:   { accent: "#2a4d8f", soft: "#dce5f3", ink: "#102347" },
  terracotta: { accent: "#b85534", soft: "#f3dccf", ink: "#5e2716" },
  plum:       { accent: "#6e3a7a", soft: "#ead9ee", ink: "#3a1c41" },
};

function applyAccent(name) {
  const key = (name || "").toString().toLowerCase();
  const p = ACCENT_PALETTES[key] || ACCENT_PALETTES.forest;
  const r = document.documentElement.style;
  r.setProperty("--accent",      p.accent);
  r.setProperty("--accent-soft", p.soft);
  r.setProperty("--accent-ink",  p.ink);
}

/* ─────────────────────────── NAV ─────────────────────────── */
function Nav({ onSignup }) {
  return (
    <header style={{
      position: "sticky", top: 0, zIndex: 40,
      background: "rgba(255,255,255,.88)", backdropFilter: "blur(12px)",
      borderBottom: "1px solid var(--line)",
    }}>
      <div className="wrap" style={{ display: "flex", alignItems: "center", justifyContent: "space-between", height: 64 }}>
        <a href="#" style={{ display: "inline-flex", alignItems: "center", gap: 8, color: "var(--ink)", textDecoration: "none", flexShrink: 0 }}>
          <span style={{ color: "var(--accent)", display: "inline-flex" }}><Icons.Logo size={22} /></span>
          <span style={{ fontWeight: 700, letterSpacing: "-.02em", fontSize: 18 }}>OrgPlease<span style={{ color: "var(--accent)" }}>!</span></span>
        </a>

        {/* FIX #1: gets hidden at ≤768px via .landing-nav-links CSS class */}
        <nav className="landing-nav-links" style={{ display: "flex", alignItems: "center", gap: 28 }}>
          <a href="#features"   style={navLink}>Features</a>
          <a href="#how"        style={navLink}>How it works</a>
          <a href="#use-cases"  style={navLink}>Use cases</a>
          <a href="Pricing.html" style={navLink}>Pricing</a>
          <a href="#faq"        style={navLink}>FAQ</a>
        </nav>

        <div style={{ display: "flex", alignItems: "center", gap: 10, flexShrink: 0 }}>
          {/* FIX #12: Log in → real app link */}
          <a href="OrgPlease.html" className="landing-nav-login" style={{ ...navLink, padding: "10px 14px" }}>Log in</a>
          {/* FIX #2: wired to modal */}
          <button onClick={onSignup} className="btn btn-primary" style={{ padding: "10px 18px", fontSize: 14 }}>
            Start free <Icons.ArrowRight />
          </button>
        </div>
      </div>
    </header>
  );
}
const navLink = { color: "var(--ink-2)", textDecoration: "none", fontSize: 14.5, fontWeight: 500 };

/* ─────────────────────────── HERO ─────────────────────────── */
function Hero({ density, onSignup }) {
  return (
    <section data-screen-label="01 Hero" style={{ padding: "40px 0 24px", position: "relative" }}>
      <div className="wrap-wide">
        {/* FIX #1: responsive class for 2→1 col on mobile */}
        <div className="landing-hero-split" style={{ display: "grid", gridTemplateColumns: "1.25fr .9fr", gap: 56, alignItems: "end", marginBottom: 48 }}>
          <h1 style={{
            fontSize: "clamp(52px, 8vw, 116px)",
            lineHeight: 0.92, letterSpacing: "-0.045em", fontWeight: 600,
            textWrap: "balance",
          }}>
            See the whole<br />
            org. Then<br />
            <span style={{ color: "var(--accent)" }}>make it&nbsp;</span>
            <span className="serif-i" style={{ fontWeight: 400, color: "var(--accent)", fontSize: "1.05em" }}>yours.</span>
          </h1>
          <div>
            {/* FIX #8: "org chart software" woven into copy */}
            <p style={{ fontSize: 18, lineHeight: 1.55, color: "var(--ink-2)", maxWidth: 380, textWrap: "pretty" }}>
              The org chart software that says <span className="serif-i" style={{ fontSize: "1.2em", color: "var(--accent)" }}>please</span> and <span className="serif-i" style={{ fontSize: "1.2em", color: "var(--accent)" }}>thank you.</span> Upload a roster,
              customize every card, and ship a chart your CEO will actually pin to the wall — in about three minutes.
            </p>
            <div style={{ display: "flex", gap: 10, marginTop: 22, flexWrap: "wrap" }}>
              {/* FIX #2 + FIX #4: single CTA wired to modal, demo button removed */}
              <button onClick={onSignup} className="btn btn-primary">Start free → no card</button>
            </div>
            <div style={{ marginTop: 18, display: "flex", gap: 22, alignItems: "center", flexWrap: "wrap" }}>
              <Stat n="3 min"  l="median upload-to-print" />
              <span style={{ width: 1, height: 22, background: "var(--line)" }} />
              <Stat n="48 fields" l="custom per card" />
              <span style={{ width: 1, height: 22, background: "var(--line)" }} />
              <Stat n="5,000+" l="rows tested" />
            </div>
          </div>
        </div>

        <HeroOrgChart density={density} />

        <div style={{ display: "flex", justifyContent: "center", alignItems: "center", gap: 14, marginTop: 28, flexWrap: "wrap" }}>
          {[{ n: 1, t: "Upload roster" }, { n: 2, t: "Map fields & style" }, { n: 3, t: "Share or print" }].map((s, i) =>
            <React.Fragment key={s.n}>
              <span style={{ display: "inline-flex", alignItems: "center", gap: 10, padding: "8px 16px 8px 10px", borderRadius: 999, background: "#fff", border: "1px solid var(--line)", boxShadow: "0 4px 12px -8px rgba(14,20,16,.18)", fontSize: 14, fontWeight: 500, color: "var(--ink)" }}>
                <span style={{ width: 22, height: 22, borderRadius: 999, background: "var(--accent)", color: "#fff", display: "inline-grid", placeItems: "center", fontSize: 11, fontWeight: 700 }}>{s.n}</span>
                {s.t}
              </span>
              {i < 2 && <span style={{ color: "var(--accent)", opacity: .55 }}><Icons.ArrowRight /></span>}
            </React.Fragment>
          )}
        </div>
      </div>
    </section>
  );
}

function Stat({ n, l }) {
  return (
    <div>
      <div style={{ fontWeight: 600, fontSize: 18, letterSpacing: "-.02em" }}>{n}</div>
      <div style={{ fontSize: 12, color: "var(--muted)", fontWeight: 500 }}>{l}</div>
    </div>
  );
}

/* ─────────────────────────── LOGO CLOUD ─────────────────────────── */
function LogoCloud() {
  return (
    <section style={{ padding: "36px 0 28px", background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <div className="wrap">
        <div style={{ textAlign: "center" }}>
          <span className="eyebrow">Trusted by people teams everywhere</span>
          <p className="serif-i" style={{ marginTop: 14, fontSize: 26, color: "var(--ink-2)", lineHeight: 1.2 }}>
            "Finally, an org chart we don't apologize for."
          </p>
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────── HOW IT WORKS ─────────────────────────── */
function HowItWorks() {
  const steps = [
    { n: "01", t: "Upload your roster",    d: "Drag in a CSV or Excel file. We auto-detect names, titles, managers, and emails — even when the column headers are creative.", icon: <Icons.Upload />, file: "team_roster_v3_FINAL_actually.xlsx" },
    { n: "02", t: "Customize every card",  d: "Map any column to any field. Drag fields into the layout you want. Color-code by department, level, or location.",           icon: <Icons.Sliders />, file: "Pick fields → drag to card" },
    { n: "03", t: "Share, embed, or print", d: "Send a live link, embed in Notion, or export a paginated PDF that prints on standard 8.5×11 with smart navigation badges.", icon: <Icons.Share />,   file: "org-chart-2026.pdf · 14 pages" },
  ];
  return (
    <section id="how" data-screen-label="02 How it works" style={{ padding: "60px 0 80px" }}>
      <div className="wrap">
        <div style={{ marginBottom: 24 }}><span className="eyebrow">How it works</span></div>
        <h2 style={{ fontSize: "clamp(36px, 5vw, 76px)", lineHeight: .98, letterSpacing: "-.04em", fontWeight: 600, maxWidth: 980, marginBottom: 80 }}>
          Three steps. The third one is <span className="serif-i" style={{ color: "var(--accent)" }}>"go home early"</span>.
        </h2>
        {/* FIX #1: responsive class */}
        <div className="landing-steps-grid" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 32 }}>
          {steps.map((s, i) =>
            <article key={s.n} style={{
              padding: 28, borderRadius: 20, background: "#fff",
              border: "1px solid var(--line)", position: "relative",
              transform: `translateY(${i * 16}px)`,
            }}>
              <div style={{ fontSize: 13, color: "var(--accent)", fontWeight: 600, marginBottom: 24, display: "inline-flex", alignItems: "center", gap: 8 }}>
                <span style={{ width: 24, height: 24, borderRadius: 999, background: "var(--accent)", color: "#fff", display: "inline-grid", placeItems: "center", fontSize: 12, fontWeight: 700 }}>{Number(s.n)}</span>
                Step {Number(s.n)}
              </div>
              <div style={{ width: 44, height: 44, borderRadius: 12, background: "var(--accent-soft)", color: "var(--accent-ink)", display: "grid", placeItems: "center", marginBottom: 18 }}>{s.icon}</div>
              <h3 style={{ fontSize: 24, letterSpacing: "-.02em", fontWeight: 600, marginBottom: 10 }}>{s.t}</h3>
              <p style={{ fontSize: 15, lineHeight: 1.55, color: "var(--ink-2)" }}>{s.d}</p>
              <div className="mono" style={{ marginTop: 22, padding: "10px 12px", background: "var(--bg-2)", border: "1px dashed var(--line)", borderRadius: 8, fontSize: 12, color: "var(--ink-2)" }}>{s.file}</div>
            </article>
          )}
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────── FEATURES ─────────────────────────── */
function Features() {
  return (
    <section id="features" data-screen-label="03 Features" style={{ padding: "100px 0", background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <div className="wrap">
        <div style={{ marginBottom: 24 }}><span className="eyebrow">Features</span></div>
        {/* FIX #1: responsive class */}
        <div className="landing-features-header" style={{ display: "grid", gridTemplateColumns: "1.1fr 1fr", gap: 80, marginBottom: 60, alignItems: "end" }}>
          <h2 style={{ fontSize: "clamp(36px, 5vw, 72px)", lineHeight: .98, letterSpacing: "-.04em", fontWeight: 600 }}>
            Everything you need.<br />
            <span className="serif-i" style={{ color: "var(--accent)" }}>Nothing you'll never use.</span>
          </h2>
          <p style={{ fontSize: 17, color: "var(--ink-2)", lineHeight: 1.55, maxWidth: 460 }}>
            We obsessed over the boring stuff so you don't have to. Pagination math. Zoom hysteresis. The exact green.
          </p>
        </div>
        {/* FIX #1: responsive class */}
        <div className="landing-features-bento" style={{ display: "grid", gridTemplateColumns: "repeat(6, 1fr)", gridAutoRows: "minmax(220px, auto)", gap: 16 }}>
          {/* Hero card anchors LEFT — natural reading flow */}
          <FeatureCard span="span 4" rowSpan={2} accent
            t="Custom field settings — for the rebels"
            d="Your org chart software shouldn't be locked into Name + Title. Map any column from your spreadsheet, drag fields around the card, color-code, hide on export. We don't judge what you put in 'Field 6'."
            icon={<Icons.Sliders />}>
            <CardChartPreview />
          </FeatureCard>
          {/* Two secondary cards stack on the right */}
          <FeatureCard span="span 2" t="Compact view"         d="A two-column stack squeezes wide teams without losing hierarchy. Goodbye, 14-foot horizontal scroll."                                             icon={<Icons.Layers />} />
          <FeatureCard span="span 2" t="Pixel-perfect PDF"    d="One-click export, smart pagination, navigation badges. Looks great on the wall and in the boardroom."                                           icon={<Icons.Pdf />} />
          {/* Equal halves on the bottom row */}
          <FeatureCard span="span 3" t="Search anything, anyone" d="Type a name, title, employee ID, or that one obscure custom field. We'll fly the camera there."                                               icon={<Icons.Search />} />
          <FeatureCard span="span 3" t="Your data stays private" d="Choose exactly who can see your org chart — share it with the whole company or keep it to just the HR team. No passwords to hand out, no accidental oversharing. Simple controls, peace of mind." icon={<Icons.Lock />} />
        </div>
      </div>
    </section>
  );
}

function FeatureCard({ children, span, rowSpan, t, d, icon, accent }) {
  return (
    <article style={{
      gridColumn: span,
      gridRow: rowSpan ? `span ${rowSpan}` : undefined,
      padding: 28, borderRadius: 18,
      background: accent ? "var(--ink)" : "#fff",
      color:      accent ? "var(--bg)"  : "var(--ink)",
      border:     accent ? "1px solid var(--ink)" : "1px solid var(--line)",
      display: "flex", flexDirection: "column", gap: 12,
      position: "relative", overflow: "hidden",
    }}>
      <div style={{ width: 36, height: 36, borderRadius: 10, background: accent ? "rgba(255,255,255,.08)" : "var(--accent-soft)", color: accent ? "#fff" : "var(--accent-ink)", display: "grid", placeItems: "center" }}>{icon}</div>
      <h3 style={{ fontSize: 22, fontWeight: 600, letterSpacing: "-.02em", lineHeight: 1.15 }}>{t}</h3>
      <p style={{ fontSize: 14.5, lineHeight: 1.55, color: accent ? "rgba(246,244,236,.7)" : "var(--ink-2)", maxWidth: 540 }}>{d}</p>
      {children && <div style={{ marginTop: "auto" }}>{children}</div>}
    </article>
  );
}

function CardChartPreview() {
  return (
    <div style={{ marginTop: 14, padding: 18, borderRadius: 14, background: "rgba(255,255,255,.04)", border: "1px solid rgba(255,255,255,.08)", display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 12 }}>
      {[
        { f: "Field 2", v: "Operations", g: true },
        { f: "Field 3", v: "London" },
        { f: "Field 4", v: "P-10002" },
        { f: "Region",  v: "LATAM", g: true },
        { f: "Hire",    v: "2024-04-01" },
        { f: "Manager", v: "M. Holloway" },
      ].map((row, i) =>
        <div key={i} style={{ display: "flex", flexDirection: "column", gap: 4, padding: 10, background: row.g ? "rgba(214,234,217,.18)" : "transparent", borderRadius: 8 }}>
          <span className="mono" style={{ fontSize: 9.5, letterSpacing: ".18em", color: "rgba(246,244,236,.5)", textTransform: "uppercase" }}>{row.f}</span>
          <span style={{ fontSize: 13, fontWeight: 500 }}>{row.v}</span>
        </div>
      )}
    </div>
  );
}

/* ─────────────────────────── USE CASES ─────────────────────────── */
function UseCases() {
  const cases = [
    { i: <Icons.Hr />,        t: "People ops",          who: "HR & People leaders",  d: "Onboard faster, plan headcount, and answer 'who reports to whom?' before the Slack thread spirals." },
    { i: <Icons.Briefcase />, t: "Founders & SMB",      who: "10–50 person teams",   d: "Make your first real org chart in an afternoon. Free up to 25 employees, forever." },
    { i: <Icons.Building />,  t: "Mid-market scaleups", who: "200–1,000 people",      d: "Custom fields, levels, departments, locations — all the slicing without the spreadsheet sprawl." },
  ];
  return (
    <section id="use-cases" data-screen-label="04 Use cases" style={{ padding: "120px 0 0" }}>
      <div className="wrap">
        <div style={{ marginBottom: 24 }}><span className="eyebrow">Who it's for</span></div>
        <h2 style={{ fontSize: "clamp(36px, 5vw, 72px)", lineHeight: .98, letterSpacing: "-.04em", fontWeight: 600, maxWidth: 1000, marginBottom: 64 }}>
          Built for everyone who's ever drawn an org chart in&nbsp;
          <span className="serif-i" style={{ color: "var(--accent)" }}>PowerPoint at 11pm.</span>
        </h2>
        {/* FIX #1: responsive class */}
        <div className="landing-usecases-grid" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 0, borderTop: "1px solid var(--line)", borderLeft: "1px solid var(--line)" }}>
          {cases.map((c) =>
            <div key={c.t} style={{ padding: 28, borderRight: "1px solid var(--line)", borderBottom: "1px solid var(--line)", minHeight: 240, display: "flex", flexDirection: "column" }}>
              <div style={{ width: 36, height: 36, borderRadius: 10, background: "var(--bg-2)", color: "var(--ink)", display: "grid", placeItems: "center", marginBottom: 18 }}>{c.i}</div>
              <div style={{ fontSize: 13, color: "var(--accent)", fontWeight: 600, marginBottom: 6 }}>{c.who}</div>
              <h3 style={{ fontSize: 22, fontWeight: 600, letterSpacing: "-.02em", marginBottom: 10 }}>{c.t}</h3>
              <p style={{ fontSize: 14.5, lineHeight: 1.55, color: "var(--ink-2)" }}>{c.d}</p>
            </div>
          )}
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────── SOCIAL PROOF ─────────────────────────── */
// FIX #3: Replaced placeholder testimonials with credible value-prop section
function SocialProof() {
  const cards = [
    {
      icon: <Icons.Upload />,
      t: "From spreadsheet to board deck in minutes",
      d: "Upload any CSV or Excel file. OrgPlease! auto-detects names, titles, and reporting relationships — even when your column headers are 'creative'. Most teams are charting within 3 minutes of signup.",
    },
    {
      icon: <Icons.Chart />,
      t: "Charts people actually open twice",
      d: "Beautiful enough for the boardroom. Functional enough for daily HR use. Export to paginated PDF, shareable web link, PNG, or SVG — all with one click, no designer required.",
    },
    {
      icon: <Icons.Sparkle />,
      t: "Priced like we want you to stay",
      d: "Free forever for teams under 25. When you outgrow free, paid plans start at $19/mo with no per-seat surprises, no mandatory annual contract, and absolutely no procurement form required.",
    },
  ];
  return (
    <section data-screen-label="05 Social proof" style={{ padding: "100px 0", background: "var(--ink)", color: "var(--bg)" }}>
      <div className="wrap">
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 40, flexWrap: "wrap", gap: 16 }}>
          <span className="eyebrow eyebrow-dark">Why teams make the switch</span>
        </div>
        <h2 style={{ fontSize: "clamp(32px, 4.5vw, 64px)", lineHeight: 1, letterSpacing: "-.04em", fontWeight: 600, maxWidth: 980, marginBottom: 48 }}>
          The org chart software your whole team will actually use —{" "}
          <span className="serif-i" style={{ color: "var(--accent-2)" }}>starting day one.</span>
        </h2>

        {/* Value prop cards */}
        <div className="landing-steps-grid" style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 20 }}>
          {cards.map((c) =>
            <div key={c.t} style={{ padding: 28, borderRadius: 18, background: "rgba(255,255,255,.04)", border: "1px solid rgba(255,255,255,.08)", display: "flex", flexDirection: "column", gap: 16 }}>
              <div style={{ width: 40, height: 40, borderRadius: 12, background: "rgba(47,170,93,.15)", color: "var(--accent-2)", display: "grid", placeItems: "center" }}>{c.icon}</div>
              <h3 style={{ fontSize: 20, fontWeight: 600, letterSpacing: "-.02em", lineHeight: 1.2, color: "var(--bg)" }}>{c.t}</h3>
              <p style={{ fontSize: 14.5, lineHeight: 1.6, color: "rgba(246,244,236,.7)" }}>{c.d}</p>
            </div>
          )}
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────── PRICING TEASER ─────────────────────────── */
// FIX #10: Annual/monthly toggle added
function PricingTeaser({ onSignup }) {
  const [annual, setAnnual] = React.useState(false);

  const tiers = [
    { n: "Free",     monthly: 0,  annual: 0,  users: "1 user · 25 employees",         cta: "Start free",   free: true },
    { n: "Starter",  monthly: 19, annual: 190, users: "3 users · 50 employees",         cta: "Try Starter" },
    { n: "Team",     monthly: 49, annual: 490, users: "10 users · 200 employees",       cta: "Try Team",     featured: true },
    { n: "Business", monthly: 99, annual: 990, users: "Unlimited · 1,000 employees",    cta: "Try Business" },
  ];

  return (
    <section id="pricing" data-screen-label="06 Pricing" style={{ padding: "120px 0 80px" }}>
      <div className="wrap">
        <div style={{ marginBottom: 24 }}><span className="eyebrow">Pricing</span></div>
        <div className="landing-features-header" style={{ display: "grid", gridTemplateColumns: "1.1fr 1fr", gap: 80, alignItems: "end", marginBottom: 40 }}>
          <h2 style={{ fontSize: "clamp(36px, 5vw, 72px)", lineHeight: .98, letterSpacing: "-.04em", fontWeight: 600 }}>
            Pricing that doesn't<br />
            <span className="serif-i" style={{ color: "var(--accent)" }}>require a procurement form.</span>
          </h2>
          <p style={{ fontSize: 17, color: "var(--ink-2)", lineHeight: 1.55, maxWidth: 460 }}>
            Free for teams up to 25, forever. Pay only when you grow.{" "}
            <a href="Pricing.html" style={{ color: "var(--accent)", textDecoration: "underline" }}>Full pricing details →</a>
          </p>
        </div>

        {/* Annual toggle */}
        <div style={{ display: "flex", alignItems: "center", gap: 12, marginBottom: 32 }}>
          <div style={{ display: "inline-flex", background: "var(--bg-2)", border: "1px solid var(--line)", borderRadius: 999, padding: 4 }}>
            {[["Monthly", false], ["Annual", true]].map(([label, val]) =>
              <button key={label} onClick={() => setAnnual(val)}
                style={{
                  padding: "8px 20px", borderRadius: 999, border: 0, cursor: "pointer",
                  fontFamily: "inherit", fontSize: 14, fontWeight: 500,
                  background: annual === val ? "var(--accent)" : "transparent",
                  color:      annual === val ? "#fff"          : "var(--ink-2)",
                  transition: "all .2s ease",
                }}>
                {label}
              </button>
            )}
          </div>
          {annual &&
            <span style={{ fontSize: 13, fontWeight: 600, color: "#fff", background: "var(--accent)", padding: "4px 12px", borderRadius: 999 }}>
              Save ~20%
            </span>
          }
          <span style={{ fontSize: 12.5, color: "var(--muted)", marginLeft: 4 }}>· All prices in USD</span>
        </div>

        {/* FIX #1: responsive class */}
        <div className="landing-pricing-grid" style={{ display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 16 }}>
          {tiers.map((t) => {
            const price = annual ? t.annual : t.monthly;
            return (
              <article key={t.n} style={{
                padding: 24, borderRadius: 18,
                background: t.featured ? "var(--ink)" : "#fff",
                color:      t.featured ? "var(--bg)"  : "var(--ink)",
                border:     t.featured ? "1px solid var(--ink)" : "1px solid var(--line)",
                position: "relative",
              }}>
                {t.featured &&
                  <span style={{ position: "absolute", top: 16, right: 16, fontSize: 12, fontWeight: 600, color: "#fff", background: "var(--accent)", padding: "5px 12px", borderRadius: 999 }}>
                    Most popular
                  </span>
                }
                <div style={{ fontSize: 14, fontWeight: 600, color: t.featured ? "var(--accent-2)" : "var(--accent)", marginBottom: 14 }}>{t.n}</div>
                <div style={{ display: "flex", alignItems: "baseline", gap: 4, marginBottom: 6 }}>
                  <span style={{ fontSize: 44, fontWeight: 700, letterSpacing: "-.04em" }}>${price}</span>
                  <span style={{ fontSize: 15, color: t.featured ? "rgba(246,244,236,.6)" : "var(--muted)" }}>{annual && price > 0 ? "/yr" : "/mo"}</span>
                </div>
                {annual && price > 0 &&
                  <div style={{ fontSize: 12, color: t.featured ? "rgba(246,244,236,.5)" : "var(--muted)", marginBottom: 6 }}>
                    2 months free · save ${t.monthly * 2}
                  </div>
                }
                <div style={{ fontSize: 13.5, color: t.featured ? "rgba(246,244,236,.7)" : "var(--ink-2)", marginBottom: 22, lineHeight: 1.5, marginTop: price > 0 ? 4 : 14 }}>{t.users}</div>
                <button onClick={t.free ? onSignup : undefined}
                  {...(!t.free ? { as: "a", href: "Pricing.html" } : {})}
                  className="btn"
                  style={{
                    width: "100%", justifyContent: "center", padding: "12px 16px", fontSize: 14,
                    background: t.featured ? "var(--accent)" : "var(--bg-2)",
                    color:      t.featured ? "#fff"          : "var(--ink)",
                    border:     t.featured ? 0 : "1px solid var(--line)",
                  }}
                  onClick={t.free ? onSignup : () => window.location.href = "Pricing.html"}>
                  {t.cta}
                </button>
              </article>
            );
          })}
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────── FAQ ─────────────────────────── */
function FAQ() {
  const items = [
    { q: "Do I need a credit card to start?",   a: "No. Free is genuinely free up to 25 employees and stays that way. We only ask for a card when you choose a paid plan." },
    { q: "What file formats can I upload?",      a: "CSV, XLSX, and a paste-from-Google-Sheets shortcut. We auto-detect manager relationships from email IDs, names, or a manager column — whichever you've got." },
    { q: "How do you handle sensitive data?",    a: "Row-level security at the database layer, SSO via SAML on Business, full audit log, and SOC 2 Type II in progress. Your data is yours; we never train on it." },
    { q: "Can I export the chart?",              a: "Yes — paginated PDF, PNG, SVG, and a shareable web link. The PDF is genuinely beautiful; reception will keep it next to the snacks." },
    { q: "What about huge orgs?",                a: "We've tested up to 5,000 rows on the Business plan. For larger, get in touch — we'll do an Enterprise pilot with custom seat pricing." },
    { q: "Why is it called OrgPlease!?",         a: "Because every other tool made us say 'org chart, please.' We took the hint." },
  ];
  const [open, setOpen] = React.useState(0);
  return (
    <section id="faq" data-screen-label="07 FAQ" style={{ padding: "100px 0", background: "var(--bg-2)", borderTop: "1px solid var(--line)", borderBottom: "1px solid var(--line)" }}>
      <div className="wrap">
        {/* FIX #1: responsive class */}
        <div className="landing-faq-split" style={{ display: "grid", gridTemplateColumns: "1fr 1.4fr", gap: 60, alignItems: "start" }}>
          <div>
            <span className="eyebrow">FAQ</span>
            <h2 style={{ marginTop: 16, fontSize: "clamp(32px, 4.5vw, 64px)", lineHeight: .98, letterSpacing: "-.04em", fontWeight: 600 }}>
              Questions, <span className="serif-i" style={{ color: "var(--accent)" }}>politely</span> answered.
            </h2>
            <p style={{ marginTop: 18, fontSize: 16, color: "var(--ink-2)", lineHeight: 1.55, maxWidth: 380 }}>
              Can't find yours? <a href="Contact.html" style={{ color: "var(--accent)" }}>Contact us</a> and a real human will reply within a business day.
            </p>
          </div>
          <div style={{ borderTop: "1px solid var(--line)" }}>
            {items.map((item, i) =>
              <div key={i} style={{ borderBottom: "1px solid var(--line)" }}>
                <button onClick={() => setOpen(open === i ? -1 : i)}
                  style={{
                    width: "100%", padding: "22px 0", display: "flex", alignItems: "center", justifyContent: "space-between",
                    background: "transparent", border: 0, cursor: "pointer", textAlign: "left",
                    fontSize: 18, fontWeight: 500, letterSpacing: "-.01em", color: "var(--ink)", fontFamily: "inherit",
                  }}>
                  <span>{item.q}</span>
                  <span style={{ color: "var(--muted)", flexShrink: 0, marginLeft: 16 }}>
                    {open === i ? <Icons.Minus /> : <Icons.Plus />}
                  </span>
                </button>
                {open === i &&
                  <div style={{ paddingBottom: 22, fontSize: 15.5, lineHeight: 1.6, color: "var(--ink-2)", maxWidth: 640 }}>
                    {item.a}
                  </div>
                }
              </div>
            )}
          </div>
        </div>
      </div>
    </section>
  );
}

/* ─────────────────────────── FINAL CTA ─────────────────────────── */
function FinalCTA({ onSignup }) {
  return (
    <section data-screen-label="08 CTA" style={{ padding: "140px 0 120px", textAlign: "center", position: "relative", overflow: "hidden" }}>
      <div style={{
        position: "absolute", inset: 0,
        backgroundImage: "radial-gradient(rgba(14,15,12,.08) 1px, transparent 1px)",
        backgroundSize: "26px 26px",
        maskImage: "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 80%)",
        WebkitMaskImage: "radial-gradient(ellipse 60% 60% at 50% 50%, #000 30%, transparent 80%)",
        zIndex: 0,
      }} />
      <div className="wrap" style={{ position: "relative", zIndex: 1 }}>
        <span className="eyebrow">Ready when you are</span>
        <h2 style={{ marginTop: 18, fontSize: "clamp(48px, 7.5vw, 120px)", lineHeight: .92, letterSpacing: "-.05em", fontWeight: 600, textWrap: "balance" }}>
          Make your org chart<br />
          <span className="serif-i" style={{ color: "var(--accent)" }}>say please.</span>
        </h2>
        <p style={{ marginTop: 24, fontSize: 19, color: "var(--ink-2)", maxWidth: 560, marginInline: "auto", lineHeight: 1.5 }}>
          Free up to 25 employees. Three minutes to your first chart. No credit card, no sales call, no procurement form.
        </p>
        {/* FIX #2: wired to modal */}
        <div style={{ marginTop: 32, display: "flex", gap: 12, justifyContent: "center", flexWrap: "wrap" }}>
          <button onClick={onSignup} className="btn btn-accent" style={{ padding: "16px 32px", fontSize: 16 }}>
            Start free → no card
          </button>
          <a href="Pricing.html" className="btn btn-ghost" style={{ padding: "16px 28px", fontSize: 16 }}>
            See pricing
          </a>
        </div>
        <p style={{ marginTop: 20, fontSize: 13, color: "var(--muted)" }}>
          Already have an account? <a href="OrgPlease.html" style={{ color: "var(--accent)" }}>Log in →</a>
        </p>
      </div>
    </section>
  );
}

/* ─────────────────────────── FOOTER ─────────────────────────── */
// FIX #12: Dead links removed/cleaned up
function Footer() {
  const cols = [
    { t: "Product",  links: [{ l: "Features", h: "#features" }, { l: "Pricing", h: "Pricing.html" }] },
    { t: "Company",  links: [{ l: "About", h: "#" }, { l: "Contact", h: "Contact.html" }] },
    { t: "Legal",    links: [{ l: "Privacy", h: "Privacy.html" }, { l: "Terms", h: "Terms.html" }, { l: "Security", h: "Security.html" }] },
  ];
  return (
    <footer style={{ background: "var(--ink)", color: "var(--bg)", padding: "80px 0 32px" }}>
      <div className="wrap">
        {/* FIX #1: responsive class */}
        <div className="landing-footer-grid" style={{ display: "grid", gridTemplateColumns: "1.6fr repeat(3, 1fr)", gap: 40, marginBottom: 60 }}>
          <div className="landing-footer-brand">
            <a href="#" style={{ display: "inline-flex", alignItems: "center", gap: 8, color: "var(--bg)", textDecoration: "none" }}>
              <span style={{ color: "var(--accent)" }}><Icons.Logo size={26} /></span>
              <span style={{ fontWeight: 700, letterSpacing: "-.02em", fontSize: 22 }}>OrgPlease<span style={{ color: "var(--accent)" }}>!</span></span>
            </a>
            <p className="serif-i" style={{ marginTop: 16, fontSize: 20, lineHeight: 1.3, color: "rgba(246,244,236,.75)", maxWidth: 280 }}>
              The org chart software that finally says yes.
            </p>
            <div style={{ marginTop: 24, display: "flex", gap: 8 }}>
              <button onClick={() => window.openSignupModal && window.openSignupModal()} className="btn btn-accent" style={{ padding: "10px 18px", fontSize: 13 }}>Start free</button>
              <a href="Pricing.html" className="btn" style={{ padding: "10px 18px", fontSize: 13, background: "rgba(255,255,255,.08)", color: "var(--bg)" }}>Pricing</a>
            </div>
          </div>
          {cols.map((c) =>
            <div key={c.t}>
              <div style={{ fontSize: 13, fontWeight: 600, color: "rgba(255,255,255,.45)", marginBottom: 16, letterSpacing: ".04em", textTransform: "uppercase" }}>{c.t}</div>
              <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 12 }}>
                {c.links.map((link) =>
                  <li key={link.l}>
                    <a href={link.h} style={{ color: "rgba(246,244,236,.75)", textDecoration: "none", fontSize: 14 }}
                      onMouseEnter={(e) => e.target.style.color = "#fff"}
                      onMouseLeave={(e) => e.target.style.color = "rgba(246,244,236,.75)"}>
                      {link.l}
                    </a>
                  </li>
                )}
              </ul>
            </div>
          )}
        </div>
        <div style={{ paddingTop: 24, borderTop: "1px solid rgba(255,255,255,.1)", display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: 16 }}>
          <span style={{ fontSize: 13, color: "rgba(255,255,255,.4)" }}>© 2026 OrgPlease, Inc. · Made with please & thank you</span>
          <span style={{ fontSize: 13, color: "rgba(255,255,255,.4)" }}>v2.0 · build 2026.05</span>
        </div>
      </div>
    </footer>
  );
}

/* ─────────────────────────── STICKY BAR ─────────────────────────── */
// FIX #9: Scroll-triggered sticky CTA
function StickyBar({ onSignup }) {
  const [visible, setVisible] = React.useState(false);
  const [dismissed, setDismissed] = React.useState(false);
  React.useEffect(() => {
    const onScroll = () => setVisible(window.scrollY > 600);
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);
  if (!visible || dismissed) return null;
  return (
    <div className="sticky-bar no-print" style={{
      position: "fixed", bottom: 0, left: 0, right: 0, zIndex: 50,
      background: "var(--ink)", borderTop: "1px solid rgba(255,255,255,.1)",
      boxShadow: "0 -8px 40px rgba(0,0,0,.25)",
      display: "flex", alignItems: "center", justifyContent: "center", gap: 20,
      padding: "14px 24px",
    }}>
      <span style={{ fontSize: 14, fontWeight: 500, color: "rgba(246,244,236,.8)" }}>
        Free for teams up to 25 · No credit card required
      </span>
      <button onClick={onSignup} className="btn btn-accent" style={{ padding: "10px 22px", fontSize: 14 }}>
        Start free →
      </button>
      <button onClick={() => setDismissed(true)} aria-label="Dismiss" style={{
        position: "absolute", right: 20,
        background: "transparent", border: 0, color: "rgba(255,255,255,.35)",
        fontSize: 22, cursor: "pointer", lineHeight: 1, padding: "4px 8px",
        fontFamily: "inherit",
      }}>×</button>
    </div>
  );
}

/* ─────────────────────────── EMAIL MODAL ─────────────────────────── */
// FIX #2: Email capture modal
function EmailModal({ open, onClose }) {
  const [email, setEmail] = React.useState("");
  const [submitted, setSubmitted] = React.useState(false);
  const [error, setError] = React.useState("");

  // Close on Escape
  React.useEffect(() => {
    if (!open) return;
    const onKey = (e) => e.key === "Escape" && onClose();
    window.addEventListener("keydown", onKey);
    return () => window.removeEventListener("keydown", onKey);
  }, [open]);

  // Reset when re-opened
  React.useEffect(() => {
    if (open) { setEmail(""); setError(""); setSubmitted(false); }
  }, [open]);

  if (!open) return null;

  const handleSubmit = (e) => {
    e.preventDefault();
    if (!email || !email.includes("@") || !email.includes(".")) {
      setError("Please enter a valid work email address.");
      return;
    }
    setSubmitted(true);
  };

  return (
    <div
      onClick={(e) => e.target === e.currentTarget && onClose()}
      style={{
        position: "fixed", inset: 0, zIndex: 200,
        background: "rgba(10,20,16,.65)", backdropFilter: "blur(8px)",
        display: "flex", alignItems: "center", justifyContent: "center",
        padding: 24,
      }}>
      <div style={{
        background: "#fff", borderRadius: 24, padding: "48px 44px", maxWidth: 480, width: "100%",
        boxShadow: "0 32px 80px -20px rgba(14,20,16,.4)",
        position: "relative",
        animation: "slideUp .3s cubic-bezier(.16,1,.3,1)",
      }}>
        <button onClick={onClose} aria-label="Close" style={{
          position: "absolute", top: 16, right: 16,
          background: "var(--bg-2)", border: 0, borderRadius: 999,
          width: 32, height: 32, cursor: "pointer", fontSize: 18, color: "var(--muted)",
          display: "grid", placeItems: "center",
        }}>×</button>

        {submitted ? (
          <div style={{ textAlign: "center", padding: "8px 0" }}>
            <div style={{ fontSize: 52, marginBottom: 20 }}>🎉</div>
            <h2 style={{ fontSize: 28, fontWeight: 700, letterSpacing: "-.02em", marginBottom: 12 }}>You're in!</h2>
            <p style={{ fontSize: 16, color: "var(--ink-2)", lineHeight: 1.6 }}>
              We'll send your account details to <strong>{email}</strong>.<br />Check your inbox — it should arrive within 60 seconds.
            </p>
            <button onClick={onClose} className="btn btn-primary" style={{ marginTop: 28, width: "100%", justifyContent: "center" }}>
              Got it →
            </button>
          </div>
        ) : (
          <>
            <span style={{ color: "var(--accent)", display: "inline-flex", marginBottom: 16 }}><Icons.Logo size={32} /></span>
            <h2 style={{ fontSize: 30, fontWeight: 700, letterSpacing: "-.03em", marginBottom: 8, lineHeight: 1.1 }}>
              Start your free account
            </h2>
            <p style={{ fontSize: 15, color: "var(--ink-2)", lineHeight: 1.55, marginBottom: 28 }}>
              Free for up to 25 employees — forever.<br />No credit card, no sales call.
            </p>
            <form onSubmit={handleSubmit} style={{ display: "flex", flexDirection: "column", gap: 12 }}>
              <input
                type="email"
                className="signup-input"
                value={email}
                onChange={(e) => { setEmail(e.target.value); setError(""); }}
                placeholder="you@company.com"
                autoFocus
                style={{
                  width: "100%", padding: "14px 16px",
                  border: "1.5px solid var(--line)", borderRadius: 12,
                  fontSize: 16, fontFamily: "inherit", outline: "none",
                  transition: "border-color .15s, box-shadow .15s",
                }}
              />
              {error && <p style={{ fontSize: 13, color: "#b91c1c", margin: 0 }}>{error}</p>}
              <button type="submit" className="btn btn-primary" style={{ justifyContent: "center", padding: "14px 22px", fontSize: 16 }}>
                Get started free →
              </button>
            </form>
            <p style={{ marginTop: 18, fontSize: 12, color: "var(--muted)", textAlign: "center", lineHeight: 1.6 }}>
              By signing up you agree to our{" "}
              <a href="#" style={{ color: "var(--accent)" }}>Terms</a> &amp;{" "}
              <a href="#" style={{ color: "var(--accent)" }}>Privacy Policy</a>.{" "}
              No spam. Unsubscribe anytime.
            </p>
          </>
        )}
      </div>
    </div>
  );
}

/* ─────────────────────────── EXPORTS ─────────────────────────── */
window.applyAccent   = applyAccent;
window.Nav           = Nav;
window.Hero          = Hero;
window.LogoCloud     = LogoCloud;
window.HowItWorks    = HowItWorks;
window.Features      = Features;
window.UseCases      = UseCases;
window.SocialProof   = SocialProof;
window.PricingTeaser = PricingTeaser;
window.FAQ           = FAQ;
window.FinalCTA      = FinalCTA;
window.Footer        = Footer;
window.StickyBar     = StickyBar;
window.EmailModal    = EmailModal;
