/**
 * Prism.js Theme - GitHub inspired
 * Optimized for OpenCode Replay with both light and dark mode support
 */

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

/* Code blocks */
pre[class*="language-"] {
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
  overflow: auto;
  border-radius: var(--radius-md);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
}

/* Token colors - Light mode */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #6a737d;
  font-style: italic;
}

.token.punctuation {
  color: #24292e;
}

.token.namespace {
  opacity: 0.7;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #005cc5;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #22863a;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #d73a49;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #d73a49;
}

.token.function,
.token.class-name {
  color: #6f42c1;
}

.token.regex,
.token.important,
.token.variable {
  color: #e36209;
}

.token.important,
.token.bold {
  font-weight: bold;
}

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

.token.entity {
  cursor: help;
}

/* Line highlighting */
.line-highlight {
  background: rgba(255, 255, 0, 0.1);
  border-left: 3px solid #f1c40f;
  margin-left: calc(-1 * var(--spacing-md) - 3px);
  padding-left: calc(var(--spacing-md) + 3px);
}

/* Line numbers */
.line-numbers .line-numbers-rows {
  position: absolute;
  pointer-events: none;
  top: 0;
  font-size: 100%;
  left: -3.8em;
  width: 3em;
  letter-spacing: -1px;
  border-right: 1px solid var(--color-border);
  user-select: none;
}

.line-numbers-rows > span {
  display: block;
  counter-increment: linenumber;
}

.line-numbers-rows > span:before {
  content: counter(linenumber);
  color: var(--color-text-muted);
  display: block;
  padding-right: 0.8em;
  text-align: right;
}

/* ============================================================================
   Dark Mode
   ============================================================================ */

:root[data-theme="dark"] code[class*="language-"],
:root[data-theme="dark"] pre[class*="language-"] {
  color: #e6edf3;
}

:root[data-theme="dark"] .token.comment,
:root[data-theme="dark"] .token.prolog,
:root[data-theme="dark"] .token.doctype,
:root[data-theme="dark"] .token.cdata {
  color: #8b949e;
}

:root[data-theme="dark"] .token.punctuation {
  color: #e6edf3;
}

:root[data-theme="dark"] .token.property,
:root[data-theme="dark"] .token.tag,
:root[data-theme="dark"] .token.boolean,
:root[data-theme="dark"] .token.number,
:root[data-theme="dark"] .token.constant,
:root[data-theme="dark"] .token.symbol,
:root[data-theme="dark"] .token.deleted {
  color: #79c0ff;
}

:root[data-theme="dark"] .token.selector,
:root[data-theme="dark"] .token.attr-name,
:root[data-theme="dark"] .token.string,
:root[data-theme="dark"] .token.char,
:root[data-theme="dark"] .token.builtin,
:root[data-theme="dark"] .token.inserted {
  color: #a5d6ff;
}

:root[data-theme="dark"] .token.operator,
:root[data-theme="dark"] .token.entity,
:root[data-theme="dark"] .token.url,
:root[data-theme="dark"] .language-css .token.string,
:root[data-theme="dark"] .style .token.string {
  color: #ff7b72;
}

:root[data-theme="dark"] .token.atrule,
:root[data-theme="dark"] .token.attr-value,
:root[data-theme="dark"] .token.keyword {
  color: #ff7b72;
}

:root[data-theme="dark"] .token.function,
:root[data-theme="dark"] .token.class-name {
  color: #d2a8ff;
}

:root[data-theme="dark"] .token.regex,
:root[data-theme="dark"] .token.important,
:root[data-theme="dark"] .token.variable {
  color: #ffa657;
}

/* Auto dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) code[class*="language-"],
  :root:not([data-theme="light"]) pre[class*="language-"] {
    color: #e6edf3;
  }

  :root:not([data-theme="light"]) .token.comment,
  :root:not([data-theme="light"]) .token.prolog,
  :root:not([data-theme="light"]) .token.doctype,
  :root:not([data-theme="light"]) .token.cdata {
    color: #8b949e;
  }

  :root:not([data-theme="light"]) .token.punctuation {
    color: #e6edf3;
  }

  :root:not([data-theme="light"]) .token.property,
  :root:not([data-theme="light"]) .token.tag,
  :root:not([data-theme="light"]) .token.boolean,
  :root:not([data-theme="light"]) .token.number,
  :root:not([data-theme="light"]) .token.constant,
  :root:not([data-theme="light"]) .token.symbol,
  :root:not([data-theme="light"]) .token.deleted {
    color: #79c0ff;
  }

  :root:not([data-theme="light"]) .token.selector,
  :root:not([data-theme="light"]) .token.attr-name,
  :root:not([data-theme="light"]) .token.string,
  :root:not([data-theme="light"]) .token.char,
  :root:not([data-theme="light"]) .token.builtin,
  :root:not([data-theme="light"]) .token.inserted {
    color: #a5d6ff;
  }

  :root:not([data-theme="light"]) .token.operator,
  :root:not([data-theme="light"]) .token.entity,
  :root:not([data-theme="light"]) .token.url,
  :root:not([data-theme="light"]) .language-css .token.string,
  :root:not([data-theme="light"]) .style .token.string {
    color: #ff7b72;
  }

  :root:not([data-theme="light"]) .token.atrule,
  :root:not([data-theme="light"]) .token.attr-value,
  :root:not([data-theme="light"]) .token.keyword {
    color: #ff7b72;
  }

  :root:not([data-theme="light"]) .token.function,
  :root:not([data-theme="light"]) .token.class-name {
    color: #d2a8ff;
  }

  :root:not([data-theme="light"]) .token.regex,
  :root:not([data-theme="light"]) .token.important,
  :root:not([data-theme="light"]) .token.variable {
    color: #ffa657;
  }
}
