If someone is hiding, do detection attempts always have disadvantage?
This is a great question. From the rules, the answer appears to be 'No', but it isn't explicitly stated. I'm inferring it from this section of the basic rules for Hiding:
Passive Perception. When you hide, there’s a chance
someone will notice you even if they aren’t searching. To
determine whether such a creature notices you, the DM
compares your Dexterity (Stealth) check with that creature’s
passive Wisdom (Perception) score, which equals 10 + the
creature’s Wisdom modifier, as well as any other bonuses
or penalties. If the creature has advantage, add 5. For
disadvantage, subtract 5.
For example, if a 1st-level character (with a proficiency
bonus of +2) has a Wisdom of 15 (a +2 modifier) and
proficiency in Perception, he or she has a passive Wisdom
(Perception) of 14.
Emphasis mine. In this case, the rules are specifically explaining how to calculate the passive perception to detect a hidden creature. Since the rules for hidden dictate that the creature must necessarily be unable to be seen clearly (implying light or heavy obscurement), we can infer that this hidden creature is in some way obscured from the searcher. However, since the passive perception total listed is 14, and does not in any way reference a -5 modifier for an obscured creature, it seems like we can be reasonably sure that detecting hidden creatures happens outside the influence of obscurement. Otherwise, the math present would necessarily have to include a -5 for detecting an obscured creature.
Can you sneak up on someone in dim light according to RAW?
This one is DM dependent according to the rules. We can piece this together from the examples that the basic rules give us:
In combat, most creatures stay alert for signs of danger
all around, so if you come out of hiding and approach
a creature, it usually sees you.
This gives rules for when a creature can detect a hidden creature approaching it. However, since it specifically calls out 'in combat', and since 'out of combat' is not addressed, we have to assume that being out of combat doesn't change the core ruling of the 'hidden' effect (otherwise it would also have a callout, because specific beats general).
The generic hiding rules that necessarily must apply out of combat are:
You can’t hide from a creature that can see you, and if you
make noise (such as shouting a warning or knocking over a
vase), you give away your position.
and the errata:
The DM decides when
circumstances are appropriate for hiding.
Also, the question isn’t whether a creature
can see you when you’re hiding. The question is whether it can see you clearly.
So in this case, the game is deferring to the DM. You are well within RAW to tell the player that they can't approach the character in dim light from the front and remain hidden. This is even more overt than a simple rule-0, because the published rules specifically call out the DM's ability to overrule it.
My reading of the published rules appear to default to allowing that, but they also give the huge caveat that the DM can overrule it. However, with what we found out above, the detecting creature would NOT receive a -5 penalty by default (unless conditions occurred to warrant disadvantage on the check(s)).
Ability Checks
The DM calls for an ability check when a character or monster attempts an action that has a chance of failure. When the outcome is uncertain, the dice determine the results. (PHB p.174, "Ability Checks," emphasis mine.)
When deciding whether to use a roll, ask yourself two questions:
- Is a task so easy and so free of conflict and stress that there should be no chance of failure?
- Is a task so inappropriate or impossible--such as hitting the moon with an arrow--that it can't work? (DMG p.237, "Using Ability Scores," emphases mine.)
So the rules say that the GM should only allow your perception checks in situations where it would even be possible to perceive something. On top of this they might be disadvantaged, or penalized, or have DC-adjustments. In other words, it's up to your GM to decide "\$Y\$ is the altitude above which I do't even have you make checks, \$Z\$ is the altitude above which those checks are disadvantaged" or however they'd like to handle it.
Do they apply in your hypotheticals? Impossible to say without considering, as DaleM does in his answer, the sizes of objects and your flying height and speed. Really, this is one of those situations where you and you GM might spend an afternoon at a coffee shop trolling Wikipedia for information on visual acuity.
I do know one thing, though: If you're putting a lot more mechanical granularity into your character's vision than your table-mates are into their characters' vision, be careful. In that situation you're actually playing with a different quality of playing-piece than the rest of your table-mates, which can lead to tension down the road.
Best Answer
Heavily obscured areas cause disadvantage on attack rolls, not lightly obscured ones
The rules on Vision and Light state:
Notably, the heavily obscured area makes a creature suffer from the blinded condition, this means:
So while a dimly lit (lightly obscured) area does not cause disadvantage on attack roll (if it did, the rules would state so clearly) a pitch black (heavily obscured) area does. The initial quote about how vision and light impact the ability to hit an enemy in combat was most likely referring to the effects of a heavily obscured area, not a lightly obscured one.