Why is `<style>` declared inside `<head>` but `<script>` must be put at the bottom of the HTML file?

Here's an example:

```
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1   {color: blue;}
p    {color: red;}
</style>
</head>
<body>

<h1></h1>
<p>This is a paragraph.</p>

<script>
var myHeading = document.querySelector('h1');
myHeading.textContent = 'Hello world!';
</script>
</body>
</html>

```

Please let me know about it.