/* Save Our Family Farms — page sections: Header, Hero, Squeeze, Footer.
   Uses brand.jsx marks + SOFF_DATA. Exports to window. */
const { NATIONAL } = window.SOFF_DATA;

function Header({ onJump }) {
  return (
    <header className="site-header">
      <div className="wrap bar">
        <SiteLogo tone="inverse" onClick={() => onJump("top")} />
        <nav>
          <button className="navlink" onClick={() => onJump("squeeze")}>The Squeeze</button>
          <button className="navlink" onClick={() => onJump("map")}>The Map</button>
        </nav>
        <button className="btn btn-primary header-cta" onClick={() => onJump("call")}>Call your senator</button>
      </div>
    </header>);

}

function Hero({ onJump }) {
  return (
    <section className="hero">
      <img className="photo" src="assets/hero-farm.jpg" alt="A red barn beside rows of ripening corn in late afternoon light" />
      <div className="scrim"></div>
      <div className="inner wrap">
        <div className="hero-grid">
          <div>
            <p className="eyebrow on-dark">A campaign for rural America</p>
            <h1>THE COST OF MAKING A LIVING IS SQUEEZING FARM COMMUNITIES</h1>
            <p className="lede">Tariffs slashed crop prices and drove up the cost of fertilizer, feed, fuel, and equipment — more than {NATIONAL.cropLosses} in crop losses last year alone.</p>
            <p className="subtle">The U.S. Senate is marking up the Farm Bill now — just a handful of Senators will be the deciding votes on real relief. They need to hear from us.</p>
            <div className="cta-row">
              <button className="btn btn-primary btn-lg" onClick={() => onJump("call")}>Call your senator</button>
              <button className="btn btn-ghost-dark btn-lg" onClick={() => onJump("map")}>See your state</button>
            </div>
            <div className="hero-stats">
              <div className="hero-stat"><b>{NATIONAL.cropLosses}</b><span>In crop losses, 2025–26</span></div>
              <div className="hero-stat"><b>{NATIONAL.bankruptcySurge}</b><span>Surge in farm bankruptcies, 2025</span></div>
              <div className="hero-stat"><b>{NATIONAL.farmDebt}</b><span>Record farm debt in 2026</span></div>
            </div>
          </div>
        </div>
      </div>
    </section>);

}

