/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    color-scheme: light dark;

    --bg:          light-dark(#fafafa, #131313);
    --text:        light-dark(#222, #d9d9d9);
    --muted:       light-dark(#717171, #888);
    --link:        light-dark(#222, #d9d9d9);
    --link-hover:  light-dark(#555, #aaa);
    --border:      light-dark(#e0e0e0, #2a2a2a);
    --code-bg:     light-dark(#f0f0f0, #1c1c1c);
    --accent:      light-dark(#444, #bbb);
    --hl-keyword:  light-dark(#8f1d2c, #ff7b72);
    --hl-string:   light-dark(#236940, #7ee787);
    --hl-comment:  light-dark(#767676, #8b949e);
    --hl-fn:       light-dark(#0c4a80, #79c0ff);
    --hl-num:      light-dark(#9e4a00, #ffa657);
}

body {
    font-family: Georgia, "Times New Roman", serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
    max-width: 640px;
    margin: 0 auto;
    padding: 3rem 1.25rem;
    font-size: 1.05rem;
}

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

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

/* Nav */
nav {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
}

nav .site-name {
    display: block;
    font-size: 1.1rem;
    text-decoration: none;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

nav .nav-links a {
    text-decoration: none;
    color: var(--muted);
}

nav .nav-links a:hover {
    color: var(--text);
}

nav .nav-links .sep {
    color: var(--border);
    margin: 0 0.15rem;
}

/* Headings */
h1 {
    font-size: 1.6rem;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

h2 {
    font-size: 1.2rem;
    margin: 2rem 0 0.75rem;
    letter-spacing: -0.01em;
}

h3 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; font-style: italic; }

/* Text */
p { margin: 0.85rem 0; }

.subtitle {
    color: var(--muted);
    font-size: 1.05rem;
    margin-top: -0.25rem;
    margin-bottom: 1.25rem;
}

ul, ol { margin: 0.85rem 0; padding-left: 1.5rem; }
li { margin: 0.3rem 0; }

small { color: var(--muted); font-size: 0.85rem; }

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

blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1rem;
    color: var(--muted);
    margin: 1.25rem 0;
    font-style: italic;
}

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

.post-list li {
    margin: 0;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

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

.post-list .post-title {
    display: block;
    font-weight: 600;
}

.post-list .post-meta {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    margin-top: 0.15rem;
}

.post-list .post-desc {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

/* Project list */
.project-list { list-style: none; padding-left: 0; }

.project-list li {
    margin: 0;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.project-list li:last-child { border-bottom: none; }

.project-tags {
    color: var(--muted);
    font-size: 0.8rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Code */
pre {
    background: var(--code-bg);
    padding: 1rem;
    overflow-x: auto;
    border-radius: 3px;
    margin: 1.25rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

code {
    font-size: 0.88rem;
    background: var(--code-bg);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
}

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

.codehilite { background: var(--code-bg); border-radius: 3px; }
.codehilite .k, .codehilite .kd, .codehilite .kn, .codehilite .kp, .codehilite .kr, .codehilite .ow { color: var(--hl-keyword); font-weight: 600; }
.codehilite .s, .codehilite .sa, .codehilite .sb, .codehilite .sc, .codehilite .dl, .codehilite .sd, .codehilite .s2, .codehilite .se, .codehilite .sh, .codehilite .si, .codehilite .sx, .codehilite .sr, .codehilite .s1, .codehilite .ss { color: var(--hl-string); }
.codehilite .c, .codehilite .ch, .codehilite .cm, .codehilite .cp, .codehilite .cpf, .codehilite .c1, .codehilite .cs { color: var(--hl-comment); font-style: italic; }
.codehilite .nf, .codehilite .fm, .codehilite .nc { color: var(--hl-fn); font-weight: 600; }
.codehilite .nb { color: var(--hl-fn); }
.codehilite .mi, .codehilite .mf, .codehilite .mh, .codehilite .mo, .codehilite .il { color: var(--hl-num); }

/* Form */
label {
    display: block;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--muted);
}

input, textarea {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.3rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    border-radius: 3px;
}

input:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

button {
    margin-top: 1.25rem;
    padding: 0.55rem 1.75rem;
    background: var(--text);
    color: var(--bg);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    border-radius: 3px;
}

button:hover { opacity: 0.85; }

/* Article */
article { margin-bottom: 2rem; }
article img { max-width: 100%; height: auto; }

.article-meta {
    color: var(--muted);
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    font-size: 0.9rem;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

footer a { color: var(--muted); }
footer a:hover { color: var(--text); }
footer .sep { margin: 0 0.25rem; }
