// ─── NON-LETHAL DEFINITION ────────────────────────────────────────────────────
// Route: #/non-lethal (real path /non-lethal via vercel.json rewrite).
// Defines "non-lethal" versus "less-lethal" and lays out the constitutional
// force standards by custody status. Styling: editorial system (home.css,
// scoped under .hp) plus the page-scoped NL_CSS below.
const { useEffect: useNLEffect } = React;

// Non-lethal vs. less-lethal comparison. Edit rows here.
const NL_COMPARE = [
  { row: 'Injury and death potential', nonLethal: 'Stays safe even when misused', lessLethal: 'Safe only when used as directed by the manufacturer' },
  { row: 'Mechanism', nonLethal: 'Encumberment and a position of advantage. No pain compliance at all', lessLethal: 'Works through the application of pain compliance' },
];

// Constitutional force standards by custody status. Edit columns here.
const NL_AMENDMENTS = [
  {
    name: 'Fourth Amendment',
    status: 'Free person being seized',
    standard: 'Objective',
    applies: 'Stop, arrest, handcuffing, transport from the scene',
    cases: ['Graham v. Connor', 'Tennessee v. Garner', 'Barnes v. Felix'],
  },
  {
    name: 'Fourteenth Amendment',
    status: 'Pretrial detainee',
    standard: 'Objective, after Kingsley',
    applies: 'Booking, holding, awaiting trial',
    cases: ['Bell v. Wolfish', 'County of Sacramento v. Lewis', 'Kingsley v. Hendrickson'],
  },
  {
    name: 'Eighth Amendment',
    status: 'Convicted prisoner',
    standard: 'Subjective. Malice',
    applies: 'Sentenced custody',
    cases: ['Whitley v. Albers', 'Hudson v. McMillian', 'Estelle v. Gamble', 'Farmer v. Brennan'],
  },
];
const NL_AMEND_ROWS = [
  { key: 'status', label: 'Status' },
  { key: 'standard', label: 'Force standard' },
  { key: 'applies', label: 'Applies during' },
  { key: 'cases', label: 'Anchor cases' },
];

const NL_CSS = `
.hp .pg-nl .nl-def{margin-top:8px;max-width:960px;padding-left:28px;border-left:3px solid var(--gold)}
.hp .pg-nl .nl-def p{font:400 clamp(22px,2.5vw,34px)/1.3 var(--ui);letter-spacing:-.015em;color:#fff;text-wrap:pretty}
.hp .pg-nl .nl-sec{padding:72px 0 0}
.hp .pg-nl .nl-sec h2{margin-bottom:12px}
.hp .pg-nl .nl-sec .lede{font:400 18px/1.55 var(--ui);color:var(--muted);max-width:62ch;margin-bottom:28px}
.hp .pg-nl .lede.one-line{max-width:none}
@media (min-width:861px){.hp .pg-nl .lede.one-line{white-space:nowrap}}
.hp .pg-nl .pg-hero h1{max-width:none}
@media (min-width:600px){.hp .pg-nl .pg-hero h1{white-space:nowrap}}
.hp .pg-nl .nl-box{background:#0A1228;border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:12px clamp(12px,2vw,28px)}
.hp .pg-nl .nl-scroll{position:relative;overflow-x:auto;-webkit-overflow-scrolling:touch}
.hp .pg-nl table{width:100%;border-collapse:separate;border-spacing:0;font:400 16px/1.45 var(--ui)}
.hp .pg-nl th,.hp .pg-nl td{text-align:left;vertical-align:top;padding:20px 18px}
.hp .pg-nl thead th{font:600 13px/1.3 var(--ui);letter-spacing:.14em;text-transform:uppercase;color:var(--muted);padding-top:18px;padding-bottom:16px;border-bottom:1px solid rgba(255,255,255,.14)}
.hp .pg-nl tbody th{font:600 15px/1.4 var(--ui);color:#fff;width:22%}
.hp .pg-nl tbody td{color:rgba(255,255,255,.86)}
.hp .pg-nl tbody tr:not(:last-child)>*{border-bottom:1px solid rgba(255,255,255,.08)}
/* non-lethal column highlighted in green, less-lethal kept neutral */
.hp .pg-nl .nl-vs{min-width:560px}
.hp .pg-nl .nl-vs th:nth-child(2),.hp .pg-nl .nl-vs td:nth-child(2){background:rgba(42,161,0,.12);box-shadow:inset 2px 0 0 var(--gold),inset -2px 0 0 var(--gold)}
.hp .pg-nl .nl-vs thead th:nth-child(2){color:#5FD63A;border-radius:8px 8px 0 0;box-shadow:inset 2px 0 0 var(--gold),inset -2px 0 0 var(--gold),inset 0 2px 0 var(--gold)}
.hp .pg-nl .nl-vs tbody tr:last-child td:nth-child(2){border-radius:0 0 8px 8px;box-shadow:inset 2px 0 0 var(--gold),inset -2px 0 0 var(--gold),inset 0 -2px 0 var(--gold)}
.hp .pg-nl .nl-vs td:nth-child(2){color:#fff;font-weight:500}
.hp .pg-nl .nl-amend{min-width:720px}
.hp .pg-nl .nl-amend td{width:26%}
.hp .pg-nl .pg-hero{padding-bottom:8px}
.hp .pg-nl .nl-amend thead th:not(:first-child){color:#5FD63A}
.hp .pg-nl .nl-cases{list-style:none;display:flex;flex-direction:column;gap:4px}
.hp .pg-nl .nl-cases li{font-style:italic}
.hp .pg-nl .nl-note{margin-top:14px;font:400 13px/1.5 var(--ui);color:var(--muted);max-width:80ch}
.hp .pg-nl .closer{padding:104px 24px 64px}
@media (max-width:860px){
  .hp .pg-nl .nl-def{padding-left:18px}
  .hp .pg-nl .nl-sec{padding-top:48px}
  .hp .pg-nl .nl-box{padding:4px 0}
  .hp .pg-nl th,.hp .pg-nl td{padding:16px 12px;font-size:15px}
  .hp .pg-nl tbody th{position:sticky;left:0;z-index:1;background:#0A1228}
  .hp .pg-nl .closer{padding:72px 16px 40px}
}
`;

