/* ==========================================================================
   CLOSE AND ASK HISTORY (Peter, 4 Nov 2026; approved on Signal card 94 and live for everyone, 5 Nov 2026)
   --------------------------------------------------------------------------
   Two buttons just under the Ask box, at its right edge, on every page with Ask. js/ask-close.js puts them in the
   box and says which show: "Ask history" opens the conversation so far, the X closes the box.
   Catalogue: preview/index.html#askchatbar.

   THE LOOK IS THE STYLE GUIDE'S OWN PILLS (Peter's note 2 on card 94, 5 Nov 2026: "make ask history and the x this
   style not the bright white one", pointing at Home's "I want to" pills; note 1, 4 Nov: "remove the underline";
   "Ask history and an X for close"): both are Ask's sentence pills (.ask-suggests--sentences .ask-suggest, ask-box.css),
   which take the darker tint on a card (dashboard.css), and the X is the same pill holding the stroke-1 X, so the two
   read as one set. This file only places them; it never restyles a pill.

   THEIR OWN ROW: they hang just under the pill (absolute), and while an answer is open it starts under them (card 94
   v2 check: on the Today row they read squeezed against the question). The greeting line keeps clear of them, and they stand down over a folded card, the Do
   list, Bullet's explain card and while you type (the finder opens there).
   ========================================================================== */
.ask-box > .ask-chatbar {
  position: absolute;
  top: calc(100% + 10px);   /* on the greeting line's baseline (Home's 12px gap above it; the bar's own is 9px, below) */
  right: 0;   /* on the box's right edge, as View all reports below it (card 94 v2 check) */
  z-index: 2;
  display: flex;
  align-items: stretch;   /* the X pill takes Ask history's height, so the pair reads as one set */
  gap: var(--space-2);
  animation: askChatbarIn .35s cubic-bezier(0.16, 1, 0.3, 1) both;   /* the greeting line's entrance (ask-bar.css askHelloIn) */
}
.ask-bar .ask-box > .ask-chatbar { top: calc(100% + 9px); }
.ask-box > .ask-chatbar[hidden] { display: none; }
.ask-chatbar__btn[hidden] { display: none; }
.ask-chatbar > .ask-suggest { margin: 0; }   /* placement only: the pill sits on the row */
.ask-chatbar__btn--close { display: inline-flex; align-items: center; justify-content: center; }   /* the X in the middle of its pill */
.ask-chatbar__btn--close svg { width: 16px; height: 16px; flex: none; margin-block: 3px; color: var(--color-text); }   /* full ink: the lone X read faint in the pill's muted ink (Peter, 5 Nov 2026: "make the X darker"). The icon size the answer's pills use; 3px each side makes the X pill a sentence pill's height (38px) when it stands alone */
/* ON THE DOCKED BAR'S YELLOW the pills wear the tint they wear on Home's yellow card (dashboard.css, the sentence pills on
   a card). The narrow pages do not load dashboard.css, so its three values are repeated here, for these two pills only. */
.ask-dock .ask-chatbar > .ask-suggest { background: rgba(0, 0, 0, 0.075); color: rgba(17, 17, 17, 0.62); }
.ask-dock .ask-chatbar > .ask-suggest:hover { background: rgba(0, 0, 0, 0.12); color: var(--color-text); }

/* THE DOCKED BOX SCROLLS INSIDE ITSELF: its window starts under them, so a long answer never scrolls under Close.
   Held while they are on the page at all (not only while shown), so typing a follow-up never makes the answer jump. */
.ask-dock:has(.ask-box > .ask-chatbar) .ask-dock__box { margin-top: 56px; padding-top: 0; }   /* under the 40px buttons */

/* THE ANSWER STARTS UNDER THEM, at every width (card 94 v2 check: on the Today row they read squeezed against the
   question). The open answer begins 56px under the box: the 40px buttons sit 10px down, then 6px clear. Keyed on the
   buttons being in the box at all, not on them showing, so typing a follow-up (they stand down) never moves the answer.
   A section card's box already keeps 36px under it. */
.ask-box.is-answering:has(> .ask-chatbar) ~ .ask-answer-wrap { padding-top: 56px; }
.sec-canvas > .ask-box.is-answering:has(> .ask-chatbar) ~ .ask-answer-wrap { padding-top: 20px; }   /* padding, not margin: on Bank the box's 36px and a margin would merge into one */

/* the greeting line under the box ends before them (Home, the docked bar's yellow) */
.ask-box:has(> .ask-chatbar:not([hidden])) ~ .ask-hello,
.ask-bar:has(.ask-chatbar:not([hidden])) ~ .ask-hello { padding-right: 132px; }   /* Ask history's width (116px) and a gap */

/* never over a folded card, the Do list or Bullet's explain card */
:is(.page-stickyhead, .tx-stickyhead):is(.is-stuck, .is-searching) .ask-box > .ask-chatbar,
.is-compact > .ask-box > .ask-chatbar,
.ado-card--do > .ask-box > .ask-chatbar,
.ask-dock.is-explaining .ask-box > .ask-chatbar { display: none; }

@keyframes askChatbarIn { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .ask-box > .ask-chatbar { animation: none; } }
