/* GoBolt site v2. The loop on index.html (BRIEF-V2 §7.2; since 2026-10-29 the hero's picture): the storefront
   chat on one side, the merchant's phone on the other, and between them the kit's travelling connector (kitTravel),
   along which the twelve questions travel to the briefing. Needs site.css. Tokens are the kit's --k-*.
   It places kit pieces: the path, the counter, the stepper and the compact phone are the kit's own. What is here
   is the layout, the path's groove, and the one slot where the storefront's two conversations take turns
   (.loop.is-answered, set by loop.js on the last step). The kit owns the standard phone frame
   and lifts older messages out of its fixed screen as new messages arrive. */

.loop { position: relative; display: grid; gap: var(--k-5); margin-top: clamp(40px, 5vw, 64px); }
/* the story in words, for a screen reader: loop.js says each step here as the visitor steps it */
.loop-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── the chats: only as tall as the conversation, no empty panel ──
   The storefront is mid-conversation, so the kit's greeting and its chips are not shown. Rows that have not arrived
   keep their place (hidden, not gone), so a panel never changes height while it plays; Bolt's typing row lays itself
   over the answer's place, where the answer will land. */
.loop .k-chat { height: 100%; }
.loop .k-chat-msgs { flex: 1 0 auto; }
.loop .k-chat-msgs > :first-child { margin-top: 0; }
.loop .k-chat-row--ai[data-at="0"], .loop .k-chat-chips { display: none !important; }
.loop .k-ui:not([data-fit]) .k-chat-row[data-at]:not([data-until]):not(.is-on) { display: flex !important; visibility: hidden; }
.loop .k-chat-row[data-until].is-on { margin-bottom: -48px; position: relative; z-index: 1; }

/* ── stacked (phones, tablets): the chat, the path running down, the phone ── */
.loop-stage { display: grid; justify-items: center; align-items: start; }
.loop-chats { position: relative; display: grid; width: min(340px, 100%); }
.loop-chats > .loop-chat { grid-area: 1 / 1; --k-ui-scale: 0.88; }
/* stacked, the path is a short run straight down from the chat's foot to the phone's top, the counter beside it:
   nothing between the chat and the phone but the line (owner, 2026-10-29: "no connection, janky") */
.loop-link { width: 100%; height: 92px; }
/* the kit turns the path at 900 px; this layout turns at 960, so the path follows the layout */
.loop-link .k-travel { --travel-dir: column; }
.loop-phone { position: relative; display: grid; justify-items: center; width: min(384px, 100%); }
.loop-phone > [data-ui="phone"] { width: 100%; }

/* the two conversations take turns in one place: before, the honest "I don't know"; at the end, the answer */
.loop-chat { transition: opacity var(--k-slow) var(--k-ease), visibility 0s linear 0s; }
.loop-chats > [data-loop-chat="after"],
.loop.is-answered .loop-chats > [data-loop-chat="before"] { opacity: 0; visibility: hidden; transition-delay: 0s, var(--k-slow); }
.loop.is-answered .loop-chats > [data-loop-chat="after"] { opacity: 1; visibility: visible; transition-delay: 0s; }

/* if the thread is ever cropped, it slides up under the phone's header: a short fade there instead of a hard cut */
.loop-phone .k-im-head { position: relative; z-index: 2; }
.loop-phone .k-im-head::after {
  content: ""; position: absolute; inset-inline: 0; top: 100%; height: 22px; pointer-events: none;
  background: linear-gradient(var(--im-wall), color-mix(in srgb, var(--im-wall) 0%, transparent));
}

/* the path: a soft groove under the kit's line (loop.js draws it with the line), so the twelve marks visibly run
   along something (the kit draws the line in, and fills its far end once the questions have landed) */
.loop-track { fill: none; stroke: var(--k-ink); stroke-opacity: 0.06; stroke-width: 14; stroke-linecap: round; }
.loop .k-travel-path { stroke: var(--k-ink-2); stroke-width: 1.5; opacity: 0.6; }

/* ── under the picture: the step's sentence (loop.js writes it as the story plays), Back and Next (the kit's stepper),
   then the one quiet line. The caption keeps two lines of room so the stepper never jumps. ── */
