/**
 * Stati theme for Prism.js
 *
 * Restrained multi-hue palette tuned for the site's code background
 * (--sunken). Every token holds at least 5:1 contrast in both themes.
 * The same classes are produced by markdown-it-prism (Markdown pages) and by
 * the `highlight` helper in stati.config.ts (homepage code panels).
 * markdown-it-prism puts the language class on <code> only, so the rules for
 * <pre> select the one around a highlighted <code>.
 */

code[class*='language-'],
pre:has(> code[class*='language-']) {
  color: #1f2937;
  background: none;
  font-family: 'Fira Code', 'Fira Code Fallback', Consolas, Monaco, monospace;
  font-variant-ligatures: none;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.65;
  tab-size: 2;
  hyphens: none;
}

pre:has(> code[class*='language-']) {
  overflow: auto;
}

.dark code[class*='language-'],
.dark pre:has(> code[class*='language-']) {
  color: #e2e8f0;
}

/* Comments */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #5c6b80;
  font-style: italic;
}

.dark .token.comment,
.dark .token.prolog,
.dark .token.doctype,
.dark .token.cdata {
  color: #8b98ad;
}

/* Punctuation and operators */
.token.punctuation,
.token.operator {
  color: #4b5563;
}

.dark .token.punctuation,
.dark .token.operator {
  color: #a7b1c2;
}

/* Keywords */
.token.keyword,
.token.atrule,
.token.important,
.token.rule {
  color: #a3165f;
}

.dark .token.keyword,
.dark .token.atrule,
.dark .token.important,
.dark .token.rule {
  color: #f472b6;
}

/* Strings */
.token.string,
.token.char,
.token.attr-value,
.token.template-string,
.token.inserted,
.token.url {
  color: #11753d;
}

.dark .token.string,
.dark .token.char,
.dark .token.attr-value,
.dark .token.template-string,
.dark .token.inserted,
.dark .token.url {
  color: #7dd3a0;
}

/* Numbers, booleans, constants */
.token.number,
.token.boolean,
.token.constant,
.token.symbol,
.token.null {
  color: #92400e;
}

.dark .token.number,
.dark .token.boolean,
.dark .token.constant,
.dark .token.symbol,
.dark .token.null {
  color: #fdba74;
}

/* Functions, class names, tags */
.token.function,
.token.class-name,
.token.tag,
.token.builtin,
.token.selector {
  color: #1d4ed8;
}

.dark .token.function,
.dark .token.class-name,
.dark .token.tag,
.dark .token.builtin,
.dark .token.selector {
  color: #93c5fd;
}

/* Properties, attributes, parameters */
.token.property,
.token.attr-name,
.token.parameter,
.token.variable,
.token.title,
.token.deleted {
  color: #6d28d9;
}

.dark .token.property,
.dark .token.attr-name,
.dark .token.parameter,
.dark .token.variable,
.dark .token.title,
.dark .token.deleted {
  color: #c4b5fd;
}

/* Tag punctuation reads as structure, not as a tag */
.token.tag .token.punctuation,
.token.attr-value .token.punctuation {
  color: #4b5563;
}

.dark .token.tag .token.punctuation,
.dark .token.attr-value .token.punctuation {
  color: #a7b1c2;
}

/* Template delimiters (Eta/EJS) */
.token.delimiter {
  color: #a3165f;
}

.dark .token.delimiter {
  color: #f472b6;
}

/* Markdown */
.language-markdown .token.title,
.language-markdown .token.title .token.punctuation {
  color: #1d4ed8;
  font-weight: 600;
}

.dark .language-markdown .token.title,
.dark .language-markdown .token.title .token.punctuation {
  color: #93c5fd;
}

.language-markdown .token.code {
  color: #11753d;
}

.dark .language-markdown .token.code {
  color: #7dd3a0;
}

.token.bold {
  font-weight: 600;
}

.token.italic {
  font-style: italic;
}

.token.namespace {
  opacity: 0.85;
}

/* Highlighted lines */
.highlight-line {
  display: block;
  margin: 0 -1.25rem;
  padding: 0 1.25rem;
  background-color: rgba(37, 99, 235, 0.08);
}

.dark .highlight-line {
  background-color: rgba(96, 165, 250, 0.1);
}
