/**************************
RESET to ensure user agent padding and 
margin on elements do not affect layout.

Note this reset is not appropriate for
production websites.
***************************/

* {
    margin: 0;
    padding: 0;
}
body {
    font-family: Arial;
    color: #333;
    background-color: #E2E2E2;
}
main {
    width: 1000px;
    padding: 20px;
    margin: auto;
    display: block;
    background-color: white;
}
header {
    padding: 40px;
    background-color: azure;
}
h1 {
    text-align: center;
}
nav div {
    width: 120px;
    height: 120px;
    line-height: 120px;
    text-align: center;
    background-color: chocolate;
    font-size: 24px;
    font-weight: bold;
}
nav {
    display: flex;
    background-color: beige;
    align-items: baseline;
}
nav ul {
    width: 100%;
    display: flex;
    list-style-type: none;
}
li:last-of-type {
    margin-left: auto;
}
li form {
    padding: 5px 0;
}
input {
    padding: 5px;
    margin-right: 5px;
}
nav ul li a {
    display: block;
    padding: 0 10px;
    text-align: center;
    /*background-color: coral;*/
    /***change to border left*/
    border-left: #666 2px solid;
}
/**removed the first left borderline**/
nav ul li:first-of-type a {
    border: none;
}
#one {
    background-color: aqua;
    display: flex;
    justify-content: space-between;
}
#one article {
    background-color: bisque;
    width: 31.5%;
}
#one article:nth-child(2) {
    background-color: beige;
}
h2 {
    margin-bottom: 1em;
}
#two {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    background-color: #D5D5D5;
    padding: 20px;
}
#two h2 {
    text-align: center;
    flex: 100%;
}
#two article {
    width: 48%;
}
p {
    font-size: 1.4em;
    line-height: 1.2em;
    margin-bottom: 1em;
}
footer {
    padding: 40px;
    text-align: center;
    background-color: azure;
}

@media only screen and (max-width: 1040px) {
main {
    width: 100%;
    box-sizing: border-box;
}
}

@media only screen and (max-width: 700px) {
section {
    flex-wrap: wrap;
}
#one article:first-of-type {
    flex: 100%;
}
#one article {
    width: 48%;
}
#two article {
    width: auto;
}
}

@media only screen and (max-width: 500px) {
section {
    flex-direction: column;
}
#one article, #two article {
    width: auto;
}
}

@media only screen and (max-width: 650px) {
nav {
    display: block;
    padding: 20px 0;
}
nav div {
    margin: 20px auto;
}
nav ul {
    justify-content: center;
    flex-wrap: wrap;
}
nav ul li:last-of-type {
    flex: 100%;
    order: -1;
}
nav ul li form {
    text-align: center;
    padding-bottom: 20px;
}
}
