Conservation laws and variational conditions for wave propagation in planarly stratified media