/* The plan (panel-plan.js): a timeline, one section per step.
   While the turn runs it is #pxPlanBar, in .foot directly above the prompt bar;
   settled, it is a small record at the top of the message. Neutral like the
   rest of the panel: bone at the ladder's alphas, never the accent. No ground
   and no filter of its own (it sits on glass). Theme tokens only. */

/* ---- the sections ---------------------------------------------------------- */
.px-plan-track {
  position: relative;
  margin: 0; padding: 0; list-style: none;
  display: flex; gap: 3px;
}
/* The section is a tall, easy target; the fill is the thin line inside it. */
.px-plan-item {
  flex: 1 1 0; min-width: 0;
  height: 14px;
  display: flex; align-items: center;
  cursor: default; outline: none;
}
.px-plan-fill {
  position: relative; overflow: hidden;
  width: 100%; height: 3px;
  border-radius: var(--r-pill);
  background: rgba(var(--bone-rgb), .12);
  transition: height var(--dur-1) ease, background-color var(--dur-3) ease;
}
.px-plan-item[data-status="done"] .px-plan-fill { background: var(--t-secondary); }
.px-plan-item[data-status="in_progress"] .px-plan-fill { background: rgba(var(--bone-rgb), .22); }
/* The step being worked: light moves along it. */
.px-plan-item[data-status="in_progress"] .px-plan-fill::after {
  content: ""; position: absolute; inset: 0; width: 45%;
  background: linear-gradient(90deg, transparent, var(--t-strong), transparent);
  animation: pxPlanSweep 1.6s ease-in-out infinite;
}
.px-plan-item[data-status="skipped"] .px-plan-fill {
  background: repeating-linear-gradient(90deg, var(--t-faint) 0 3px, transparent 3px 6px);
  opacity: .7;
}
.px-plan-item:hover .px-plan-fill,
.px-plan-item:focus-visible .px-plan-fill { height: 5px; }
.px-plan-item[data-status="pending"]:hover .px-plan-fill,
.px-plan-item[data-status="pending"]:focus-visible .px-plan-fill { background: rgba(var(--bone-rgb), .22); }
.px-plan-item[data-status="done"]:hover .px-plan-fill,
.px-plan-item[data-status="done"]:focus-visible .px-plan-fill { background: var(--t-primary); }
.px-plan-item:focus-visible { box-shadow: 0 0 0 1px var(--hair); border-radius: var(--r-ctl-sm); }
@keyframes pxPlanSweep { from { transform: translateX(-100%); } to { transform: translateX(230%); } }

/* ---- the step in full, on hover or focus ------------------------------------ */
.px-plan-tip {
  position: absolute; z-index: var(--z-tip); left: 0;
  bottom: calc(100% + 6px);
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 10px;
  border-radius: var(--r-ctl);
  background: rgb(var(--panel-hi-rgb));
  box-shadow: var(--lit-card), 0 8px 24px rgba(var(--ink-rgb), calc(.4 * var(--shadow-k)));
  pointer-events: none;
  opacity: 0; transform: translateY(2px);
  transition: opacity var(--dur-1) ease, transform var(--dur-1) ease;
  visibility: hidden;
}
.px-plan-tip[data-on="1"] { opacity: 1; transform: none; visibility: visible; }
.px-plan-tip-head {
  font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--t-meta);
}
.px-plan-tip .px-plan-text {
  font: 400 var(--fs-base)/1.45 var(--sans); color: var(--t-strong);
  overflow-wrap: anywhere;
}

/* ---- above the prompt bar, while it runs ------------------------------------ */
.px-plan-bar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 0 4px;
  animation: pxRise var(--dur-3) ease both;
}
.px-plan-bar[hidden] { display: none; }
.px-plan-bar-head {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
}
.px-plan-bar-label, .px-plan-bar-count {
  flex-shrink: 0;
  font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--t-faint);
}
.px-plan-bar-count { color: var(--t-meta); font-variant-numeric: tabular-nums; }
.px-plan-bar-now {
  flex: 1; min-width: 0;
  font: 400 var(--fs-md)/1.4 var(--sans); color: var(--t-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.px-plan-bar[data-state="settled"] .px-plan-bar-now { color: var(--t-meta); }

/* ---- on the message, once the turn has ended -------------------------------- */
.px-plan {
  margin: 2px 0 10px;
  max-width: 320px;
  display: flex; flex-direction: column; gap: 2px;
}
/* The bar above the prompt is the plan while it runs; this copy waits. */
.px-plan[data-state="running"] { display: none; }
.px-plan-summary {
  font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--t-faint);
  font-variant-numeric: tabular-nums;
}
/* At the top of the message the tip opens downward, into the answer, rather
   than up past the column's edge. */
/* Not a markdown list: the bubble's ol/li spacing (.chat-bubble.assistant ol,
   li) is for the answer's lists. */
.chat-bubble .px-plan .px-plan-track { margin: 0; padding: 0; }
.chat-bubble .px-plan .px-plan-item { margin: 0; }
.px-plan .px-plan-tip { bottom: auto; top: calc(100% + 4px); transform: translateY(-2px); }
.px-plan .px-plan-tip[data-on="1"] { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .px-plan-item[data-status="in_progress"] .px-plan-fill::after { animation: none; display: none; }
  .px-plan-fill, .px-plan-tip { transition: none; }
  .px-plan-bar { animation: none; }
}
