/* The item search's results (app/components/search.js): under the top bar's field, and the phone's full-screen search.
   Their popover box (2px swan, radius 16); each result is a row: the picture on its tier tile, the name with its tier and
   type, the value and this week's change. Colours: tokens only. Prefix sr-. */

/* ---------------------------------------------------------------- the box under the top bar's field */
/* its right edge on the field's: wider than the field, it grows to the left, so it never passes the page's column (the
   field sits near the bar's right end) */
.f-search > .sr-res {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 320; width: max(100%, 480px); max-width: calc(100vw / var(--zoom, 1) - 32px);
  max-height: min(640px, calc(100vh / var(--zoom, 1) - var(--f-top-h, 64px) - 24px)); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px; border: 2px solid var(--u-drop-edge); border-radius: 16px; background: var(--color-snow); scrollbar-width: thin;
  box-shadow: var(--u-drop-shadow);
}
.sr-res[hidden] { display: none; }
/* it comes out of the field like a popover (ui.css .u-pop): a fade and a 4px glide, and goes the same way */
.f-search > .sr-res:not([hidden]) { animation: sr-in var(--m-fast) var(--m-ease-out) both; }
.f-search > .sr-res.is-leaving { animation: sr-out var(--m-fast) var(--m-ease-in) both; pointer-events: none; }
@keyframes sr-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes sr-out { to { opacity: 0; transform: translateY(-4px); } }

/* ---------------------------------------------------------------- the rows */
.sr-k { margin: 0; padding: 8px 12px 6px; color: var(--color-label); font: 700 13px/16px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.sr-empty { margin: 0; padding: 18px 12px; color: var(--color-wolf); font: 400 17px/24px var(--font); }
.sr-hit {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; min-height: 64px;
  padding: 6px 12px; border-radius: 12px; color: var(--color-eel); text-decoration: none; scroll-margin: 8px;
}
.sr-hit.is-hi { background: var(--color-polar); }
.sr-hit__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sr-hit__name { font: 700 17px/22px var(--font); overflow-wrap: break-word; }
.sr-hit__meta { color: var(--color-wolf); font: 400 15px/18px var(--font); }
.sr-hit__val { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.sr-hit__val .u-val { color: var(--color-eel); font: 700 19px/24px var(--font); font-variant-numeric: tabular-nums; }
.sr-hit__chg { font-size: 14px; line-height: 18px; font-variant-numeric: tabular-nums; }
.sr-all {
  display: flex; align-items: center; min-height: 48px; margin-top: 6px; padding: 0 12px;
  border-top: 2px solid var(--color-swan); border-radius: 0 0 12px 12px; color: var(--color-link); font: 700 15px/20px var(--font); text-decoration: none;
}
.sr-all.is-hi { background: var(--color-polar); }
.sr-hit:focus-visible, .sr-all:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: -2px; }

/* ---------------------------------------------------------------- the full-screen search (phones) */
.sr-sheet { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); }
.sr-sheet__head { display: flex; align-items: center; gap: 8px; flex-shrink: 0; height: 64px; padding: 0 16px; border-bottom: 2px solid var(--color-swan); }   /* on the page's 16px edges, like the rows' words under it */
.sr-sheet__back { --h: 44px; --pad: 0; --r: 12px; width: 44px; flex-shrink: 0; color: var(--color-eel); }
.sr-sheet__head .u-field { flex: 1; min-width: 0; height: 46px; }
.sr-sheet__head .u-field > input { font-size: 17px; }
.sr-sheet__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 4px calc(16px + env(safe-area-inset-bottom, 0px)); }
/* typing (app/viewport.js): iOS keeps the sheet its full height under the keyboard, so the last results (and "See
   all") could never scroll up out from behind it; the sheet is the part the keyboard leaves visible instead */
html.kb .sr-sheet { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-h, 100%); }
html.kb .sr-sheet__body { padding-bottom: 16px; }
/* "See all": its line as wide as the rows' words, not the sheet (rows sit 12px in) */
.sr-sheet__body .sr-all { margin: 6px 0 0; border-top: 0; border-radius: 12px; background: linear-gradient(var(--color-swan), var(--color-swan)) 50% 0 / calc(100% - 24px) 2px no-repeat; }
.sr-sheet__body .sr-all.is-hi { background: var(--color-polar); }
