// site/sections-b.jsx — use-cases · engine (value stream) · true picture · outcomes · cost · story

// ════════════════════════════════════════════════════════════════════════
//  WHAT CAN YOU BRING? — 6 concrete use-case cards
// ════════════════════════════════════════════════════════════════════════
function UseCases() {
  const cards = [
    { icon: "bolt", t: "Stuck feature", d: "A feature that has been planned for weeks but keeps losing priority to urgent work. Wakalix puts the right roles on it and produces a reviewable PR." },
    { icon: "refresh", t: "Migration", d: "A framework, API, dependency, or infrastructure migration nobody has time to finish. The engine works inside your systems, against your standards." },
    { icon: "check", t: "Flaky test suite", d: "A test suite that slows releases and wastes review cycles. Roles identify failure patterns, fix unstable tests, and hand your team a clean, documented result." },
    { icon: "layers", t: "Legacy refactor", d: "A module that works but is too risky or unclear to change. The engine maps it, refactors it incrementally, and keeps it reviewable at every step." },
    { icon: "book", t: "Docs & SDK cleanup", d: "API docs, examples, onboarding guides, SDK improvements. Work your team never quite has time to get to — done properly, with your engineers approving what ships." },
    { icon: "shield", t: "Production readiness", d: "Observability gaps, error handling, resilience, security hardening, release checks. The unglamorous work that protects what you've already built." },
  ];
  return (
    <Section id="usecases" max={1120}>
      <div className="reveal" style={{ textAlign: "center", marginBottom: 48 }}>
        <Eyebrow icon="target">What can you bring?</Eyebrow>
        <h2 className="h-section" style={{ fontSize: "clamp(28px, 3.4vw, 40px)", margin: 0 }}>One real problem. Any kind.</h2>
        <p style={{ fontSize: 16, lineHeight: 1.6, color: "var(--fg-2)", maxWidth: 600, margin: "18px auto 0" }}>
          No migration, no long transformation program. Bring one thing that has been waiting on time, focus, or senior capacity. Wakalix forms the right AI roles around it and produces reviewable work your team can approve.
        </p>
      </div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 18 }} className="pillar-grid">
        {cards.map((c, i) => (
          <Card key={c.t} className="reveal" pad={24} style={{ transitionDelay: (i % 3 * 60) + "ms" }}>
            <div style={{ display: "flex", alignItems: "center", gap: 11, marginBottom: 12 }}>
              <span style={{ width: 36, height: 36, borderRadius: 10, background: "var(--accent-soft)", color: "var(--accent)", display: "grid", placeItems: "center", flexShrink: 0 }}><Ico name={c.icon} size={18} /></span>
              <span style={{ fontSize: 16, fontWeight: 600, color: "var(--fg-1)" }}>{c.t}</span>
            </div>
            <div style={{ fontSize: 13.5, lineHeight: 1.6, color: "var(--fg-3)" }}>{c.d}</div>
          </Card>
        ))}
      </div>
    </Section>
  );
}

