/* paper (default) */
:root,
html[data-theme="paper"] {
    --bg: #f8f9fa;
    --fg: #222;
    --muted: #444;
    --code-bg: #ebebeb;
    --border: #111;
    --link: #00e;
    --link-visited: #551a8b;
    --link-hover-bg: #111;
    --link-hover-fg: #f5f5f5;
    --font-mono:
        "SF Mono", Monaco, Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", "Ubuntu Mono",
        "Courier New", ui-monospace, monospace;
    --font-sans:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="invert"] {
    --bg: #1a1a1a;
    --fg: #fff;
    --muted: #b3b3b3;
    --code-bg: #252525;
    --border: #fff;
    --link: #79b8ff;
    --link-visited: #bc8cff;
    --link-hover-bg: #fff;
    --link-hover-fg: #111;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0 auto;
    padding: 2em 1.25em 3em;
    max-width: 72ch;
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.55;
    background: var(--bg);
    color: var(--fg);
}

.site-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 1em;
    margin-bottom: 1.5em;
    padding-bottom: 0.65em;
    border-bottom: 1px solid var(--border);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35em 0.5em;
}

.site-nav .sep {
    color: var(--muted);
    user-select: none;
}

.site-bar-end {
    display: flex;
    align-items: baseline;
    gap: 0.75em;
}

.invert-btn,
.copy-btn {
    font: inherit;
    font-family: var(--font-mono);
    color: var(--fg);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.15em 0.5em;
    cursor: pointer;
}

.invert-btn:hover,
.copy-btn:hover {
    background: var(--link-hover-bg);
    color: var(--link-hover-fg);
}

a {
    color: var(--link);
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited);
}

a:hover,
a:focus-visible,
a:active {
    background: var(--fg);
    color: var(--bg);
    text-decoration: none;
}

h1,
h2,
h3,
h4 {
    font-weight: bold;
    line-height: 1.25;
    margin: 1.25em 0 0.4em;
}

h1 {
    font-size: 1.5em;
    margin-top: 0;
}

h2 {
    font-size: 1.2em;
    margin-top: 1.75em;
}

h2:first-child {
    margin-top: 0;
}

h3 {
    font-size: 1.05em;
}

p {
    margin: 0.5em 0;
}

ul,
ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

li {
    margin: 0.2em 0;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.75em 0;
}

.muted {
    color: var(--muted);
}

section {
    margin: 1.75em 0;
}

main.home section {
    text-align: left;
    margin: 3em auto;
}

main.home #intro {
    margin-bottom: 0.5em;
}

main.home #intro h1 {
    margin-bottom: 0.65em;
}

main.home #intro p {
    margin: 0.55em 0;
}

main.home #intro ul {
    margin: 0.75em 0;
}

main.home section > h2:not(:first-child) {
    margin-top: 3em;
}

main.home h2 {
    margin-bottom: 0.85em;
}

main.home section > h2 + p,
main.home section > h2 + ul,
main.home section > h2 + .experience-item {
    margin-top: 0.85em;
}

main.home li {
    margin: 0.35em 0;
}

main.home hr {
    margin: 3em 0;
}

main.home .experience-item {
    margin: 1.5em 0;
}

main.home footer {
    text-align: center;
    margin-top: 3.25em;
}

.experience-item {
    margin: 0.85em 0;
    padding-left: 1em;
    border-left: 2px solid var(--border);
}

.experience-item p {
    margin: 0.45em 0;
}

.experience-item p:first-child {
    margin-top: 0;
}

.experience-item p:last-child {
    margin-bottom: 0;
}

main > h1 {
    margin-bottom: 1em;
}

main:not(.home) article.post {
    margin: 0 0 2.5em;
}

main.post-page > p:last-child {
    margin-top: 2em;
}

/* blog list */
.post-list {
    list-style: none;
    padding: 0;
    margin-top: 1em;
}

.post-list li {
    margin: 0.55em 0;
}

.post-list .post-line {
    display: block;
}

.post-list .post-date {
    font-family: var(--font-mono);
}

.post-list a {
    font-family: var(--font-sans);
}

main.blog > h1 {
    font-family: var(--font-mono);
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 0.65em;
    line-height: 1.25;
}

main.blog footer {
    text-align: center;
    margin-top: 3.25em;
}

main.post-page {
    font-family: var(--font-sans);
}

.post-header {
    margin-bottom: 2em;
    padding-bottom: 1.25em;
    border-bottom: 1px solid var(--border);
}

.post-header h1 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0 0 0.65em;
    line-height: 1.35;
}

