/* The chat thread and its ask bar. Loads after g.css, the kit's kit.css and fasra.css (the ask bar shape
   and the orb come from there, so this chat reads as the homepage's). Tokens only. */
.ch { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ch-scroll { overflow-anchor: none; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
/* min-height lets the intro sit at the foot, right above the suggestions, instead of leaving a gap under it */
.ch-thread { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4) var(--sp-4) var(--sp-5); min-height: 100%; box-sizing: border-box; }

/* With no turns yet the thread is only as tall as its intro, and the foot follows it */
.ch:has(.ch-empty) .ch-scroll { flex: none; }
.ch:has(.ch-empty) .ch-thread { min-height: 0; padding-bottom: var(--sp-2); }
.ch-empty { margin: auto 0 0; font-size: 14px; line-height: var(--lh-2); color: var(--text-secondary); }
.ch-a .orb { width: 24px; height: 24px; flex: none; margin-top: 2px; }

/* The person's lines on the right, as on the homepage */
.ch-q { display: flex; justify-content: flex-end; }
.ch-q span { max-width: 80%; background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: 14px 14px 4px 14px; padding: var(--sp-2) var(--sp-3); font-size: 14px; line-height: var(--lh-2); overflow-wrap: anywhere; }
.ch-a { display: flex; gap: var(--sp-3); align-items: flex-start; }
.ch-a p { margin: 0; font-size: 15px; line-height: var(--lh-3); min-width: 0; }
.ch-note { margin: 0 0 0 36px; font-size: 13px; line-height: var(--lh-2); color: var(--text-secondary); }
.ch-card { margin-left: 36px; min-width: 0; }
/* A card that resizes itself eases to its new height (Glide in chat.js), clipped only while it moves */
.ch-glide { transition: height 360ms var(--ease-ios); min-width: 0; }
.ch-glide.is-gliding { overflow: clip; overflow-clip-margin: 8px; }

/* Each word of a reply fades in, one after the other, so the fade runs along the line. The owner's call (2026-11-20,
   again 2026-11-24): a reply's words are the one thing here that fades, and no wipe. The homepage's own answers
   (.turn .w in fasra.css) use the same fade and the same length. */
.ch-w { display: inline-block; opacity: 0; animation: ch-word calc(var(--fx-reveal-ms, 560) * .8ms) var(--ease-out) forwards; }
@keyframes ch-word { to { opacity: 1; } }
.ch-in { animation: ch-wipe 480ms var(--ease-out) both; }
@keyframes ch-wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* Foot: Latest, suggestions, then the ask bar. The thread scrolls above it and never runs under it. */
.ch-foot { position: relative; flex: none; padding: calc(var(--sp-3) + 1px) var(--sp-4) var(--sp-4); }
/* The rule over the foot is drawn only once there is a thread above it. On the first ask it wipes in where the foot
   comes to rest, so it never crosses the dock in one frame as the foot's box changes. */
.ch-foot::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--border-subtle); clip-path: inset(0); transition: clip-path 420ms var(--ease-ios, ease); pointer-events: none; }
.ch:has(.ch-empty) .ch-foot::after { clip-path: inset(0 100% 0 0); transition: none; }
/* The pill has its own strip at the top of the foot, under the thread's last line, so it never covers a control or text. */
.ch-latest { display: flex; margin: 0 auto var(--sp-3); min-height: 40px; border-radius: 999px; animation: ch-wipe 360ms var(--ease-out) both; }
/* The chips fold shut once the person asks, so the ask bar's box eases instead of losing their rows in one frame */
.ch-suggest-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 420ms var(--ease-ios, ease); }
.ch-suggest-fold.is-open { grid-template-rows: 1fr; }
.ch-suggest-fold > div { min-height: 0; overflow: hidden; }
.ch-suggest { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.ch-suggest button { font: inherit; font-size: 13px; line-height: var(--lh-1); min-height: 40px; padding-inline: var(--sp-3); border-radius: 999px; border: 1px solid var(--border-subtle); background: var(--surface-1); color: var(--text-primary); cursor: pointer; transition: border-color var(--dur-base) var(--ease-out); animation: ch-wipe 480ms var(--ease-out) both; }
.ch-suggest button:hover { border-color: var(--border-hover); }
.ch-foot > .ask { width: 100%; }
.ch-foot > .ask input { min-height: 40px; }

@media (prefers-reduced-motion: reduce) {
  .ch-w, .ch-in, .ch-suggest button, .ch-latest { animation: none; clip-path: none; }
  .ch-w { opacity: 1; }
  .ch-suggest-fold { transition: none; }
  .ch-foot::after { transition: none; }
}

/* A card waiting for its data: a quiet line sweeps under the label, under a mask. No opacity. */
.ch-wait { position: relative; overflow: hidden; padding: var(--sp-4); min-height: 72px; color: var(--text-secondary); }
.ch-wait::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--border); animation: ch-sweep 1600ms var(--ease-in-out) infinite; }
@keyframes ch-sweep { from { clip-path: inset(0 100% 0 0); } 50% { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }
@media (prefers-reduced-motion: reduce) { .ch-wait::after { animation: none; } }

/* Bare: the thread alone inside a host that has its own ask bar and its own page scroll (the homepage hero). */
.ch.is-bare { height: auto; }
.ch.is-bare .ch-scroll { overflow: visible; flex: none; }
.ch.is-bare .ch-thread { padding: 0; min-height: 0; }
/* The host shows the assistant itself (the hero's orb), so nothing here is indented for an orb beside it. */
.ch.is-bare .ch-note, .ch.is-bare .ch-card { margin-left: 0; }
/* A task's steps there (Trail in chat.js): a plain list, quiet until a step is the one running. */
.ch-trail { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); font-size: 13px; line-height: var(--lh-2); color: var(--text-secondary); }
.ch-trail li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--sp-2); align-items: center; min-height: var(--h-1); transition: color var(--dur-slow) var(--ease-out); }
.ch-trail li.running { color: var(--text-primary); }
.ch-tick { width: 10px; height: 10px; margin: 3px; border-radius: 50%; box-sizing: border-box; border: 1.5px solid var(--border); transition: background var(--dur-slow) var(--ease-out), border-color var(--dur-slow) var(--ease-out); }
.ch-trail .running .ch-tick { border-color: var(--leaf); }
.ch-trail .done .ch-tick { border-color: var(--leaf); background: var(--leaf); }
.ch-trail .failed .ch-tick { border-color: var(--chart-5); background: var(--chart-5); }
.ch-st { font-size: 12px; line-height: var(--lh-1); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ch-trail li, .ch-tick { transition: none; } }
