The Thermodynamics of Attention