function Squeeze() {
  return (
    <section className="squeeze" id="squeeze">
      <div className="wrap">
        <div className="head">
          <p className="eyebrow">THE SQUEEZE</p>
          <h2 className="h2">A crisis farmers didn't cause — and can't absorb</h2>
          <p className="lead">Farmers and rural communities were promised that tariffs would deliver better trade deals. Instead they got losses, and then a second shock from a war half a world away.</p>
        </div>

        <div className="two-front">
          <div className="front">
            <div className="roof"><Roofline color="#9c3a2a" height={11} stroke={2.4} /></div>
            <div className="front-body">
            <p className="kick"></p>
            <h3>Tariffs</h3>
            <p>Tariffs on farm inputs pushed production costs above what commodities sell for — a third straight year of soybean losses, with crop cash receipts now the lowest since 2007.<sup className="fn">1</sup> The bridge payment Congress passed in 2025<sup className="fn">4</sup> covered only a fraction of accumulated losses, and many producers didn't qualify at all.</p>
            <ul>
              <li><b>+{NATIONAL.bankruptcySurge}<sup className="fn">2</sup></b><span>surge in farm bankruptcies in 2025</span></li>
              <li><b>315<sup className="fn">2</sup></b><span>Chapter 12 filings — up from 216 in 2024</span></li>
              <li><b>4th yr<sup className="fn">3</sup></b><span>of losses growing corn &amp; soybeans</span></li>
            </ul>
            </div>
          </div>
          <div className="front">
            <div className="roof"><Roofline color="#9c3a2a" height={11} stroke={2.4} /></div>
            <div className="front-body">
            <p className="kick"></p>
            <h3>The Iran War</h3>
            <p>The Strait of Hormuz blockade sent fuel and fertilizer prices higher just as families were already stretched thin. To plant at all, many borrowed — taking on record operating debt<sup className="fn">5</sup> at interest rates still well above the decade's average.</p>
            <ul>
              <li><b>+{NATIONAL.operatingLoanSize}<sup className="fn">5</sup></b><span>larger average operating loan vs. 2024</span></li>
              <li><b>+{NATIONAL.newOperatingLoans}<sup className="fn">5</sup></b><span>more new operating loans, late 2025</span></li>
              <li><b>{NATIONAL.interestExpense}<sup className="fn">6</sup></b><span>record sector interest expense, 2026</span></li>
            </ul>
            </div>
          </div>
        </div>

        <div className="math">
          <div className="mtitle">The math no longer works</div>
          <div className="crop">
            <span className="lbl">Corn, per bushel<sup className="fn">7</sup></span>
            <div className="row"><span className="grow">$5.00</span><span className="sell">$4.20</span></div>
            <span className="cap">Costs to grow · Sells for</span>
          </div>
          <div className="crop">
            <span className="lbl">Soybeans, per bushel<sup className="fn">7</sup></span>
            <div className="row"><span className="grow">$12.27</span><span className="sell">$10.30</span></div>
            <span className="cap">Costs to grow · Sells for</span>
          </div>
        </div>

        <details className="sources-x">
          <summary>
            <span className="sx-label">Sources &amp; notes</span>
            <svg className="sx-chev" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round"><path d="m6 9 6 6 6-6" /></svg>
          </summary>
          <ol className="footnotes" aria-label="Sources and footnotes">
            <li><span className="fn-num">1</span><span>Crop cash receipts at their lowest since 2007 — USDA Economic Research Service, <em>Farm Sector Income Forecast</em>.</span></li>
            <li><span className="fn-num">2</span><span>Farm bankruptcies — Chapter 12 filings rose 46% in 2025 (315 filings, up from 216 in 2024). American Farm Bureau Federation analysis of U.S. Courts data.</span></li>
            <li><span className="fn-num">3</span><span>Fourth consecutive year of negative returns for corn and soybean growers — USDA ERS; Agri-Pulse / Farmer Mac analysis.</span></li>
            <li><span className="fn-num">4</span><span>Farmer Bridge Assistance Program (2025) — USDA Farm Service Agency.</span></li>
            <li><span className="fn-num">5</span><span>Operating loans — average size up ~30% and new-loan volume up ~40% in late 2025; total farm debt at a record $624.7B for 2026. Federal Reserve Bank of Kansas City Agricultural Credit Survey; USDA ERS.</span></li>
            <li><span className="fn-num">6</span><span>Record sector interest expense (~$33B forecast for 2026) — USDA ERS.</span></li>
            <li><span className="fn-num">7</span><span>Per-bushel cost to grow vs. price received — USDA projections: corn ~$5.00 / ~$4.20; soybeans ~$12.27 / ~$10.30. USDA ERS; CME Group futures.</span></li>
          </ol>
          <p className="fn-note">National figures verified against USDA ERS, AFBF / U.S. Courts, and Federal Reserve Bank of Kansas City data, June 2026.</p>
        </details>
      </div>
    </section>);

}

function Footer({ onJump }) {
  return (
    <footer className="site-footer" id="footer">
      <div className="wrap">
        <div className="footer-grid">
          <div>
            <SiteLogo tone="inverse" />
            <p>A campaign to win real relief for family farms hurt by tariffs and the war-driven cost spike — and to make sure Washington hears from rural America before the Farm Bill vote.</p>
          </div>
          <div className="footer-col">
            <h4>The campaign</h4>
            <a href="#squeeze" onClick={(e) => {e.preventDefault();onJump("squeeze");}}>The squeeze</a>
            <a href="#map" onClick={(e) => {e.preventDefault();onJump("map");}}>The impact map</a>
            <a href="#call" onClick={(e) => {e.preventDefault();onJump("call");}}>Call your senator</a>
          </div>
          <div className="footer-col">
            <h4>Join in</h4>
            <a href="#footer">#SaveOurFamilyFarms</a>
            <a href="#footer">Press &amp; partners</a>
          </div>
        </div>
        <div className="disclosure">
          <span className="paidfor">PAID FOR BY HOMETOWN ANCHOR, INC.</span>
          <span className="legal-links">
            <a href="https://hometownanchor.org/privacy.html" target="_blank" rel="noopener">Privacy Policy</a>
            <span className="dot">·</span>
            <a href="https://hometownanchor.org/sms-terms.html" target="_blank" rel="noopener">SMS Terms</a>
            <span className="dot">·</span>
            <a href="https://hometownanchor.org/terms.html" target="_blank" rel="noopener">Terms of Service</a>
            <span className="dot">·</span>
            <a href="https://hometownanchor.org/privacy-request.html" target="_blank" rel="noopener">Submit a Privacy Request</a>
          </span>
          <span className="meta">Per-state figures: Iowa, South Dakota and Arkansas show farm-specific Chapter 12 filings (AFBF / U.S. Courts, 2024–25); other states show the change in all bankruptcy filings (2024–25). National figures verified against USDA ERS, AFBF / U.S. Courts, and Federal Reserve Bank of Kansas City data, June 2026.</span>
        </div>
      </div>
    </footer>);

}

Object.assign(window, { Header, Hero, Squeeze, Footer });