// content-services.jsx — the "Services" lens registry. The pyramid teaches the
// LIFE180 *process*; life180.com/services markets the same work under familiar
// *service* names. This maps each public service onto the tier(s) where it's
// delivered, so the Services toggle can surface service widgets in the pyramid
// and route a click into the matching internal stream funnel.
//
// Services map MANY-TO-MANY to tiers: one service can live on several tiers
// (`tiers: [..]`), and one tier can host several services. `route` names the
// primary stream a "Get started" CTA opens — resolved through the existing
// app.jsx onStream() pipeline (funnels, DNA, sub-pyramids, schedule, links).

window.L180_SERVICES = [
  {
    key: "tax-strategies",
    name: "Tax Strategies",
    tagline: "Stop overpaying — in your working years and in retirement.",
    blurb: "Roth conversions, full tax-position analysis, and strategies to minimize RMD tax liability so more of what you build stays yours.",
    tiers: [5],
    route: { tierN: 5, streamName: "Tax Strategy" },
    link: "https://life180.com/services",
  },
  {
    key: "legacy-planning",
    name: "Legacy Planning",
    tagline: "Create a legacy for the next generation.",
    blurb: "Rockefeller Method strategies, trusts and wills, and whole life for children — building intergenerational wealth and the values that carry it.",
    tiers: [5],
    route: { tierN: 5, streamName: "Estate & Legacy" },
    link: "https://life180.com/services",
  },
  {
    key: "cash-flow-hacking",
    name: "Cash Flow Hacking",
    tagline: "The most efficient place to save a dollar.",
    blurb: "Discover how a properly designed whole life policy lets the same dollar stay liquid, stay protected, keep growing, and get put to work again.",
    tiers: [3],
    route: { tierN: 3, streamName: "The Best Place to Save" },
    link: "https://life180.com/services",
  },
  {
    key: "freedom-planning",
    name: "Freedom Planning",
    tagline: "What does financial freedom look like for you?",
    blurb: "Probability modeling, cash-flow mapping, and Monte Carlo simulations to stress-test your Freedom Number and prove out financial independence.",
    tiers: [1, 3],
    route: { tierN: 1, streamName: "Clarity Check" },
    link: "https://life180.com/services",
  },
  {
    key: "family-protection",
    name: "Family Protection",
    tagline: "Protect the family by building the financial foundation.",
    blurb: "Life, disability, and health coverage designed to put a real floor under the household — defense before offense.",
    tiers: [2],
    route: { tierN: 2, streamName: "Wealth Protection Assessment" },
    link: "https://life180.com/services",
  },
  {
    key: "debt-elimination",
    name: "Debt Elimination",
    tagline: "Debt is a crippling feeling — let's end it.",
    blurb: "Velocity banking and consolidation strategies that align every debt and accelerate payoff without starving the rest of the plan.",
    tiers: [2],
    route: { tierN: 2, streamName: "Cash Flow & Debt Design" },
    link: "https://life180.com/services",
  },
  {
    key: "risk-alignment",
    name: "Risk Alignment",
    tagline: "Is how you're invested aligned with how you're wired?",
    blurb: "Audit portfolio volatility, diversification, and overall risk against your real tolerance — captured at your Design and applied to the path you take.",
    tiers: [2, 1, 4],
    route: { tierN: 1, streamName: "Investor Design Assessment" },
    link: "https://life180.com/services",
  },

  // --- standalone services — NOT placed inside the pyramid ---
  {
    key: "business-consulting",
    name: "Business Consulting",
    tagline: "Understanding the financials — for owners.",
    blurb: "Group health, retirement plans, key-man insurance, succession planning, and tax analysis. It touches every tier, so we run it as its own engagement.",
    standalone: "footer",
    route: null, // cross-cutting — opens scheduling rather than a single stream
    link: "https://life180.com/services",
  },
  {
    key: "rescue-my-iul",
    name: "Rescue My IUL",
    tagline: "When did you last audit your IUL?",
    blurb: "A separate, education-first service exposing the limitations of indexed universal life — with an audit and a masterclass. It lives outside the pyramid.",
    standalone: "external",
    route: null,
    link: "https://life180.com/services",
  },
];

// The Services pyramid — its OWN triangle, distinct from the 5-tier process
// pyramid. Three service-native bands, built foundation -> apex. Same visual
// language as L180_TIERS (topW/botW geometry, n, name, positioning, tagline,
// intro) so the existing L180Pyramid component renders it unchanged — but a
// different band count + names so the two pyramids don't feel redundant.
// Each band lists the services that live in it via `serviceKeys`.
window.L180_SERVICE_TIERS = [
  {
    n: 3, name: "Preserve & Pass On", positioning: "Optimize what you keep — and what you leave",
    tagline: "Make it efficient, then make it last.",
    topW: 240, botW: 430,
    intro: "Once the foundation is built and the money's working, the final job is keeping more of it and passing it on with intention.",
    serviceKeys: ["tax-strategies", "legacy-planning"],
  },
  {
    n: 2, name: "Grow & Align", positioning: "Put your money to work the way you're wired",
    tagline: "Velocity, markets, and alignment.",
    topW: 430, botW: 620,
    intro: "With the floor in place, we get every dollar moving — aligned to how you're built and modeled against the freedom you're aiming for.",
    serviceKeys: ["cash-flow-hacking", "risk-alignment", "freedom-planning"],
  },
  {
    n: 1, name: "Protect & Free Up", positioning: "Secure the household, free the cash flow",
    tagline: "Defense before offense.",
    topW: 620, botW: 810,
    intro: "Everything starts here: protect the people and assets you can't afford to lose, then free up the money that's quietly sleeping.",
    serviceKeys: ["family-protection", "debt-elimination"],
  },
];

// Resolve a Services-pyramid band's serviceKeys to full service objects.
window.l180BandServices = function (band) {
  return (band.serviceKeys || [])
    .map((k) => window.L180_SERVICES.find((s) => s.key === k))
    .filter(Boolean);
};

// Services shown as related-chip widgets inside a PROCESS tier's modal.
// Standalone services (footer-only) are excluded.
window.l180ServicesForTier = function (n) {
  return window.L180_SERVICES.filter(
    (s) => !s.standalone && Array.isArray(s.tiers) && s.tiers.includes(n)
  );
};

// Standalone services for the Services-lens footer strip (Consulting, IUL).
window.l180StandaloneServices = function () {
  return window.L180_SERVICES.filter((s) => s.standalone);
};
