Magnetic (Or other!) Sensor for a wood yard gate?

I have a gate between mine and my neighbors yard. I am on very good terms with my neighbor, however if a criminal got into his yard (Or mine) and came through the gate I would want to know about it

Does anyone have any suggestions for a sensor? Z-Wave is out as I don’t have the signal out there. Zigbee is a last resort, but WiFi or some kind of wired situation is preferred.

It also needs to be able to deal with the variation of the gap on a wooden gate

I can run conduit to the gate if needed!

Any suggestions?

Are you into DIY, or are you looking for a off-the-shelf solution?
Note that I know no solution that will give you the “gap”, only “open-closed” sensors.

Either way works for me, looking for the BEST solution, if I have to DIY it, fine

Open/Closed is fine, as long as it doesn’t get confused by some wood movement

Yolink has several sensors that work via LoRa, so very long range signal. They require a small hub and a cloud service (not local), so that may be a show-stopper for you, but if not, I’ve found them to work very well, and the integration with HA is good.

This device seems targeted for exactly your use case:
https://www.amazon.com/Universal-Contact-Closure-Assistant-Security-Required/dp/B08P1VQMCR?ref_=ast_sto_dp&th=1

Or perhaps a motion sensor would be more forgiving for your “gap” issue. Depending on how you positioned and aimed it, it could see either the gate opening, or a person moving through the gate.
https://www.amazon.com/Driveway-Property-Invasion-Tresspassing-Assistant/dp/B08ZXVK1XZ?ref_=ast_sto_dp&th=1