California's new climate change laws almost didn't happen this year. Here's how lawmakers pulled it off.