/*
 * Live Demo — animated estimating-assistant chat panel for the home hero.
 * Vanilla translation of the design handoff's B_LiveDemo.jsx (inline styles +
 * LD_CSS). Uses the shared design tokens in tokens.css. Paired with
 * /static/js/live-demo.js, which drives the timeline.
 */

@keyframes ldFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ldBlink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes ldPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.ld-shell {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  background: var(--ink-1);
  border: 1px solid var(--ink-3);
  border-top: 3px solid var(--amber-2);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
}

/* Brand mark: 26x26 amber square containing a centered 9x9 ink square. */
.ld-avatar {
  width: 26px; height: 26px;
  background: var(--amber-2);
  flex: 0 0 auto;
  display: grid; place-items: center;
  margin-top: 2px;
}
.ld-avatar::after { content: ''; width: 9px; height: 9px; background: var(--ink-0); }

.ld-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--ink-3); background: var(--ink-1);
}
.ld-header-left { display: flex; align-items: center; gap: 11px; }
.ld-header-left .ld-avatar { margin-top: 0; }
.ld-h-title { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--paper); letter-spacing: -0.01em; }
.ld-h-sub { font-size: 11.5px; color: var(--gray-2); margin-top: 1px; }
.ld-live { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--amber); }
.ld-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: ldPulse 1.6s ease-in-out infinite; }

.ld-body {
  height: 470px; overflow-y: auto; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 14px; background: var(--ink-0);
}
.ld-body::-webkit-scrollbar { width: 8px; }
.ld-body::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 4px; }
.ld-body::-webkit-scrollbar-track { background: transparent; }

.ld-row-bot { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.ld-row-user { display: flex; justify-content: flex-end; }
.ld-anim { animation: ldFadeUp 0.4s ease both; }

.ld-bubble-bot {
  background: var(--ink-2); color: var(--gray-4); border: 1px solid var(--ink-3);
  padding: 12px 15px; border-radius: 4px 14px 14px 14px;
  font-size: 13.5px; line-height: 1.55; max-width: calc(100% - 36px);
}
.ld-bubble-user {
  background: var(--gray-4); color: var(--ink-0);
  padding: 12px 15px; border-radius: 14px 4px 14px 14px;
  font-size: 13.5px; line-height: 1.5; max-width: 82%; white-space: pre-line; font-weight: 500;
}

.ld-typing { display: flex; gap: 5px; padding: 14px 16px; }
.ld-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--gray-2); animation: ldBlink 1.2s infinite ease-in-out; }
.ld-typing span:nth-child(2) { animation-delay: 0.16s; }
.ld-typing span:nth-child(3) { animation-delay: 0.32s; }

.ld-status {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--gray-2); padding: 2px 0;
}
.ld-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: ldPulse 1s ease-in-out infinite; flex: 0 0 auto; }

/* Estimate card (dark) */
.ld-card-wrap { flex: 1; min-width: 0; }
.ld-card { background: var(--ink-1); border: 1px solid var(--ink-3); padding: 22px; border-radius: 4px 14px 14px 14px; }
.ld-card-includes { font-size: 13.5px; line-height: 1.55; color: var(--gray-3); }
.ld-card-includes strong { font-weight: 700; color: var(--paper); }
.ld-card-rule { height: 1px; background: var(--ink-3); margin: 18px 0; }
.ld-card-line { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--ink-3); }
.ld-card-line-label { font-size: 13px; line-height: 1.45; color: var(--gray-3); flex: 1; }
.ld-card-line-price { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--paper); font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; }
.ld-card-thickrule { height: 2px; background: var(--gray-3); margin: 4px 0 16px; }
.ld-card-total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 18px; }
.ld-card-total-label { font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--paper); }
.ld-card-total-num { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ld-card-disc { font-size: 11.5px; line-height: 1.5; font-style: italic; color: var(--gray-1); text-align: center; margin-bottom: 12px; }
.ld-card-callout {
  margin-top: 4px; padding: 12px 16px; text-align: center;
  background: oklch(0.72 0.14 65 / 0.12); border: 1px solid oklch(0.62 0.15 55 / 0.45);
  color: var(--amber); font-size: 12.5px; line-height: 1.45; font-weight: 500;
}

.ld-composer { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--ink-3); background: var(--ink-1); }
.ld-composer-input { flex: 1; font-size: 13px; color: var(--gray-1); padding: 9px 12px; background: var(--ink-0); border: 1px solid var(--ink-3); border-radius: 6px; }
.ld-composer-send { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; background: var(--amber-2); color: var(--ink-0); font-size: 16px; font-weight: 700; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  .ld-anim { animation: none; }
  .ld-live-dot, .ld-status-dot, .ld-typing span { animation: none; }
}
