Specific Time vs Period of Time

Looking for clarification on why a recent automation didn’t work. I used the automation in the ST app, but here is the goal in pseudocode for engineering types:

if (location mode == night && time > 5am && morning hasn't run) {
    if ( any motion ) {
        execute morning scene

I tried using specific time of 5 am assuming the precondition would be met once the clock passed 5am. However, this hasn’t worked. I have only been able to get it to run by using a period of time (5am - 5pm). Does the specific time trigger need the motion to occur exactly at 5am? Is there a way to use 5am as a specific time precondition even if the motion occurs well after?

I would prefer that the precondition be Night mode + at least 5am, and flip to Home mode.

Bingo. Gotta use time range otherwise.