/*
 * Dolfin editor — syntax token styles
 *
 * CodeMirror 6 classHighlighter maps each grammar tag to a stable CSS class:
 *   .tok-keyword   .tok-typeName  .tok-string   .tok-number
 *   .tok-comment   .tok-punctuation  .tok-invalid  …
 *
 * Colors reference the Catppuccin CSS variables declared in style.css so they
 * adapt automatically when the user switches between light (Latte) and dark
 * (Macchiato) themes.
 *
 * To restyle a token just change its rule here — no JS needed.
 */

/* ── Syntax tokens ──────────────────────────────────────────────────── */

.tok-keyword {
  color: var(--ctp-blue);
  font-weight: 600;
}

.tok-typeName {
  color: var(--ctp-teal);
}

.tok-string {
  color: var(--ctp-peach);
}

.tok-number {
  color: var(--ctp-green);
}

.tok-comment {
  color: var(--ctp-overlay1);
  font-style: italic;
  /* Uncomment to use a different font or size for comments: */
  font-family: 'Georgia', serif;
  /* font-size: 0.9em; */
}

.tok-punctuation {
  color: var(--ctp-subtext0);
}

.tok-invalid {
  color: var(--ctp-red);
  text-decoration: underline wavy;
}

/* ── LSP semantic token highlights (dlf-tt-N maps to LSP tokenType index) ── */

:root {
  --dlf-tt-namespace: var(--ctp-yellow);
  --dlf-tt-type:      var(--ctp-blue);
  --dlf-tt-class:     var(--ctp-red);
  --dlf-tt-enum:      var(--ctp-mauve);
  --dlf-tt-enumMember:var(--ctp-peach);
  --dlf-tt-function:  var(--ctp-teal);
  --dlf-tt-macro:     var(--ctp-green);
  --dlf-tt-variable:  var(--ctp-text);
  --dlf-tt-keyword:   var(--ctp-mauve);
}

.dlf-tt-0 { color: var(--dlf-tt-namespace); }
.dlf-tt-1 { color: var(--dlf-tt-type); }
.dlf-tt-2 { color: var(--dlf-tt-class); }
.dlf-tt-3 { color: var(--dlf-tt-enum); }
.dlf-tt-4 { color: var(--dlf-tt-enumMember); }
.dlf-tt-5 { color: var(--dlf-tt-function); }
.dlf-tt-6 { color: var(--dlf-tt-macro); }
.dlf-tt-7 { color: var(--dlf-tt-variable); }
.dlf-tt-8 { color: var(--dlf-tt-keyword); }
.dlf-tt-decl { font-weight: 600; }

/* ── LSP hover tooltip ────────────────────────────────────────────────────── */

.dlf-hover {
  padding: 4px 8px;
  max-width: 480px;
  font-size: 0.85em;
  font-family: monospace;
  background: var(--ctp-mantle);
  color: var(--ctp-text);
  border: 1px solid var(--ctp-surface1);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}
