Both heritable adaptation (evolution) and the ability of individuals to physiologically adapt to environmental conditions (phenotypic plasticity) certainly come into play. And then there are heritable temporal changes in gene expression in response to environmental factors (epigenetics). Biology sure is interesting!