/* Theme-based styling for code blocks and syntax highlighting */

/* Dark-only Code Blocks */
.code-theme pre,
.code-theme code,
.dark-code-theme pre,
.dark-code-theme code {
  background-color: var(--bg-secondary) !important;
  background-image: var(--noise-pattern) !important;
  background-size: var(--noise-size) var(--noise-size) !important;
  background-repeat: repeat !important;
  color: var(--text-primary) !important;
  border-color: var(--border-glass) !important;
}

.code-theme .hljs,
.dark-code-theme .hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  color: var(--text-primary) !important;
  background: var(--bg-secondary) !important;
  background-image: var(--noise-pattern) !important;
  background-size: var(--noise-size) var(--noise-size) !important;
  background-repeat: repeat !important;
}

.code-theme .hljs-comment,
.code-theme .hljs-quote,
.code-theme .hljs-variable,
.dark-code-theme .hljs-comment,
.dark-code-theme .hljs-quote,
.dark-code-theme .hljs-variable {
  color: #6a9955 !important;
}

.code-theme .hljs-keyword,
.code-theme .hljs-selector-tag,
.code-theme .hljs-built_in,
.code-theme .hljs-name,
.code-theme .hljs-tag,
.dark-code-theme .hljs-keyword,
.dark-code-theme .hljs-selector-tag,
.dark-code-theme .hljs-built_in,
.dark-code-theme .hljs-name,
.dark-code-theme .hljs-tag {
  color: #569cd6 !important;
}

.code-theme .hljs-string,
.code-theme .hljs-title,
.code-theme .hljs-section,
.code-theme .hljs-attribute,
.code-theme .hljs-literal,
.code-theme .hljs-template-tag,
.code-theme .hljs-template-variable,
.code-theme .hljs-type,
.code-theme .hljs-addition,
.dark-code-theme .hljs-string,
.dark-code-theme .hljs-title,
.dark-code-theme .hljs-section,
.dark-code-theme .hljs-attribute,
.dark-code-theme .hljs-literal,
.dark-code-theme .hljs-template-tag,
.dark-code-theme .hljs-template-variable,
.dark-code-theme .hljs-type,
.dark-code-theme .hljs-addition {
  color: #ce9178 !important;
}

.code-theme .hljs-deletion,
.code-theme .hljs-selector-attr,
.code-theme .hljs-selector-pseudo,
.code-theme .hljs-meta,
.dark-code-theme .hljs-deletion,
.dark-code-theme .hljs-selector-attr,
.dark-code-theme .hljs-selector-pseudo,
.dark-code-theme .hljs-meta {
  color: #d16969 !important;
}

.code-theme .hljs-doctag,
.dark-code-theme .hljs-doctag {
  color: #608b4e !important;
}

.code-theme .hljs-attr,
.dark-code-theme .hljs-attr {
  color: #9cdcfe !important;
}

.code-theme .hljs-symbol,
.code-theme .hljs-bullet,
.code-theme .hljs-link,
.dark-code-theme .hljs-symbol,
.dark-code-theme .hljs-bullet,
.dark-code-theme .hljs-link {
  color: #569cd6 !important;
}

/* Code block header styling */
.code-theme .code-block-header,
.dark-code-theme .code-block-header {
  background-color: var(--bg-glass-thick) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-glass) !important;
}

/* Inline code styling */
.code-theme :not(pre) > code,
.dark-code-theme :not(pre) > code {
  background-color: var(--bg-glass) !important;
  background-image: var(--noise-pattern) !important;
  background-size: var(--noise-size) var(--noise-size) !important;
  background-repeat: repeat !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-glass) !important;
}

/* Prose overrides for dark mode */
.prose-invert pre {
  background-color: var(--bg-secondary) !important;
  background-image: var(--noise-pattern) !important;
  background-size: var(--noise-size) var(--noise-size) !important;
  background-repeat: repeat !important;
  color: var(--text-primary) !important;
}

.prose-invert code {
  color: var(--text-primary) !important;
}

/* Prose overrides for light mode */
/* Light prose variants removed */

/* Override any existing styles */
.prose-invert .hljs,
.prose-invert pre code {
  background-color: var(--bg-secondary) !important;
  background-image: var(--noise-pattern) !important;
  background-size: var(--noise-size) var(--noise-size) !important;
  background-repeat: repeat !important;
  color: var(--text-primary) !important;
}

/* Markdown table dark overrides (loaded last to win cascade) */
.markdown-content table thead,
.markdown-content table thead tr,
.markdown-content table thead th,
.markdown-content.prose table thead,
.markdown-content.prose table thead tr,
.markdown-content.prose table thead th,
.markdown-content.prose-invert table thead,
.markdown-content.prose-invert table thead tr,
.markdown-content.prose-invert table thead th,
.markdown-content table tr:first-child th {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-glass) !important;
}

.markdown-content table td,
.markdown-content.prose table td,
.markdown-content.prose-invert table td {
  color: var(--text-primary) !important;
}
