/* Loops — Homepage v2 FAQ + final CTA */

const V2_FAQS = [
  {
    q: "I've tried a lot of apps for ADHD, and they overwhelm me. How is Loops different?",
    a: "Loops was made by people who coach others with ADHD, live with ADHD themselves, and know goal setting inside out. Everything they've learned about what really helps has gone into the app.\n\nLoops works in layers. It starts by breaking your goal into small, doable Loops, each one moving you towards something bigger.\n\nThen your Buddy keeps you going, through gentle encouragement rather than pressure. And because the ADHD brain responds well to rewards, you earn ones that actually mean something.\n\nThen there's Dora, an AI coach who truly gets ADHD, ready with Loop ideas and support whenever you need her.\n\nAnd it stays quiet. Three notifications a day at most, rest days when you need them, and no guilt when life gets in the way.",
  },
  {
    q: "Do I need an ADHD diagnosis to use Loops?",
    a: "No. Loops never asks for a diagnosis. It asks what you're trying to do, then helps you build the small daily actions that get you there.\n\nWhether you were assessed and told it isn't ADHD, you're still waiting, or you've never joined the queue at all, the struggle is the same. Starting things, staying consistent, getting back up after a wobble.\n\nReports says support should be needs-led and shouldn't rely on or require a clinician-provided diagnosis. In plain terms, if someone is struggling, help them based on their needs. That's how Loops has worked from day one.",
    cta: { label: "Why Loops works for everyone", href: "/no-diagnosis-needed/" },
  },
  {
    q: "What are AI credits, and what if I run out?",
    a: "Dora uses credits to give you advice. Longer conversations and more context, which includes previous chats, your Loops and your goals, use more credits in computing power. We hope you'll have enough for what you need in your plan. If you run out and need more, you can top up. To save credits, start new chats for new topics, and manage what Dora remembers about you. That's available to you at all times.",
  },
  { q: "Is there a free trial?", a: "You can try Loops free for 7 days." },
  { q: "Can I cancel any time?", a: "Yes. Cancel any time. No questions, no friction. Annual plans cancelled in the first 30 days get a full refund." },
  {
    q: "Can my Buddy see my journal or my chats with Dora?",
    a: "No. Your Buddy only sees the Loops you've closed and the streaks you've built. Your journal and your conversations with Dora stay private to you.",
  },
  {
    q: "Will my data be used to train AI?",
    a: "No. Your conversations, journal entries and personal data are never used to train AI models. They're used to coach you. You can see and delete what Dora is learning about you in your admin at any time. Total transparency. That's the whole architecture.",
  },
  {
    q: "How does Dora compare to human coaching?",
    a: "Loops is not a replacement for professional therapy or the right human coach. Dora has been trained to understand ADHD and the ADHD mind, along with the best ways to pursue and achieve the goals people set. That combination will be genuinely useful to you. She's also been trained to know where the boundaries are, and when you need to talk to a person.",
  },
  { q: "Is there an Android version?", a: "It's coming soon, promise." },
];

const V2FAQItem = ({ q, a, cta, defaultOpen = false }) =>
<details className="group rounded-card border border-line bg-white overflow-hidden" open={defaultOpen}>
    <summary className="flex cursor-pointer items-center justify-between gap-4 px-6 sm:px-7 py-5 list-none">
      <span className="text-[16px] sm:text-[17px] font-semibold tracking-tight2 text-ink text-pretty">{q}</span>
      <span aria-hidden="true" className="shrink-0 text-ink-3 transition-transform group-open:rotate-45">
        <svg width="22" height="22" viewBox="0 0 24 24" fill="none"><path d="M12 5v14M5 12h14" stroke="currentColor" strokeWidth="2" strokeLinecap="round" /></svg>
      </span>
    </summary>
    <div className="px-6 sm:px-7 pb-6 -mt-1">
      <p className="max-w-prose text-[15.5px] sm:text-[16px] leading-[1.65] text-ink-2 text-pretty whitespace-pre-line">{a}</p>
      {cta ? <div className="mt-5"><Button variant="secondary" size="sm" href={cta.href}>{cta.label}</Button></div> : null}
    </div>
  </details>;

const FAQSectionV2 = () =>
<Section id="faq" className="bg-base">
    <Container>
      <div className="grid gap-10 lg:gap-16 lg:grid-cols-12">
        <div className="lg:col-span-4">
          <Kicker>FAQ</Kicker>
          <h2 className="mt-5 text-balance text-ink font-semibold tracking-tight2 text-[28px] sm:text-[34px] lg:text-[40px] leading-[1.12]">
            Questions answered.
          </h2>
        </div>
        <div className="lg:col-span-8 flex flex-col gap-3">
          {V2_FAQS.map((f, i) => <V2FAQItem key={f.q} q={f.q} a={f.a} cta={f.cta} defaultOpen={i === 0} />)}
        </div>
      </div>
    </Container>
  </Section>;

const FinalCTAV2 = () =>
<Section id="start" className="bg-soft">
    <Container>
      <div className="mx-auto max-w-3xl text-center">
        <h2 className="text-balance text-ink font-bold tracking-tight3 text-[34px] sm:text-[44px] lg:text-[52px] leading-[1.05]">
          Small Loops. Big goals. <span className="text-brand">Someone in your corner.</span>
        </h2>
        <p className="mt-5 text-[17px] sm:text-[19px] leading-[1.55] text-ink-2 text-pretty">That's the whole trick.</p>
        <div className="mt-8 flex flex-col items-center gap-3">
          <Button variant="primary" size="lg" href="#start">
            Get Early Access
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" /></svg>
          </Button>
          <span className="text-[13.5px] text-ink-3">7-day free trial. No complicated setup.</span>
        </div>
      </div>
    </Container>
  </Section>;

Object.assign(window, { FAQSectionV2, FinalCTAV2 });
