/* Quick answers: the search that opens like a pill (R7; design-research/BACKLOG-5-bencho-features.md section 1; js/ux/search-anim.js).
   Motion and layout only: the pill and the panel sit as two objects (pill on top, the panel 8px under it), the highlight bar slides under the rows,
   matched letters are inked. Colours come from the tokens the other Quick-answers rules already use (--mf-wash, --mf-sh-overlay, --lg-fg*), nothing new is
   painted on an existing chip. All motion is transform / opacity / filter plus the two sizes the spring drives (pill width, panel height). */

/* ---------- list mode: the wrap holds a pill and a panel (class set by js/ux/search-anim.js; the answer card keeps the centred grid) ---------- */
#ask-ov .ask-wrap.aw-list {
  --ask-w: min(46rem, calc(100% - var(--pad) * 2));
  --ask-h: clamp(52px, 3.6rem, 68px);
  --ask-top: max(4.4rem, calc(var(--pad) + var(--safe-t, 0px) + 1.6rem));
  --ask-gap: 8px;
  display: block; padding: 0;
}
html.r13.tv #ask-ov .ask-wrap.aw-list { --ask-h: calc(52px * var(--ui-scale)); }   /* (F5) the TV's pill holds the TV's 75px clear box with the same 4px a side (it was clamped to 68) */
@media (orientation: portrait) { #ask-ov .ask-wrap.aw-list { --ask-w: min(58rem, calc(100% - var(--pad) * 2)); } }   /* the 800x1280 tablet: the width of the screen less the margins */
#ask-ov .ask-wrap.aw-list > .ask-pill {
  position: absolute; z-index: 2; box-sizing: border-box;
  left: calc((100% - var(--ask-w)) / 2); top: var(--ask-top); width: var(--ask-w); height: var(--ask-h);
  display: flex; align-items: center; gap: .4rem; overflow: hidden;
  border-radius: 999px; background-color: #fff; color: var(--lg-fg, #16161b);
  box-shadow: inset 0 0 0 1px rgba(22, 22, 27, .12), var(--el-2-scene, 0 6px 18px -10px rgba(0, 0, 0, .5)); transition: box-shadow 160ms var(--mf-ease-out, cubic-bezier(.22, 1, .36, 1));   /* (2 November, FINAL-FIX3 F5, QA-C D6) the capsule family's edge: the sheet's own 12% hairline and the one soft floating shadow (it was a 1.5px ring, a 4px halo and the 80px sheet shadow) */
  --say: 1; --lens: 1.4rem;
}
#ask-ov .ask-wrap.aw-list > .ask-pill:focus-within {
  box-shadow: inset 0 0 0 1px rgba(22, 22, 27, .34), var(--el-2-scene, 0 6px 18px -10px rgba(0, 0, 0, .5));   /* the focus is the hairline going darker, inside the pill (the scrim behind it is light, an outer ring would vanish) */
}
/* the field inside the pill has no frame of its own (the pill is the frame), and its lens stays pinned to the left padding so it never moves while the pill grows */
body #ask-ov .ask-pill .ask-in, body #ask-ov .ask-pill .ask-in:focus-within {
  flex: 1 1 auto; min-width: 0; align-self: stretch; margin: 0; min-height: 0; border-radius: 0; background: none; box-shadow: none; border: 0;
  padding: 0 0 0 calc(22px - var(--lens) / 2); gap: .8rem;
}
#ask-ov .ask-pill .ask-in svg { width: var(--lens); height: var(--lens); }
/* placeholder, typed text and the clear button come in once the pill is wide enough (--say follows the width spring), never before there is room */
#ask-ov .ask-pill .ask-in input { opacity: var(--say); translate: calc((1 - var(--say)) * -6px) 0; text-overflow: ellipsis; }
/* (2 November, FINAL-FIX3 F5, QA-C D3) the clear x: a 44 x 44 hit box (--q-ctl: 44px, 75px on a TV), the wash disc 32px (--q-chip) drawn inside it, the glyph 16px (20px x the scale for the TV) */
#ask-ov .ask-pill .ask-clear {
  position: relative; flex: none; display: grid; place-items: center; width: var(--q-ctl, 44px); height: var(--q-ctl, 44px); margin: 0 calc(2px * var(--ui-scale, 1)) 0 0; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--lg-fg, #16161b);
  opacity: var(--say); translate: calc((1 - var(--say)) * -6px) 0;
}
#ask-ov .ask-pill .ask-clear[hidden] { display: none; }
#ask-ov .ask-pill .ask-clear::before { content: ""; position: absolute; left: 50%; top: 50%; width: var(--q-chip, 32px); height: var(--q-chip, 32px); margin: calc(var(--q-chip, 32px) / -2) 0 0 calc(var(--q-chip, 32px) / -2); border-radius: 50%; background: var(--mf-wash, rgba(22, 22, 27, .06)); }
#ask-ov .ask-pill .ask-clear svg { position: relative; width: calc(16px * var(--ui-scale, 1)); height: calc(16px * var(--ui-scale, 1)); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* the panel: 8px under the pill, the same width; its height is the spring's (js sets it while it moves, auto at rest) */
#ask-ov .ask-wrap.aw-list > .ask-panel {
  position: absolute; box-sizing: border-box; overflow: hidden; display: block; padding: 0; z-index: 3;
  left: calc((100% - var(--ask-w)) / 2); top: calc(var(--ask-top) + var(--ask-h) + var(--ask-gap)); width: var(--ask-w);
  height: auto; max-height: none;
  --ask-hmax: calc(var(--jr-vh, 100dvh) - var(--ask-top) - var(--ask-h) - var(--ask-gap) - var(--pad) - var(--safe-b, 0px));
}
#ask-ov .ask-panel > .ask-inner {
  position: relative; box-sizing: border-box; display: flex; flex-direction: column; gap: .8rem; padding: 1.7rem 2rem 1.2rem; max-height: min(var(--ask-hmax), 56rem);
}
#ask-ov .ask-panel.ah > .ask-inner { position: absolute; left: 0; right: 0; top: 0; }   /* while the height moves the content keeps its final size and the panel just reveals it */
#ask-ov .ask-inner > .k { flex: none; }
#ask-ov .ask-inner > .ask-g, #ask-ov .ask-inner > .ask-flag { flex: none; }
#ask-ov .ask-inner > .ask-g.cx-fade { margin: 0 -2rem; padding: .2rem 2rem; }
#ask-ov .ask-inner > .x { top: .8rem; }

