/* General Layout, Typography, and Components */

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    font-size: 14px;
    line-height: 20px;
    padding: 20px 0;
    max-width: var(--content-width);
    margin: 0 auto;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition:
        background-color 0.3s ease,
        color 0.3s ease;

    counter-reset: sidenote-counter;
}

main:not(:has(section)),
section {
    background-color: var(--bg-float);
    border: 1px solid var(--border-color);
    padding: 1em;
    border-radius: 3px;
    margin: 1em 0;
}

@media (min-width: 900px) {
    body {
        padding: 20px;
    }
}

@media (max-width: 900px) {
    main:not(:has(section)),
    section {
        border-radius: 0;
        border-width: 0;
        border-top-width: 1px;
        border-bottom-width: 1px;
    }
}

p {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    word-spacing: -0.05em;
    hyphenate-limit-chars: 6 3 3;
    margin-top: 0.5em;
}

ul {
    margin: 0 0 0 -1em;
}

header,
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "Source Serif 4", "Source Serif 4 Fallback", Georgia, serif;
    /*
    font-family:
        ui-sans-serif,
        system -ui,
        sans-serif,
        "Apple Color Emoji",
        "Segoe UI Emoji",
        "Segoe UI Symbol",
        "Noto Color Emoji";
        */
    font-weight: normal;
    text-wrap: balance;
    line-height: 1em;
    margin: 0;
}

header .site-title {
    font-family:
        "Averia Serif Libre", "Source Serif 4", "Source Serif 4 Fallback",
        Georgia, serif;
}

/* Site Header */
header.site-header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header.site-header .header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

header.site-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

header.site-header .site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
}

header.site-header .site-title a {
    text-decoration: none;
    color: var(--text-color);
}

header.site-header nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

header.site-header nav a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1rem;
    transition: color 0.2s ease;
}

header.site-header nav a:hover {
    color: var(--link-color);
}

/* Article Header */
article header h1 {
    margin-bottom: 0.5rem;
}

article header .meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    padding: 0 5px;
    margin: 0 -5px;
    border-radius: 5px;
}

main a:hover {
    background: color-mix(in srgb, var(--link-color) 25%, transparent);
}

/* Code */
code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

pre:has(> code) {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 3px;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

table td,
table th {
    border: 1px solid var(--border-color);
    padding: 8px;
}

table th {
    background-color: var(--code-bg);
}

/* Post Lists */
.post-list {
    list-style: none;
    padding: 0;
}

.post-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.post-item:last-child {
    border-bottom: none;
}

.post-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-size: 0.9rem;
}