function NonLethalPage({ navigate }) {
  useNLEffect(() => { document.title = 'Non-Lethal Definition — WRAP® Non-Lethal Response™'; }, []);

  return (
      <main className="pg-nl">
        <style>{NL_CSS}</style>

        <section className="pg-hero">
          <div className="wrap">
            <div className="label accent">Operationalize De-escalation</div>
            <h1>Non-Lethal Definition</h1>
            <div className="nl-def">
              <p>A device that stays non-lethal even when misused and cannot cause death without additional human intervention. It works by encumberment and a position of advantage, never by pain compliance.</p>
            </div>
          </div>
        </section>

        <section className="nl-sec">
          <div className="wrap">
            <h2 className="hl sm">Non-lethal vs. less-lethal</h2>
            <p className="lede">The difference comes down to what happens when a tool is misused, and whether it depends on pain to work.</p>
            <div className="nl-box">
              <div className="nl-scroll" role="region" aria-label="Non-lethal compared with less-lethal" tabIndex="0">
                <table className="nl-vs">
                  <thead>
                    <tr><th scope="col"><span className="sr-only">Attribute</span></th><th scope="col">Non-lethal</th><th scope="col">Less-lethal</th></tr>
                  </thead>
                  <tbody>
                    {NL_COMPARE.map(r => (
                        <tr key={r.row}><th scope="row">{r.row}</th><td>{r.nonLethal}</td><td>{r.lessLethal}</td></tr>
                    ))}
                  </tbody>
                </table>
              </div>
            </div>
            <p className="swipe-hint">Swipe sideways to see the full table.</p>
          </div>
        </section>

        <section className="nl-sec">
          <div className="wrap">
            <h2 className="hl sm">Force standards by custody status</h2>
            <p className="lede one-line">Which constitutional standard governs a use of force depends on the person’s status at the time.</p>
            <div className="nl-box">
              <div className="nl-scroll" role="region" aria-label="Constitutional force standards by custody status" tabIndex="0">
                <table className="nl-amend">
                  <thead>
                    <tr>
                      <th scope="col"><span className="sr-only">Attribute</span></th>
                      {NL_AMENDMENTS.map(a => <th scope="col" key={a.name}>{a.name}</th>)}
                    </tr>
                  </thead>
                  <tbody>
                    {NL_AMEND_ROWS.map(r => (
                        <tr key={r.key}>
                          <th scope="row">{r.label}</th>
                          {NL_AMENDMENTS.map(a => (
                              <td key={a.name}>
                                {r.key === 'cases'
                                    ? <ul className="nl-cases">{a.cases.map(c => <li key={c}>{c}</li>)}</ul>
                                    : a[r.key]}
                              </td>
                          ))}
                        </tr>
                    ))}
                  </tbody>
                </table>
              </div>
            </div>
            <p className="swipe-hint">Swipe sideways to see the full table.</p>
            <p className="nl-note">For general information only, not legal advice. Agencies should consult their own counsel on use-of-force policy.</p>
          </div>
        </section>

        <section className="closer">
          <h2 className="hl">Bring it to your agency</h2>
          <p>Talk with our team about your agency’s needs, product demonstrations, training, and certification.</p>
          <div className="pills" style={{ justifyContent: 'center' }}>
            <a className="pill gold" href="#/contact" onClick={e => { e.preventDefault(); navigate('contact'); }}>Contact Sales</a>
            <a className="pill line" href="#/products/bolawrap-150" onClick={e => { e.preventDefault(); navigate('product', 'bolawrap-150'); }}>Explore <span className="nb">BolaWRAP® 150</span></a>
          </div>
        </section>

        <Footer navigate={navigate} />
      </main>
  );
}

Object.assign(window, { NonLethalPage });
