// Long-form content. Each section renders bare; the parent (app.jsx) wraps
// them in the rail layout so the sticky 300×600 sidebar lives alongside.

function HowItWorks() {
  return (
    <section className="section" id="how-it-works">
      <div className="section-eyebrow">How S-Corp election works</div>
      <h2>The math is simple. The <em>discipline</em> isn't.</h2>
      <p className="deck">
        An S-Corp isn't a separate business — it's a tax election. You're still
        an LLC (or corporation) in the eyes of your state. You just told the
        IRS you'd like your profit to flow through differently. Here's what
        actually changes.
      </p>

      <div className="three-col">
        <div>
          <span className="num">i.</span>
          <h3>You become an employee of your own business</h3>
          <p>
            Each pay period, your business cuts you a real W-2 paycheck with
            withholdings and a 941 filing. The IRS calls this your "reasonable
            compensation." Skipping it or making it a token amount is the
            fastest way to lose the audit.
          </p>
        </div>
        <div>
          <span className="num">ii.</span>
          <h3>Profit above salary skips payroll tax</h3>
          <p>
            Anything left after your salary becomes a "distribution." It's
            still taxed as ordinary income — but the 15.3% Social Security
            and Medicare combo doesn't apply. That's where the savings live.
          </p>
        </div>
        <div>
          <span className="num">iii.</span>
          <h3>You take on new paperwork forever</h3>
          <p>
            A separate 1120-S return. Quarterly payroll filings. A balance
            sheet on Schedule L if you cross $250k. Most owners outsource
            this, which means a real monthly bill — the line item the
            calculator above is asking about.
          </p>
        </div>
      </div>
    </section>
  );
}

function ReasonableComp() {
  return (
    <section className="section" id="reasonable-comp">
      <div className="section-eyebrow">The audit hot-button</div>
      <h2>What "reasonable" actually <em>means</em></h2>
      <p className="deck" style={{marginBottom: 24, maxWidth: '60ch'}}>
        The single largest enforcement target in S-Corp examinations:
        owners who pay themselves a $20,000 salary on $300,000 of profit
        to dodge payroll tax. Don't be that person.
      </p>

      <div className="prose" style={{maxWidth: '65ch'}}>
        <p>
          The IRS standard, from Treas. Reg. §1.162-7 and reinforced by the
          <em> Watson v. Commissioner</em> case, is what someone else would
          pay you to do the same work if you weren't the owner. In practice,
          examiners look at:
        </p>
        <ul>
          <li>Training, experience, and credentials</li>
          <li>Duties and responsibilities (everything you do, not just billable work)</li>
          <li>Time and effort devoted to the business</li>
          <li>Comparable salaries for similar roles in your geography</li>
          <li>Dividend history and timing of distributions</li>
        </ul>
        <p>
          <strong>Practical rules of thumb</strong> we've seen survive
          examination: for personal-service businesses (consulting, design,
          law, medicine) salaries below 50% of profit start drawing scrutiny.
          For businesses with real capital, inventory, or staff doing the
          actual work, the owner's salary can legitimately be a smaller
          share — but it still can't be zero.
        </p>
        <p>
          If you want a defensible figure, third-party services like
          RCReports and BizStats produce reasonable-comp reports built
          from BLS and compensation-survey data. CPAs often run one
          annually and keep it in the file as audit insurance.
        </p>
      </div>
    </section>
  );
}

