As I'm sure you remember, being a teenager is nothing short of complicated, fueled with crazy emotions and a strong need to be independent of your family, and subconsciously hating that you are dependent on them. It's a crazy and complicated time, and parents often get the short end of the stick. Teenagers are a rage of hormones and are often unequipped to deal with them. It's a completely natural process. A little rebellion is healthy. Even though it feels like he hates you, I can assure you he doesn't. While he may have some pent-up anger towards dealing with his father's sexuality that may make it a little more-so than the average teenager, the sass and attitude is completely natural. Also, a lot of teens express themselves through writing. Believe me, depressing poetry is a much healthier alternative than some teenagers take, such as self-harm. As I mentioned, your son is both thirsting for independence, and angry because he doesn't have that independence yet and also craves your love, all at the same time. This is a delicate process to handle. Nobdy said being a parent was easy, and this applies to matter what age your child is. There is no right answer, no handbook. Although a good rule of thumb is to be there for your son when he reaches out to you or needs to be disciplined or praised, appropriately, but also give him enough space and independence to feel that he has freedom enough to make his own choices (within reason) and even let him make some mistakes to learn from for himself, which he will have to do eventually no matter how much you want to protect him. IN summary, be there for him, but do not smother him. All of this being said, there are some times that "just being a teenager" doesn't take the cake. Your son could be depressed.
Here is a link to an article about teenage depression and the warning sides. Unfortunately, some teenagers turn to drug abuse to deal with the hormones and feelings they are experiencing. Paired with drug availability and peer pressure, ANYBODY is susceptible to drug addiction, even after one "try".
Be sure to lock all prescription medication somewhere where he does not have access to it, such as a safe. This is a commonly abused drug among teenagers.
Here is a link to warning signs for drug abuse in teens. I can assure you, your son will not have this attitude forever. Once he moves out (yes, it will take forever to get the sweet son you miss back) and has the space he craves, your relationship will improve and probably be better than it has ever been. In the mean time, hold tight, and know it is a completely natural process, no matter how much it sucks. Also read the articles I attached in case your son falls under the category of a depressed or drug abusing teen. If you suspect he may be depressed or abusing drugs, seek professional help immediately.