That’s not really how IP works. Just because you think of something while eating a sandwich that Google paid for, that doesn’t mean they own it. Your brain is not “company resources”. The sandwich was not necessary for the brainstorm.
It’s smarter to think up good ideas away from the office, but it’s completely legal to take knowledge and experience with you when you leave the company.