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

    --font-sans: system-ui, 'Helvetica', sans-serif;
    --font-serif: 'Times New Roman', serif;
    --font-mono: 'Inconsolata', 'Menlo', 'Courier', monospace;

    /* default light-mode colors */
    --foreground-default: #222;
    --foreground-light: #778;
    --line-grey: #5f5f5f;
    --line-light: #777;
    --background-default: #f8f8f8;
    --background-block: #eee;
}

.dark {
    --foreground-default: #f8f8f8;
    --foreground-light: #d8d8d8;
    --background-default: #111;
    --background-block: #555;
}

.dark .dark\:invert {
    filter: invert(1);
}

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

body {
    font-family: var(--font-sans);
    color: var(--foreground-default);
    background: var(--background-default);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

main {
    flex-shrink: 0;

    /* paper feel */
    width: calc(100% - 6em);
    padding: 0 1em;
    margin: 0 auto;
}

a {
    color: var(--foreground-default)
}

p a[href],
li a[href] {
    color: var(--foreground-default);
    text-decoration: underline;
    text-decoration-color: var(--line-light);
    transition: color .2s, text-decoration-color .2s;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    cursor: pointer;
}

p a[href]:hover,
li a[href]:hover,
p a[href]:focus,
li a[href]:focus {
    text-decoration-color: var(--foreground-light);
}

/* TYPOGRAPHY */

h1,
h2,
h3,
h4,
p,
li {
    font-size: 1em;
    font-weight: normal;
    line-height: 1.5em;
    margin: 1em 0;
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
}

p,
li {
    max-width: 52ch;
}

.postlist li a,
.postlist p a {
    padding: initial;
    background: initial;
}

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

.desktop {
    display: none !important;
}

hr {
    background: var(--foreground-light);
    max-width: 32ch;
    padding: 0;
    margin: 2em 0;
}

@media only screen and (min-width: 600px) {
    main {
        max-width: 780px;
        /* paper feel */
        margin: 2em auto;
        padding: 0 2em;
    }

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

    .desktop {
        display: initial !important;
    }

    .mobile {
        display: none !important;
    }
}

/* paper feel */
@media only screen and (max-width: 760px) {
    main {
        margin: 0;
        max-width: unset;
        width: calc(100% - 2em);
        background: initial;
        box-shadow: none;
    }
}

/* HEADER */

header a {
    text-decoration: none;
}

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

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

header {
    height: 100px;
}

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

nav a {
    margin-right: 12px;
}

/* FOOTER */

.prevInSection {
    text-align: left;
}

.nextInSection {
    text-align: right;
}

footer {
    margin: 6em 0;
    padding-bottom: 32px;
    line-height: 1.5em;
}

footer p {
    margin: 0;
}

a.footer-mailto-link[href] {
    color: inherit;
    text-decoration-color: transparent;
}

/* SINGLETON */

main {
    overflow: hidden;
}

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

.meta {
    color: var(--foreground-light);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.meta-item {
    width: 0;
    flex-grow: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

p img {
    margin: 1.5em 0;
    width: 100%;
}

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

pre, code {
    color: var(--foreground-default);
    font-family: var(--font-mono);
}

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;
}

blockquote {
    font-style: italic;
}

/* utilities */

.text-muted {
    color: var(--line-light);
}

.dark .text-muted {
    color: #999;
}

.italic {
    font-style: italic;
}

.indent {
    margin-left: 2ch;
}

/* index */

.index-hero {
    margin: 6em 0;
}

.index-section .section-header {
    font-weight: bold;
}

@media only screen and (min-width: 768px) {
    .index-section {
        display: flex;
        flex-direction: row;
        gap: 8px;
    }

    .index-section .section-header {
        min-width: 8rem;
    }

    footer {
        display: flex;
        justify-content: space-between;
        flex-direction: row;
        align-items: center;
    }
}

