/* ==========================================================================
   Stochastic theme — technical enhancements
   Code blocks (One Dark), inline code, KaTeX math, tables, blockquotes
   Loaded after Source's screen.css so these rules win.
   ========================================================================== */

:root {
  --st-code-bg: #282c34;
  --st-code-fg: #abb2bf;
  --st-code-border: #21252b;
  --st-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono",
             "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- Code blocks ---------- */
.gh-content pre,
.kg-code-card pre {
  position: relative;
  background: var(--st-code-bg);
  color: var(--st-code-fg);
  border: 1px solid var(--st-code-border);
  border-radius: 10px;
  padding: 1.1em 1.25em;
  margin: 1.6em 0;
  font-family: var(--st-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  tab-size: 4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
}

.gh-content pre code,
.kg-code-card pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border: 0;
  white-space: pre;
  text-shadow: none;
}

/* Language label (from data-language on the code card, if present) */
.gh-content pre[data-lang]::before,
.kg-code-card[data-lang]::before {
  content: attr(data-lang);
}

/* ---------- Copy button ---------- */
.st-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font: 600 11px/1 var(--st-mono);
  letter-spacing: 0.03em;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.gh-content pre:hover .st-copy-btn,
.kg-code-card pre:hover .st-copy-btn {
  opacity: 1;
}
.st-copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.st-copy-btn.is-copied {
  color: #98c379;
  border-color: rgba(152, 195, 121, 0.5);
}

/* ---------- Inline code ---------- */
.gh-content :not(pre) > code {
  font-family: var(--st-mono);
  font-size: 0.86em;
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: rgba(135, 131, 120, 0.15);
  color: #c7254e;
  white-space: nowrap;
}
:root[data-theme="dark"] .gh-content :not(pre) > code,
.dark .gh-content :not(pre) > code {
  background: rgba(255, 255, 255, 0.08);
  color: #e06c75;
}

/* ==========================================================================
   Prism — One Dark token colors
   ========================================================================== */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #7f848e; font-style: italic; }
.token.punctuation { color: #abb2bf; }
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #d19a66; }
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #98c379; }
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #56b6c2; }
.token.atrule,
.token.attr-value,
.token.keyword { color: #c678dd; }
.token.function,
.token.class-name { color: #61afef; }
.token.regex,
.token.important,
.token.variable { color: #e06c75; }
.token.important,
.token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

/* ==========================================================================
   KaTeX math
   ========================================================================== */
.katex { font-size: 1.06em; }
.katex-display {
  margin: 1.6em 0;
  padding: 0.4em 0.2em;
  overflow-x: auto;
  overflow-y: hidden;
}
.katex-display > .katex { white-space: nowrap; }
/* subtle scrollbar for wide equations / code on webkit */
.katex-display::-webkit-scrollbar,
.gh-content pre::-webkit-scrollbar { height: 8px; }
.katex-display::-webkit-scrollbar-thumb,
.gh-content pre::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.4);
  border-radius: 4px;
}

/* ==========================================================================
   Tables & blockquotes — technical polish
   ========================================================================== */
.gh-content table:not(.kg-nft-card table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.6em 0;
  display: block;
  overflow-x: auto;
}
.gh-content th,
.gh-content td {
  border: 1px solid rgba(128, 128, 128, 0.25);
  padding: 0.5em 0.8em;
  text-align: left;
}
.gh-content thead th {
  background: rgba(128, 128, 128, 0.08);
  font-weight: 600;
}
