/* Syntax Highlighting Theme - Gruvbox inspired */
/* Based on the site's color scheme */

code[class*="language-"],
pre[class*="language-"] {
  color: var(--fg) !important;
  background: none;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.5;
  tab-size: 4;
  hyphens: none;
}

/* Ensure text nodes in code blocks have color */
pre[class*="language-"] > code {
  color: var(--fg);
}

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

/* All pre blocks should have relative positioning for copy button */
pre {
  position: relative;
  padding: 1em;
  margin: 1.5em 0;
  overflow: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  font-size: 0.8em;
  line-height: 1.5;
}

pre[class*="language-"] {
  padding: 1em;
  margin: 1.5em 0;
  overflow: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  position: relative;
}

:not(pre) > code[class*="language-"] {
  padding: 0.1em 0.3em;
  border-radius: 0.3em;
  white-space: normal;
  background: var(--code-bg);
}

/* Inline code */
:not(pre) > code {
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 0.3em;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  font-size: 0.9em;
}

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

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
  color: #8a1814;
}

.token.boolean,
.token.number {
  color: #b16286;
}

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

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

.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
  color: #d65d0e;
}

.token.keyword {
  color: #8a1814;
  font-weight: bold;
}

/* Missing token styles */
.token.literal-property.property,
.token.string-property.property {
  color: var(--nav-blue);
}

.token.parameter {
  color: var(--visited);
}

.token.function-variable.function {
  color: var(--nav-orange);
}

.token.regex,
.token.important {
  color: #d65d0e;
}

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

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

.token.entity {
  cursor: help;
}

/* Copy button styles */
.copy-button {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3em 0.6em;
  font-size: 0.8em;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  color: var(--fg);
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  z-index: 10;
}

.copy-button:hover {
  opacity: 1;
}

.copy-button:active {
  transform: scale(0.95);
}

.copy-button.copied {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}
