/* =========================================================================
   CoreShift bot walkthroughs — demo player styles.
   Loaded AFTER ../assets/styles.css; reuses its design tokens.
   Three channel skins from one engine: .wt-skin-sms / .wt-skin-chat / .wt-skin-email
   ========================================================================= */

/* ----- layout: conversation stage | live side panels ----- */
.wt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 2rem;
}
/* Single column on small screens. minmax(0,1fr) — NOT 1fr — so the payload
   <pre>'s long unbreakable JSON lines can't widen the track past the phone
   screen (they scroll inside .wt-payload instead). */
@media (max-width: 900px) { .wt-grid { grid-template-columns: minmax(0, 1fr); } }
.wt-grid > * { min-width: 0; }

/* ----- the conversation stage ----- */
.wt-stage {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.wt-stage-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
}
.wt-channel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-soft);
  background: rgba(255, 107, 31, 0.12);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
}
.wt-stage-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wt-play {
  margin-left: auto;
  font-family: 'Manrope', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
}
.wt-play:hover { filter: brightness(1.1); }
.wt-play:disabled { opacity: 0.45; cursor: default; }

.wt-chat {
  position: relative; /* offsetTop of messages resolves against the chat box */
  padding: 1.25rem;
  min-height: 420px;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.wt-chat .wt-hint {
  margin: auto;
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
}
/* Bubbles must keep their intrinsic (content) height. .wt-chat is a column
   flexbox with a max-height; the default flex-shrink:1 would compress children
   to fit, which (with .wt-mail's overflow:hidden) clipped long email bodies
   mid-sentence and made cards overlap. flex-shrink:0 makes the box SCROLL
   instead — the behaviour the JS scrollToMsg() already assumes. All skins. */
.wt-chat > * { flex-shrink: 0; }

/* ----- bubbles (sms + chat skins) ----- */
.wt-msg {
  max-width: 82%;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: wt-in 0.25s ease;
}
.wt-msg .wt-meta {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-top: 0.4rem;
  text-align: right;
}
.wt-msg b { color: var(--accent-soft); font-weight: 600; }
.wt-bot  { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; }
.wt-user { align-self: flex-end; background: rgba(255, 107, 31, 0.16); border: 1px solid rgba(255, 107, 31, 0.25); border-bottom-right-radius: 4px; }

/* sms skin: rounder, denser — phone feel */
.wt-skin-sms .wt-chat { background: #0a0a0b; }
.wt-skin-sms .wt-msg { border-radius: 18px; }
.wt-skin-sms .wt-bot { border-bottom-left-radius: 5px; }
.wt-skin-sms .wt-user { border-bottom-right-radius: 5px; }

/* chat-widget skin: header strip styled like an embedded support widget */
.wt-skin-chat .wt-stage-head { background: linear-gradient(90deg, rgba(255,107,31,0.14), var(--bg-card)); }
.wt-skin-chat .wt-msg { border-radius: 10px; }

/* ----- email skin: thread of message cards instead of bubbles ----- */
/* gap is the inter-card spacing (~17.6px) — combined with flex-shrink:0 the
   cards can never overlap. Container still scrolls (overflow-y:auto above). */
.wt-skin-email .wt-chat { gap: 1.1rem; max-height: 640px; }
.wt-mail {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
  /* No overflow:hidden / no height cap — the card grows to fit its full body
     so multi-line email text is never clipped. */
  animation: wt-in 0.25s ease;
  max-width: 100%;
}
.wt-mail.wt-user { border-color: rgba(255, 107, 31, 0.35); align-self: stretch; }
.wt-mail-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  padding: 0.6rem 1rem;
  /* Darker "envelope header" strip + divider clearly separates the
     From/Subject/time metadata from the message body below. */
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.wt-mail-head .wt-from { color: var(--text-dim); }
.wt-mail-head .wt-subject { color: var(--accent-soft); }
.wt-mail-body {
  /* Roomy padding (16px+) and a generous line-height keep long, multi-line
     email bodies comfortable to read against the card background. */
  padding: 1rem 1.1rem;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.wt-mail-body b { color: var(--accent-soft); font-weight: 600; }

/* ----- typing / composing indicator ----- */
.wt-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 0.7rem 0.95rem;
}
.wt-typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: wt-blink 1.2s infinite;
}
.wt-typing i:nth-child(2) { animation-delay: 0.2s; }
.wt-typing i:nth-child(3) { animation-delay: 0.4s; }
.wt-skin-email .wt-typing::after {
  content: 'composing…';
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  color: var(--text-faint);
  margin-left: 0.5rem;
}

@keyframes wt-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes wt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ----- side panels: live extraction + payload ----- */
.wt-side { display: flex; flex-direction: column; gap: 1.25rem; }
.wt-panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
}
.wt-panel h4 {
  margin: 0 0 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-soft);
}
.wt-extract { display: flex; flex-direction: column; }
.wt-extract .wt-empty { color: var(--text-faint); font-size: 0.82rem; padding: 0.4rem 0; }
.wt-exrow {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.82rem;
  animation: wt-in 0.3s ease;
}
.wt-exrow:last-child { border-bottom: none; }
.wt-exrow .wt-k { color: var(--text-faint); font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; letter-spacing: 0.04em; padding-top: 0.1rem; white-space: nowrap; }
.wt-exrow .wt-v { color: var(--text); text-align: right; }
.wt-exrow.wt-new .wt-v { color: var(--good); }

.wt-payload {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.55;
  color: var(--text-dim);
  background: #0a0a0b;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0.9rem;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre;
}

/* ----- value-prop cards on walkthrough pages ----- */
.wt-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.wt-value {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
}
.wt-value h4 { margin: 0 0 0.5rem; font-family: 'Fraunces', serif; font-size: 1.02rem; color: var(--text); }
.wt-value p { margin: 0; font-size: 0.85rem; line-height: 1.6; color: var(--text-dim); }

/* ----- catalog tiles (walkthroughs/index.html) ----- */
a.wt-cat-tile { text-decoration: none; color: inherit; display: flex; }
a.wt-cat-tile .bot-tile { width: 100%; transition: border-color 0.15s, transform 0.15s; }
a.wt-cat-tile:hover .bot-tile { border-color: var(--accent-deep); transform: translateY(-2px); }
.wt-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
}
.wt-back { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.wt-back a { color: var(--accent); text-decoration: none; }
.wt-back a:hover { text-decoration: underline; }
