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

    --font-serif: 'IBM Plex Mono', 'Menlo', 'Monaco', monospace;

    /* default light-mode colors */
    --foreground-default: #222;
    --foreground-light: #778;
    --background-default: #f8f8f8;
    --background-block: #eee;
    --accent: #a02c35;
    --accent-transparent: rgba(223, 73, 82, .25);
}

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

body {
    font-family: var(--font-serif);
    color: var(--foreground-default);
    background: var(--background-default);

    border-bottom: 8px solid var(--accent);

    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(--foreground-default)
}

/* emulating typewriter style */

em {
    font-style: normal;
    text-decoration: underline;
}

hr {
    border-color: transparent;
}

hr::after,
.hero::after {
    content: '~*~';
    text-align: center;
    display: block;
    width: 100%;
    color: var(--foreground-light);
}

.overlay {
    max-width: unset;
    width: calc(100% - 32px);
    margin-left: auto;
    margin-right: auto;
}

/* TYPOGRAPHY */

h1,
h2,
h3 {
    font-weight: bold;
    font-size: 1em;
    line-height: 1.625em;
    color: var(--foreground-default);
    margin-top: 1.8em;
    margin-bottom: 1em;

    padding-bottom: .125rem;
    display: inline-block;
}

p, li {
    line-height: 1.625em;
    margin: 1em 0;
}

li a,
p a {
    text-decoration: none;
    padding: 0 3px;
    border-radius: 3px;
    background: var(--accent-transparent);
}

li a:hover,
p a:hover {
    background: rgba(0, 0, 0, .1);
}

.postlist p a {
    border-radius: 0;
    background: transparent;
    padding-bottom: .125rem;
}

.postlist p a:hover {
    background: transparent;
}

.dateprefix {
    display: inline-block;
    min-width: 3.125rem;
    text-align: right;
    color: var(--foreground-light);
}

.desktop {
    display: none !important;
}

/* HEADER */

header {
    position: relative;
    height: 100px;

    /* prevent overflow by typewriter */
    overflow: hidden;
    max-width: 100%;
}

header::after {
    display: block;
    width: 240px;
    height: 200px;
    transform: rotate(24deg);
    content: '';
    background-image: url('/img/typewriter.jpg');
    background-size: 100%;
    background-position: bottom center;
    position: absolute;
    top: -126px;
    right: -50px;
    z-index: -1;
    opacity: .32;
    mix-blend-mode: multiply;
}

header a {
    text-decoration: none;
    white-space: nowrap;
}

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

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

.home {
    font-weight: bold;
    margin-right: 24px;
}

nav {
    flex-grow: 1;
    flex-shrink: 1;
    overflow-x: auto;
}

nav a {
    margin-right: 12px;
}

nav a.faded {
    color: var(--foreground-light);
}

/* FOOTER */

.prevInSection {
    text-align: left;
}

.nextInSection {
    text-align: right;
}

footer .overlay {
    height: 80px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 32px;
}

footer .right {
    height: 1em;
}

footer .right .square {
    display: inline-block;
    height: 1em;
    width: 1em;
    background: var(--foreground-default);
}

/* HOME */

.type-home  main {
    margin-top: 3rem;
}

/* SINGLETON */

main {
    overflow: hidden;
}

.meta {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.meta-item {
    flex-grow: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--foreground-light);
}

p img {
    margin: 1.5em 0;
    width: 100%;
    max-width: 700px;
}

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

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

pre > code {
    line-height: 1.5em;
    flex-shrinK: 0;
    display: block;
    padding: 1em;
}

code {
    background: var(--background-block);
}

p code {
    padding: 3px 5px;
}

/* YouTube embeds, mostly */
article > iframe {
    max-width: 100%;
}

@media only screen and (max-width: 600px) {
    p img {
        width: 100vw;
        max-width: unset;
        position: relative;
        top: 0;
        left: -16px;
    }
}

@media only screen and (min-width: 600px) {
    .overlay {
        max-width: 700px;
    }

    header::after {
        opacity: 1;
    }

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

    .desktop {
        display: initial !important;
    }
    .mobile {
        display: none !important;
    }
}

.right-align {
    text-align: right;
}

.system {
    font-family: system-ui, sans-serif;
}
