/*
 * static/css/workblocks.css — the work blocks (batch 4 §10, plan R-106): one dropdown per run of behind-the-scenes
 * work, "Doing stuff" + cycling dots while the run is live, "Did some stuff" once it is finished, collapsed by
 * default (static/js/chat/work-block.js draws them).
 *
 * The UI overhaul (batch 4 §9 phase 2) gives the header the step rows' quiet look: a borderless 32 px row with a
 * line chevron, the label in the accent while the run is live and in the secondary text once it is done; the open
 * run hangs from a hairline rail. The steps inside keep their chat.css rules (.work-run, .work-step, .think-chip,
 * .tool-chip, .folded-chip). Tokens only (tokens.css and the profile's theme.css), so both themes follow; every
 * selector is defined once (I7).
 */

.work-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    min-width: 0;
    max-width: 100%;
}
.work-block-head { display: flex; min-width: 0; max-width: 100%; margin-left: -8px; }

/* The header: a quiet row; gold words while the run is live, the secondary text once it is done. */
.work-block-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    max-width: 100%;
    padding: 4px 12px 4px 6px;
    font: var(--t-label-l);
    text-align: left;
    color: var(--c-on-2);
    background: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
button.work-block-toggle { cursor: pointer; }
button.work-block-toggle:hover { color: var(--c-on); background: var(--c-hover); }
.work-block[data-live="true"] .work-block-toggle { color: var(--c-accent-text); }
.work-block[data-live="true"] button.work-block-toggle:hover { color: var(--c-accent-text); background: var(--c-hover); }

/* A chevron line icon (right closed, down open); the opener keeps the slot so its label never moves. */
.work-block-chevron {
    display: inline-block;
    flex: none;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    background: var(--c-on-3);
    -webkit-mask: var(--icon-chevron-right) center / contain no-repeat;
    mask: var(--icon-chevron-right) center / contain no-repeat;
    transition: transform var(--dur-2) var(--ease-standard);
}
.work-block-toggle[aria-expanded="true"] .work-block-chevron { transform: rotate(90deg); }
.work-block[data-live="true"] .work-block-chevron { background: var(--c-accent); }
.work-block[data-empty="true"] .work-block-chevron { visibility: hidden; }

.work-block-label { min-width: 0; overflow-wrap: anywhere; }
/* The dots (Ray: . -> .. -> ... -> .) sit right after the label in a box as wide as "...", so the row never changes
   width while they cycle: 450 ms a step. CSS, not script: the page's DOM stays still (computer use watches it). */
.work-block-dots { display: inline-block; flex: none; width: 1.1em; text-align: left; white-space: pre; }
.work-block-dots::after { content: "."; animation: work-block-dots 1350ms steps(1, end) infinite; }
@keyframes work-block-dots {
    0% { content: "."; }
    33.333% { content: ".."; }
    66.667% { content: "..."; }
}
.work-block[data-live="false"] .work-block-dots { display: none; }

/* The open run hangs from a hairline rail under the chevron; its steps are rows (chat.css). */
.work-block > .work-run {
    align-self: stretch;
    margin: 0 0 var(--space-1) 3px;
    padding: 2px 0 2px 14px;
    border-left: 1.5px solid var(--c-outline-variant);
}

/* Reduced motion: the dots hold still at "..." (and the chevron turns without a transition, base.css). */
@media (prefers-reduced-motion: reduce) {
    .work-block-dots::after { animation: none; content: "..."; }
}

/* Forced colours: the chevron is a mask, which forced colours would paint in the Canvas colour. */
@media (forced-colors: active) {
    .work-block-chevron,
    .work-block[data-live="true"] .work-block-chevron { forced-color-adjust: none; background: ButtonText; }
}

@media (max-width: 560px) {
    .work-block-toggle { min-height: 36px; }
    .work-block > .work-run { padding-left: 12px; }
}
