Working on navigation or refreshing it wont work ever again

Home htmlf
Basically i am trying to bring effect if i click on home after opening home it bring css effect on that text which was clicked in navigation
Here is my code please tell me what should i do
i also linked html inside html using javascript Navigation html
Nav css
Java

i took help of chat gpt it works for one time but after refreshing or clicking other links in nav it stop working