function QBISection() {
  return (
    <section className="section" id="qbi">
      <div className="section-eyebrow">Section 199A · the gotcha</div>
      <h2>The QBI <em>wrinkle</em> nobody mentions</h2>
      <p className="deck" style={{marginBottom: 24, maxWidth: '60ch'}}>
        The 20% Qualified Business Income deduction interacts with S-Corp
        election in ways that have flipped real owners from "saving $8k"
        to "owing $4k" between the napkin math and the actual return.
      </p>

      <div className="prose" style={{maxWidth: '65ch'}}>
        <p>
          <strong>How QBI changes under S-Corp.</strong> Your W-2 salary
          from the S-Corp is <em>not</em> qualified business income — only
          the distributions are. So electing S-Corp shrinks the slice of
          your income eligible for the 20% deduction.
        </p>
        <p>
          <strong>The SSTB trap.</strong> If your work is a "Specified
          Service Trade or Business" — consulting, law, health, financial
          services, performing arts, athletics — your QBI deduction phases
          out completely above the income threshold (about $241,950 single
          / $483,900 married jointly in 2025). For SSTB owners in this
          range, electing S-Corp can wipe out a QBI deduction worth more
          than the SE-tax savings ever were.
        </p>
        <p>
          <strong>The wage-limit angle.</strong> Above the threshold for
          non-SSTBs, your QBI deduction is capped at 50% of W-2 wages
          paid. Counterintuitively, this is one situation where paying
          yourself a <em>higher</em> S-Corp salary can preserve the
          deduction — but it's also a situation where you should be
          paying a CPA, not a website.
        </p>
        <p style={{color: 'var(--ink-3)', fontSize: 14}}>
          This calculator models all three cases. The break-even threshold
          shown above already accounts for whether you're an SSTB and
          whether you're past the income phaseout.
        </p>
      </div>
    </section>
  );
}

const FAQ_DATA = [
  {
    q: "Will electing S-Corp lower my actual paycheck?",
    a: <>
      <p>Yes, in a sense — your "paycheck" becomes the salary portion, with normal
      payroll withholdings. The rest comes through as distributions, which you
      can take on whatever schedule you want (monthly, quarterly, ad-hoc). Total
      cash to you is the same; the timing and tax treatment are different.</p>
    </>
  },
  {
    q: "When do I have to file Form 2553?",
    a: <>
      <p><strong>New entities:</strong> within 75 days of formation to apply to
      the current tax year.</p>
      <p><strong>Existing entities:</strong> by March 15 of the year you want
      the election to apply to. Miss it, and the election waits until next
      year — though the IRS does grant late-election relief under Rev. Proc.
      2013-30 if you have reasonable cause and file within 3 years 75 days.</p>
    </>
  },
  {
    q: "Can I undo an S-Corp election?",
    a: <>
      <p>Yes, by filing a statement of revocation, but the IRS won't let you
      re-elect S-Corp status for 5 years afterward. Treat the decision as a
      multi-year commitment.</p>
    </>
  },
  {
    q: "Do I need a separate bank account?",
    a: <>
      <p>You needed one for the LLC already if you wanted the liability shield.
      With S-Corp election, the operational answer is the same — but the
      hygiene matters more, because payroll, distributions, and reimbursements
      all need to be traceable for the 1120-S return.</p>
    </>
  },
  {
    q: "What about health insurance?",
    a: <>
      <p>S-Corp owners holding more than 2% of shares get a unique treatment:
      health premiums paid by the corporation are added to your W-2 wages
      (Box 1) but you take an above-the-line self-employed health insurance
      deduction to wash it out. Net effect: same as before, but the
      bookkeeping is fiddly. Your payroll provider should know how to do
      this — confirm before signing up.</p>
    </>
  },
  {
    q: "How does this affect my retirement contributions?",
    a: <>
      <p>Solo 401(k) limits change. As a sole proprietor, your contribution
      base is your full SE income; as an S-Corp owner, it's only your W-2
      salary. Set the salary too low and you cap your own retirement
      contributions. The calculator factors this in when you set the
      retirement % field above.</p>
    </>
  },
  {
    q: "I have a regular W-2 job too. Does that change anything?",
    a: <>
      <p>Yes — and usually in S-Corp's favor at higher incomes. If your W-2
      wages already exceed the Social Security wage base ({'$176,100'} in 2025),
      you've maxed out the 12.4% SS portion, so the marginal SE tax on
      additional self-employment income is just 2.9% Medicare. The
      calculator accounts for your other W-2 wages in the form.</p>
    </>
  },
  {
    q: "Should I trust this number?",
    a: <>
      <p>Trust it as a directional estimate, not a filing position. Tax law
      has more edge cases than a calculator can model — state-level pass-through
      entity tax elections, multi-state apportionment, fringe benefit rules,
      accumulated-adjustments accounting, you name it. If the calculator says
      you'd save $1,200 a year, the realistic range is probably $500 to
      $2,000, and a real CPA should be the one signing off before you file
      Form 2553.</p>
    </>
  },
];

