caps+(any other key) mapped to ctrl-shift-command-option+that key(useful to bind to extra shortcuts in an app).
a single just caps lock press alone bound to escape.
and finally right shift + caps lock is bound to toggle caps lock on and off.
works pretty well for me for a long while now.
karabiner elements on macos lets you do all that with "complex modifications" though the config is a bit dumb to do manually as they expect you to download configs from the web.