Pearl was supposed to happen *after* start of war...
Japanese diplomats were supposed to deliver declaration of war a couple of hours before Pearl attack.
They didn't.
IIRC, due delays in de-crypting, transcription etc, they were informed of Pearl attack when they tried to deliver their message.
As diplomats, they understood this was 'Not Cricket', and the US population was going to be very, very annoyed.
IIRC, Yamamoto was furious. This flouted his honour-code. It also meant the US would now see the Pacific war as a 'grudge match', one not amenable to a negotiated armistice. It was going to be 'win or lose' and, as he'd predicted, IJN could only run wild for the year or so before the US' latent industrial capacity got up to speed. The Pearl 'foul' meant US response would not be fettered by indifference... so even faster and meaner than predicted.
Somehow, I don't think he would have been too surprised by the nukes.
Timing wasn't Yamamoto's fault --he was 'framed'-- and he seems to have fought a clean war. I reckon a good lawyer could have got him off the capital charges.
Would have been nice to sit him and Rommel together post-war for a long natter about purblind politicians...