// ════════════════════════════════════════════════════════════════════════
//  THE ENGINE — SEE, the Software Engineering Engine (20 roles, end to end)
// ════════════════════════════════════════════════════════════════════════
function ValueStream() {
  const stages = [
    { n: "01", stage: "Strategy & governance", icon: "target", tier: "portfolio", count: 3,
      d: "A chief architect, a governance auditor and a delivery lead set direction, guard your standards, and keep the work honest." },
    { n: "02", stage: "Product & design", icon: "sparkle", tier: "product", count: 3,
      d: "Product managers and architects turn an idea into a real plan; an experience designer shapes how it feels to use." },
    { n: "03", stage: "Platform & security", icon: "shield", tier: "product", count: 2,
      d: "A platform engineer lays the foundations and a security auditor keeps them safe — before a line of feature code is written." },
    { n: "04", stage: "Build", icon: "box", tier: "developer", count: 4,
      d: "Backend, frontend, data and integration engineers do the actual building — in your systems, to your conventions." },
    { n: "05", stage: "Quality", icon: "check", tier: "helper", count: 4,
      d: "Code review, testing, accessibility and documentation — the checks teams usually skip under pressure, done every time." },
    { n: "06", stage: "Implementation", icon: "dispatch", tier: "helper", count: 2,
      d: "Release managers and deployment specialists get the work live cleanly, reliably, and with every step documented and reversible." },
    { n: "07", stage: "Support & operations", icon: "refresh", tier: "helper", count: 3,
      d: "Site reliability, support and observability roles keep the product healthy, responsive to real users, and improving after launch." },
  ];
  return (
    <Section id="engine" bg="var(--bg-base)" style={{ borderTop: "var(--hairline) solid var(--border-1)", borderBottom: "var(--hairline) solid var(--border-1)" }}>
      <div className="reveal" style={{ maxWidth: 760, marginBottom: 36 }}>
        <Eyebrow icon="grid">The engine, in full</Eyebrow>
        <h2 className="h-section" style={{ fontSize: "clamp(28px, 3.6vw, 42px)", margin: 0 }}>The complete software value stream.</h2>
        <p style={{ fontSize: 16, lineHeight: 1.6, color: "var(--fg-2)", marginTop: 18 }}>
          Every stage the work needs — from first idea all the way through to live in production and supported by real users — covered by one connected engine, not a pile of disconnected bots. The engine works inside your engineering organization, against your standards, and produces reviewable work at every step. We have a proven way to onboard these roles into <em style={{ color: "var(--fg-1)", fontStyle: "normal", fontWeight: 500 }}>your</em> organization: your codebase, your conventions, your guardrails.
        </p>
      </div>

      {/* one clean diagram: idea → production track + six stage write-ups */}
      <div className="reveal wx-card" style={{ padding: "26px 26px 24px", overflow: "hidden" }}>
        <div style={{ display: "flex", alignItems: "center", gap: 12, marginBottom: 24 }}>
          <span className="mono" style={{ fontSize: 11, color: "var(--fg-3)", letterSpacing: "0.08em", flexShrink: 0 }}>IDEA</span>
          <span style={{ flex: 1, height: 2, borderRadius: 1, background: "linear-gradient(90deg, var(--accent), var(--accent-border) 50%, var(--accent))" }} />
          <span className="mono" style={{ fontSize: 11, color: "var(--fg-3)", letterSpacing: "0.08em", flexShrink: 0 }}>IN PRODUCTION</span>
        </div>
        <div className="stream">
          {stages.map((s) => (
            <div key={s.stage} className="stream-col">
              <div style={{ display: "flex", alignItems: "center", gap: 9, marginBottom: 10 }}>
                <span style={{ width: 32, height: 32, borderRadius: 9, background: "var(--accent-soft)", color: "var(--accent)", display: "grid", placeItems: "center", flexShrink: 0 }}><Ico name={s.icon} size={16} /></span>
                <span className="mono" style={{ fontSize: 11, color: "var(--fg-4)", fontWeight: 600 }}>{s.n}</span>
              </div>
              <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 7 }}>
                <span style={{ fontSize: 14, fontWeight: 600, color: "var(--fg-1)" }}>{s.stage}</span>
                <span style={{ display: "inline-flex", alignItems: "center", gap: 5, fontSize: 11, color: "var(--fg-3)" }}>
                  <span className="tier-stripe" data-tier={s.tier} style={{ width: 3, height: 11, borderRadius: 2 }} />{s.count} roles
                </span>
              </div>
              <div style={{ fontSize: 13, lineHeight: 1.55, color: "var(--fg-3)" }}>{s.d}</div>
            </div>
          ))}
        </div>
      </div>

      {/* concrete example callout */}
      <div className="reveal" style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 18, marginTop: 24 }}>
        <div style={{ padding: "20px 22px", borderRadius: "var(--r-4)", background: "var(--accent-softer)", border: "var(--hairline) solid var(--accent-border)" }}>
          <div style={{ fontSize: 12, fontWeight: 600, color: "var(--accent)", letterSpacing: "0.08em", textTransform: "uppercase", marginBottom: 10 }}>Example — flaky test suite</div>
          <div style={{ fontSize: 13.5, lineHeight: 1.6, color: "var(--fg-2)", marginBottom: 14 }}>
            For a flaky test suite, the engine brings in a <strong style={{ color: "var(--fg-1)", fontWeight: 600 }}>test engineer, backend engineer, code reviewer, delivery lead,</strong> and <strong style={{ color: "var(--fg-1)", fontWeight: 600 }}>documentation role.</strong>
          </div>
          <div style={{ display: "flex", flexDirection: "column", gap: 7 }}>
            {["Identifies failure patterns across the suite","Fixes unstable tests against your conventions","Updates the relevant documentation","Opens a reviewable PR with evidence — your team approves it"].map((l, i) => (
              <span key={i} style={{ display: "flex", alignItems: "flex-start", gap: 9, fontSize: 12.5, color: "var(--fg-3)" }}>
                <span style={{ width: 16, height: 16, borderRadius: 4, background: "var(--accent-soft)", color: "var(--accent)", display: "grid", placeItems: "center", flexShrink: 0, marginTop: 1 }}><Ico name="check" size={10} stroke={2.4} /></span>{l}
              </span>
            ))}
          </div>
        </div>
        <div style={{ display: "flex", flexWrap: "wrap", alignContent: "center", gap: "14px 36px", padding: "20px 22px", borderRadius: "var(--r-4)", background: "var(--bg-raised)", border: "var(--hairline) solid var(--border-1)" }}>
          {[
            { icon: "grid", t: "20+ roles, the complete value stream" },
            { icon: "route", t: "Proven onboarding into your org" },
            { icon: "refresh", t: "Gets sharper every run" },
          ].map((c, i) => (
            <span key={i} style={{ display: "inline-flex", alignItems: "center", gap: 9, fontSize: 13, color: "var(--fg-2)", width: "100%" }}>
              <span style={{ width: 24, height: 24, borderRadius: 7, background: "var(--accent-soft)", color: "var(--accent)", display: "grid", placeItems: "center", flexShrink: 0 }}><Ico name={c.icon} size={13} /></span>{c.t}
            </span>
          ))}
        </div>
      </div>
    </Section>
  );
}

