/* Chroma syntax highlighting, in ink rather than colour.
 *
 * Hugo emits class-based tokens because markup.highlight.noClasses is false.
 * Following ascii.rest: keywords and names in full ink, the rest of the code a
 * step back, comments and punctuation two steps back. Colours come from the
 * tokens in tui-patch.css (--ink / --text / --muted / --spot-ink), so light, dark
 * and E-Ink all follow the theme without a second palette here.
 */

.chroma { -webkit-text-size-adjust: none; color: var(--text); }
.chroma .lnlinks { outline: none; text-decoration: none; color: inherit; }
.chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
.chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
.chroma .hl { display: block; background: color-mix(in oklab, var(--ink) 8%, transparent); }
.chroma .lnt,
.chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 1.5ch; color: var(--rule); }
.chroma .line { display: flex; }
.chroma .err { color: inherit; text-decoration: underline wavy var(--spot-ink); }

/* Keywords: full ink, a little weight. */
.chroma :is(.k, .kc, .kd, .kn, .kp, .kr, .ow) { color: var(--ink); font-weight: 600; }
.chroma .kt { color: var(--ink); }

/* Names that carry the structure: functions, types, builtins, tags. */
.chroma :is(.nf, .fm, .nc, .nn, .ne, .nb, .bp, .nt, .nd, .na) { color: var(--ink); }
.chroma :is(.n, .nx, .nv, .vc, .vg, .vi, .vm, .nl, .py, .no, .ni) { color: var(--text); }

/* Literals: numbers in ink, strings a step back. */
.chroma :is(.m, .mb, .mf, .mh, .mi, .il, .mo) { color: var(--ink); }
.chroma :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .l, .ld) { color: var(--text); }
.chroma :is(.se, .si) { color: var(--ink); }

/* Comments and punctuation: two steps back. No italic; it mangles CJK. */
.chroma :is(.c, .ch, .cm, .c1, .cs, .cp, .cpf) { color: var(--muted); font-style: normal; }
.chroma :is(.p, .o) { color: var(--muted); }

/* Generic (diffs, consoles, markup). */
.chroma .gd { color: var(--spot-ink); }
.chroma .gi { color: var(--ink); font-weight: 600; }
.chroma :is(.gh, .gu) { color: var(--ink); font-weight: 600; }
.chroma .ge { font-style: italic; }
.chroma .gs { font-weight: 600; }
.chroma :is(.go, .gp, .gt, .gr) { color: var(--muted); }
.chroma .gl { text-decoration: underline; }
.chroma .w { color: var(--rule); }
