* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #121212;
    color: #FFFFFF;
    font-family: Arial, Helvetica, sans-serif;
}

#wrapper, #contact-wrapper, #projects-wrapper, #about-wrapper {
    margin: 0;
    height: calc(100vh + 4.5em); /* Footer height is 4.5em */
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto 1fr auto auto;
    grid-template-areas: "header"
                         "nav"
                         "upperbody"
                         "hero"
                         "lowerbody"
                         "footer";
}

#contact-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas: "header"
                         "nav"
                         "hero"
                         "contact"
                         "footer";
}

#projects-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr 1fr 1fr auto;
    grid-template-areas: "header"
                         "nav"
                         "project1"
                         "project2"
                         "project3"
                         "footer";
}

#about-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "header"
                         "nav"
                         "main"
                         "footer";
}

/* Header */

header {
    margin: auto 0;
    grid-area: header;
    border-bottom: 1px solid #FFFFFF;
    color: #FFFFFF;
    text-align: center;
}

header a {
    text-decoration: none;
}

header a:link, header a:visited {
    color: #FFFFFF;
}

/* Navigation */

nav {
    grid-area: nav;
    padding: 0 1em;
    text-align: center;
}

nav a {
    text-decoration: none;
}

nav ul {
    margin: 0;
    padding: 0;
    font-size: 1.25em;
    list-style-type: none;
}

nav li {
    padding: 0.5em;
    border-bottom: 1px solid #2B2B2B;
}

nav a:link, nav a:visited {
    color: #FFFFFF;
}

nav a:hover {
    color: #00FFFF;
}

/* Main */

main {
    grid-area: main;
    display: flex;
    justify-content: center;
    align-items: center;
}

#about-container {
    flex: 1;
    background-color: #2B2B2B;
    border-radius: 2em;
    margin: 2em;
    max-height: 600px;
    max-width: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 16/9;
    z-index: 1;
}

#upperbody {
    grid-area: upperbody;
    text-align: center;
    margin: 0 1em;
    z-index: 1;
}

#upperbody h2 {
    margin: 1em 0;
}

#homehero, #contacthero {
    grid-area: hero;
    margin: 2em;
    max-width: 100%;
    max-height: 100%;
    min-height: 400px;
    background-image: url(assets/homehero.png);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

#contacthero {
    min-width: 400px;
    margin: 2em auto;
}

#lowerbody {
    grid-area: lowerbody;
    text-align: center;
    margin: 0 1em;
    z-index: 1;
}

#form-container {
    grid-area: contact;
    background: #2B2B2B;
    margin: 2em auto;
    margin-top: 0;
    padding: 2em;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 1em;
    min-height: 400px;
    max-width: calc(68ch + 3em);
}

input {
    font-size: 1.5em;
    margin: 0.5em 0 0 0;
    max-width: 45ch;
}

#input-wrapper {
    display: flex;
    flex-direction: column;
}

.project {
    padding: 2em;
    margin: 2em auto;
    width: calc(100% - 4em);
    max-width: 550px;
    height: calc(100% - 4em);
    min-height: 600px;
    background-color: #2B2B2B;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 2em;
}

#project-1 {
    grid-area: project1;
}

#project-2 {
    grid-area: project2;
}

#project-3 {
    grid-area: project3;
}

.project-header {
    margin: 0;
    grid-area: project-header;
    font-weight: normal;
}

.app-image {
    grid-area: project-image;
    margin: 1em auto;
    height: calc(100% - 7em);
    aspect-ratio: 1/2;
    align-self: start;
    border-radius: 1em;
}

.image-row {
    height: calc(100% - 4em);
    margin: 1em 0 0 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#button-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: end;
}

.button, #submit {
    background-color: #00FFFF;
    color: #000000;
    border: none;
    padding: 0.15em 2em;
    border-radius: 2em;
    text-decoration: none;
    font-weight: normal;
}

.button {
    align-self: center;
    font-size: 1em;
    margin: 1em 0 0 0;
    padding: 0.5em 2em;
}

#github-button {
    background-color: #121212;
    color: #FFFFFF;
    border: 1px solid #FFFFFF;
}

video {
    margin: 0;
    position: absolute;
    height: calc(100vh - 12em - 9px);
    min-height: calc(400px + 12em);
    width: 100vw;
    top: calc(12em + 9px);
    left: 0;
    object-fit: cover;
    z-index: 0;
}

/* Footer */

footer {
    grid-area: footer;
    font-size: 75%;
    font-style: italic;
    text-align: center;
    font-family: Georgia, "Times New Roman", serif;
    padding: 2em;
}

footer a {
    color: #00FFFF;
}

h1 {
    margin: 0;
    font-weight: normal;
    letter-spacing: 0.15em;
    padding: 0.5em;
}

/* Responsive UI */

@media (min-width: 600px) {
    nav {
        margin: auto 0;
        padding: 0;
    }

    nav ul {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-around;
        align-content: center;
    }

    nav li {
        border-bottom: none;
    }

    .app-image {
        margin: 0;
        height: 100%;
    }

    .image-row {
        flex-direction: row;
        height: calc(100% - 3em);
    }

    video {
        height: calc(100vh - 7em - 2px);
        min-height: calc(400px + 11.5em);
        top: calc(7em + 2px);
    }
}

@media (min-width: 1000px) {
    header {
        text-align: left;
        border: none;
    }

    nav ul {
        flex-wrap: nowrap;
        justify-content: end;
        align-content: center;
    }

    nav li {
        padding: 0 1em;
    }

    #homehero {
        margin: 2em 0;
    }

    #wrapper {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
                              "header    header    header nav    nav       nav"
                              "upperbody upperbody hero   hero   lowerbody lowerbody"
                              "footer    footer    footer footer footer    footer";
    }

    #contact-wrapper {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
                              "header header header nav     nav     nav"
                              "hero   hero   hero   contact contact contact"
                              "footer footer footer footer  footer  footer";
    }

    #projects-wrapper {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr 1fr auto;
        grid-template-areas:
                              "header   nav"
                              "project1 project2"
                              "project3 empty"
                              "footer   footer";
    }

    #about-wrapper {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
                              "header nav"
                              "main  main"
                              "footer footer";
    }

    #upperbody {
        margin: auto 1em;
        margin-right: 0;
    }

    #lowerbody {
        margin: auto 1em;
        margin-left: 0;
    }

    .project {
        width: calc(100% - 4em);
        max-width: 550px;
        height: calc(100% - 4em);
        min-height: 350px;
    }

    #form-container {
        margin: auto auto;
    }

    #contacthero {
        height: 1000px;
        width: 450px;
        margin: auto;
    }

    video {
        height: calc(100vh - 4em - 5px);
        min-height: calc(400px + 4em);
        top: calc(4em + 5px);
    }
}