html,
body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;

    --font-sans: 'IBM Plex Sans', system-ui,sans-serif;
    --font-mono: 'IBM Plex Mono', 'Menlo', monospace;

    --primary-bg: #fdfeff;
    --primary-text: #111111;
    --secondary-bg: #f1f1f8;
    --secondary-text: #9b9b9b;
    --hover-bg: #dde1e5;
    --active-bg: #cdcfd2;
    --underline-bg: #aaafb5;
    --translucent: rgba(249, 250, 251, .8);
    --transparent: rgba(249, 250, 251, 0);
}

.dark {
    --primary-bg: #141516;
    --primary-text: #ebebeb;
    --secondary-bg: #30373a;
    --secondary-text: #a4a7a9;
    --hover-bg: #474c50;
    --active-bg: #626569;
    --underline-bg: #6d7176;
    --translucent: rgba(47, 52, 55, .8);
    --transparent: rgba(47, 52, 55, 0);
}

html {
    /* rem for the page */
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    color: var(--primary-text);
    background: var(--primary-bg);

    border-bottom: 8px solid #111111;

    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header,
footer {
    flex-grow: 0;
    flex-shrink: 0;
}

main {
    flex-grow: 1;
    flex-shrink: 0;
}

a {
    color: var(--primary-text)
}

.overlay {
    max-width: 96ch;
    width: calc(100% - 2rem);
    margin-left: auto;
    margin-right: auto;
}

.split {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5em;
}

.split > * {
    max-width: 100%;
}

/* TYPOGRAPHY */

h1,
h2,
h3 {
    line-height: 1.5em;
    color: var(--primary-text);
    margin-top: 1.5em;
    margin-bottom: .75em;
    font-weight: normal;
}

h1 {
    margin-top: 1em;
    font-size: 2em;
}

h2 {
    font-size: 1.5em;
}

h3 {
    font-size: 1.2em;
}

p, li {
    line-height: 1.5em;
    margin: 1em 0;
    max-width: 64ch;
}

p img.blend-multiply {
    mix-blend-mode: multiply;
}

/* HEADER */

header a {
    text-decoration: none;
    font-size: 1.125em;
}

header a:hover {
    text-decoration: underline;
}

header .overlay,
nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
}

header {
    background: var(--primary-bg);
    height: 100px;
}

.home {
    font-weight: bold;
    margin-right: 3ch;
}

nav {
    gap: 1.5ch;
}

nav a {
    font-weight: normal;
    white-space: nowrap;
}

/* FOOTER */

footer .overlay {
    height: 80px;
    padding-bottom: 32px;
}

footer .right {
    font-style: italic;
}

/* HERO AND HOME PAGE */

.tagline {
    font-size: 1.2em;
}

.hero {
    padding-top: 32px;
    padding-bottom: 32px;
}

.hero h1 {
    margin-top: 0;
}

.hero pre {
    margin: 0;
}

.hero .disclaimer {
    font-size: 12px;
    color: var(--secondary-text);
}

/* ARTICLE */

main {
    overflow: hidden;
}

details {
    margin: 1em 0;
}

summary {
    cursor: pointer;
}

summary > h2,
summary > h3,
summary > h4 {
    display: inline;
    margin-left: 8px;
}

table a,
article p a,
article li a {
    text-decoration-color: var(--underline-bg);
    text-underline-offset: 1px;
    text-decoration-thickness: 2px;
    transition: text-decoration-color .2s;
}

table a:hover,
article p a:hover,
article li a:hover {
    text-decoration-color: var(--secondary-text);
}

.meta {
    color: var(--secondary-text);
    display: flex;
    flex-direction: row;
    gap: 3ch;
}

.meta a {
    color: var(--secondary-text);
    text-decoration: none;
}

.meta a:hover {
    text-decoration: underline;
}

p img {
    width: 100vw;
    max-width: unset;
    position: relative;
    top: 0;
    left: -16px;
}

pre, code, kbd {
    font-family: var(--font-mono);
    tab-size: 4;
}

pre {
    display: block;
    margin: 1.5em 0;
    border-radius: 6px;
    background: var(--secondary-bg);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    display: flex;
    flex-direction: row;
}

pre > code {
    flex-shrink: 0;
    display: block;
    padding: 1em;
    font-size: calc(1em - 2px);
    -webkit-text-size-adjust: none;
}

code,
kbd {
    background: var(--secondary-bg);
}

h1 code,
h2 code,
h3 code,
h4 code,
p code,
p kbd,
li code,
li kbd {
    padding: 3px 5px;
    border-radius: 4px;
}

blockquote {
    font-style: italic;
}

blockquote em,
blockquote pre {
    font-style: normal;
}

hr {
    border: 0;
    margin: 2em 0;
}

hr::after {
    content: '{{ * * * }}';
    display: block;
    width: 100%;
    color: var(--secondary-text);
    text-align: center;
    font-family: var(--font-mono);
}

/* AUXILIARY UI */

.button {
    display: inline-block;
    background: var(--hover-bg);
    box-sizing: border-box;
    text-decoration: none;
    padding: .6em 1em;
    margin: .5em .6em .5em 0;
    border-radius: 6px;
}

.button:hover {
    background: var(--active-bg);
}

/* TABLE OF CONTENTS */

.toc {
    box-sizing: border-box;
    border-left: 6px solid var(--secondary-text);
    background: var(--hover-bg);
    margin: 1.5em 0;
}

.toc summary {
    padding-left: 1em;
    cursor: pointer;
}

.toc .toc-title {
    display: inline-block;
    font-size: 1.4em;
    margin: 1em 0;
}

.toc[open] .toc-title {
    margin-bottom: 0;
}

.toc ul {
    padding-left: 1.6em;
}

.toc li {
    list-style: none;
    margin: .75em 0;
}

.toc summary::-webkit-details-marker {
    transform: translateY(-.2em);
}

/* BLOG POST LIST */

ul.postlist {
    padding-left: 0;
}

ul.postlist li {
    list-style: none;
}

.postlist .dateBit {
    margin-left: .25em;
    color: var(--secondary-text);
    font-size: calc(1em - 2px);
    font-style: italic;
    white-space: nowrap;
}

.desktop {
    display: none;
}

@media only screen and (max-width: 820px) {
    .split {
        flex-direction: column;
        gap: 0;
    }

    .hero pre {
        margin: 1.5em 0;
        transform: rotate(0);
    }
}

@media only screen and (min-width: 600px) {
    nav {
        gap: 2ch;
    }

    .overlay {
        width: calc(100% - 3rem);
    }

    h1,
    h2,
    h3 {
        margin-top: 1.2em;
        margin-bottom: .5em;
    }

    .tagline {
        font-size: 1.3em;
    }

    h1 {
        margin-top: 1em;
        font-size: 3em;
    }

    h2 {
        font-size: 2.25em;
    }

    h3 {
        font-size: 1.5em;
    }

    pre > code {
        font-size: 1em;
    }

    p img {
        left: 0;
        margin: 1.5em 0;
        max-width: 96ch;
        width: calc(100vw - 3rem);
    }

    .desktop {
        display: initial;
    }

    .mobile {
        display: none;
    }
}

