@import url("https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Yrsa:ital,wght@0,300..700;1,300..700&display=swap");

:root {
    --bg: #fbfbfb;
    --fg: #222;
    --transition: all 75ms cubic-bezier(0.39, 0.58, 0.57, 1);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--fg);
    font-size: 20px;
    line-height: 26px;
    scroll-behavior: smooth;
}

body {
    font-family: "Yrsa", serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-size: 1rem;
    line-height: 1.3rem;
}

a {
    color: #007be0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    &:hover a::after {
        content: "#";
        margin-left: 10px;
    }

    a {
        color: var(--fg);
        text-decoration: none;
        display: block;
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "DM Sans", serif;
    font-weight: 600;
    font-style: normal;
}

h1,
.h1 {
    font-size: 2.35rem;
    line-height: 2.6rem;
    margin-top: 1.3rem;
    margin-bottom: 2.6rem;
}
h2,
.h2 {
    font-size: 1.8rem;
    line-height: 2.6rem;
    margin-top: 1.3rem;
    margin-bottom: 1.3rem;
}
h3,
.h3 {
    font-size: 1.35rem;
    line-height: 2rem;
    margin-top: 1.3rem;
    margin-bottom: 0.6rem;
}
h4,
.h4 {
    font-size: 1rem;
    line-height: 1.3rem;
    margin-top: 1.3rem;
    margin-bottom: 0rem;
}
h5,
.h5 {
    font-size: 1rem;
    line-height: 1.3rem;
    margin-top: 1.3rem;
    margin-bottom: 0rem;
}
p,
ul,
ol,
pre,
table,
blockquote {
    margin-top: 0rem;
    margin-bottom: 1.3rem;
}
ul ul,
ol ol,
ul ol,
ol ul {
    margin-top: 0rem;
    margin-bottom: 0rem;
}

ul li {
    list-style: square;
}

ul li li {
    list-style: circle;
}

hr,
.hr {
    border: 1px solid;
    margin: -1px 0;
}

b,
i,
strong,
em,
small,
code {
    line-height: 0;
}
sub,
sup {
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}
sup {
    top: -0.5em;
}
sub {
    bottom: -0.25em;
}

hr {
    border: 0;
    height: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    overflow: visible;
}

code {
    font-family: "DM Mono", monospace;
    background: #eee;
    font-size: 0.85rem;
}

main {
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 3fr;
    max-width: 840px; /* 250 nav + 540 article + 50 gap*/
}

nav {
    width: calc(250px + 20px);
    top: 1.3rem;
    padding-right: 20px;
    margin-right: 30px;
    position: sticky;
    align-self: start;
    height: 90vh;
    padding-bottom: 1.5rem; /* To get the scroll showing on the bottom */
    overflow-y: auto;

    background:
        linear-gradient(var(--bg) 30%, rgba(255, 255, 255, 0)) center top,
        /* Shadow Cover BOTTOM */
            linear-gradient(rgba(255, 255, 255, 0), var(--bg) 70%) center bottom,
        /* Shadow TOP */
            radial-gradient(
                farthest-side at 50% 0,
                rgba(0, 0, 0, 0.2),
                rgba(0, 0, 0, 0)
            )
            center top,
        /* Shadow BOTTOM */
            radial-gradient(
                farthest-side at 50% 100%,
                rgba(0, 0, 0, 0.2),
                rgba(0, 0, 0, 0)
            )
            center bottom;

    background-repeat: no-repeat;
    background-size:
        100% 40px,
        100% 40px,
        100% 14px,
        100% 14px;
    background-attachment: local, local, scroll, scroll;

    /* Shout out to css tricks! */
    /*
        https://css-tricks.com/books/greatest-css-tricks/scroll-shadows/
    */
}

nav a {
    line-height: unset;
    display: block;
    text-decoration: none;
    padding: 6px 0;
    font-size: 0.75rem;
    line-height: normal;
    font-family: "DM Sans";
}

nav a.nav-2 {
    padding-left: 12px;
}

nav a.nav-1:not(:first-of-type) {
    border-top: 1px solid rgba(0, 0, 0, 0.2);
}

