:root {
    --fg: #1a1a1a;
    --muted: #777;
    --heading: #666;
    --border: #e1e1e1;
    --bg: #ffffff;
    --code-bg: #f8f8f8;
    --code-fg: #1a1a1a;
    --accent: #2a6286;
    --pulse: #eee;

    /* Syntax tokens — One Light palette, readable on the light code fill. */
    --syn-comment: #a0a1a7;
    --syn-keyword: #a626a4;
    --syn-string: #50a14f;
    --syn-number: #986801;
    --syn-function: #4078f2;
    --syn-builtin: #0184bc;
    --syn-class: #c18401;
    --syn-variable: #e45649;
    --syn-operator: #383a42;
}

html {
    -webkit-text-size-adjust: 100%;
}

/* Zig's font stack. */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Liberation Sans", "Helvetica Neue", Helvetica, Arial, sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji";
    font-size: 16px;
    line-height: 1.45;
    color: var(--fg);
    background-color: var(--bg);
    margin: 0;
}

/* Wide reading column, matching Zig's .container (max-width 1000px). */
#content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 1rem 4rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Zig headings: muted gray, tight, no dividers. */
#content h1,
#content h2,
#content h3,
#content h4,
#content h5,
#content h6 {
    margin: 1.6em 0 0.5em;
    line-height: 1.2;
    font-weight: 700;
    color: var(--heading);
}

#content h1 { font-size: 2em; }
#content h2 { font-size: 1.5em; }
#content h3 { font-size: 1.25em; }
#content h4 { font-size: 1.1em; }
#content h5 { font-size: 0.9em; }
#content h6 { font-size: 0.85em; color: var(--muted); }

#content > :first-child { margin-top: 0; }

#content :is(h1, h2, h3, h4, h5, h6):empty { display: none; }

/* Zig-style entry date: a small, muted label sitting just above the title,
   never a heading. Written in Markdown as <span class="date">…</span>. */
#content p:has(.date) {
    margin: 1.8em 0 0;
}

#content .date {
    font-size: 0.85em;
    color: var(--muted);
    letter-spacing: 0.02em;
}

#content p:has(.date) + h1,
#content p:has(.date) + h2 {
    margin-top: 0.15em;
}

/* Pulse a dated entry when linked to by its anchor (Zig devlog behaviour). */
#content :target {
    animation: pulse 2s ease-in-out 1 forwards;
}

@keyframes pulse {
    0%, 100% { background-color: var(--pulse); }
    50% { background-color: var(--bg); }
}

#content p {
    margin: 0.8em 0;
}

#content a {
    color: var(--accent);
    text-decoration: none;
}

#content a:hover { text-decoration: underline; }

#content ul,
#content ol {
    margin: 0 0 1rem;
    padding-left: 2em;
}

#content li + li { margin-top: 0.25em; }

#content li > ul,
#content li > ol {
    margin: 0.25em 0 0;
}

/* Task lists rendered from "- [ ]" / "- [x]". */
#content .task-list-item {
    list-style: none;
}

#content .task-list-item input[type="checkbox"] {
    margin: 0 0.5em 0.25em -1.4em;
    vertical-align: middle;
}

#content blockquote {
    margin: 0 0 1rem;
    padding: 0 1em;
    color: var(--muted);
    border-left: 0.25em solid var(--border);
}

/* Code / scripts: Zig uses default monospace on a light fill. */
#content code,
#content pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 0.95em;
}

#content code {
    background-color: var(--code-bg);
    color: var(--code-fg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

#content pre {
    background-color: var(--code-bg);
    color: var(--code-fg);
    padding: 0.5em;
    border-radius: 4px;
    overflow: auto;
    line-height: 1.45;
}

#content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* Pygments syntax highlighting (codehilite). Token colours come from the
   --syn-* variables, so light/dark swap automatically. Language is taken from
   the fenced-block info string (```bash, ```python, ```java, …). */
#content .codehilite { margin: 1rem 0; }
#content .codehilite pre { margin: 0; }

#content .codehilite .c,
#content .codehilite .ch,
#content .codehilite .cm,
#content .codehilite .cp,
#content .codehilite .cpf,
#content .codehilite .c1,
#content .codehilite .cs {
    color: var(--syn-comment);
    font-style: italic;
}

#content .codehilite .k,
#content .codehilite .kc,
#content .codehilite .kd,
#content .codehilite .kn,
#content .codehilite .kp,
#content .codehilite .kr,
#content .codehilite .kt {
    color: var(--syn-keyword);
}

#content .codehilite .s,
#content .codehilite .sa,
#content .codehilite .sb,
#content .codehilite .sc,
#content .codehilite .dl,
#content .codehilite .sd,
#content .codehilite .s2,
#content .codehilite .sh,
#content .codehilite .sx,
#content .codehilite .sr,
#content .codehilite .s1,
#content .codehilite .ss {
    color: var(--syn-string);
}

#content .codehilite .m,
#content .codehilite .mb,
#content .codehilite .mf,
#content .codehilite .mh,
#content .codehilite .mi,
#content .codehilite .mo,
#content .codehilite .il,
#content .codehilite .no {
    color: var(--syn-number);
}

#content .codehilite .nf,
#content .codehilite .fm,
#content .codehilite .nd {
    color: var(--syn-function);
}

#content .codehilite .nb,
#content .codehilite .bp,
#content .codehilite .ni {
    color: var(--syn-builtin);
}

#content .codehilite .nc,
#content .codehilite .nn,
#content .codehilite .ne,
#content .codehilite .nl {
    color: var(--syn-class);
}

#content .codehilite .nv,
#content .codehilite .vc,
#content .codehilite .vg,
#content .codehilite .vi,
#content .codehilite .nt,
#content .codehilite .na {
    color: var(--syn-variable);
}

#content .codehilite .o,
#content .codehilite .ow,
#content .codehilite .si,
#content .codehilite .se {
    color: var(--syn-operator);
}

/* Don't flag Pygments' "error" tokens (e.g. shell heredocs) with a red box. */
#content .codehilite .err {
    color: inherit;
    background: none;
    border: 0;
}

#content table {
    border-collapse: collapse;
    margin-bottom: 1rem;
    display: block;
    overflow-x: auto;
}

#content table th,
#content table td {
    padding: 6px 13px;
    border: 1px solid var(--border);
}

#content table th { font-weight: 600; }
#content table tr:nth-child(2n) { background-color: var(--code-bg); }

#content hr {
    height: 1px;
    margin: 2rem 0;
    background-color: var(--border);
    border: 0;
}

#content img {
    max-width: 100%;
    box-sizing: border-box;
}

/* Footer "Home" link. */
nav {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

/* Zig dark mode: #111 canvas, #bbb text, #88f links, #1e1e1e code. */
@media (prefers-color-scheme: dark) {
    :root {
        --fg: #bbb;
        --muted: #949494;
        --heading: #aaa;
        --border: #444;
        --bg: #111111;
        --code-bg: #1e1e1e;
        --code-fg: #ccc;
        --accent: #88f;
        --pulse: #222;

        /* Syntax tokens — One Dark palette, like Zig's bright code. */
        --syn-comment: #5c6370;
        --syn-keyword: #c678dd;
        --syn-string: #98c379;
        --syn-number: #d19a66;
        --syn-function: #61afef;
        --syn-builtin: #56b6c2;
        --syn-class: #e5c07b;
        --syn-variable: #e06c75;
        --syn-operator: #abb2bf;
    }
}
