A couple of years ago, my daughter was given an after-school detention for hugging a boy in the a hallway of her middle school. Evidently PDA's were banned there. My husband and I didn't get too upset at her; we figured there could be lots of worse reasons to get a detention!
By saying "evidently" it seems that this policy was either brand-new or so very poorly publicized that both you and your daughter were unaware of it. this doesn't sound like a policy that was implemented very well, and so to punish an otherwise good student on this basis seems a bit heavy-handed to me.
My husband and I didn't get too upset at her; we figured there could be lots of worse reasons to get a detention!
Indeed. Who knows how many other 'secret policies' they have on the books that they implement at random?