Many thanks for a great article.
I had already decided to stop using window.orientation and instead use client width < client height to determine whether in portrait.
Now I see why I made the right choice, because my Pixel-C shows angle 0 as landscape with the off button top left.
What is annoying though is that when you are in portrait on a Pixel-C, and you invoke the soft kbd, the client width becomes > client height; i.e you are technically now in landscape even though you are still holding the damn thing in portrait mode. I guess that’s logical, but if I really would like to be able to know how the user is holding the device, I’d also need to know that the current device is a Pixel-C. Having to identify the device is obviously out of the question (stupid Apple).