html {
    font-family: "JetBrains Mono", Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: auto;
    max-width: 90ch;
    padding-top: 0.5rem;
    padding-right: 1em;
    padding-bottom: 3em;
    padding-left: 1em;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-variant-ligatures: none;
}

img {
    max-width: 100%;
}

img:not([src$=".svg"]),
article > div,
blockquote,
pre {
    border-radius: 0.4rem;
}

img[src$="#pixelate"] {
    image-rendering: pixelated;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "JetBrains Mono", Georgia, serif;
    font-weight: 500;
    letter-spacing: -0.05em;
    margin: 1.5rem 0 0.75rem;
}

h1 {
    font-size: 1.4rem;
}

h2 {
    font-size: 1.1rem;
}

h3 {
    font-size: 0.9rem;
}

p {
    text-align: left;
}

p,
ul,
ol,
article > footer,
article > header {
    margin: 0 0 0.6rem;
}

pre,
blockquote {
    padding: 1.5rem;
    margin: 0 0 1.5rem;
}

pre {
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.5;
}

pre code {
    background: 0 !important;
    padding: 0;
    font-size: inherit;
    font-variant-ligatures: none;
}

code {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-variant-ligatures: none;
}

blockquote > *:last-child {
    margin-bottom: 0;
}

/* Theme variables */
html.light {
    color-scheme: light;
    background: var(--light-bg);
    --tc: var(--light-bg);
    --accent: var(--light-accent);
    --accent-hover: var(--light-accent-hover);
    --text: var(--light-text);
    --muted: var(--light-text-muted);
    --code-bg: var(--light-code-bg);
    --border: var(--light-border);
    --bold: var(--light-bold);
    --italic: var(--light-italic);
    --headers: var(--light-headers);
    color: var(--text);
}

html.dark {
    color-scheme: dark;
    background: var(--dark-bg);
    --tc: var(--dark-bg);
    --accent: var(--dark-accent);
    --accent-hover: var(--dark-accent-hover);
    --text: var(--dark-text);
    --muted: var(--dark-text-muted);
    --code-bg: var(--dark-code-bg);
    --border: var(--dark-border);
    --bold: var(--dark-bold);
    --italic: var(--dark-italic);
    --headers: var(--dark-headers);
    color: var(--text);
}

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

html a:visited {
    color: var(--accent);
}

html a:hover {
    color: var(--accent-hover);
}

html header > div > span > a {
    text-decoration: none;
}

html header > div > span > a:hover {
    text-decoration: underline;
}

html p,
html ul,
html ol,
html .desc {
    color: var(--muted);
}

html h1,
html h2,
html h3,
html h4,
html h5,
html h6 {
    color: var(--headers);
}

html strong,
html b {
    color: var(--bold);
}

html em,
html i {
    color: var(--italic);
}

article > img,
article > p > img,
article > div {
    display: block;
    margin-bottom: 1.5rem;
    width: 100%;
}



article table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--code-bg);
    border-radius: 0.4rem;
    font-size: 0.9rem;
}

article th,
article td {
    padding: 0.75rem 1rem;
    text-align: left;
}

article th {
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

article h1::before {
    content: "# ";
    color: var(--border);
}

article h2::before {
    content: "## ";
    color: var(--border);
}

article h3::before {
    content: "### ";
    color: var(--border);
}

article h4::before {
    content: "#### ";
    color: var(--border);
}

article h5::before {
    content: "##### ";
    color: var(--border);
}

article h6::before {
    content: "###### ";
    color: var(--border);
}

.yt {
    aspect-ratio: 16/9;
    width: 100%;
    overflow: hidden;
}

.yt iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.s {
    font-size: 0.85rem;
}

.theme {
    display: inline-block;
    width: 1.125rem;
    height: 1.125rem;
    vertical-align: middle;
    margin-bottom: 0.15rem;
}

.theme img,
.theme svg {
    width: 100%;
    height: 100%;
}

html.light .theme img:first-child,
html.light .theme svg:first-child,
html.dark .theme img:last-child,
html.dark .theme svg:last-child {
    display: none;
}

header strong {
    font-family: "JetBrains Mono", Georgia, serif;
    font-weight: 600;
    color: var(--accent);
}

#site-header {
    margin-bottom: 0.25rem;
    padding-bottom: 0;
}

#site-header > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: center;
    margin: 0.35rem 0 2rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.post-meta time {
    opacity: 0.6;
}

.post-tags {
    display: inline-flex;
    flex-wrap: wrap;
    width: 100%;
    color: var(--accent);
    font-size: 0.90rem;
}

.post-tags-label {
    color: var(--muted);
    margin-right: 0.35rem;
}

.post-tags a {
    text-decoration: none;
    color: var(--accent);
}

.post-tags a:hover {
    color: var(--accent-hover);
}

.tag-comma {
    color: var(--muted);
    margin-right: 0.35rem;
}
.site-icon {
    width: 2.25rem;
    height: 2.25rem;
    vertical-align: middle;
    margin-right: 1rem;
    color: var(--accent);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--accent);
}

.custom-icon {
    height: auto;
    max-height: 3rem;
    width: auto;
    margin-right: 1rem;
}

body > footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body > footer img,
body > footer svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