.post-description {
    margin: 0 0 0.65em;
    line-height: 1.6;
}

.post-meta {
    margin: 0;
}

/* markdown prose */
.post-body {
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
}

.post-body > :first-child {
    margin-top: 0;
}

.post-body > :last-child {
    margin-bottom: 0;
}

.post-body p {
    margin: 1.1em 0;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
    font-weight: bold;
    line-height: 1.35;
}

.post-body h1 {
    font-size: 1.35em;
    margin: 2em 0 0.75em;
}

.post-body h2 {
    font-size: 1.15em;
    margin: 2.25em 0 0.85em;
}

.post-body h3 {
    font-size: 1.05em;
    margin: 1.75em 0 0.65em;
}

.post-body h4 {
    font-size: 1em;
    margin: 1.5em 0 0.5em;
}

.post-body ul,
.post-body ol {
    margin: 1.1em 0;
    padding-left: 1.5em;
}

.post-body li {
    margin: 0.4em 0;
}

.post-body li > ul,
.post-body li > ol {
    margin: 0.35em 0;
}

.post-body img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 1.75em auto;
    border: 1px solid #ddd;
}

.post-body figure.post-figure {
    margin: 1.75em auto;
    width: 100%;
    max-width: 100%;
}

.post-body figure.post-figure img {
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.post-body .post-caption {
    margin: 0.35em 0 0;
    font-size: 0.9em;
    color: var(--muted);
    line-height: 1.45;
    text-align: center;
}

@media (min-width: 640px) {
    .post-body > img,
    .post-body p > img {
        width: 75%;
        max-width: 75%;
    }

    .post-body figure.post-figure {
        width: 75%;
        max-width: 75%;
    }
}

.post-body blockquote {
    margin: 1.5em 0;
    padding: 0.5em 0 0.5em 1em;
    border-left: 3px solid var(--border);
    color: var(--muted);
}

.post-body hr {
    margin: 2.25em 0;
}

.post-body pre {
    overflow-x: auto;
    margin: 1.5em 0;
    padding: 0.85em 1em;
    background: var(--code-bg);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.post-body .code-block {
    margin: 1.5em 0;
}

.post-body .code-block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1em;
    padding: 0.15em 0.35em 0.15em 0.65em;
    border: 1px solid var(--border);
    border-bottom: none;
    background: var(--bg);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
}

.post-body .code-block-lang {
    color: var(--muted);
}

.post-body .code-block pre {
    margin: 0;
    border-top: none;
}

.post-body code {
    font-family: var(--font-sans);
    background: var(--code-bg);
    padding: 0.1em 0.3em;
}

.post-body pre code {
    padding: 0;
    background: transparent;
    font-family: var(--font-mono);
}

.post-body pre code.hljs {
    background: transparent;
    color: inherit;
}

html[data-theme="invert"] .post-body .hljs {
    color: #e6edf3;
}

html[data-theme="invert"] .post-body .hljs-comment,
html[data-theme="invert"] .post-body .hljs-quote {
    color: #8b949e;
}

html[data-theme="invert"] .post-body .hljs-keyword,
html[data-theme="invert"] .post-body .hljs-selector-tag,
html[data-theme="invert"] .post-body .hljs-built_in,
html[data-theme="invert"] .post-body .hljs-type {
    color: #ff7b72;
}

html[data-theme="invert"] .post-body .hljs-string,
html[data-theme="invert"] .post-body .hljs-meta .hljs-string,
html[data-theme="invert"] .post-body .hljs-regexp {
    color: #a5d6ff;
}

html[data-theme="invert"] .post-body .hljs-title,
html[data-theme="invert"] .post-body .hljs-title.class_,
html[data-theme="invert"] .post-body .hljs-title.function_ {
    color: #d2a8ff;
}

html[data-theme="invert"] .post-body .hljs-number,
html[data-theme="invert"] .post-body .hljs-literal {
    color: #79c0ff;
}

html[data-theme="invert"] .post-body .hljs-attr,
html[data-theme="invert"] .post-body .hljs-attribute {
    color: #79c0ff;
}

.post-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    overflow-x: auto;
    display: block;
}

.post-body th,
.post-body td {
    border: 1px solid var(--border);
    padding: 0.35em 0.6em;
    text-align: left;
}

.post-body th {
    font-weight: bold;
}

.post-body del {
    color: var(--muted);
}

.post-body input[type="checkbox"] {
    margin-right: 0.35em;
}

footer {
    margin-top: 2.5em;
    padding-top: 0.75em;
    color: var(--muted);
}
