A
I'm going through your replay as I type this, so I will mention things that I notice as I come up to them and pause the replay as time progresses. There will be a part where the game is technically over, but I will still analyze the decision making process as the game progresses, in case if the same scenario comes up again and it is still any ones game. If you need a practice partner: Dance.943
Step by step analysis
The first thing I noticed is you sent the scouting scv out even though you opened reaper first. This is not a bad idea, but it doesn't quite fit the opening you have going. An instance where you would want to send an scv around that time would be when you plan to go command center first and wish to e-bay block the protoss expansion. Instead you have the reaper coming out exactly 1 minute later, you are not going to gain any less scouting information from the reaper, and you are losing out on 40 minerals / minute with that scv not mining.
Now the reaper does come out and you notice your opponent is cannon rushing you. This is not a problem at all because cannons cannot move, and they are not in your main. There is no reason to pull scvs because the cannons are not a threat and you would only be losing out on mining time. Instead this should tell you that your opponent is weak at home because he invested 300 minerals at your natural, this will delay his cybernetics core which means no mothership core at home to defend against the reaper (plenty of worker kills for you). Keep your workers on gas and either a) Build a tech lab (marauders) or b) build a factory (tanks) to push back the cannon threat, and then build your command center in your main (expansions do not need to be in your natural until the threat is dealt with, produce scvs off both cc's and transfer when you have secured your natural)
When scouting with an scv, don't pull it back home so easily. You stopped his cannon threat, and then you placed an expansion. Had you kept your scv by your opponents base, you could have built an engineering bay to block his natural expansion.
At around 5:50 the protoss player will choose their tech path after fast expanding. You see his cannons so you know that his tech is delayed, and you saw the timing on his Nexus so you can assume that he is going to place his tech buildings around the 7 minute mark. That is around the time that you will want to start your factory, specifically because had your opponent gone robotics he could have placed the support bay around the 8-9 minute mark, and would have colossus around 12 minutes. Also because medivacs force the protoss player to tech to either blink, charge, colossus, pheonix, or storm. To counter the threat of the colossuss you would need the vikings or the ability to produce them as soon as you spot it.
At 9 minutes he attacks you with 4 stalkers. You should actually be the one attacking him, this is nearing the mid game mark where the protoss gateway army becomes obsolete without charge / blink. Your goal is to hit them right before they get their significant tech choice out.
At around 11:30 when you scanned your opponent, scan his main. Protoss rarely place their tech in their natural, and if you apply pressure with your army, you are going to see his natural anyway. Your goal is to see what tech path he is going, so that you can counter.
When you move your army out at 12 minutes. This position you are currently in (the aggressor), you should also be taking a third base. And have medivacs producing!
After you attacked his base, you saw he had a handful of stalkers. You might have been able to kill them all and take the nexus, I do not know for certain, but it would have been close. Another option would have been to run up his ramp. You killed his MSC so he cannot photon over charge the main, he has no zealots so his stalkers are too vulnerable, you would force his army to come to you while you snipe important tech structures or un-power buildings / supply block him. The possibilities are endless and in the end the choice you made was still a good choice, I like how your army is positioned at his third.
The engagement the second time... You scanned and see high templar, your first priority should be to avoid the incoming storms. You stim your units and attempt to catch your opponent off guard by focusing down his high templar. Good idea, bad outcome. Templar only have so much energy, and as you saw, even though you completely ate all of his storms, you still had an army left over capable of destroying his. Lesson: If you do engage in a scenario like this, rather than focusing down the high templar, instead split your units up so that they do not all get hit by the storm. In the end he will run out of energy, he will turn them into archons, and you will be in the exact same scenario with the exception that not all of your units will nearly dead. After that point, focus the pylon so he cannot warp in, it will buy you a little bit more time. If you do not think you can take out the pylon, back out.
at 17 minutes he attacks your 3rd. Your opponent's army is now located between yours, and a planetary fortress = A rock and a hard place. Best scenario here is to have your scv's repair the planetary and attack him from behind with your army. Attack click units will focus the closest threatening units, so if he were to engage your army from here, he would have to get out of range of the planetary or else some of his units would still be focusing it.
at 17:35~ you see his high templar, you only need to grab 2-3 marauders to attack them, not your entire army. That is what costed you that engagement
at 18:25, the micro actually hurt you. In this scenario because your opponent has only 3 zealots, it would be better to focus fire them and then re-stim and studder step into your opponents army. Stalkers are the 2nd worst cost efficient units in the game, the worst being the hellion without blue flame. If you see more zealots, then that is the queue to fall back to your army.
My reaction to your thoughts
You mentioned you think your two biggest mistakes are not denying his expansion and the engagement at the 12 minute mark. I am going to have to disagree with you. The engagement at 12 minutes was not one that put you behind in any means. Preventing someone from expanding is never something that could be considered a mistake because mistakes come from reacting, and preventing an expansion is not a reaction, it is a preemptive decision.
My thoughts on the two biggest mistakes
I think the two things that hurt you the most this game were not having medivacs out sooner, and the way you handled your army against high templar and psionic storm. If you treat high templars like banelings, I think the engagements would have been much more in your favor.