• Sanhedrin 97b-98a's treatment of Gog and Magog as the final end-time military campaign is the Talmudic frame for all of Zechariah 12-14. Zechariah 12:2-3 — "Behold, I am about to make Jerusalem a cup of staggering to all the surrounding peoples... I will make Jerusalem a heavy stone for all the peoples. All who lift it will surely hurt themselves" — is the Talmud's physical description of the trap mechanism: Jerusalem appears to be a prize worth seizing, but the act of seizing it activates the divine counter-measure. The Sitra Achra's endgame offensive is also its mechanism of self-destruction.
• Megillah 3a discusses the heavenly patrons of nations and the Talmud's teaching that the defeat of Gog and Magog requires divine engagement at both the earthly and heavenly levels simultaneously. Zechariah 12:4 — "On that day, declares the Lord, I will strike every horse with panic, and its rider with madness... every horse of the peoples with blindness" — is the divine decommissioning of the Sitra Achra's cavalry at the Second Heaven level before the earthly engagement. The confusion of Gog's armies is not coincidental but is targeted divine electronic warfare.
• Berakhot 4b records the Talmud's discussion of divine protection of David and the covenant people even in maximum military threat. Zechariah 12:5-6 — the clans of Judah recognizing "the inhabitants of Jerusalem have strength through the Lord of hosts, their God" — is the Talmud's picture of distributed Tzaddik recognition of divine operational support. The fire among the wood-piles that consumes the surrounding nations is the divine action that confirms what faith already knew.
• Sotah 14a's teaching about divine chesed in action provides the frame for Zechariah 12:10 — "I will pour out on the house of David and the inhabitants of Jerusalem a spirit of grace and pleas for mercy, so that, when they look on me, on him whom they have pierced, they will mourn for him, as one mourns for an only child, and weep bitterly over him." The Talmud's discussion of this verse connects it to the mourning for the Messiah son of Joseph, the warrior Messiah who falls in the final battle before the Messiah son of David completes the campaign.
• Sukkah 52a is the central Talmudic text for Zechariah 12:10-14: the Talmud identifies the one who is mourned as the Messiah son of Joseph and discusses the weeping of the clans separately — men and women apart, families apart. The Talmud's teaching is that this mourning is not defeat but the final reckoning with the cost of the long war — the tears are not for a lost cause but for the price paid for the won campaign. The Tzaddik holds both the grief and the victory simultaneously.