/* ══════════════════════════════════════════════════════════════════════
   code-block — chrome for the fenced code blocks markdown.js emits
   ══════════════════════════════════════════════════════════════════════

   Styles `.code-block-wrapper` + its header bar, toolbar buttons, and the
   scrolling <pre> inside. Deliberately GLOBAL and unprefixed, because
   markdown.js emits these class names unprefixed and three different surfaces
   render them: assistant prose, the artifact source viewer, and the artifact
   version-history preview (see code-highlight.css, which shares the palette).

   Linked globally from index.html beside code-highlight.css. It previously
   lived in chat-components.css, which is loaded only by the Chat app's own
   _loadCss — so the other six widget prefixes (Signals, Chaos, Forge,
   lani-assistant, controls-lab) rendered code blocks with NO chrome at all.

   NOT part of the shared prose sheet: this is a component, not typography, and
   its theme contract is the opposite one — the code surface stays dark in both
   light and dark app themes (see code-highlight.css), while prose follows the
   skin. */

/* ── Code block wrapper (Chatbot parity: zinc-950 + zinc-700 bar) ── */
.code-block-wrapper {
    margin: 8px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #09090b;
    font-family: sans-serif;
}
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #3f3f46;
    color: #fff;
}
.code-block-lang {
    font-size: 12px;
    text-transform: lowercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
/* Filenames keep their original case (README.md, App.tsx) and use a mono
   font so the header reads as a path rather than a language tag. */
.code-block-lang--filename {
    text-transform: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-block-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.code-block-copy,
.code-block-download {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.code-block-copy:hover,
.code-block-download:hover {
    background: #27272a;
}

/* ── Task list items ────────────────────────────── */
.task-item {
    list-style: none;
    margin-left: -16px;
}
.task-item input[type="checkbox"] {
    margin-right: 6px;
    pointer-events: none;
}
.task-done { text-decoration: line-through; opacity: 0.6; }

/* ── Wide-content scrolling ─────────────────────────────────────────────
   The wrapper keeps overflow:hidden for its border-radius, so the SCROLLER
   must be the <pre> inside it. Without this the <pre> simply grew wider than
   the wrapper and the wrapper clipped it — no scrollbar, no way to reach the
   rest of the line, and no indication anything was missing. Silent truncation,
   not a visible clip. */
.code-block-wrapper > pre {
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.code-block-wrapper > pre > code {
    /* Never wrap code: indentation is semantic. */
    white-space: pre;
    display: block;
    min-width: 0;
}

/* A nested task item must not inherit the top-level negative margin, which
   would hang its checkbox to the left of the parent item's text. Nested task
   lists only became reachable when the renderer learned to nest at all. */
li li.task-item { margin-left: 0; }
