Sometimes a story can turn away from its original direction and take on a darker tone, what is a good approach to lightening the mood?
As a new DM, I started a Pathfinder campaign a year ago with a small town with a temple/dungeon crawl set up outside, my players and I both had a great time and when it came time to move on, they decided to travel to a major city. I decided to introduce the major plot arch and due to bad player decisions, one player was kidnapped and experimented upon, and the plan to investigate his disappearance went south fast when the rogue was recognized immediately due to a nat 20 perception check. When they got the character back he ran off again and was beaten within an inch of his life and the next day the town fell into chaos as a cultist group took power by force.
My whole party was sacked in the process and my trouble character ended up dying in the conflict. In the end, they were exceedingly afraid to do anything and were often distracted from the game when they were previously not. Their characters managed to escape alongside an adventuring shopkeep and I plan to open our next season with them having taken up the roll of caravan guards protecting refugees of the city.
I have a direction to go in, but I need to give the players a good excuse to feel confident and have fun, even if that means another dungeon crawl. I want to try to approach a more light-hearted game without breaking continuity, but the players and characters alike have seen the other side of the coin now and I fear will have difficulty returning. Even if they were not afraid, the game has come away from its roots of just having a good time to a darker, more treacherous game. My players were much more comfortable and entertained when they are able to joke and laugh around the table, and as the game grew less light-hearted, they have started breaking out of character in order to have their laughs, slowing gameplay down considerably. Tangental conversation has blossomed and the game has lost focus. Thus: how can a DM lighten the mood and recapture the interest of his players as a result?