/* The conversation itself: messages, answer cards, the handoff and the WhatsApp mock.
   Shared by the three skins; colours, type and radii come from each skin's tokens.

   Ground rules, enforced here so no skin can break them:
   1. The thread is the only thing that scrolls; the skin gives it min-height: 0 in its column.
   2. Free height is never handed to messages: the thread and every message pack to the top
      (align-content: start), and no message or card stretches to the row (align-self: start).
   3. Widths are bounded: a user bubble is at most 80% wide, bot content never exceeds the thread
      (min-width: 0 on the bot column), so long words and tables cannot push the panel wider.
   4. New content animates in with opacity and transform only; the panel's height is animated by
      app.js morph(), never by layout properties here.
   5. The composer stays visible under the thread in every state; the skin keeps it out of the
      scrolling region.
   6. The thread follows new content instantly (no smooth scrolling on the scroller): a smooth
      scroll interrupted by the next append leaves the thread parked mid-answer. */
.as-thread { display: grid; align-content: start; gap: var(--s-4); padding: var(--s-5); overflow-y: auto; overscroll-behavior: contain; min-width: 0; }
.as-thread[hidden] { display: none; }
.msg { display: grid; align-content: start; gap: var(--s-3); min-width: 0; animation: rise var(--t-slow) var(--ease-out) both; }
.msg > * { align-self: start; min-width: 0; }
.msg-user { justify-self: end; max-width: 80%; width: fit-content; padding: 0.65rem 0.95rem; border-radius: 16px 16px 4px 16px; background: var(--navy); color: var(--on-navy); font-size: var(--step--1); line-height: 1.45; overflow-wrap: anywhere; }
.msg-bot { grid-template-columns: 28px minmax(0, 1fr); align-items: start; column-gap: var(--s-3); }
.msg-bot .as-face { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; margin-top: 1px; }
.msg-bot p { grid-column: 2; max-width: 56ch; line-height: 1.5; overflow-wrap: anywhere; }
.msg-bot > :not(.as-face) { grid-column: 2; }
.typing { display: inline-flex; gap: 4px; padding: 0.6rem 0.2rem; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Answer cards: real cars, a comparison, a branch, slots, a campaign offer. */
.t-cars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.t-car { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); font-size: var(--step--1); transition: border-color var(--t-fast); }
.t-car:hover { border-color: var(--navy); }
.t-car img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.t-car > div { padding: 0 var(--s-3) var(--s-3); display: grid; gap: 3px; }
.t-car .car-tag { font-size: 0.8125rem; }
.t-car strong { font-weight: 600; line-height: 1.3; }
.t-car .price { flex-wrap: wrap; gap: 0 6px; }
.t-car .price b { font-size: 1.15rem; white-space: nowrap; }
.t-car .facts { font-size: 0.8125rem; }
.t-car .where { color: var(--ink-3); font-size: 0.8125rem; }

.t-compare { width: 100%; border-collapse: collapse; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.t-compare th, .t-compare td { padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.t-compare th { font-weight: 600; }
.t-compare td:first-child { color: var(--ink-3); width: 28%; }

.t-branch { display: grid; grid-template-columns: auto 1fr; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font-size: var(--step--1); }
.t-branch svg { width: 20px; height: 20px; color: var(--navy); margin-top: 2px; }
.t-branch b { display: block; font-weight: 600; font-size: var(--step-0); }
.t-branch span { display: block; color: var(--ink-2); }

.t-slots { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* Campaign offers: selectable cards built as a shell (hairline tray) holding a core (the plate), so the
   selection reads as the whole object lifting, not as a border changing colour. One pressed per group. */
.t-offer { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); --offer-ease: cubic-bezier(0.32, 0.72, 0, 1); }
.t-offer-item { display: grid; align-items: stretch; width: 100%; padding: 5px; border: 1px solid var(--line); border-radius: 22px; background: color-mix(in oklch, var(--ink) 4%, transparent); color: var(--ink); text-align: left; font: inherit; cursor: pointer; animation: rise 700ms var(--offer-ease) both; animation-delay: calc(var(--i, 0) * 90ms); transition: transform 500ms var(--offer-ease), border-color 500ms var(--offer-ease), background 500ms var(--offer-ease); }
.t-offer-item:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.t-offer-item:active { transform: scale(0.985); }
.t-offer-item[aria-pressed="true"] { border-color: var(--navy); background: color-mix(in oklch, var(--navy) 18%, transparent); }
.t-offer-core { display: grid; align-content: start; gap: var(--s-3); padding: var(--s-4) var(--s-4) calc(var(--s-4) + 2px); border-radius: 17px; background: var(--card); box-shadow: inset 0 1px 0 color-mix(in oklch, var(--ink) 9%, transparent); font-size: var(--step--1); }
.t-offer-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }.t-offer-disc { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--on-navy); transition: background 400ms var(--offer-ease), border-color 400ms var(--offer-ease), transform 400ms var(--offer-ease); }
.t-offer-disc svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.6); transition: opacity 300ms var(--offer-ease), transform 400ms var(--offer-ease); }
.t-offer-item[aria-pressed="true"] .t-offer-disc { background: var(--navy); border-color: var(--navy); transform: scale(1.08); }
.t-offer-item[aria-pressed="true"] .t-offer-disc svg { opacity: 1; transform: none; }
.t-offer-fig { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.4rem; font-variant-numeric: tabular-nums; }
.t-offer-from { font-size: var(--step--1); color: var(--ink-3); }
.t-offer-fig b { font-family: var(--font-display); font-weight: var(--display-weight); font-stretch: var(--display-stretch, 100%); font-size: var(--step-3); line-height: 1; letter-spacing: -0.03em; color: var(--navy-ink); }
.t-offer-unit { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.t-offer-sub { color: var(--ink-2); line-height: 1.45; }

/* The handoff: the one green element on the page. It is born locked when the answer asks for a choice. */
.t-handoff { display: grid; gap: var(--s-2); justify-items: start; padding-top: var(--s-2); }
.t-handoff .btn-wa { padding: 0.85rem 1.3rem; font-size: var(--step-0); transition: opacity 400ms var(--ease-out), filter 400ms var(--ease-out), background var(--t-fast); }
.t-handoff .btn-wa[disabled] { opacity: 0.38; filter: saturate(0.35); cursor: not-allowed; }
.t-handoff small { font-size: 0.8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.t-handoff small[hidden] { display: none; }
.t-handoff [data-need] { color: var(--ink-2); font-weight: 500; }
.t-handoff code { font-family: inherit; font-weight: 700; color: var(--ink); letter-spacing: 0.04em; }

@media (max-width: 640px) {
  .as-thread { padding-inline: var(--s-4); }
  .t-cars { grid-template-columns: 1fr; }
  .t-car { grid-template-columns: 110px 1fr; }
  .t-car img { height: 100%; aspect-ratio: auto; }
  .t-car > div { padding: var(--s-3) var(--s-3) var(--s-3) 0; }
  .t-offer { grid-template-columns: 1fr; }
  .msg-bot { grid-template-columns: 1fr; }
  .msg-bot .as-face { display: none; }
  .msg-bot > :not(.as-face) { grid-column: 1; }
}
