// Long-form explainer + FAQ. Heavy on the two-credit interaction.

function Explainer() {
  return (
    <section className="explainer-section" id="how-it-works">
      <h2>How the Dependent Care FSA and Tax Credit actually interact</h2>
      <p>
        Two federal benefits, one pool of childcare expenses, and one rule that most parents miss:
        <strong> every dollar you contribute to a Dependent Care FSA reduces — dollar-for-dollar — the expense base for the Child &amp; Dependent Care Credit.</strong> You don't get both on the same dollar. The right strategy depends on your tax bracket, how many kids you have in care, and how much you spend.
      </p>

      <h3>The DCFSA in 30 seconds</h3>
      <ul>
        <li>An employer-sponsored benefit you elect during open enrollment. Money comes out of your paycheck <em>before</em> federal income tax and FICA (Social Security + Medicare).</li>
        <li>2025 cap: <span className="mono">$5,000</span> per household (married filing jointly, head of household, single). <span className="mono">$2,500</span> if married filing separately.</li>
        <li>Use-it-or-lose-it: unused balance at year-end is generally forfeited. Pick a number you'll actually spend.</li>
        <li>Savings = contribution × (your marginal federal income tax rate + 7.65% FICA). High earners often save 30–37% per dollar contributed.</li>
      </ul>

      <h3>The CDCC in 30 seconds</h3>
      <ul>
        <li>A non-refundable federal tax credit claimed on Form 2441. No employer needed.</li>
        <li>Expense base capped at <span className="mono">$3,000</span> for one qualifying child or <span className="mono">$6,000</span> for two or more, under age 13.</li>
        <li>Credit rate slides from 35% (AGI ≤ $15k) down to 20% for AGI above $43k. Most working parents land at the <span className="mono">20%</span> floor.</li>
        <li>Non-refundable: it can't take your federal tax bill below zero, but for most working households the credit gets fully used.</li>
      </ul>

      <h3>Why "max both" is a trap</h3>
      <p>
        The instinct is right — claim every benefit. The IRS instinct is the opposite: pick one bucket per dollar. When you put $5,000 in the DCFSA and have $6,000 of expenses for two kids, the CDCC's <span className="mono">$6,000</span> base gets reduced by your FSA $5,000 first. You can only claim <span className="mono">$1,000</span> of expenses for the credit. The "max both" parent who thinks they're getting FSA savings <em>plus</em> a credit on $6,000 of expenses is double-counting in their head.
      </p>
      <p>
        That's the whole game: pick the split that captures the most savings per dollar. For high earners, DCFSA's 30%+ trumps CDCC's 20% — fill the FSA first. For lower-AGI households, the CDCC's higher rate at lower income can beat the FSA. For two-or-more-kid households with expenses above $5,000, the answer is usually <em>both</em> — but only because the FSA fills the first $5,000 and the CDCC catches the remainder up to $6,000.
      </p>

      <h3>The five mistakes we see most</h3>
      <ol>
        <li><strong>Over-contributing to the FSA.</strong> Pick a contribution you'll actually spend. Forfeited dollars cancel the tax savings.</li>
        <li><strong>Forgetting the FSA reduces the CDCC base.</strong> The IRS catches this on Form 2441. Better to model it now and elect the right amount.</li>
        <li><strong>Claiming a credit while only one spouse worked.</strong> Both spouses must have earned income (or be a student / disabled).</li>
        <li><strong>Counting overnight camp.</strong> Day camp counts. Sleepaway camp doesn't. Same with tutoring or enrichment that's not custodial care.</li>
        <li><strong>Treating the CTC as the same thing.</strong> The Child Tax Credit ($2,000/kid under 17) is separate, simpler, and isn't affected by the FSA at all.</li>
      </ol>
    </section>
  );
}

const FAQ_ITEMS = [
  {
    q: 'When do I have to decide on my DCFSA contribution?',
    a: 'At your employer\'s open enrollment, typically October–November for the following plan year. The decision is locked once the year starts — outside narrow qualifying life events (marriage, birth, job change), you can\'t change it until the next enrollment. Pick conservatively if you\'re unsure: forfeited FSA dollars cost more than under-saving.'
  },
  {
    q: 'What if both spouses have access to a DCFSA?',
    a: 'The $5,000 household cap is shared. You can split it across both employers, but the combined contribution can\'t exceed $5,000 for MFJ/HoH/Single. MFS households are capped at $2,500 each.'
  },
  {
    q: 'Does the FSA cover summer day camp?',
    a: 'Yes, if the camp lets both parents work or look for work. Day camp counts. Overnight camp doesn\'t. The same rule applies to the CDCC.'
  },
  {
    q: 'What about after-school care and before-school care?',
    a: 'Both qualify if they\'re custodial (parent-enabling) care. Tutoring, music lessons, and enrichment programs do not.'
  },
  {
    q: 'My kid turns 13 this year. Now what?',
    a: 'Childcare expenses count up through the day before they turn 13. Pro-rate if their birthday is mid-year. The expense after that date isn\'t eligible for either benefit.'
  },
  {
    q: 'I\'m a single parent. Does the math change?',
    a: 'Eligibility is simpler: you need earned income; there\'s no second-spouse requirement. The dollar caps are the same. Single parents often qualify for Head of Household, which has more favorable brackets and a higher standard deduction — make sure you\'re filing as HoH if you\'re unmarried with kids.'
  },
  {
    q: 'What\'s the difference between this and the Child Tax Credit?',
    a: 'The CTC is $2,000 per qualifying child under 17, claimed regardless of childcare expenses. It phases out at high income ($400k MFJ / $200k others). The DCFSA and CDCC are about childcare costs specifically — what you actually pay daycare/camp/etc. The CTC and the dependent-care benefits stack; one doesn\'t reduce the other.'
  },
  {
    q: 'State-level benefits?',
    a: 'A handful of states layer their own dependent care credit on top of the federal one — notably California (refundable for low-income), New York, and Oregon. Look up your state\'s Form 2441 equivalent after you\'ve finished here.'
  },
  {
    q: 'Are these limits current?',
    a: `Yes — figures here use 2025 IRS limits (DCFSA cap $5,000, CDCC base $3k/$6k, CTC $2,000). We update for inflation adjustments each January. See the footer for the "last updated" date.`
  },
  {
    q: 'Do my inputs leave this page?',
    a: 'No. The math runs entirely in your browser. We don\'t store your income, expenses, or filing details on a server. See the Privacy link in the footer for full detail.'
  },
];

function FAQ() {
  return (
    <section className="explainer-section" id="faq" itemScope itemType="https://schema.org/FAQPage">
      <h2>Common questions</h2>
      <div>
        {FAQ_ITEMS.map((item, i) => (
          <details key={i} className="faq-item" itemScope itemProp="mainEntity" itemType="https://schema.org/Question">
            <summary className="faq-q" itemProp="name">{item.q}</summary>
            <div className="faq-a" itemScope itemProp="acceptedAnswer" itemType="https://schema.org/Answer">
              <span itemProp="text">{item.a}</span>
            </div>
          </details>
        ))}
      </div>
    </section>
  );
}

window.Explainer = Explainer;
window.FAQ = FAQ;
