:root {
    --font-family: "JetBrains Mono", monospace;
    --font-optical-sizing: auto;
    --font-weight: 400;
    --font-style: normal;
    --html-size: 50rem;
    --main-color-light: #dedede;
    --main-color-dark: #161616;
    --secondary-color: #CF0000;
    --text-color-light: #161616;
    --text-color-dark: #dddddd;
    --secondary-text-light: #545454;
    --links-color: #ff6f06;
    --links-color-dark: #06ad28;
    --codeblock-bg-color-dark: #252525;
}

/* Common styles */
* {
    box-sizing: inherit;
    text-rendering: optimizeLegibility;
}

html {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-optical-sizing: var(--font-optical-sizing);
    font-weight: var(--font-weight);
    font-style: var(--font-style);
    max-width: var(--html-size);
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: 20px 0;
    background-color: var(--main-color-light);
    color: var(--main-color-dark);
}

main {
    flex: 1 0 auto;
}

hr {
    border: none;
    border-top: 2px dashed var(--secondary-text-light);
}

h1 {
    font-family: "Pixelify Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 0px;
}

h2 {
    font-size: clamp(1.6rem, 3.5vw, 2rem);
}

h2::before {
    content: "# ";
    color: var(--secondary-color);
}

h3 {
    font-size: clamp(1.4rem, 3vw, 1.6rem);
}

h3::before {
    content: "## ";
    font-size: 18px;
    color: var(--secondary-color);
}

h4 {
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
}

h4::before {
    content: "### ";
    color: var(--secondary-color);
}

h5 {
    font-size: clamp(1.1rem, 2vw, 1.2rem);
}

h5::before {
    content: "#### ";
    color: var(--secondary-color);
}

ul {
    line-height: 1.6;
}

p {
    max-width: 80ch;
    margin: 1em 0;
    text-align: left;
    hyphens: auto;
    word-break: keep-all;
}

p code {
    font-size: 1rem;
    padding: 1px 3px;
    background-color: var(--secondary-text-light);
    color: var(--text-color-dark);
    border-radius: 3px;
    transition: color 0.2s;
}

p,
li {
    font-size: clamp(1rem, 1.8vw, 1.1rem);
    line-height: 1.6;
}

li {
    list-style-type: "- ";
    margin: 0 0 0 0.5em;
}

a {
    color: var(--text-color-light);
    text-decoration: none;
    border-bottom: solid 2px var(--secondary-color);
    transition: color 0.2s;
}

a.dark {
    color: var(--text-color-dark);
}

a:hover {
    color: var(--links-color);
    border-color: var(--secondary-text-light);

    code {
        background-color: var(--links-color);
    }
}

a::after {
    content: url("/static/icons/arrow-up-right-from-square-solid-full.svg");
    display: inline-block;
    white-space: nowrap;
    width: 15px;
    height: 15px;
    margin: 0 0 0 0.5em;
}

img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

blockquote {
    padding-left: 10px;
    border-left: solid 3px;
    color: var(--secondary-color);

    p {
        color: var(--secondary-text-light);
    }
}

/* Article card*/
.card {
    margin-bottom: 40px;
}

.article-title {
    margin-bottom: 0;
}

.article-name {
    text-decoration: none;
    margin-bottom: 0;
    border: none;
    transition: color 0.2s;
}

.article-name::after {
    content: none;
}

.article-name:hover {
    color: var(--links-color);
}

.pub {
    display: flex;
    justify-content: flex-start;

    p {
        font-size: 1rem;
        margin: 0;
        color: var(--secondary-text-light);
    }
}

.pub-info::before {
    content: "|";
    margin: 0 0 0 0.5em;
}

.desc {
    margin-top: 0;
}

.tags {
    margin: 20px 0;
}

.tags::before {
    content: "---------------------------------------"
        "--------------------------------------------";
    display: block;
    left: 0;
}

.tags p {
    display: inline;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav {
    display: flex;
    gap: 20px;
}

.btns {
    display: flex;
    gap: 10px;
}

.btn {
    border: none;
}

.btn::after {
    content: none;
}

.link {
    font-weight: bold;
    text-decoration: none;
    color: var(--links-color);
    border: none;
}

.link:hover {
    color: var(--secondary-color);
}

.icon {
    width: 30px;
    height: 30px;
}

.icon:hover {
    cursor: pointer;
    filter: invert(30%);
}

/* Page title */
.title::after {
    content:
        "========================================="
        "==========================================";
    display: block;
    left: 0;
}

/* Footer */
footer {
    flex-shrink: 0;
    text-align: center;
}

/* Dark Theme */
html.dark body {
    background-color: var(--main-color-dark);
    color: var(--text-color-dark);
}

html.dark img.icon {
    filter: invert(80%);
}

html.dark img.icon:hover {
    filter: invert(60%);
}

html.dark a::after {
    filter: invert(80%);
}

html.dark a {
    color: var(--text-color-dark);
}

html.dark a:hover {
    color: var(--links-color);
}

html.dark a::after {
    filter: invert(0.8);
}

html.dark .link {
    color: var(--links-color);
}

html.dark .link:hover {
    color: var(--secondary-color);
}

html.dark .codehilite {
    background: var(--codeblock-bg-color-dark);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        max-width: 100%;
    }

    .nav {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btns {
        flex-wrap: wrap;
        gap: 8px;
    }

    p {
        font-size: 1rem;
        line-height: 1.5;
        text-align: justify;
    }

    .pub {
        align-items: flex-start;

        p {
            font-size: 0.8rem;
        }
    }

    .tags::before {
        font-size: 12px;
        content: "-------------------------------------------------";
    }

    .icon {
        width: 24px;
        height: 24px;
    }

    img {
        border-radius: 8px;
    }
}

@media (max-width: 480px) {

    h2 {
        font-size: 20px;
    }

    p {
        font-size: 0.95rem;
    }

    .icon {
        width: 20px;
        height: 20px;
    }

    .title::after {
        content: "=====================================";
    }
}
