Pedophilia is the state of having a sexual attraction to children. It's perfectly legal, though not socially respectable. Acting on pedophilia, on the other hand, is illegal. Someone with that attraction who never acts on it is to be commended.
There are gray areas, necessarily, since the cut-off age is somewhat arbitrary, and relative age is an important consideration. Part of the dynamic is relative power, which includes social experience. We don't allow adults to make binding contracts with minors because a 30-year-old salesman has too much social power in talking a 14-year old into an easy payment plan. Similarly, there is a difference between a sexual relationship between teens a few years apart with one below the legal age of consent, and one where one of the participants is 15 and the other is 25. It's perfectly possible to write the laws to eliminate most 'edge' cases so you don't have 17 year olds going to jail for having a 16-yo GF or BF. You can't eliminate edge cases entirely because some degree of arbitrariness is inevitable (can they be four years apart or only three? what about three years and two months?), given that we aren't issued with a clear physiological signifier of when we're too young or too old or too far apart in age...or at least we've collectively decided that onset of puberty usually isn't old enough, so we have to pick an age instead.
There are gray areas, necessarily, since the cut-off age is somewhat arbitrary, and relative age is an important consideration. Part of the dynamic is relative power, which includes social experience. We don't allow adults to make binding contracts with minors because a 30-year-old salesman has too much social power in talking a 14-year old into an easy payment plan. Similarly, there is a difference between a sexual relationship between teens a few years apart with one below the legal age of consent, and one where one of the participants is 15 and the other is 25. It's perfectly possible to write the laws to eliminate most 'edge' cases so you don't have 17 year olds going to jail for having a 16-yo GF or BF. You can't eliminate edge cases entirely because some degree of arbitrariness is inevitable (can they be four years apart or only three? what about three years and two months?), given that we aren't issued with a clear physiological signifier of when we're too young or too old or too far apart in age...or at least we've collectively decided that onset of puberty usually isn't old enough, so we have to pick an age instead.