@media (prefers-color-scheme: dark) {
    :root {
        --body-bg-color: #202124;
        --text-color: #fafffc;
        --link-color: lightblue;
        --link-hover-color: rgb(65, 65, 65);
        --header-color: rgb(212, 199, 237);
        --muted-color: #9aa0a6;
        --code-bg: #2a2d31;
    }
}

@media (prefers-color-scheme: light) {
    :root {
        --body-bg-color: #fafffc;
        --text-color: #000000;
        --link-color: blue;
        --link-hover-color: #dfe7ee;
        --header-color: rgb(133, 77, 237);
        --muted-color: #5f6368;
        --code-bg: #eef2f7;
    }
}

* {
    font-family: 'Noto Sans', sans-serif;
}

/* Prevent long URLs from forcing horizontal scroll on mobile. */
a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

#top-container {
    display: block;
}

img {
    border-radius: 8px;
}

#subtitle {
    margin-bottom: 0.3em;
}

#date {
    margin-top: 0;
    line-height: 1.4;
    color: var(--muted-text-color, #888);
    font-size: 0.9em;
}

@media only screen and (max-width: 680px) {
    body {
        padding: 8px !important;
    }
}

body {
    padding: 4px 48px;
    background-color: var(--body-bg-color);
}

h1, h2, h3 {
    margin: 8px 0;
    color: var(--header-color);
}

blockquote, ul, table, details, summary {
    color: var(--text-color);
}

a {
    padding: 0 4px;
    color: var(--link-color);
}

p > a, i > a, li > a, b > a {
    padding: 0px;
}

a:hover {
    background-color: var(--link-hover-color);
}

p, li, blockquote, table, summary, details {
    line-height: 1.5;
    font-size: 1.2rem;
    letter-spacing: 0.04rem;
}

p {
    display: inline;
    margin: 0;
    color: var(--text-color);
}

.content {
    display: block;
    margin: 1rem 0px;
}

.muted {
    color: var(--muted-color);
    font-size: 0.95rem;
}

blockquote.content {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 3px solid var(--header-color);
    font-style: italic;
}

blockquote.content .muted {
    font-style: normal;
}

code {
    background-color: var(--code-bg);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95em;
}

hr {
    border: 0;
    border-top: 1px solid var(--link-hover-color);
    margin: 12px 0 16px;
}

#overall {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.demovid {
    max-width: 640px;
    width: 100%;
    display: block;
    margin: 1rem auto;
    border-radius: 8px;
}

.demovid-top {
    max-width: 300px;
    margin: 1rem auto 1.25rem;
    text-align: center;
}

.demovid-top figcaption {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 0.35rem;
    text-align: left;
}

.demovid-top video {
    width: 100%;
    display: block;
    border-radius: 6px;
    cursor: pointer;
}

.variants {
    border-collapse: collapse;
    margin: 1rem auto;
    max-width: 620px;
    width: 100%;
    font-size: 0.95rem;
}
.variants th, .variants td {
    border: 1px solid #333;
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.variants thead th {
    background: var(--code-bg);
    color: var(--header-color);
    font-weight: 600;
}
.variants tbody th {
    background: var(--code-bg);
    color: var(--header-color);
    font-weight: 600;
    width: 5.5rem;
}

.center {
    text-align: center;
}

.center img {
    max-width: 100%;
    margin: 1rem auto;
    display: block;
}

/* Table of contents */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 12px;
}

#toc {
    margin: 8px 0 24px;
    font-size: 0.95em;
}

#toc ol {
    list-style: decimal;
    margin: 0;
    padding-left: 1.6em;
    color: var(--muted-color);
}

#toc li {
    margin: 3px 0;
}

#toc li::marker {
    color: var(--muted-color);
}

#toc a {
    padding: 0;
}

/* Back to top */
#back-to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    color: var(--text-color);
    background: var(--code-bg);
    border: 1px solid var(--muted-color);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    padding: 0;
}

#back-to-top.visible {
    opacity: 0.85;
    pointer-events: auto;
}

#back-to-top:hover {
    opacity: 1;
    background: var(--link-hover-color);
}

/* Top-of-post quicklinks — surface the two main artifacts right below the title. */
.quicklinks {
    display: block;
    margin: 0.75rem 0 0;
    padding: 0.6rem 0.9rem;
    background: var(--code-bg);
    border-left: 3px solid var(--header-color);
    border-radius: 4px;
    font-size: 1.05rem;
    line-height: 1.7;
}
.quicklinks b {
    color: var(--header-color);
    margin-right: 0.25rem;
}