function FAQ() {
  return (
    <section className="section" id="faq">
      <div className="section-eyebrow">Frequently asked</div>
      <h2>Questions, briefly answered</h2>
      <div className="faq" style={{marginTop: 28, maxWidth: 880}}>
        {FAQ_DATA.map((item, i) => (
          <details key={i}>
            <summary>{item.q}</summary>
            <div>{item.a}</div>
          </details>
        ))}
      </div>
    </section>
  );
}

function Footer({ onOpenPrivacy, privacyRef }) {
  const year = new Date().getFullYear();
  return (
    <footer className="footer" data-screen-label="03 Footer">
      <div className="footer-grid">
        <div className="footer-col footer-brand">
          <div className="footer-brand-row">
            <div className="footer-brand-mark">S</div>
            <div className="footer-brand-name">
              S-Corp Breakeven<span className="footer-brand-tld">.com</span>
            </div>
          </div>
          <p className="footer-tagline">
            The break-even threshold where electing S-Corp tax status starts
            paying off — calculated for your state, salary, and situation.
          </p>
        </div>

        <div className="footer-col">
          <h4 className="footer-heading">The tool</h4>
          <ul className="footer-list">
            <li><a href="#top">Calculator</a></li>
            <li><a href="#how-it-works">How it works</a></li>
            <li><a href="#reasonable-comp">Reasonable comp</a></li>
            <li><a href="#qbi">QBI wrinkle</a></li>
            <li><a href="#faq">FAQ</a></li>
          </ul>
        </div>

        <div className="footer-col">
          <h4 className="footer-heading">Related</h4>
          <ul className="footer-list">
            <li>
              <a href="https://www.irs.gov/forms-pubs/about-form-2553" target="_blank" rel="noopener">
                IRS Form 2553 instructions
              </a>
            </li>
            <li>
              <a href="https://www.irs.gov/newsroom/qualified-business-income-deduction" target="_blank" rel="noopener">
                IRS QBI deduction overview
              </a>
            </li>
            <li>
              <a href="https://www.irs.gov/businesses/small-businesses-self-employed/s-corporation-compensation-and-medical-insurance-issues" target="_blank" rel="noopener">
                IRS reasonable-comp guidance
              </a>
            </li>
            <li>
              <a href="https://10yearrmd.com" target="_blank" rel="noopener">
                10yearrmd.com — inherited IRA rules
              </a>
            </li>
          </ul>
        </div>
      </div>

      <hr className="footer-divider" />

      <p className="footer-disclaimer">
        <strong>Not tax advice.</strong> This tool produces directional
        estimates only, based on the IRS Code, Treasury regulations, and
        published state Department of Revenue rules current to the 2025 tax
        year. Tax outcomes depend on details this calculator cannot see —
        accumulated adjustments, fringe benefits, multi-state apportionment,
        basis tracking, fiscal year quirks, and the gap between what the law
        says and what your specific examiner thinks. Confirm any election
        with a CPA, EA, or tax attorney before filing Form 2553.
      </p>

      <div className="footer-bottom">
        <div className="footer-copy">
          © {year} scorpbreakeven.com · An independent calculator, not
          affiliated with the IRS, any state taxing authority, or any
          tax-preparation service.
        </div>
        <div className="footer-legal-links">
          <button
            ref={privacyRef}
            className="privacy-link-btn"
            onClick={onOpenPrivacy}
          >Privacy</button>
        </div>
      </div>
    </footer>
  );
}

window.HowItWorks = HowItWorks;
window.ReasonableComp = ReasonableComp;
window.QBISection = QBISection;
window.FAQ = FAQ;
window.SiteFooter = Footer;
