Get node's view mode within template_preprocess_page
I needed to put a class based on view mode onto my pages.  I seem to remember that view mode is handled separately from the node data.  My solution was actually based on using the Display Suite submodule Switch View Mode (was already using DS).  This module creates a new base field in the entity and sets the view mode to it.

This let me use the following code to create the class:

$view_mode = $node-&gt;ds_switch-&gt;value;
if (!empty($view_mode)) {
   $variables['page_class'] .= " node-view-{$view_mode}";
}


This solution won't work with out the module.  A bit of tracing on how this works shows that it is based on using hook_entity_view_mode_alter() to get the view mode and add it to the ds_switch field on the node. 

This field seems to be added by using the hook_entity_base_field_info().  See the ds_switch_view_mode.module file in the Display Suite code for details on this.