Layering transitions and the structure of dense hydrogen