In what order should one apply max HP reduction and damage?

A character at 10/26 HP is hit by a Wraith and fails the Constitution saving throw. They take 21 damage and their maximum HP is reduced to 5.

Are they unconscious because the 11 excess damage is less than 26 or dead because it’s greater than 5?