/* ----------

FILE CONTENT AND STRUCTURE

1. Global variables
2. Navigation
3. Header
4. Footer
5. Components

---------- */

/* 1. Global variables */

:root {
    --primary-color: hsl(125, 25%, 25%);
    --bg-colour: hsl(0, 0%, 100%);
}

/* fonts */

@font-face {
    font-family: "sans-condensed";
    src: url("OpenSans-CondLight.ttf") format("truetype");
}

@font-face {
    font-family: "accidental-presidency";
    src: url("AccidentalPresidency.ttf") format("truetype");
}

/* Overall layout */
* {
    padding: 0;
    margin: 0;

    font-family: "sans-condensed", sans-serif;
}

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

html {
    display: inline-block;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
    height: auto;
    min-height: 100vh;

    background-color: var(--bg-colour);

    font-size: 16px;
}

/* content width */

/* desktop */
main {
    width: clamp(850px, 60%, 1200px);
    min-height: 200px;

    margin: 0 auto;
}

footer {
    width: clamp(850px, 60%, 1200px);
    margin: 0 auto;
}

p {
    margin: 0;
}

/* laptop */
@media (max-width: 1280px) {
    main,
    footer {
        width: max(800px, 75%);
    }
}

/* tablets */
@media (max-width: 1024px) {
    main,
    footer {
        width: max(600px, 80%);
    }
}

/* mobile */
@media (max-width: 768px) {
    main,
    footer {
        width: 85%;
    }
}

/* small mobile */
@media (max-width: 450px) {
    main,
    footer {
        width: 95%;
    }
}

p {
    margin: 0;
    padding: 0;
}

/**/

/* 2. Navigation */

/* desktop, laptop, tablet */
nav {
    width: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;

    ul {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;

        width: 50%;
        max-height: 200px;

        margin: 0;
        padding: 0;
        opacity: 1;

        list-style-type: none;
    }

    ul li {
        font-size: 1.25rem;
        padding: 0.2rem 0 0.2rem 0;
        width: 100%;
        text-align: center;
    }

    ul li a {
        text-decoration: underline 0.05em;
        text-decoration-color: transparent;
        transition: all 0.5s;
    }

    ul li a:hover {
        text-decoration-color: black;
    }

    span {
        display: none;
        width: 18px;
        height: 1px;
        margin-top: 0;
        margin-bottom: calc(1rem / 3);
        background: black;
        border-radius: 1.5px;
    }

    span:nth-child(1) {
        margin-top: 1rem;
    }

    span:nth-child(3) {
        margin-bottom: 1rem;
    }

    input {
        display: none;
        position: absolute;
        top: 1rem;
        left: 0;
        right: 0;
        margin: 0 auto 0 auto;
        width: calc(1rem + 3px);
        height: calc(1rem + 3px);
        cursor: pointer;
        opacity: 0; /* hide this */
        z-index: 2; /* and place it over the hamburger */
        -webkit-touch-callout: none;
    }

    .mobile {
        display: none;
    }

    .desktop {
        display: block;
    }
}

/* mobile, small mobile */

@media (max-width: 768px) {
    nav {
        span {
            display: block;
        }

        input {
            display: block;
        }

        ul {
            display: none;
            flex-direction: column;

            width: 100%;
            max-height: 0;
        }

        ul li {
            font-size: 1rem;
        }

        input:checked ~ ul {
            display: block;
            max-height: 200px;
        }

        .mobile {
            display: block;
        }

        .desktop {
            display: none;
        }
    }
}

/* 3. Header */

header {
    width: 100%;
    display: flex;
    position: relative;
    align-items: center;

    background-image: url(title-background.jpg);
    background-size: cover;
    background-repeat: repeat;

    &:before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        background: linear-gradient(
            to top,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 1) 100%
        );
        height: 25%;
    }

    &:after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 1) 100%
        );
        height: 25%;
    }

    /* desktop, laptop */
    min-height: 280px;

    h1 {
        text-align: center;

        width: 70%;

        margin: 1em auto;
        padding: 0;

        font-size: 4.5rem;
        font-family: "accidental-presidency", Arial, sans-serif;
        font-weight: 100;
    }
}

/* laptop */
@media (max-width: 1280px) {
    header {
        min-height: 250px;

        h1 {
            font-size: 4rem;
        }
    }
}

/* tablet */
@media (max-width: 1024px) {
    header {
        min-height: 200px;

        h1 {
            width: 80%;
            font-size: 3.5em;
        }
    }
}

/* mobile */
@media (max-width: 768px) {
    header {
        min-height: 175px;

        h1 {
            width: 90%;
            font-size: 3rem;
        }
    }
}

/* small mobile */
@media (max-width: 450px) {
    header {
        min-height: 150px;

        h1 {
            width: 100%;
            font-size: 2rem;
        }
    }
}

/* 4. Footer */

