/* Ask MIH v2 — chat UI styles.
   Extends v1's ask styles (cream answer box #f6f2ea, red #C81028 accents,
   gold #E0B83A rule, dark text #191919) with a conversation thread.
   Mobile-first: most readers are on phones. */

/* ---- page + input row (v1 .ask-box, kept) ---- */
.ask-sub { margin-top: 0; }
.ask-box { display: flex; gap: 8px; margin: 18px 0 8px; }
.ask-box input {
  flex: 1; min-width: 0; padding: 12px; font-size: 17px;
  border: 2px solid #C81028; border-radius: 8px; background: #fff; color: #191919;
}
.ask-box button {
  padding: 12px 22px; font-size: 17px; background: #C81028; color: #fff;
  border: 0; border-radius: 8px; cursor: pointer; min-height: 48px;
}
.ask-box button:disabled { opacity: 0.55; cursor: default; }
.ask-box button.ask-mic {
  background: #fff; border: 2px solid #C81028; font-size: 17px; padding: 10px 13px;
}

/* ---- suggestion chips ---- */
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.ask-chip {
  padding: 8px 13px; font-size: 14px; line-height: 1.25;
  background: #fff; color: #A50D24; border: 1.5px solid #C81028;
  border-radius: 999px; cursor: pointer; min-height: 40px;
}
.ask-chip:active { background: #C81028; color: #fff; }

/* ---- conversation thread ---- */
.ask-thread { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.ask-turn { display: flex; }
.ask-turn-user { justify-content: flex-end; }
.ask-bubble-user {
  max-width: 85%; padding: 11px 14px; border-radius: 14px 14px 4px 14px;
  background: #191919; color: #fff; font-size: 16px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.ask-turn-bot { justify-content: flex-start; flex-direction: row; align-items: flex-start; gap: 8px; }
.ask-avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  object-fit: cover; object-position: top center;
  background: #0d1b2e; border: 2px solid #f6f2ea;
}
/* No floating Ask button on the Ask page itself. */
.ask-fab { display: none; }
.ask-head { display: flex; align-items: center; gap: 14px; }
.ask-head h1 { margin: 0; }
/* Beats the site stylesheet's .story img sizing, which blew the
   header mascot up to full column width on first deploy. */
.ask-head img.ask-mascot { height: 88px; width: auto; max-width: none; }

/* Assistant bubble = v1 .ask-answer cream box. */
.ask-answer {
  flex: 1; min-width: 0; max-width: 100%; box-sizing: border-box;
  background: #f6f2ea; color: #191919; border-left: 5px solid #E0B83A;
  padding: 14px 16px; border-radius: 6px; font-size: 16px; line-height: 1.5;
  overflow-wrap: break-word;
}
.ask-answer p { color: #191919; margin: 0 0 8px; }
.ask-answer p:last-child { margin-bottom: 0; }
.ask-answer a { color: #A50D24; }
.ask-note { color: #191919; }
.ask-note-box { border-left-color: #C81028; }
.ask-src { font-size: 14px; margin-top: 10px; color: #444; }
.ask-list { margin: 6px 0 0; padding-left: 20px; }
.ask-list li { margin-bottom: 5px; }

/* General answers: visibly NOT our reporting. */
.ask-general-label {
  display: inline-block; padding: 3px 9px; border-radius: 4px;
  background: #E0B83A; color: #191919; font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* ---- source chips (answer type) ---- */
.ask-sources { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ask-sources-label { font-size: 13.5px; font-weight: 700; color: #444; }
.ask-source-chip {
  display: block; padding: 8px 11px; border: 1.5px solid #C81028; border-radius: 8px;
  background: #fff; color: #A50D24; font-size: 14.5px; line-height: 1.35;
  text-decoration: none;
}
.ask-source-chip:active { background: #f6f2ea; }
.ask-source-meta { color: #555; font-size: 13px; }

/* ---- Listen button (v1) ---- */
.ask-listen {
  margin-top: 10px; padding: 9px 16px; font-size: 15px;
  background: #191919; color: #fff; border: 0; border-radius: 8px; cursor: pointer;
  min-height: 42px;
}

/* ---- loading indicator ---- */
.ask-loading { color: #555; font-style: italic; }
.ask-dots { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.ask-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #C81028;
  animation: ask-blink 1.2s infinite ease-in-out;
}
.ask-dots span:nth-child(2) { animation-delay: 0.15s; }
.ask-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ask-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---- wider screens: keep the thread readable, not stretched ---- */
@media (min-width: 640px) {
  .ask-bubble-user { max-width: 70%; }
  .ask-answer { width: auto; min-width: 60%; max-width: 92%; }
  .ask-chip:hover { background: #C81028; color: #fff; }
  .ask-source-chip:hover { background: #f6f2ea; }
}

/* ---- collapsed older exchanges (Cory's pick, Nov 28) ----
   Only the newest Q&A stays expanded. Older bot turns hide; their
   question rows go compact with a tap-to-expand hint. */
.ask-turn-bot.ask-collapsed { display: none; }
.ask-turn-user.ask-old .ask-bubble-user {
  cursor: pointer; opacity: 0.82; font-size: 15px; padding: 8px 12px;
}
.ask-expand-hint {
  display: block; font-size: 12px; color: #A50D24; margin-top: 3px;
}

/* ---- per-answer close-out (Cory, Nov 28) ---- */
/* The ✕ rides at the answer box's top-right corner — positioned
   against the TURN (the button is a turn child; inside the bubble
   it was wiped by every render path's innerHTML reset). */
.ask-turn-bot { position: relative; }
.ask-answer { padding-right: 42px; }
.ask-close {
  position: absolute; top: 6px; right: 8px; z-index: 2; padding: 4px 7px;
  font-size: 16px; line-height: 1; background: transparent;
  color: #A50D24; border: none; cursor: pointer;
}
.ask-close:active { color: #191919; }
.ask-collapsed .ask-close { display: none; }
