/* ========================================================================
 * BoutiqueChat — editorial active-chat styles.
 * Matches docs/pellier-chat-experience.html.
 * All colors reference CSS custom properties from index.css :root.
 * ======================================================================== */

/* ---- Persona cover banner ----
 * Compact version of the BoutiqueWelcome hero cover. Sits above the
 * chat stream so the warm persona-matched product photograph stays
 * visible once the conversation starts. Uses the same editorial
 * treatment (cream dot eyebrow, cream edition numeral) but shorter
 * (140px) so it doesn't crowd the chat.
 */
.ec-persona-cover {
  position: relative;
  height: 140px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(180deg, #ead4b1 0%, #d4b48a 100%);
  margin: 0 0 18px;
  border-radius: 12px;
}
.ec-persona-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}
.ec-persona-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(31, 20, 16, 0.08) 0%,
    rgba(31, 20, 16, 0.42) 100%
  );
  z-index: 1;
}
.ec-persona-cover-overlay {
  position: absolute;
  bottom: 14px;
  left: 18px;
  right: 18px;
  z-index: 3;
}
.ec-persona-cover-eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(250, 243, 232, 0.96);
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ec-persona-cover-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cream-1);
  box-shadow: 0 0 0 3px rgba(250, 243, 232, 0.2);
  display: inline-block;
  flex-shrink: 0;
}

/* ---- Header ---- */
.ec-header {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule-1);
  position: relative;
  flex-shrink: 0;
  background: var(--cream-1);
  z-index: 5;
}
.ec-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 22px;
  width: 28px;
  height: 1px;
  background: var(--red-1);
}
.ec-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ec-b-mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink-1);
  color: var(--cream-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  flex-shrink: 0;
}
.ec-title-stack {
  display: flex;
  flex-direction: column;
}
.ec-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.1;
  color: var(--ink-1);
}
.ec-status {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red-1);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-weight: 500;
}

.ec-status-label { color: var(--red-1); }

/* Status dot — idle pulse */
.ec-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red-1);
  display: inline-block;
}
.ec-dot-pulse { position: relative; }
.ec-dot-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--red-1);
  opacity: 0;
  animation: editorial-pulse 2.4s ease-out infinite;
}

/* Status dot — typing cascade */
.ec-dot-typing {
  position: relative;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red-1);
  display: inline-block;
  animation: editorial-typing-dot 1.4s ease-in-out infinite;
}
.ec-dot-typing::before,
.ec-dot-typing::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red-1);
  top: 0;
}
.ec-dot-typing::before {
  left: 9px;
  animation: editorial-typing-dot 1.4s ease-in-out 0.2s infinite;
}
.ec-dot-typing::after {
  left: 18px;
  animation: editorial-typing-dot 1.4s ease-in-out 0.4s infinite;
}
.ec-dot-typing-sm {
  width: 4px; height: 4px;
}
.ec-dot-typing-sm::before,
.ec-dot-typing-sm::after {
  width: 4px; height: 4px;
}
.ec-dot-typing-sm::before { left: 7px; }
.ec-dot-typing-sm::after { left: 14px; }

/* Header actions */
.ec-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ec-text-link {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}
.ec-text-link:hover { color: var(--ink-1); }
.ec-icon-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
}
.ec-icon-btn:hover {
  background: rgba(31, 20, 16, 0.06);
  color: var(--ink-1);
}

/* ---- Edition strip ---- */
.ec-edition-strip {
  padding: 8px 22px;
  background: var(--cream-2);
  border-bottom: 1px solid var(--rule-1);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ec-edition-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ec-edition-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--red-1);
  display: inline-block;
  flex-shrink: 0;
}

