* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --dark-grey: hsl(216, 15%, 50%);
    --dark-blue: #2b6cb0;
}

/* Base Styling */
body {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

body,
a,
input,
textarea,
button {
    font-family: 'Montserrat', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

input,
button {
    padding: .45rem .5rem;
    font-size: 1rem;
}

textarea {
    padding: .75rem 1.25rem;
}

.header {
    position: relative;
    padding: 2rem 5rem;
    border-bottom: 4px solid #7f9cf5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__title {
    font-weight: 400;
    color: #2d3748;
}

.nav__link {
    display: inline-block;
    margin: 0 .25rem;
    padding: .5rem;
    color: #111;
    font-size: 1rem;
}


.main {
    margin: 5rem;
    max-width: 92.5%;
}

.main__title {
    margin-bottom: 1rem;
    font-weight: 400;
    color: var(--dark-blue);
}

.main__admin-greeting {
    margin-bottom: .75rem;
}

.new-article {
    text-decoration: underline;
    margin-right: .25rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.new-title {
    margin-bottom: 1rem;
}

.article {
    margin: 3rem 0;
    max-width: 35rem;
}

.article__title {
    font-weight: 400;
    color: var(--dark-blue);
}

.article__title:hover {
    text-decoration: underline;
}

.article__date {
    margin-top: .25rem;
    color: var(--dark-grey);
    font-size: 1rem;
    font-weight: 700;
}

.article__description {
    margin: .75rem 0;
}

.article__controls {
    display: flex;
    justify-content: center;
    align-items: center;
}

.article__edit {
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-right: 1rem;
}

.article__edit:hover {
    text-decoration: underline;
}


.footer {
    padding: 2rem;
    background-color: #0c1014;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer__title {
    font-size: .95rem;
    font-weight: 400;
    opacity: .725;
}

/* Form */
.form {
    width: 100%;
}

.form-group {
    max-width: 40rem;
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.form-group__label {
    margin-bottom: .5rem;
}

.form-group__input,
.form-group__textarea {
    border: 1px solid #a0aec0;
    border-radius: 4px;
}

.form-group__textarea {
    line-height: 1.6;
}

.form-cancel {
    padding: .75rem 0;
    margin-right: 1rem;
    display: inline-block;
    text-decoration: underline;
}

.form-submit {
    padding: .5rem 1.1rem;
    border: none;
    border-radius: 4px;
    background-color: var(--dark-grey);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 1rem;
    cursor: pointer;
}

.form-error {
    margin: 1rem 0;
    color: #9b2c2c;
}

/* Blog Post */
.post__date {
    color: #718096;
    font-size: 1rem;
    font-weight: 400;
    text-align: center;
}

.post__title {
    margin-top: 1.75rem;
    text-align: center;
    font-style: italic;
}

.md-content {
    display: grid;
    margin: 2rem auto;
    padding: 0 1rem;
    max-width: 90rem;
    grid-template-columns: 3fr 12fr 5fr;
    grid-gap: 1rem 1.5rem;
}

.md-content h1,
.md-content h2,
.md-content h3 {
    grid-column: 2 / -2;
}

.md-content figure {
    margin-bottom: 2rem;
    grid-column: 2 / -2;
}

.md-content figure.full-width {
    grid-column: 1 / -1;
}

.md-content figure img {
    width: 100%;
    height: 30rem;
    object-fit: cover;
}

.md-content figure p {
    /* Remove extra line height added by Marked inserting a p element to HTML */
    line-height: 0;
}

.md-content > p {
    margin-bottom: 1.25rem;
    line-height: 1.6;
    grid-column: 2 / -2;
}

.md-content blockquote {
    padding: 1rem;
    grid-row: span 5;
    align-self: start;
    background-color: #E2E8F0;
}

.md-content blockquote:nth-of-type(odd) {
    grid-column: 1 / span 1;
    text-align: right;
    border-right: 3px solid #ECC94B;
}

.md-content blockquote:nth-of-type(even) {
    grid-column: span 1 / -1;
    text-align: left;
    border-left: 3px solid #ECC94B;
}

.post__controls {
    padding-top: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    border-top: 1px solid hsl(214, 32%, 90%);
}

.btn-logout {
    display: inline-block;
    margin-right: 1rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-decoration: underline;
}

.link,
.btn-link {
    position: relative;
    display: inline-block;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .97rem;
    color: #2d3748;
}

.btn-link::before {
    position: absolute;
    top: -.1rem;
    left: -2rem;
    content: url(/icons/icon-arrow-left.svg);
    opacity: .75;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-link:first-of-type {
    margin-right: 1rem;
}

/* Comments */
.form--comments {
    margin-bottom: 5rem;
}

.post__comments__title {
    margin: 2rem 0 1.25rem 0;
}

.post__comments {
    grid-column: 2 / -2;
}

.post__comments__list {
    list-style: none;
}

.post__comments__list__comment {
    margin-bottom: 3rem;
}

.post__comments__list__author {
    margin-bottom: .2rem;
    color: var(--dark-grey);
}

.post__comments__list__author span {
    font-size: .95rem;
    font-weight: 400;
}

.post__comments__list__text {
    margin-bottom: .75rem;
}


@media screen and (max-width: 60em) {
    .header {
        padding: 2rem 3rem;
    }

    .header__title {
        font-size: 1.5rem;
    }
    
    /* Home page */
    .main {
        margin: 2.5rem 3rem;
    }

    .main__title {
        font-size: 1.4rem;
    }

    .article__title {
        font-size: 1.25rem;
    }

    .article__date {
        font-size: .95rem;
    }

    /* Post page */
    .post__title {
        font-size: 1.75rem;
    }

    .post__date {
        font-size: .975rem;
    }
}

@media screen and (max-width: 36.5em) {
    .header {
        padding: 1rem;
    }

    .header__title {
        font-size: 1.05rem;
    }

    .nav__link {
        margin: 0;
        padding: .15rem .25rem;
        font-size: .935rem;
    }
    
    /* Home page */
    .main {
        margin: 1.15rem 1rem;
    }

    .main__title {
        font-size: 1.25rem;
    }

    .article__title {
        font-size: 1.25rem;
    }

    .article__date {
        font-size: .95rem;
    }

    /* Post page */
    .post__title {
        font-size: 1.5rem;
    }

    .post__date {
        font-size: .975rem;
    }

    .md-content {
        grid-template-columns: 1fr;
    }

    .btn-link::before {
        content: none;
    }

    /* Admin home page */
    .main__admin-greeting {
        font-size: 1.25rem;
    }

    .new-title {
        font-size: 1.4rem;
    }
}

