lines.on("mouseover", function(event, d) {
d3.select(this).style("opacity", 1);
tooltip.style("visibility", "visible")
.html(`Sex: ${d.sex}<br>Diet: ${d.diet_group}<br>Age: ${d.age_group}`);
})
.on("mousemove", function(event) {
tooltip.style("top", (event.pageY - 10) + "px")
.style("left", (event.pageX + 10) + "px");
})
.on("mouseout", function() {
d3.select(this).style("opacity", 0.5);
tooltip.style("visibility", "hidden");
});