// ════════════════════════════════════════════════════════════════════════
//  THE TRUE PICTURE — replaces the technical "git as memory" framing
// ════════════════════════════════════════════════════════════════════════
function PicturePanel() {
  const quality = [62, 70, 68, 79, 85, 90];
  return (
    <Card hover={false} pad={24} style={{ background: "var(--bg-raised)" }}>
      <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 18 }}>
        <span style={{ fontSize: 12.5, fontWeight: 600, color: "var(--fg-3)", textTransform: "uppercase", letterSpacing: "0.06em" }}>Roadmap, as it really is</span>
        <span className="badge" data-tone="ok" style={{ height: 20 }}><span className="dot" />live</span>
      </div>
      {/* three honest signals */}
      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "18px 16px", marginBottom: 20 }}>
        <div>
          <div className="metric-num" style={{ fontSize: 26, color: "var(--fg-1)" }}>On track</div>
          <div style={{ fontSize: 11.5, color: "var(--fg-3)", marginTop: 3 }}>roadmap status, ground-truth</div>
        </div>
        <div>
          <div className="metric-num" style={{ fontSize: 26, color: "var(--accent)" }}>+38%</div>
          <div style={{ fontSize: 11.5, color: "var(--fg-3)", marginTop: 3 }}>quality trend, this quarter</div>
        </div>
      </div>
      {/* quality trend bars */}
      <div style={{ fontSize: 11.5, fontWeight: 600, color: "var(--fg-3)", textTransform: "uppercase", letterSpacing: "0.06em", marginBottom: 10 }}>Quality, climbing</div>
      <div style={{ display: "flex", alignItems: "flex-end", gap: 8, height: 56, marginBottom: 18 }}>
        {quality.map((h, i) => (
          <div key={i} style={{ flex: 1, height: h + "%", borderRadius: 3, background: i === quality.length - 1 ? "var(--accent)" : "var(--accent-soft)" }} />
        ))}
      </div>
      {/* innovation mix */}
      <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", paddingTop: 16, borderTop: "var(--hairline) solid var(--border-1)" }}>
        <span style={{ fontSize: 12.5, color: "var(--fg-2)" }}>Effort on <strong style={{ color: "var(--fg-1)" }}>new value</strong> vs. upkeep</span>
        <span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
          <span style={{ width: 90, height: 8, borderRadius: 4, background: "var(--bg-sunken)", overflow: "hidden", display: "inline-block" }}>
            <span style={{ display: "block", height: "100%", width: "66%", background: "var(--accent)" }} />
          </span>
          <span className="mono" style={{ fontSize: 12, color: "var(--fg-1)", fontWeight: 600 }}>66%</span>
        </span>
      </div>
    </Card>
  );
}