/* ---- Conversation scroll area ---- */
.ec-conversation {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- User message ---- */
.ec-msg-user {
  align-self: flex-end;
  max-width: 88%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 0 22px;
}
.ec-msg-user-eyebrow {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* User message bubble.
 *
 * Typed questions and chip-sourced messages both land in the same
 * bubble. Historically this rendered italic Fraunces with red quote
 * marks, which was beautiful for the three welcome-screen P.S. chips
 * ("something for long summer walks") but off-key for real
 * questions users type ("Which headphones are running low and how
 * do the prices stack up?"). The italic register made typed
 * questions feel performative.
 *
 * Switched to the canonical sans-serif chat spec (Instrument Sans 15/1.5)
 * with a slightly tighter tracking that matches the body copy of
 * assistant replies. The red decorative quote marks are gone —
 * italic P.S. chips on the welcome screen still carry the typographic
 * flourish there where it earns its place.
 */
.ec-msg-user-text {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.003em;
  color: var(--ink-1);
  background: var(--cream-2);
  padding: 10px 16px;
  border-radius: 14px 14px 4px 14px;
  border: 1px solid var(--rule-1);
}

/* ---- Agent message ---- */
.ec-msg-agent {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 100%;
  padding: 0 22px;
}
.ec-msg-agent-eyebrow {
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red-1);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -4px;
}
.ec-b-mini {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink-1);
  color: var(--cream-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  font-style: normal;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

/* Thinking inline — premium concierge feel.
 *
 * Three staggered dots with a soft pulse, plus a "Considering" label
 * in small-caps burgundy. The dots use a custom ease-in-out-back
 * timing so they feel organic, not mechanical. The label fades in
 * with a 200ms delay so the dots lead the eye.
 */
.ec-thinking-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 8px;
}
.ec-thinking-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red-1);
  font-weight: 500;
  animation: thinking-label-in 400ms ease-out both;
  animation-delay: 200ms;
}
@keyframes thinking-label-in {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Message body
 *
 * Canonical chat prose for both Boutique and Atelier. Instrument Sans at
 * 15px / 1.7 leading / -0.003em is the Claude-desktop register —
 * reads cleanly on any width and leaves enough air between lines
 * that a streamed reply doesn't feel cramped. Fraunces stays
 * reserved for the eyebrow and user-message italic quotes; product
 * names use <strong> in the same sans face as the body.
 */
.ec-msg-body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: -0.003em;
  color: var(--ink-1);
  font-feature-settings: 'ss01', 'cv11';
}
.ec-msg-body p { margin-bottom: 10px; }
.ec-msg-body p:last-child { margin-bottom: 0; }

/* Product names from **bold** markdown — same sans as body, heavier weight. */
.ec-msg-body strong {
  font-family: inherit;
  font-style: normal;
  font-weight: 600;
  letter-spacing: inherit;
}

/* Streaming body — the prose grows in place, no cursor. We keep a
 * whisper of a breathing animation so the bubble feels live during
 * long tool-call pauses; the amplitude is small enough not to read
 * as motion while text is actually landing. */
.ec-msg-streaming {
  animation: streaming-breathe 2.4s ease-in-out infinite;
}
@keyframes streaming-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.96; }
}

/* Product artifacts stack */
.ec-artifacts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Sticky input ---- */
.ec-input {
  border-top: 1px solid var(--rule-1);
  padding: 14px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cream-elev);
  flex-shrink: 0;
}
.ec-input-field {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-1);
  outline: none;
  padding: 8px 4px;
}
.ec-input-field::placeholder {
  color: var(--ink-4);
  font-style: italic;
  font-family: var(--serif);
  font-size: 15px;
}
.ec-input-field:disabled {
  opacity: 0.5;
}
.ec-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink-1);
  color: var(--cream-1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 180ms;
}
.ec-send:hover:not(:disabled) {
  background: var(--red-1);
  transform: scale(1.05);
}
.ec-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ---- Thinking block (collapsible) ---- */
.ec-thinking {
  border: 1px solid var(--rule-1);
  border-left: 2px solid var(--red-1);
  border-radius: 0 8px 8px 0;
  background: var(--cream-2);
  overflow: hidden;
  transition: all 200ms ease;
}
.ec-thinking-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.ec-thinking-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ec-thinking-header-label {
  color: var(--red-1);
}
.ec-thinking-header-duration {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.05em;
  text-transform: none;
}
.ec-thinking-chevron {
  color: var(--ink-3);
  font-size: 12px;
  transition: transform 200ms;
}
.ec-thinking-chevron-open {
  transform: rotate(180deg);
}
.ec-thinking-body {
  padding: 0 14px 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-3);
  border-top: 1px solid var(--rule-1);
  padding-top: 12px;
}
.ec-thinking-body p {
  margin-bottom: 6px;
}

