Happy medium/median

: Is it 'happy medium' or 'happy median'? Googling suggests 'medium' but the word median seems to apply more. What's the origin of this phrase?

happy medium

The midway point between two extremes. For example, We need to find a happy medium between overdoing the holiday season and ignoring it entirely . This expression, first recorded in 1778, was once known as the golden mean and is based on ancient mathematical principles.From The American Heritage® Dictionary of Idioms by Christine Ammer.