function Picture() {
  const points = [
    "A true picture of your roadmap — what's really moving, what's stuck, and why — not a slide written the night before the review.",
    "Quality you can watch trend over time, instead of finding out at release.",
    "How much of your effort is going to real innovation versus keeping the lights on.",
  ];
  return (
    <Section id="picture">
      <div style={{ display: "grid", gridTemplateColumns: "1.05fr 0.95fr", gap: 48, alignItems: "center" }} className="story-grid">
        <div className="reveal">
          <Eyebrow icon="eye">See the true picture</Eyebrow>
          <h2 className="h-section" style={{ fontSize: "clamp(26px, 3.4vw, 40px)", margin: 0 }}>Finally see what your roadmap is really made of.</h2>
          <p style={{ fontSize: 16, lineHeight: 1.6, color: "var(--fg-2)", margin: "18px 0 22px", maxWidth: 500 }}>
            Because the engine does the work as one connected system, nothing happens off the record. That gives you something most teams never get: an honest, always-current view of your own delivery.
          </p>
          <ul className="flist">
            {points.map((p, j) => <li key={j}><span className="chk"><Ico name="check" size={11} stroke={2} /></span>{p}</li>)}
          </ul>
        </div>
        <div className="reveal" style={{ transitionDelay: "80ms" }}>
          <PicturePanel />
        </div>
      </div>
    </Section>
  );
}

// ════════════════════════════════════════════════════════════════════════
//  OUTCOMES — quick "what changes" summary
// ════════════════════════════════════════════════════════════════════════
function Outcomes() {
  const cols = [
    { k: "Ship faster", icon: "bolt", d: "Clear the backlog that's been waiting on headcount. Work that sat for quarters starts moving in weeks." },
    { k: "Spend far less", icon: "coin", d: "A fraction of the cost of new hires — and a fraction of what an unmanaged coding agent burns in tokens." },
    { k: "Build what you couldn't", icon: "sparkle", d: "Finally take on the projects there was never time or people for — without pulling your team off the roadmap." },
  ];
  return (
    <Section id="outcomes" bg="var(--bg-base)" style={{ borderTop: "var(--hairline) solid var(--border-1)" }}>
      <div className="reveal" style={{ textAlign: "center", marginBottom: 50 }}>
        <Eyebrow icon="target">What changes</Eyebrow>
        <h2 className="h-section" style={{ fontSize: "clamp(28px, 3.4vw, 40px)", margin: 0 }}>More shipped, for less.</h2>
      </div>
      <div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 22 }} className="pillar-grid">
        {cols.map((c, i) => (
          <Card key={c.k} className="reveal" pad={28} style={{ transitionDelay: (i * 80) + "ms" }}>
            <span style={{ width: 40, height: 40, borderRadius: 11, background: "var(--accent-soft)", color: "var(--accent)", display: "grid", placeItems: "center", marginBottom: 18 }}><Ico name={c.icon} size={20} /></span>
            <div style={{ fontSize: 20, fontWeight: 600, color: "var(--fg-1)", marginBottom: 10 }}>{c.k}</div>
            <div style={{ fontSize: 14, lineHeight: 1.6, color: "var(--fg-3)" }}>{c.d}</div>
          </Card>
        ))}
      </div>
    </Section>
  );
}

