/* =========================================================
   Prism.js Syntax Highlighting Theme
   Matches the Federal Data Science Learning Handbook design
   Light: warm neutral base / Dark: deep navy base
   ========================================================= */

code[class*="language-"],
pre[class*="language-"] {
  color: #2D2D2A;
  background: none;
  font-family: 'SFMono-Regular', 'Fira Code', 'Cascadia Code', 'Consolas', 'Liberation Mono', monospace;
  font-size: 0.875rem;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.7;
  tab-size: 2;
  hyphens: none;
}

pre[class*="language-"] {
  padding: 1.25rem 1.5rem;
  margin: 0;
  overflow: auto;
  border-radius: 0 0 10px 10px;
  background: #F1F0EC;
  border: 1px solid #E8E7E3;
  border-top: none;
}

:not(pre) > code[class*="language-"] {
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: #F1F0EC;
  white-space: normal;
}

/* ---- Token Colors (Light) ---- */

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #8A8375;
  font-style: italic;
}

.token.punctuation {
  color: #6B6560;
}

.token.namespace {
  opacity: 0.7;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #003B5C; /* Jupiter navy */
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #009845; /* Qlik green */
}

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

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #1B2A4A; /* Palantir blue */
  font-weight: 600;
}

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

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

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

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

.token.entity {
  cursor: help;
}

/* ---- Shell / Bash ---- */
.language-bash .token.function {
  color: #003B5C;
  font-weight: 600;
}

.language-bash .token.string {
  color: #009845;
}

/* ---- Python-specific ---- */
.language-python .token.decorator {
  color: var(--advana-gold, #C5A572);
}

/* ---- Dark Mode Overrides ---- */
[data-theme="dark"] code[class*="language-"],
[data-theme="dark"] pre[class*="language-"] {
  color: #CDD3DE;
  background: #161B26;
}

[data-theme="dark"] pre[class*="language-"] {
  background: #161B26;
  border-color: #252B3A;
}

[data-theme="dark"] :not(pre) > code[class*="language-"] {
  background: #161B26;
}

[data-theme="dark"] .token.comment,
[data-theme="dark"] .token.prolog,
[data-theme="dark"] .token.doctype,
[data-theme="dark"] .token.cdata {
  /* UX-023: Lightened from #606876 to #7A8290 for ~4:1 contrast on #161B26 background */
  color: #7A8290;
  font-style: italic;
}

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

[data-theme="dark"] .token.property,
[data-theme="dark"] .token.tag,
[data-theme="dark"] .token.boolean,
[data-theme="dark"] .token.number,
[data-theme="dark"] .token.constant,
[data-theme="dark"] .token.symbol,
[data-theme="dark"] .token.deleted {
  color: #5BA3C9; /* lighter Jupiter navy */
}

[data-theme="dark"] .token.selector,
[data-theme="dark"] .token.attr-name,
[data-theme="dark"] .token.string,
[data-theme="dark"] .token.char,
[data-theme="dark"] .token.builtin,
[data-theme="dark"] .token.inserted {
  color: #4DC97A; /* lighter Qlik green */
}

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

[data-theme="dark"] .token.atrule,
[data-theme="dark"] .token.attr-value,
[data-theme="dark"] .token.keyword {
  color: #7EB3D4;
  font-weight: 600;
}

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

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

/* ---- Line Highlight ---- */
.line-highlight {
  background: rgba(197, 165, 114, 0.1);
  border-left: 3px solid #C5A572;
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
  display: block;
}

/* ---- Line Numbers ---- */
.line-numbers .line-numbers-rows {
  border-right: 1px solid #D0CEC8;
}

[data-theme="dark"] .line-numbers .line-numbers-rows {
  border-right-color: #252B3A;
}

.line-numbers-rows > span:before {
  color: #B8B4A8;
}

[data-theme="dark"] .line-numbers-rows > span:before {
  color: #4A5060;
}

/* ---- Toolbar ---- */
div.code-toolbar > .toolbar {
  top: 0.5rem;
  right: 0.5rem;
}

div.code-toolbar > .toolbar .toolbar-item button {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

div.code-toolbar > .toolbar .toolbar-item button:hover {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
}