nav .nav-info {
    background: var(--bg);
    position: sticky;
    top: 0;
}

nav input {
    margin-bottom: 10px;
}

.updated-on {
    color: #888;
    margin-top: 1rem;
    display: block;
}

article {
    max-width: 540px;
}

img {
    width: 90%;
    margin: 0 auto;
    display: block;
}

button,
.button {
    font-family: "DM Sans";
    outline: none;
    border: 2px solid rgb(200, 200, 210);
    border-radius: 2px;
    cursor: pointer;
    padding: 10px 20px;
    background: #fff;
    color: var(--fg);
    display: inline-block;
    line-height: 1.3;
    font-weight: 500;
    user-select: none;

    transition: var(--transition);
}

button:hover,
.button:hover {
    transition: var(--transition);
    background: #f2f2f2;
}

button:active,
.button:active {
    transition: var(--transition);
    box-shadow: 0 2px 2px 0px #ddd inset;
    background: #eaeaea;
}

input {
    width: 100%;
    outline: 0;
    color: var(--fg);
    padding: 10px;
    border-radius: 2px;
    border: 2px solid rgb(200, 200, 210);
    transition: var(--transition);
    display: block;
    font-family: "DM Sans";
}

nav input {
    padding: 6px;
    font-size: 0.8rem;
}

input:focus {
    transition: var(--transition);
    border-color: #007be0;
}

.mobile-headings {
    display: none;
}

@media (560px <= width <= 992px) {
    nav {
        display: none;
    }

    main {
        width: 85%;
        max-width: 560px;
        margin: 0 auto;
        display: block;
    }

    article {
        width: 100%;
        margin: 0 auto;
    }

    img {
        width: 95%;
    }
}

@media (width <= 560px) {
    nav {
        display: none;
    }

    main {
        width: 90%;
        max-width: 560px;
        margin: 0 auto;
        display: block;
    }

    article {
        width: 100%;
        margin: 0 auto;
    }

    img {
        width: 100%;
    }

    ul {
        padding-left: 30px;
    }
}

@media (width <= 992px) {
    .mobile-headings {
        display: block;
        position: relative;
        margin-top: 25px;
        font-family: "DM Sans";
    }

    .mobile-headings .dropdown-button {
        cursor: pointer;
        padding: 12px 16px;
        user-select: none;
        display: flex;
        width: 100%;
        align-items: center;
        column-gap: 20px;
    }

    .mobile-headings .dropdown-content {
        position: absolute;
        top: 50%;
        padding: 6px 0;
        background-color: #f9f9f9;
        border: 2px solid rgb(200, 200, 210);
        border-radius: 2px;
        width: 100%;
        z-index: 100000;
        visibility: hidden;
        opacity: 0;
        box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
        transition: var(--transition);
    }

    .mobile-headings .dropdown-content a {
        color: black;
        font-size: 0.85rem;
        padding: 12px 20px;
        display: block;
        text-decoration: none;
        user-select: none;
    }

    .mobile-headings .dropdown-content a:hover {
        transition: var(--transition);
        background: #eaeaea;
    }

    .mobile-headings:focus-within .dropdown-content {
        outline: none;
        transform: translateY(30px);
        visibility: visible;
        opacity: 1;
        transition: var(--transition);
    }

    .mobile-headings .db {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        opacity: 0;
        cursor: pointer;
        z-index: 10;
        display: none;
    }

    .mobile-headings:focus .db {
        display: inline-block;
    }

    .mobile-headings .db:focus .dropdown-content {
        outline: none;
        visibility: hidden;
        opacity: 0;
        transition: var(--transition);
    }

    .mobile-headings .dropdown-button :last-child {
        margin-left: auto;
    }

    .mobile-headings .dropdown-content .nav-1 {
        padding-left: 20px;
    }

    .mobile-headings .dropdown-content .nav-2 {
        padding-left: 30px;
    }
}

.hidden {
    display: none;
}

blockquote {
    background: #eee;
    margin-left: 20px;
    margin-right: 20px;
    padding: 20px;
}

blockquote :last-child {
    margin-bottom: 0;
}