/* desktop */
footer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;

    min-height: 50px;
    height: auto;

    background-color: #5d5d5d /*var(--primary-color)*/;
    color: #fff /*var(--bg-color)*/;

    div {
        min-width: 90px;
        width: 50%;
        text-align: center;

        h3 {
            width: 100%;
            margin: 1rem 0;

            font-size: 1.5rem;
            font-weight: bold;
        }
    }

    ul {
        list-style-type: none;
        height: auto;

        li {
            font-size: 1.25rem;

            a {
                color: white;

                text-decoration: underline 0.05em;
                text-decoration-color: transparent;
                transition: all 0.5s;

                &:hover {
                    text-decoration-color: white;
                }
            }
        }

        &:last-child {
            margin-bottom: 1rem;
        }
    }
}

/* laptop */
@media (max-width: 1280px) {
    footer {
        div h3 {
            font-size: 1.25rem;
        }

        ul li {
            font-size: 1rem;
        }
    }
}

/* M mobile */
@media (max-width: 650px) {
    footer {
        flex-direction: column;
        align-items: center;
        width: 100%;

        div h3 {
            font-size: 1rem;
        }

        ul li {
            font-size: 1rem;
        }
    }
}

/* 5. Components */

/* the default paragraph section containing*/
.paragraph-section {
    padding: 0.5rem;
    margin: 1rem auto;

    /* desktop */
    h1 {
        width: 60%;
        padding: 0.5rem 2rem;
        font-size: 2rem;
    }

    h2 {
        width: 70%;
        padding: 2rem 2rem 0.25rem 2rem;
        font-size: 1.5rem;
    }

    p,
    ul {
        width: calc(100% - 4rem);
        padding: 0.5rem 2rem;
        height: auto;
        font-size: 1.5rem;
        text-align: justify;
        line-height: 2.25rem;
    }

    li {
        padding: 0.5rem 0 0.5rem 2rem;
    }

    hr {
        border: 1px solid black;
        margin-bottom: 1rem;
    }

    /* laptop */
    @media (max-width: 1280px) {
        h1 {
            width: 75%;
            font-size: 1.75rem;
        }

        h2 {
            width: 80%;
            padding: 1.75rem 2rem 0.25rem 2rem;
            font-size: 1.25rem;
        }

        p,
        ul {
            font-size: 1.25rem;
        }

        hr {
            margin-bottom: 0.75rem;
        }
    }

    /* tablet */
    @media (max-width: 1024px) {
        h1 {
            width: 80%;
            font-size: 1.5rem;
        }

        h2 {
            width: 90%;
            padding: 1.5rem 2rem 0.25rem 2rem;
            font-size: 1rem;
        }

        p,
        ul {
            font-size: 1rem;
            line-height: 2rem;
        }

        li {
            padding: 0.25rem 0 0.25rem 2rem;
        }

        hr {
            margin-bottom: 0.5rem;
        }
    }

    /* mobile */
    @media (max-width: 768px) {
        h1 {
            padding: 0.25rem 1rem;
            font-size: 1.25rem;
        }

        h2 {
            padding: 1.25rem 1rem 0.25rem 1rem;
            font-size: 1rem;
        }

        p,
        ul {
            width: calc(100% - 2rem);
            padding: 0.5rem 1rem;
            font-size: 1rem;
        }
    }

    /* small mobile */
    @media (max-width: 450px) {
        h1 {
            width: calc(100% - 2rem);
        }

        h2 {
            width: calc(100% - 2rem);
        }
    }
}

/* Buttons */
.button-wrapper {
    display: flex;
    justify-content: space-evenly;

    margin: 0.5em 2em;
}

button {
    display: inline-block;
    padding: 0.5em 3em;

    background-color: lightgray;
    border: 0.5px solid lightgray;
    border-radius: 5px;

    color: black;
    text-align: center;
    text-decoration: 1px underline;
    text-decoration-color: lightgray;
    font-weight: normal;

    font-size: 1.25em;

    transition-duration: 0.4s;
    cursor: pointer;
}

button:hover {
    background-color: white;
    text-decoration-color: black;
}

/* Lists */

ul {
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    list-style-type: square;
    list-style-position: inside;
}

ul li {
    line-height: 1.5;
}

/* Flexbox Wrapper */

.flexbox {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
}

.flexbox > div {
    width: calc(50% - 2em);
    min-width: calc(50% - 2em);

    margin: 0 1em;
}

.centering {
    display: block;
    flex-direction: column;
    align-items: center;
}

.textcenter {
    text-align: center;
    padding: 0;
    width: auto;
    font-weight: normal;
    font-size: 1.5em;
}

.italic {
    font-style: italic;
}

/* CODE LISTING SECTION */

.tab {
    display: inline-block;
    margin-left: 1em;
}

.code {
    margin: 0.2em 4em;
    border-left: 4px lightgrey solid;
}

h5 {
    font-size: 1.25em;
    margin: 0.2em 4em;
}

/* Images */
.flexbox img {
    width: 90%;
}

p > a {
    color: #666666;

    text-decoration: underline 0.05em;
    text-decoration-color: transparent;
    transition: all 0.5s;
}

p > a:hover {
    text-decoration-color: black;
}

/* Article formatting */

.katex-html {
    display: none;
}

.katex-mathml {
    padding: 0 0.4em;
    border-radius: 0.2em;

    background-color: #e3e3e3;
}

code {
    padding: 0 0.4em;
    border-radius: 0.2em;

    background-color: #e3e3e3;
    font-family: "lekton-regular", monospace;
    font-size: 0.8em;
}
