/* ============================================
 * Execution Tracer
 * Styles for theme/tracer.js's step-through widget: a bordered "shelf" of
 * variable "boxes", matching the book's warehouse metaphor (see
 * VISUAL_STYLE.md's "Signature Element: The Wireframe Box"). Kept in its
 * own file, separate from general.css, so the tracer feature stays easy to
 * remove wholesale if it doesn't earn its keep.
 *
 * NOTE: shipped via book.toml's [output.html] additional-css, which copies
 * the file into the build with a hashed name and auto-injects its <link>.
 * Do NOT hand-link it from theme/index.hbs: mdBook 0.5 skips unregistered
 * theme extras, so ../../css/tracer.css emits a 404 path.
 * ============================================ */

.tracer-widget {
    margin: 1.5em 0;
    border: 1px solid var(--table-border-color);
    border-radius: var(--radius);
    background-color: var(--bg);
    overflow: hidden;
}

.tracer-mount {
    padding: 12px;
}

.tracer-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tracer-btn {
    font-family: var(--mono-font);
    font-size: 0.9em;
    font-weight: 500;
    padding: 6px 14px;
    border: 1px solid var(--table-border-color);
    border-radius: var(--radius);
    background-color: var(--code-block-bg);
    color: var(--fg);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.tracer-btn:hover:not(:disabled) {
    border-color: var(--links);
    color: var(--links);
}

.tracer-btn:focus-visible {
    outline: 2px solid var(--links);
    outline-offset: 2px;
}

.tracer-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tracer-status {
    font-family: var(--mono-font);
    font-size: 0.85em;
    color: var(--fg);
}

.tracer-shelf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    min-height: 56px;
}

/* A single sealed "crate" — one flat variable and its repr'd value. */
.tracer-box {
    min-width: 64px;
    padding: 6px 10px;
    border: 2px solid var(--fg);
    border-radius: var(--radius);
    background-color: var(--code-block-bg);
    font-family: var(--mono-font);
    font-size: 0.85em;
    text-align: center;
}

.tracer-box-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--links);
}

.tracer-box-value {
    display: block;
    word-break: break-word;
}

/* One-level-deep list/dict: a labeled shelf holding its own row of boxes.
 * Deliberately never nests a container inside another container — see
 * design.md's v1 scope ceiling (flat vars + one-level-deep only). */
.tracer-shelf-container {
    padding: 8px;
    border: 2px dashed var(--fg);
    border-radius: var(--radius);
    background-color: var(--quote-bg);
}

.tracer-shelf-container .tracer-shelf {
    margin-top: 6px;
    gap: 8px;
    min-height: 0;
}

.tracer-empty {
    font-family: var(--mono-font);
    font-size: 0.85em;
    color: var(--fg);
    opacity: 0.6;
}

.tracer-error {
    margin: 0;
    padding: 12px;
    font-family: var(--mono-font);
    font-size: 0.85em;
    background-color: color-mix(in srgb, var(--blockquote-caution-color) 12%, var(--bg));
    color: var(--blockquote-caution-color);
}
