Sounds like it could have been written by Ted Dekker. I read his ‘Thr3e” by Dekker and I was hooked. He writes in sequels so you have to keep reading. His “Black”, “Red”, and “White” kept me up several nights. Couldn’t put them down.
John Christopher’s The Tripods Trilogy. great books for any age!