/* ---------- the list: one highlight bar that slides under the rows ---------- */
#ask-ov .ask-inner > .ask-list { position: relative; flex: 0 1 auto; min-height: 0; overscroll-behavior: contain; }
#ask-ov .ask-list > .ask-row { position: relative; z-index: 1; }
#ask-ov .ask-list > .ask-hl {
  position: absolute; z-index: 0; left: .4rem; right: .4rem; top: 0; height: 48px; pointer-events: none; border-radius: var(--r-pill, 999px);
  background: var(--mf-wash, rgba(22, 22, 27, .06)); opacity: 0; transform: translate3d(0, 0, 0); will-change: transform;
  transition: opacity 160ms var(--mf-ease-fade, cubic-bezier(.4, 0, .6, 1)), height 200ms var(--mf-ease-out, cubic-bezier(.22, 1, .36, 1));
}
#ask-ov .ask-list > .ask-hl.ready { opacity: 1; }
body #ask-ov .ask-list .ask-row:active { background-color: transparent; }   /* the bar is the press wash (it follows pointerdown) */
/* a row that left the list: a clone that fades and blurs where it was, then goes */
#ask-ov .ask-inner > .ask-ghost { position: absolute; z-index: 4; margin: 0; pointer-events: none; }

/* ---------- letter inking: while a query is typed the words go muted, the matched runs stay ink at 600; the row under the bar is ink ---------- */
#ask-ov.ask-q .ask-list .ask-row > span { color: var(--lg-fg3, rgba(22, 22, 27, .64)); transition: color 160ms var(--mf-ease-out, cubic-bezier(.22, 1, .36, 1)); }
#ask-ov.ask-q .ask-list .ask-row[data-on] > span, #ask-ov.ask-q .ask-list .ask-row:hover > span, #ask-ov.ask-q .ask-list .ask-row:focus-visible > span { color: var(--lg-fg, #16161b); }
#ask-ov .ask-row mark.ask-hit { background: none; color: var(--lg-fg, #16161b); font-weight: 600; padding: 0; }

/* ---------- the magnifier: its own lens hides while the pill that grew out of it is up, so two lenses never show ---------- */
html.ask-morph #tally [data-ask] svg { visibility: hidden; }

/* ---------- reduced motion: no morph, no blur, no spring; the pill and panel fade (js/search-anim.js), the bar moves with a short opacity step ---------- */
@media (prefers-reduced-motion: reduce) {
  #ask-ov .ask-list > .ask-hl { transition: opacity 120ms linear; }
  #ask-ov .ask-pill .ask-in input, #ask-ov .ask-pill .ask-clear { translate: none; }
}
