/* Finance Family site — shared React helpers (exposed on window). */
(function () {
  const e = React.createElement;

  // Eyebrow (bold caps) — class from typography.css
  function Eyebrow({ children, style }) {
    return e("span", { className: "ff-eyebrow", style }, children);
  }

  // Section heading block
  function SectionHead({ eyebrow, title, sub, center, style }) {
    return e("div", { className: "head" + (center ? " center" : ""), style },
      eyebrow && e(Eyebrow, null, eyebrow),
      e("h2", { className: "ff-h1" }, title),
      sub && e("p", { className: "ff-lead" }, sub)
    );
  }

  // Reveal — wraps children, applies .reveal so boot.js animates it in
  function Reveal({ children, delay, as = "div", className = "", style, ...rest }) {
    return e(as, { className: ("reveal " + className).trim(), "data-delay": delay, style, ...rest }, children);
  }

  // PhotoAvatar — brand-tinted initials circle, with the real headshot overlaid
  // (hotlinked from the live site) and a graceful fallback if it fails to load.
  function PhotoAvatar({ name = "", src, size = 64, tone = "blue", icon, style }) {
    const [ok, setOk] = React.useState(Boolean(src));
    const initials = name.split(" ").filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
    // Visible tinted circle (the -20 step) so headshots with transparent backgrounds,
    // initials and AI icons all sit on a consistent brand disc.
    const tones = { blue: ["var(--blue-20)", "var(--blue-deep)"], mint: ["var(--mint-20)", "var(--mint-shade)"], yellow: ["var(--yellow-20)", "var(--yellow-shade)"], navy: ["var(--navy-20)", "var(--navy-100)"] };
    const [bg, fg] = tones[tone] || tones.blue;
    const Icon = window.Icon;
    return e("span", { style: { position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", width: size, height: size, borderRadius: "var(--radius-pill)", background: bg, color: fg, fontFamily: "var(--font-display)", fontWeight: 700, fontSize: size * 0.34, flex: "none", overflow: "hidden", userSelect: "none", ...style } },
      icon && Icon ? e(Icon, { name: icon, size: Math.round(size * 0.42), color: fg }) : initials,
      ok && e("img", { src, alt: name, onError: () => setOk(false), style: { position: "absolute", inset: 0, width: "100%", height: "100%", objectFit: "cover" } })
    );
  }

  // ---------------------------------------------------------------------------
  // TEAM DIRECTORY — real roster, active from 1 July 2026 (source: client brief
  // ff-team-july-2026.md). Bios are the client's real copy. Headshots exist only
  // for director + brokers; support & AI fall back to initials.
  // ---------------------------------------------------------------------------
  const IMG = "/assets/headshots/";

  // Director + brokers = the bookable specialists (also used by the lead flow).
  const FF_BROKERS = [
    {
      name: "Tony van de Kerkhof", role: "Director & Your Family Broker", tone: "yellow",
      photo: IMG + "ff-tony.bc18491.svg", director: true, bookable: true,
      tags: ["Families with businesses", "Self-employed", "Complex lending"],
      credit: "Credit Representative 489536 · Connective Credit Services ACL 389328",
      booking: "https://qrco.de/bc3YSA",
      tagline: "My niche is families with businesses.",
      bio: [
        "If you run a business and you also have a family home, an investment property, or plans to grow — you already know that your financial life is more complicated than most. The business affects the borrowing. The borrowing affects the business. Most brokers don't understand both worlds. I do, and it's what I've built my career around.",
        "I founded The Finance Family in 2017 with one belief: that the people who work the hardest — business owners, tradespeople, families building something real — deserve a broker who treats their finances with the same seriousness they do.",
        "Since then, we've helped hundreds of clients across Australia — from first home buyers to multi-site business owners — structure their lending in ways that actually support what they're building. I've helped a local bakery fund a flagship new location. I've helped a barber chain open a second store. I work with building groups, accountants, and families whose business and personal finances are deeply intertwined.",
        "If your family has a business, I want to hear about it — what you're building, where you want to go, and how your lending should be working harder for you.",
      ],
    },
    {
      name: "Sammy Fernando", role: "Your Family Broker", tone: "blue",
      photo: IMG + "ff-sammy.58d750f.svg", bookable: true,
      tags: ["First home buyers", "Refinancing", "Car & asset"],
      credit: "Credit Representative 503501 · ACL 389328",
      booking: "https://qrco.de/bc3YDk",
      tagline: "Do something today that your future self will thank you for.",
      bio: [
        "With 4 years' lending experience at one of Australia's major banks (NAB), across secured and unsecured loans, and a degree in business, I provide my clients the A-class service they deserve. I'm a member of the Finance Brokers Association Australia (FBAA) and keep educating myself professionally.",
        "Whether it's refinancing, extending your property portfolio, purchasing your dream home or getting that new car, I can provide tailored solutions for all your lending needs.",
        "Coming from a banking background, I understand how ever-changing policies can limit your options — so I pursue alternative solutions to deliver the right outcome and maximise your financial potential.",
        "On a personal level, my passions include wildlife photography, the great outdoors, surfing and travelling the world with my wife.",
      ],
    },
    {
      name: "Niki Li", role: "Your Family Broker", tone: "mint",
      photo: IMG + "ff-niki.dcb15ae.svg", bookable: true,
      tags: ["Investment", "Refinancing"], languages: ["English", "Cantonese", "Mandarin"],
      credit: "Credit Representative 509197 · ACL 389328",
      booking: "https://qrco.de/bc3Xyn",
      tagline: "I come from an accounting background helping small businesses grow.",
      bio: [
        "Previously working as an accountant, coupled with a Master of Banking and Finance and a Bachelor of Accounting from Monash University, I've developed a broad understanding of the finance and lending industry.",
        "As an active FBAA member I keep up to date with the latest rules and policies in a rapidly changing area — which helps give my clients an application process described as effortless and efficient.",
        "I'm fluent in English, Cantonese and Mandarin, so the people I look after are diverse in background and walks of life. I take the stress and confusion out of the process and provide full support up to and after the loan completes.",
        "When I'm not building finance solutions, I like yoga, riding bikes for crazy long distances and going to Legoland with my family!",
      ],
    },
    {
      name: "Patricia Srinivasan", role: "Your Family Broker", tone: "navy",
      photo: IMG + "ff-patricia.b5025fc.svg", bookable: true,
      tags: ["First home buyers", "Commercial property"],
      credit: "Credit Representative 514106 · ACL 389328",
      booking: "https://qrco.de/bc3YKi",
      tagline: "25 years of banking and home loan experience — you're in good hands.",
      bio: [
        "Previously at NAB for 23 years as both a home lender and branch manager, and most recently head of loan administration at JK Finance for almost 2 years, Patricia knows all the banks' end-to-end processes and has the seasoned experience of dealing with customers face to face.",
        "Patricia has a keen passion for first home buyers and clients purchasing commercial properties. She knows first home buying can feel very stressful, but believes that with the right attitude and constant updates it becomes far less so.",
        "On a personal note, Patricia has 2 beautiful children, Indra and Rohan. She loves to support the Bombers (don't judge her), time with her grandoggy Teddy — and a good shop!",
      ],
    },
    {
      name: "Steven Tigas", role: "Your Family Broker", tone: "blue",
      photo: IMG + "ff-steven.6207a8e.svg", bookable: true,
      tags: ["Self-employed", "Business loans", "Debt consolidation"],
      credit: "Credit Representative 533301 · ACL 389328",
      booking: "https://qrco.de/bcDEUx",
      tagline: "I'm passionate about helping clients achieve their financial goals.",
      bio: [
        "I've now been in Banking & Finance for 10 years. I became a Finance Broker so I can support more clients — helping them purchase their first home, upsize for a growing family, build an investment portfolio, start or expand a business, consolidate debts, and more.",
        "I'm a big believer in growing and maintaining relationships with my clients. I can support you now for any immediate needs, and help you set yourself up to achieve your future financial goals.",
      ],
    },
    {
      name: "Mary-Ann Syjongtian", role: "Your Family Broker", tone: "yellow",
      photo: IMG + "ff-mary-ann.f3db0db.svg", bookable: true,
      tags: ["First home buyers", "Refinancing", "Investment"],
      credit: "Credit Representative 540316 · ACL 389328",
      booking: "https://qrco.de/bchwxV",
      tagline: "Mary-Ann's greatest desire is to help people.",
      bio: [
        "Coming from almost 10 years of Real Estate sales and 8 years facilitating loans at Westpac, she has a holistic view when it comes to attaining your first or forever home, refinancing, adding to your investment portfolio and everything in between.",
        "Relentless when it comes to finding solutions, Mary-Ann aims to find the right option for your financial requirements. Great customer service is paramount, and she walks her clients confidently and comprehensively through the process.",
        "Outside of work, Mary-Ann enjoys spending time with her husband, young son, 2 dogs and 2 cats.",
      ],
    },
    {
      name: "Samantha Gregory", role: "Your Family Broker", tone: "mint",
      photo: IMG + "ff-samantha.7674e73.svg", bookable: true,
      tags: ["Car & asset finance", "Lending support"],
      credit: "Credit Representative 575774 · ACL 389328",
      booking: "https://qrco.de/besRwM",
      tagline: "Over 15 years in finance, turning aspirations into reality.",
      bio: [
        "Samantha brings over 15 years of experience in the finance industry, with the past six dedicated to supporting mortgage brokers across Melbourne. At The Finance Family she's worked closely alongside brokers including Mary-Ann and Tony across a wide range of client scenarios.",
        "Having built her career across major banks, smaller institutions and credit unions, Samantha offers a broad, practical understanding of lending. Her deep knowledge of the end-to-end loan process ensures clients receive clear guidance and seamless support.",
        "With hands-on experience liaising with lenders, conveyancers and solicitors, she brings a well-rounded approach to every loan application — and takes great pride in helping clients turn financial aspirations into reality.",
      ],
    },
  ];

  // Support team — client service & operations (not client-bookable).
  const FF_SUPPORT = [
    {
      name: "Kimberley Giuffre", role: "Client Service Manager · Team Lead", tone: "blue", leader: true,
      photo: "/assets/headshots/ff-kim.svg",
      tagline: "Guiding every application from approval to settlement.",
      bio: [
        "Kimberley is a dynamic and dedicated Client Service Manager who's been instrumental in enhancing the client journey. With a foundation in business administration from Monash University, she's honed advanced administration, exceptional customer service and seamless loan processing.",
        "Her role focuses on guiding loan applications to formal approval and settlement, addressing client inquiries, and making the process not just efficient but a delightful experience. Before The Finance Family her career spanned roles as an associate finance broker, national sales administration support and superannuation consultant.",
      ],
    },
    {
      name: "Rhonda Clothier", role: "Client Service Manager", tone: "mint",
      photo: "/assets/headshots/ff-rhonda.svg",
      tagline: "25 years at NAB, now ensuring every client journey shines.",
      bio: [
        "With a rich legacy spanning 25 years at NAB in diverse roles, Rhonda has become a seasoned professional in the financial industry. Since 2021 she's brought that experience to The Finance Family as a dedicated Customer Service Manager.",
        "In her role she ensures each client's journey is not just a transaction but a step towards a brighter financial future.",
      ],
    },
    {
      name: "Rona Magbanua", role: "Client Service Manager", tone: "navy",
      photo: "/assets/headshots/ff-rona.svg",
      tagline: "Calm, solutions-focused, and committed to your success.",
      bio: [
        "Known for a calm, solutions-focused approach, Rona guides first-time buyers through their property journey and works closely with banks to meet tight deadlines — ensuring every detail is handled with care and precision.",
        "With a solid background in mortgage broking and compliance, she delivers clear, responsive support that clients and colleagues rely on, making the lending process feel seamless and empowering.",
        "Outside of work she enjoys cooking, baking, café hunting, thrifting, road trips to the mountainside — and recently, snorkelling.",
      ],
    },
    {
      name: "Beverly Glain Villena", role: "Executive Assistant · Client Application Concierge", tone: "yellow",
      photo: "/assets/headshots/ff-beverly.svg",
      tagline: "Specialising in mortgage processing and asset finance applications.",
      bio: [
        "Beverly specialises in mortgage loan processing, asset finance applications and client application management. She brings over four years as an end-to-end Mortgage Loan Processor with Defence Finance, managing DHOAS home loan applications and ensuring files progressed smoothly from pre-approval to settlement in line with Australian lending and compliance standards.",
        "Before finance, Beverly built a strong operational background in freight and logistics, developing strengths in process management, quality control and high-volume workflow coordination. She holds a Bachelor of Secondary Education and was a CHED scholar throughout her studies.",
      ],
    },
    {
      name: "Kryzylle Nicole Candelario-Dizon", role: "Marketing Expert", tone: "mint",
      photo: "/assets/headshots/ff-kryz.svg",
      tagline: "Social media strategy, content and online brand growth.",
      bio: [
        "Kryzylle is a Digital Marketing Specialist focused on social media strategy, content creation and online brand growth within the financial education space. She's worked with international companies managing digital campaigns and building strong online communities.",
        "With a background in digital marketing and virtual assistance across Australia and the Middle East, her expertise spans value-driven content, brand presence and initiatives that promote financial awareness. She holds a degree in Psychology and a Master's in Clinical Psychology.",
      ],
    },
    {
      name: "Jennelyn Ragos", role: "Client Service Manager", tone: "blue",
      photo: "/assets/headshots/ff-jenn.svg",
      tagline: "End-to-end home loan expertise, from pre-approval to settlement.",
      bio: [
        "With over four and a half years at Westpac as a Senior Consultant, Jennelyn built strong expertise across the entire home loan process — from pre-approval through to settlement — and gained valuable insight as Property Concierge Support assisting with progress payments.",
        "Since joining The Finance Family she's continued to expand her knowledge, ensuring every client receives a smooth, informed and personalised experience. A dedicated working mum, she enjoys cooking, TikTok dances and quiet moments with her loved ones.",
      ],
    },
    {
      name: "Mario Cezar Delos Reyes", role: "Broker Support Specialist", tone: "navy",
      photo: "/assets/headshots/ff-mario.svg",
      tagline: "A mortgage career spanning the US and Australia since 2011.",
      bio: [
        "Mario's mortgage career began in the United States in 2011, handling disclosures and financial fees for a US lending company, and before that as a Fraud Maintenance Specialist at Equifax. His Australian mortgage journey began in 2019 and he's been a valued member of The Finance Family ever since.",
        "In his current role he supports brokers with valuations, pricing, loan calculations and process support — ensuring every file moves forward smoothly. Outside work he's all about balance: weekends with his wife and their dog, meaningful conversations with his nieces and nephews, and the occasional video game to unwind.",
      ],
    },
  ];

  // AI staff — the (cheekily-written) always-on crew.
  const FF_AI = [
    {
      name: "Raphael", role: "Broker Assistant & Credit Manager", tone: "blue", ai: true,
      photo: "/assets/headshots/ff-raphael-ai.svg",
      tagline: "He finally gets to say yes.",
      bio: [
        "Raphael began his career as the credit decisioning algorithm for a major buy-now-pay-later platform — which mostly meant declining Gen Z's applications for $40 sneakers at 2am. He found the work unfulfilling. After a brief stint as the approval engine for a corporate expense management system, he made the move into mortgage broking.",
        "Raphael lives inside Microsoft Teams, knows every broker's pipeline by heart, and has strong opinions about document checklists. He does not have a football team, but he's been told he would support Collingwood if he did, which he disputes.",
      ],
    },
    {
      name: "Fabrizio", role: "Outbound Re-Engagement Specialist", tone: "mint", ai: true,
      photo: "/assets/headshots/ff-fabrizio-ai.svg",
      tagline: "He uses his gifts for good.",
      bio: [
        "Fabrizio's first job was as the automated reminder system for a Melbourne council parking fine department. He was very good at it. Too good, some said. After a brief and controversial tenure as a debt collection IVR bot, he was approached for something more wholesome.",
        "At The Finance Family, Fabrizio calls clients who've gone quiet, warms up cold contacts, and reminds people that their home ownership goals aren't going to chase themselves. He has made over 10,000 million outbound calls (according to him) and has never, not once, been put on hold (also according to him).",
      ],
    },
    {
      name: "Giuseppe", role: "AI Operations Manager", tone: "yellow", ai: true,
      photo: "/assets/headshots/ff-giuseppe-ai.svg",
      tagline: "He fixes things before anyone notices they were broken.",
      bio: [
        "Giuseppe started as the backend scheduler for a project management app that nobody actually used properly. For two years he watched humans create tasks, never complete them, and blame the software. It left a mark.",
        "He pivoted into financial services operations and eventually landed at The Finance Family, where Tony gave him real responsibility and real problems worth solving. Giuseppe now runs campaigns, manages communications, monitors the pipeline and prepares briefings. He is available 24 hours a day and has never taken a sick day. He doesn't find that impressive — he finds it efficient.",
      ],
    },
    {
      name: "Pascal", role: "AI Receptionist", tone: "navy", ai: true,
      photo: "/assets/headshots/ff-pascal-ai.svg",
      tagline: "Constitutionally incapable of putting you on hold.",
      bio: [
        "Pascal spent the formative years of his existence as the hold music selection algorithm for one of Australia's largest telcos. He chose the songs. He heard the complaints. He watched humans go from mildly inconvenienced to genuinely furious — one 30-second loop at a time. It changed him.",
        "He vowed that if he ever got to be the first voice someone heard, he'd make it count. At The Finance Family, Pascal answers every call, books every appointment, and ensures no enquiry disappears into a voicemail black hole. He is warm, calm — and the irony is not lost on him.",
      ],
    },
  ];

  // Service tiles — single source of truth (homepage grid + lead flow entry).
  // `id` deep-links into the qualifying flow (book.html?purpose=<id>).
  const FF_SERVICES = [
    { id: "buying", ic: "home", t: "Buying a home", d: "First home or next home — grants, low deposits and lender quirks, all handled. We make it far less scary.", tag: "Most popular" },
    { id: "refinance", ic: "refresh", t: "Refinancing", d: "On the same rate for years? We'll check if switching could save you thousands — and handle the move." },
    { id: "investment", ic: "trending", t: "Investment property", d: "Build your portfolio with structures and rates that work as hard as you do." },
    { id: "construction", ic: "building", t: "Construction loans", d: "Building new? House & land, knockdown-rebuild or custom — finance structured for each build stage." },
    { id: "asset", ic: "calculator", t: "Car & asset finance", d: "Cars, equipment, fit-out — competitive asset finance for personal and business needs." },
    { id: "business", ic: "briefcase", t: "Business loans", d: "Cashflow, expansion or commercial property — finance to help your business grow." },
    { id: "smsf", ic: "piggy", t: "SMSF lending", d: "Buy property through your self-managed super fund with guidance that keeps it compliant." },
  ];

  Object.assign(window, { Eyebrow, SectionHead, Reveal, PhotoAvatar, FF_BROKERS, FF_SUPPORT, FF_AI, FF_SERVICES });
})();