.loop-foot { display: grid; justify-items: center; gap: var(--k-4); }
.loop-caption { min-height: calc(2 * 1.45em); max-width: 32rem; text-align: center; text-wrap: balance; font-size: var(--k-body); line-height: 1.45; color: var(--k-ink); }
.loop-caption:empty::before { content: "\00a0"; }
.loop-foot .k-stepper { margin-top: 0; }
.loop-note { max-width: 30rem; text-align: center; text-wrap: balance; }

/* ── side by side: the mocks at their own sizes, and the path is the only thing that stretches ──
   The chat sits level with the middle of the phone, and the path leaves it level with the shopper's question
   (loop.js measures it and sets --path-y), so the picture is balanced from the first frame to the last. */
@media (min-width: 960px) {
  .loop-stage {
    grid-template-columns: 346px minmax(120px, 1fr) 300px; column-gap: var(--k-3);
    width: min(1040px, 100%); margin-inline: auto; align-items: center;
  }
  .loop-chats { width: 346px; }
  .loop-chats > .loop-chat { --k-ui-scale: 0.9; }
  .loop-phone { width: 100%; }
  .loop-link { align-self: start; height: 150px; margin-top: calc(var(--path-y, 260px) - 75px); }
  .loop-link .k-travel { --travel-dir: row; }
}

@media (prefers-reduced-motion: reduce) { .loop-chat { transition: none !important; } }
.still .loop-chat { transition: none !important; }

/* ── MKT-032: the deck behind the chat, and the published entry at the end ──
   Two blank cards sit behind the storefront chat, each a step back and a step aside, so one chat reads as many
   shoppers asking the same thing. From the step the questions travel (.is-counting, loop.js) they fold in under the
   chat; at the end (.is-answered) the knowledge base's entry rises over the chat's foot: the question as its title,
   the draft as its text, "Published". The words are the kit's page language (loop.js). */
.loop-chats { isolation: isolate; align-content: start; }
.loop-deck {
  grid-area: 1 / 1; z-index: -1; display: block; align-self: stretch; justify-self: stretch;
  border-radius: var(--k-r-sheet); background: var(--k-surface); border: 1px solid rgba(30, 29, 26, 0.06);
  box-shadow: var(--k-shadow-quiet); pointer-events: none;
  transition: transform var(--k-slow) var(--k-ease), opacity var(--k-slow) ease;
}
.loop-deck--1 { transform: translate(10px, -10px) scale(0.97); opacity: 0.9; }
.loop-deck--2 { transform: translate(20px, -20px) scale(0.94); opacity: 0.7; }
.loop.is-counting .loop-deck--1, .loop.is-counting .loop-deck--2 { transform: translate(0, 0) scale(1); opacity: 0; }
/* the entry stands over the chat's foot (absolute, so it takes no room: stacked, the path follows the chat at once) */
.loop-card {
  position: absolute; left: 50%; bottom: 0; z-index: 2;
  display: grid; gap: 6px; width: min(300px, 92%); padding: 14px 16px 16px;
  border-radius: var(--k-r-card); background: var(--k-surface); border: 1px solid rgba(30, 29, 26, 0.08);
  box-shadow: var(--k-shadow-sheet); font-family: var(--k-font-ui); font-size: 13px; line-height: 1.4; color: var(--k-ink-2); text-align: start;
  opacity: 0; visibility: hidden; transform: translate(-50%, 60%) scale(0.98);
  transition: opacity var(--k-slow) ease, transform var(--k-slow) var(--k-ease), visibility 0s linear var(--k-slow);
}
.loop.is-answered .loop-card { opacity: 1; visibility: visible; transform: translate(-50%, 42%); transition-delay: 0s, 0s, 0s; }
/* stacked, it rises over the chat's composer instead, clear of the path under the chat */
@media (max-width: 959px) { .loop.is-answered .loop-card { transform: translate(-50%, 14%); } }
.loop-card-head { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--k-ink-3); }
.loop-card-head svg { width: 14px; height: 14px; }
.loop-card-head b { margin-inline-start: auto; padding: 2px 8px; border-radius: var(--k-r-pill); background: var(--k-green-tint); color: var(--k-green); font-weight: 600; letter-spacing: 0.02em; text-transform: none; }
.loop-card-head b::before { content: "\2713\00a0"; }
.loop-card strong { color: var(--k-ink); font-weight: 600; font-size: 13.5px; line-height: 1.35; }
@media (prefers-reduced-motion: reduce) { .loop-deck, .loop-card { transition: none !important; } }
.still .loop-deck, .still .loop-card { transition: none !important; }
