/* Syntax highlighting theme — restrained, tuned for light and dark.
   Token colors are driven by variables so the two themes stay in sync. */

:root {
  --tok-comment: #939aa3;
  --tok-punct: #71767f;
  --tok-key: #b21e6b;
  --tok-string: #157a52;
  --tok-number: #9a5b00;
  --tok-func: #2c5fbf;
  --tok-class: #2c5fbf;
  --tok-symbol: #9a5b00;
  --tok-regex: #7c3aed;
  --tok-important: #b21e6b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tok-comment: #6a716b;
    --tok-punct: #8b918b;
    --tok-key: #e879b0;
    --tok-string: #5cc88f;
    --tok-number: #d99a5b;
    --tok-func: #7aa2f7;
    --tok-class: #7aa2f7;
    --tok-symbol: #d99a5b;
    --tok-regex: #c99bf5;
    --tok-important: #e879b0;
  }
}

:root[data-theme="dark"] {
  --tok-comment: #6a716b;
  --tok-punct: #8b918b;
  --tok-key: #e879b0;
  --tok-string: #5cc88f;
  --tok-number: #d99a5b;
  --tok-func: #7aa2f7;
  --tok-class: #7aa2f7;
  --tok-symbol: #d99a5b;
  --tok-regex: #c99bf5;
  --tok-important: #e879b0;
}

code[class*="language-"],
pre[class*="language-"] {
  color: var(--ink);
  background: none;
  font-family: var(--font-mono);
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  tab-size: 2;
  hyphens: none;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--tok-comment);
  font-style: italic;
}

.token.punctuation {
  color: var(--tok-punct);
}

.token.property,
.token.tag,
.token.key,
.token.keyword,
.token.atrule,
.token.selector,
.token.important {
  color: var(--tok-key);
}

.token.boolean,
.token.number,
.token.constant,
.token.symbol {
  color: var(--tok-number);
}

.token.string,
.token.char,
.token.attr-value,
.token.inserted,
.token.builtin {
  color: var(--tok-string);
}

.token.attr-name,
.token.function,
.token.class-name {
  color: var(--tok-func);
}

.token.operator,
.token.entity,
.token.url,
.token.variable {
  color: var(--tok-punct);
}

.token.regex {
  color: var(--tok-regex);
}

.token.deleted {
  color: #c0392b;
}

.token.important,
.token.bold {
  font-weight: var(--fw-semibold);
}
.token.italic {
  font-style: italic;
}

/* Ledger custom grammar aliases (date→keyword, directive→important,
   commodity→symbol, account→class-name). */
.language-ledger .token.symbol {
  color: var(--tok-symbol);
}
.language-ledger .token.class-name {
  color: var(--tok-class);
}
