/*
 * Lesson template — code.
 * Code is short, tested, and comes with a header that names the file
 * and says what was verified. highlight.js (loaded by lesson.js) paints
 * the tokens. The colours below map its classes onto the site palette,
 * so dark and light themes both stay on-brand. No highlight.js theme CSS.
 */

.code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 24px 0;
  overflow: hidden;
}
.code-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.code-head .tested { color: var(--accent3); }
.code-head .tested::before { content: '✓ '; }
.code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text);
}
/* highlight.js output. Transparent so the card background shows through. */
.code pre code.hljs {
  background: transparent;
  padding: 0;
  color: var(--text);
  display: block;
  font-family: inherit;
  font-size: inherit;
}
.code .hljs-keyword,
.code .hljs-literal { color: var(--accent2); }
.code .hljs-title,
.code .hljs-built_in,
.code .hljs-function { color: var(--accent); }
.code .hljs-string { color: var(--accent3); }
.code .hljs-number { color: var(--accent5); }
.code .hljs-comment { color: var(--text-dim); font-style: italic; }
.code .hljs-meta { color: var(--accent4); }

/* Older hand-coloured spans, if a page still has them. */
.code .kw { color: var(--accent2); }
.code .fn { color: var(--accent); }
.code .str { color: var(--accent3); }
.code .num { color: var(--accent5); }
.code .cmt { color: var(--text-dim); font-style: italic; }

/* Plain-English notes under a code block, one per highlighted line. */
.code-notes { border-top: 1px solid var(--border); padding: 12px 18px; }
.code-notes li { font-size: 0.9rem; }
.code-notes code { white-space: nowrap; }
