This is an example of why I tend to avoid taking the Bible literally in its every aspect. The ‘literal’ meaning of some of the Old Testament is possibly lost to us as there are inevitably metaphors in use in the text that had meaning in their time but not in ours.
“Saw the nakedness” may well have been one of those metaphors or else it may have simply been a tribal taboo to see a naked elder. In any case, Ham did something wrong and he suffered for it. What he did will remain a mystery for the ages and I’m content to accept that and move on.
Usually, when the Bible uses an euphemism, it is talking about some form of sexual activity. Odds are, it is possible that he molested or raped Noah.
Also, word definitions have changed and been lost over time. "Gay" now days has almost lost it's meaning of happiness. See how fast that word has changed meaning so imagine over the course of 2000 years. Then there's the problem that some meanings in one language don't translate well into another language.