:root {
    --bg: #ffffff;
    --text: #1d1d1f;
    --muted: #5a5a5e;
    --line: #e3e3e8;
    --link: #0a58b5;
    --max: 58rem;
    --font-serif: "Tinos", Georgia, "Times New Roman", Times, serif;
    --font-sans:
        "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
        Arial, sans-serif;
}

[data-theme="dark"] {
    --bg: #0d1117;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #30363d;
    --link: #58a6ff;
}

[data-theme="dark"] pre        { background: #1e2430; border-color: #2a2d35; }
[data-theme="dark"] code       { background: #1e2430; }
[data-theme="dark"] a:hover    { color: #79b8ff; }
[data-theme="dark"] div.highlight > .chroma { background: #1e2430; border-color: #2a2d35; }

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.62;
    text-rendering: optimizeLegibility;
}

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 2.25rem 1.25rem 3rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
}

#theme-toggle {
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

#theme-toggle:hover {
    color: var(--text);
}

.site-title {
    font-family: var(--font-sans);
    color: var(--text);
    text-decoration: none;
    font-size: 1.75rem;
    letter-spacing: -0.01em;
    font-weight: 600;
}

.site-subtitle {
    font-family: var(--font-sans);
    color: var(--muted);
    margin: 0.35rem 0 0;
    font-size: 0.97rem;
}

h1 {
    font-family: var(--font-sans);
    font-size: clamp(1.8rem, 4.8vw, 2.4rem);
    line-height: 1.2;
    margin: 0 0 0.85rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h2,
h3 {
    font-family: var(--font-sans);
    line-height: 1.3;
    margin: 1.6rem 0 0.7rem;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.35rem;
}

h3 {
    font-size: 1.1rem;
}

p,
ul,
ol {
    margin: 0 0 0.95rem;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

a:hover {
    color: #003f86;
}

.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.6rem;
    border-top: 1px solid var(--line);
    padding: 0.65rem 0;
}

.post-list li:last-child {
    border-bottom: 1px solid var(--line);
}

.meta {
    font-family: var(--font-sans);
    color: var(--muted);
    font-size: 0.88rem;
    white-space: nowrap;
}

.crumbs {
    font-family: var(--font-sans);
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.content {
    margin-top: 1rem;
}

.content p:first-child {
    font-size: 1.05rem;
}

.site-footer {
    font-family: var(--font-sans);
    margin-top: 2.5rem;
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
    color: var(--muted);
    font-size: 0.88rem;
}

/* ── Code ───────────────────────────────────────────── */

pre,
code {
    font-family:
        "JetBrains Mono", "Fira Code", ui-monospace,
        "Cascadia Code", "Menlo", "Monaco", monospace;
    font-size: 0.855rem;
}

code {
    background: #e8e1ce;
    padding: 0.12em 0.38em;
    border-radius: 3px;
    font-size: 0.875em;
}

pre {
    background: #eee8d5;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1.1rem 1.3rem;
    overflow-x: auto;
    line-height: 1.55;
    margin: 1.5rem 0;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* ── Code blocks (Chroma, noClasses=false) ──────────────────── */
/*
 * With noClasses=false, Chroma outputs CSS classes (.chroma, .lntd, .lnt,
 * .line, etc.). syntax.css provides the token colors for light + dark.
 * Structure: div.highlight > .chroma > code > table.lntable > tr >
 *            td.lntd (line nums) + td.lntd (code)
 */

/* Outer div.chroma is the visual container (Hugo wraps table in div.chroma) */
div.highlight > .chroma {
    background: #eee8d5;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1.1rem 1.3rem;
    overflow: hidden;
    margin: 1.5rem 0;
}

/* Table fills the container */
div.highlight .lntable {
    width: 100%;
    table-layout: fixed;
    border-spacing: 0;
}

/* Line number column */
div.highlight .lntd:first-child {
    width: 2.2em;
    padding-right: 0.75em;
    text-align: right;
    vertical-align: top;
}

/* Code column */
div.highlight .lntd:last-child {
    vertical-align: top;
}

/* Inner pre elements: reset box styling, outer pre.chroma is the container */
div.highlight .lntd pre {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    overflow: visible;
    line-height: 1.55;
}

/* Reset code inside highlight (would otherwise get inline-code styling) */
div.highlight code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Wrap long lines */
div.highlight .lntd:last-child pre {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-all;
}

/* Hanging indent: each source line is a .line span (display:flex in syntax.css).
 * block + padding/text-indent makes continuations appear indented. */
div.highlight .line {
    display: block !important;
    padding-left: 2em;
    text-indent: -2em;
}

@media (max-width: 640px) {
    .wrap {
        padding-top: 1.5rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .post-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
}