// ════════════════════════════════════════════════════════════════════════
//  COST — the headline differentiator (token-budget pain + proof)
// ════════════════════════════════════════════════════════════════════════
function CostPanel() {
  const models = [
    { label: "Light model", pct: 64, note: "mechanical work", c: "var(--ok)" },
    { label: "Standard model", pct: 31, note: "most delivery", c: "var(--accent)" },
    { label: "Premium model", pct: 5, note: "hard design only", c: "var(--tier-portfolio)" },
  ];
  return (
    <Card hover={false} pad={24} style={{ background: "var(--bg-raised)" }}>
      <div style={{ display: "flex", alignItems: "baseline", justifyContent: "space-between", marginBottom: 6 }}>
        <span style={{ fontSize: 12.5, fontWeight: 600, color: "var(--fg-3)", textTransform: "uppercase", letterSpacing: "0.06em" }}>This month</span>
        <span className="badge" data-tone="ok" style={{ height: 20 }}><span className="dot" />under cap</span>
      </div>
      <div style={{ display: "flex", alignItems: "baseline", gap: 8, marginTop: 10 }}>
        <span className="metric-num" style={{ fontSize: 30, color: "var(--fg-1)" }}>$184</span>
        <span className="mono" style={{ fontSize: 13, color: "var(--fg-3)" }}>/ $2,400 budget</span>
      </div>
      <div style={{ position: "relative", height: 8, borderRadius: 4, background: "var(--bg-sunken)", border: "var(--hairline) solid var(--border-1)", overflow: "hidden", margin: "10px 0 6px" }}>
        <div style={{ position: "absolute", inset: 0, width: "8%", background: "var(--accent)", borderRadius: 4 }} />
        <div style={{ position: "absolute", top: 0, bottom: 0, left: "80%", width: 2, background: "var(--warn)" }} title="alert at 80%" />
      </div>
      <div className="mono" style={{ fontSize: 11, color: "var(--fg-3)", marginBottom: 18 }}>alerts fire at 80% — you never get a surprise bill</div>
      <div style={{ fontSize: 11.5, fontWeight: 600, color: "var(--fg-3)", textTransform: "uppercase", letterSpacing: "0.06em", marginBottom: 12 }}>Right-sized models</div>
      <div style={{ display: "flex", flexDirection: "column", gap: 11 }}>
        {models.map((m) => (
          <div key={m.label}>
            <div style={{ display: "flex", justifyContent: "space-between", fontSize: 12, marginBottom: 4 }}>
              <span style={{ color: "var(--fg-1)", fontWeight: 500 }}>{m.label} <span style={{ color: "var(--fg-3)", fontWeight: 400 }}>· {m.note}</span></span>
              <span className="mono" style={{ color: "var(--fg-2)" }}>{m.pct}%</span>
            </div>
            <div style={{ height: 6, borderRadius: 3, background: "var(--bg-sunken)", overflow: "hidden" }}>
              <div style={{ height: "100%", width: m.pct + "%", background: m.c, borderRadius: 3 }} />
            </div>
          </div>
        ))}
      </div>
    </Card>
  );
}

