

* {
    box-sizing: border-box;
}

body  {
    margin: 0;
    display: flex;
    flex-direction: column;
    flex-basis: 100vh;
}

header {
    background-color: blue;
    flex-basis: 100px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header a {
    text-decoration: none;
    color: white;
}

main {
    display: flex;
    flex-basis: 800px;
}

main > *, header, footer {
    margin: 4px;
    padding: 5px;
    border-radius: 7px;
}

article {
    flex: 5 0 60%;
    background-color: red;
}

nav {
    flex: 1 1 20%;
    background-color: orange;
    order: -1;
}

aside {
    flex: 1 1 20%;
    background-color: green;
}

footer {
    background-color: blue;
    flex-basis: 100px;
}


@media all and (max-width: 640px) {
    main {
        flex-direction: column;
        flex-grow: 1;
    }
    nav {
        order: 0;
    }
}