.tags {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.tags li {
    display: inline;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 0;
    font-size: 0.9rem;
}

nav a {
    font-weight: 500;
}

nav img,
nav svg {
    display: none;
}

.tag-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.tag-list li {
    display: flex;
    gap: 0.2rem;
    align-items: baseline;
    margin-bottom: 0rem;
}

.tag-list li:last-child {
    margin-bottom: 0;
}

.tag-list a {
    text-decoration: none;
}

.tag-list .count {
    color: var(--muted);
    font-size: 0.9em;
}

.p {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.p li {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    align-items: baseline;
}

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

.p time {
    opacity: 0.7;
    flex-shrink: 0;
}

.profile-pic {
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 1.5rem;
}

.projects .project {
    margin-bottom: 1.5rem;
}

.project header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.project header h2 {
    margin: 0;
    font-size: 1.375rem;
}

.project-emoji {
    font-size: 1.5rem;
}

.project-image {
    max-width: 200px;
    aspect-ratio: 1;
    object-fit: cover;
    float: right;
    margin: 0 0 1.5rem 1.5rem;
    border-radius: 0.4rem;
}

.project p {
    margin-bottom: 0.75rem;
    text-align: left;
}

.project .tags {
    margin: 0;
}

.lb {
    position: fixed;
    inset: 0;
    background: #000d;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    cursor: pointer;
}

.lb img {
    max-width: 95vw;
    max-height: 95vh;
}

/* Giallo syntax highlighting */
.giallo-l {
    display: inline-block;
    min-height: 1lh;
    width: 100%;
}

.giallo-ln {
    display: inline-block;
    user-select: none;
    margin-right: 0.4em;
    padding: 0.4em;
    min-width: 3ch;
    text-align: right;
    opacity: 0.8;
}

/* Syntax highlighting */
html.light .z-comment {
    color: #6a737d;
    font-style: italic;
}
html.light .z-keyword {
    color: #d73a49;
}
html.light .z-string {
    color: #22863a;
}
html.light .z-number {
    color: #005cc5;
}
html.light .z-function {
    color: #6f42c1;
}
html.light .z-type {
    color: #005cc5;
}
html.light .z-constant {
    color: #005cc5;
}
html.light .z-variable {
    color: #e36209;
}
html.light .z-attribute {
    color: #6f42c1;
}
html.light .z-tag {
    color: #22863a;
}
html.light .z-operator {
    color: #d73a49;
}
html.light .z-punctuation {
    color: #24292e;
}
html.light .z-builtin {
    color: #6f42c1;
}
html.light .z-label {
    color: #005cc5;
}
html.light .z-namespace {
    color: #e36209;
}

html.dark .z-comment {
    color: #8b949e;
    font-style: italic;
}
html.dark .z-keyword {
    color: #ff7b72;
}
html.dark .z-string {
    color: #a5d6ff;
}
html.dark .z-number {
    color: #79c0ff;
}
html.dark .z-function {
    color: #d2a8ff;
}
html.dark .z-type {
    color: #79c0ff;
}
html.dark .z-constant {
    color: #79c0ff;
}
html.dark .z-variable {
    color: #ffa657;
}
html.dark .z-attribute {
    color: #d2a8ff;
}
html.dark .z-tag {
    color: #7ee787;
}
html.dark .z-operator {
    color: #ff7b72;
}
html.dark .z-punctuation {
    color: #c9d1d9;
}
html.dark .z-builtin {
    color: #d2a8ff;
}
html.dark .z-label {
    color: #79c0ff;
}
html.dark .z-namespace {
    color: #ffa657;
}

html.dark img[src$=".svg"],
html.dark nav svg,
html.dark .theme svg,
html.dark footer svg {
    filter: invert(1);
}

html.light pre,
html.light article > img,
html.light article > p > img {
    background: var(--code-bg) !important;
    color-scheme: light !important;
}

html.dark pre,
html.dark article > img,
html.dark article > p > img {
    background: var(--code-bg) !important;
    color-scheme: dark !important;
}

/* Inline code only */
html code {
    background: var(--code-bg);
    /* color: var(--text); */
}

/* Code blocks: let theme handle foreground color */
/* html pre code {
    color: inherit;
} */

html hr {
    border: 0;
    border-bottom: 1px solid var(--border);
    border-width: 0 0 2px 0;
    border-style: dashed;
    width: 95%;
    clear: both;
    margin: 1.5rem auto;
}

.site-sep {
    margin: 0.4rem 0;
    width: 100%;
}

.bottom-sep {
    display: none;
}

html blockquote {
    border: 1.5px dashed var(--border);
    background: var(--code-bg);
    padding: 1.25rem;
    padding-left: 2.5rem;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--muted);
    opacity: 0.95;
    border-radius: 0.5rem;
    position: relative;
}

html blockquote::before {
    content: "**";
    position: absolute;
    left: 0.6rem;
    top: 0.4rem;
    font-size: 0.8rem;
    line-height: 1;
    color: var(--accent);
    font-style: normal;
}

@media (max-width: 600px) {
    html blockquote {
        padding: 1rem;
        padding-left: 2rem;
        font-size: 0.85rem;
    }

    html blockquote::before {
        left: 0.4rem;
        top: 0.3rem;
        font-size: 1.2rem;
    }
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

a.active {
    color: var(--accent);
}

a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 2px;
}

@media (max-width: 600px) {
    html {
        font-size: 0.95rem;
    }
}

@media (max-width: 30em) {
    header .desc {
        display: none;
    }

    #site-header > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-brand {
        width: 100%;
    }

    nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    nav a {
        display: inline-block;
    }

    .theme {
        position: absolute;
        top: 0.7rem;
        right: 1rem;
    }
}

.recent-posts {
    margin-top: 2.5rem;
}

.recent-posts h2 {
    margin-bottom: 1rem;
}

/* Scroll to top button */
#scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.4rem;
    background-color: var(--code-bg);
    color: var(--muted);
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s, opacity 0.3s, color 0.2s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding-bottom: 3px;
}

#scroll-to-top.show {
    visibility: visible;
    opacity: 0.8;
}

#scroll-to-top:hover {
    opacity: 1;
    color: var(--accent);
}

@media (max-width: 600px) {
    #scroll-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 2rem;
        height: 2rem;
        font-size: 1.1rem;
    }
}