function Cost() {
  const points = [
    "Every job gets the cheapest model that can do it well — premium models fire only on genuinely hard design.",
    "A hard spend cap per role, per project. Alerts before you reach it; nothing runs away in the background.",
    "Every dollar accounted for — re-run the cost picture any time. The bill is never a mystery.",
  ];
  return (
    <Section id="cost" bg="var(--bg-base)" style={{ borderTop: "var(--hairline) solid var(--border-1)", borderBottom: "var(--hairline) solid var(--border-1)" }}>
      <div style={{ display: "grid", gridTemplateColumns: "1.1fr 0.9fr", gap: 48, alignItems: "center" }} className="story-grid">
        <div className="reveal">
          <Eyebrow icon="coin">Predictable AI spend</Eyebrow>
          <h2 className="h-section" style={{ fontSize: "clamp(26px, 3.4vw, 40px)", margin: 0 }}>Coding agents burn through budgets.<br /><span style={{ color: "var(--accent)" }}>This one doesn't.</span></h2>
          <p style={{ fontSize: 16, lineHeight: 1.6, color: "var(--fg-2)", margin: "18px 0 22px", maxWidth: 480 }}>
            If your team's coding-agent bill swings wildly month to month — premium models firing on trivial work, no caps, no visibility — you already know the problem. wakalix is built cost-first.
          </p>
          <ul className="flist">
            {points.map((p, j) => <li key={j}><span className="chk"><Ico name="check" size={11} stroke={2} /></span>{p}</li>)}
          </ul>
          <div style={{ display: "flex", alignItems: "center", gap: 14, marginTop: 26, padding: "16px 20px", borderRadius: "var(--r-4)", background: "var(--accent-softer)", border: "var(--hairline) solid var(--accent-border)" }}>
            <span className="metric-num" style={{ fontSize: 30, color: "var(--accent)" }}>~$150<span style={{ fontSize: 15, color: "var(--fg-3)" }}>/mo</span></span>
            <div>
              <div style={{ fontSize: 13.5, color: "var(--fg-2)", lineHeight: 1.5 }}>is what it cost us to run our <strong style={{ color: "var(--fg-1)" }}>entire portfolio of products</strong> — AI and infrastructure, all in.</div>
              <div style={{ fontSize: 12, color: "var(--fg-3)", marginTop: 6, lineHeight: 1.5 }}>Your cost depends on project size, complexity, and run frequency. We show you the cost model before any work starts — no surprises.</div>
            </div>
          </div>
        </div>
        <div className="reveal" style={{ transitionDelay: "80ms" }}>
          <CostPanel />
        </div>
      </div>
    </Section>
  );
}

// ════════════════════════════════════════════════════════════════════════
//  OUR STORY — track record as a case study (proof)
// ════════════════════════════════════════════════════════════════════════
function Story() {
  const stats = [
    { n: "Multiple", l: "products built" },
    { n: "Weeks", l: "not quarters" },
    { n: "Elite", l: "delivery metrics" },
    { n: "0", l: "quality regressions" },
  ];
  return (
    <Section id="story">
      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 48, alignItems: "center" }} className="story-grid">
        <div className="reveal">
          <Eyebrow icon="sparkle">Proof, not promises</Eyebrow>
          <h2 className="h-section" style={{ fontSize: "clamp(26px, 3.2vw, 38px)", margin: 0 }}>We built our own company this way.</h2>
          <p style={{ fontSize: 15.5, lineHeight: 1.6, color: "var(--fg-2)", margin: "18px 0 18px" }}>
            Before we offered this to anyone, we ran the engine on ourselves. A small group of people and the full roster of AI roles built and shipped a portfolio of real products — live, in production.
          </p>
          <p style={{ fontSize: 14.5, lineHeight: 1.6, color: "var(--fg-3)", margin: 0 }}>
            Your story will look different from ours. But the way the work gets done — the engine doing the legwork, your people deciding — is exactly what we'll bring to your team.
          </p>
        </div>
        <div className="reveal" style={{ transitionDelay: "80ms" }}>
          <Card hover={false} pad={28} style={{ background: "var(--bg-raised)" }}>
            <div style={{ fontSize: 11.5, fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.08em", color: "var(--fg-3)", marginBottom: 20 }}>Our own track record</div>
            <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: "22px 18px" }}>
              {stats.map((s, i) => (
                <div key={i}>
                  <div className="metric-num" style={{ fontSize: 28, color: "var(--accent)" }}>{s.n}</div>
                  <div style={{ fontSize: 12.5, color: "var(--fg-3)", marginTop: 4 }}>{s.l}</div>
                </div>
              ))}
            </div>
            <div style={{ marginTop: 22, paddingTop: 18, borderTop: "var(--hairline) solid var(--border-1)", fontSize: 12.5, color: "var(--fg-3)", lineHeight: 1.5 }}>
              We'll walk you through the real numbers behind every one of these in a call — measured, not estimated.
            </div>
          </Card>
        </div>
      </div>
    </Section>
  );
}

Object.assign(window, { UseCases, ValueStream, Picture, Outcomes, Cost, Story });