/* ---- Collapsed skills + tools disclosure ---- */
.ec-worked {
  margin-top: 8px;
  margin-bottom: 4px;
  border: 1px solid var(--rule-1);
  border-radius: 10px;
  background: color-mix(in srgb, var(--cream-2) 72%, transparent);
  overflow: hidden;
}
.ec-worked-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  text-align: left;
}
.ec-worked-header:hover {
  background: rgba(31, 20, 16, 0.035);
}
.ec-worked-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red-1);
  flex-shrink: 0;
  opacity: 0.8;
}
.ec-worked-title {
  font-family: var(--sans);
  font-style: normal;
  color: var(--dl-ink-2, var(--ink-2));
  font-size: 13px;
  font-weight: 500;
}
.ec-worked-summary {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  margin-left: auto;
  white-space: nowrap;
}
.ec-worked-chevron {
  color: var(--ink-4);
  font-size: 12px;
  transition: transform 160ms ease;
}
.ec-worked-chevron-open {
  transform: rotate(180deg);
}
.ec-worked-body {
  border-top: 1px solid var(--rule-1);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ec-worked-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ec-worked-section-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.ec-worked .ec-msg-attribution {
  margin: 0;
}
.ec-worked-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--dl-ink-2, var(--ink-2));
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--red-1) 42%, transparent);
  padding-bottom: 2px;
}
.ec-worked-link:hover {
  color: var(--red-1);
  border-bottom-color: var(--red-1);
}

/* ---- Tool-call lines ---- */
.ec-toolcalls {
  display: flex;
  flex-direction: column;
}
.ec-toolcall {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  border-bottom: 1px dashed var(--rule-1);
  animation: toolcall-slide-in 300ms ease-out both;
}
@keyframes toolcall-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.ec-toolcall:last-child {
  border-bottom: none;
}
.ec-toolcall-indicator {
  font-family: var(--mono);
  font-size: 12px;
  width: 14px;
  flex-shrink: 0;
  text-align: center;
}
.ec-toolcall-complete .ec-toolcall-indicator {
  color: var(--green-1);
  font-weight: 600;
}
.ec-toolcall-active .ec-toolcall-indicator {
  color: var(--red-1);
  animation: toolcall-pulse 1.4s ease-in-out infinite;
}
.ec-toolcall-label {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-1);
  font-size: 13.5px;
}
.ec-toolcall-active .ec-toolcall-label {
  color: var(--red-1);
}
.ec-toolcall-meta {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.05em;
}

/* ---- Skill attribution line ----
 *
 * Renders only when the router loaded one or more skills for the turn.
 * Sits between the "· Pellier" eyebrow and the reply body. TraceChip
 * row (skill.gift-table, etc.) — same mono pill register as
 * memory.recall on product cards. Absent when no skills load.
 */
.ec-msg-attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 2px;
}

/* ---- Persona-tailored follow-up chips ----
 *
 * Render only under the most recent complete assistant reply. Each
 * chip is a canned query grounded in the active persona's signals
 * from docs/personas-config.json. Horizontal pills (not a bulleted
 * list) — reads as "what to try next", not an editorial postscript.
 * Flow-wraps on narrow widths so three chips still fit below a mobile
 * chat bubble.
 */
.ec-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(45, 24, 16, 0.12);
}
/* Canonical follow-up pill — shared shape between Boutique
 * (persona chips) and Atelier (quick-query chips). Sans 12.5px /
 * 500 weight / -0.003em, neutral cream background with a hair of
 * red on hover. The Atelier side lives on the Tailwind classes
 * inside QuickQueryChips.tsx; keep the two in lockstep.
 */
.ec-followup {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: -0.003em;
  color: var(--ink-2);
  background: var(--cream-1);
  border: 1px solid rgba(45, 24, 16, 0.14);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ec-followup:hover {
  background: rgba(196, 69, 54, 0.08);
  border-color: rgba(196, 69, 54, 0.4);
  color: var(--red-1);
}
.ec-followup:focus-visible {
  outline: 2px solid var(--red-1);
  outline-offset: 2px;
}

.ec-followup-workshop {
  border-style: dashed;
  border-color: rgba(196, 69, 54, 0.52);
  background: rgba(255, 252, 247, 0.95);
  white-space: normal;
}
.ec-followup-workshop:hover {
  border-color: rgba(196, 69, 54, 0.75);
}
