/* ============================================================
   SEARCH (SEARCH_DIRECTION, NORTH_STAR A97): the top bar's field and its panel from 1024, the
   phone's sheet, the rows and the best match they share, /search, and the 404's box. On every
   page, since the header carries it. Tokens only.
   ============================================================ */

/* ---------- The top bar's field, from 1024 (§3.1) ---------- */
.hdr-find { display: none; }
@media (min-width: 1024px) {
  .hdr-find { display: block; position: relative; flex: 0 1 480px; min-width: 280px; }
  .frame:not(.has-nav) .app-header__brand + .hdr-find { margin-left: 24px; }
}
.sr-find { position: relative; }
.sr-find > .icon {
  position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  color: var(--ink-2); pointer-events: none;
}
.sr-find .input { height: 40px; padding: 0 44px 0 42px; }
.sr-kc { position: absolute; right: 12px; top: 50%; margin: -10px 0 0; pointer-events: none; }
.sr-find:focus-within .sr-kc, .sr-find:has(.input:not(:placeholder-shown)) .sr-kc { display: none; }
.sr-find__clear {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: var(--radius-control); color: var(--ink-2);
}
:is(.sr-find, .sr-field, .sr-page__find):has(.input:placeholder-shown) :is(.sr-find__clear, .sr-field__clear, .sr-clear) { display: none; }
:is(.sr-find, .sr-field, .sr-page__find, .nf__find) input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- The panel under it (§3.2), drawn like the ⋯ menus ---------- */
.sr-panel {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 60; width: 560px; max-height: calc(100dvh - 72px);
  overflow: auto; overscroll-behavior: contain; padding: 16px; scrollbar-width: thin;
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-2);
}
.sr-panel[hidden] { display: none; }

/* ---------- The sheet (§4.1): a place, not a sheet you flick away ---------- */
.sr-sheet {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0;
  padding: env(safe-area-inset-top) 0 0; border: 0; background: var(--surface-0); color: var(--ink);
}
.sr-sheet[open] { display: flex; flex-direction: column; animation: sr-fade 120ms var(--ease-out) both; }
.sr-sheet::backdrop { background: var(--surface-0); }
@keyframes sr-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sr-sheet[open] { animation: none; } }
.sr-head {
  flex: none; display: flex; align-items: center; gap: 4px; height: var(--header-h); padding: 0 12px 0 4px;
  background: var(--surface-0); border-bottom: 1px solid var(--line);
}
.sr-field { position: relative; flex: 1; min-width: 0; }
.sr-field > .icon {
  position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  color: var(--ink-2); pointer-events: none;
}
.sr-field .input { height: var(--tap); padding: 0 44px 0 42px; font-size: max(16px, var(--fs-body)); }
.sr-field__clear {
  position: absolute; right: 0; top: 0; width: var(--tap); height: var(--tap); display: grid; place-items: center; color: var(--ink-2);
}
.sr-body {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---------- What sits under a field (§4.2–§4.5) ---------- */
.sr-box { position: relative; }
.sr-roll { position: relative; height: 3px; margin: -16px -16px 13px; overflow: hidden; }
.sr-roll::after {
  content: ""; position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--ink);
  animation: sr-roll 1.1s var(--ease-roll) infinite alternate;
}
@keyframes sr-roll { to { left: calc(100% - 8px); } }
@media (prefers-reduced-motion: reduce) { .sr-roll::after { animation: none; left: calc(50% - 4px); } }
.sr-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 8px; color: var(--ink-2); }
.sr-status[hidden] { display: none; }
.sr-status .t-meta { margin: 0; }
.sr-status__line { display: flex; align-items: center; gap: 6px; }
.sr-status__retry { font-size: var(--fs-meta); }
.sr-status:not([hidden]) + .sr-recent-head:not([hidden]) { margin-top: 16px; }
.sr-recent-head { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.sr-recent-head[hidden] { display: none; }
.sr-recent-head .t-plate { margin: 0; color: var(--ink-2); }
.sr-recent-head .btn--tertiary { font-size: var(--fs-meta); }
.sr-recent__row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0 -16px; padding: 0 16px;
  color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.sr-recent__row .icon { flex: none; color: var(--ink-2); }
.sr-recent__row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-hint { margin: 0; padding-top: 8px; color: var(--ink-2); }

/* Nothing found, in the sheet and the panel (§4.4): the words, without the drawing or a button */
.sr-none { padding-top: 8px; }
.sr-none .t-headline { margin: 0; text-wrap: balance; }
.sr-none .t-meta { margin: 8px 0 0; }

/* ---------- Groups and rows (§5) ---------- */
.sr-fuzzy { margin: 0 0 16px; color: var(--ink-2); }
.sr-group + .sr-group { margin-top: 24px; }
.sr-group__head { display: flex; align-items: center; height: 40px; color: var(--ink-2); }
.sr-row {
  display: flex; align-items: center; gap: 12px; min-height: var(--row-h); margin: 0 -16px; padding: 6px 16px;
  color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.sr-row__lead { flex: none; width: 48px; height: 48px; display: grid; place-items: center; }
.sr-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.sr-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-row__meta { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ink-2); white-space: nowrap; }
.sr-row__meta > span:not(.live-dot):not(.plate) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sr-row__meta > .plate { flex: none; }
.sr-tile {
  display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; border-radius: var(--radius-control);
  background: var(--surface-2); color: var(--ink-2);
}
.sr-tile__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sr-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 48px; height: 48px; border-radius: var(--radius-control); background: var(--surface-2); color: var(--ink);
}
.sr-date .t-plate { font-size: 11px; line-height: 1; }
.sr-date .t-figure { line-height: 1; }
.sr-all {
  display: flex; align-items: center; gap: 4px; min-height: var(--tap); margin: 0 -16px; padding: 0 16px;
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.sr-all .icon { flex: none; }
.sr-foot {
  display: flex; align-items: center; gap: 12px; min-height: 56px; margin: 24px -16px 0; padding: 0 16px;
  border-top: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.sr-foot > .icon { flex: none; color: var(--ink-2); }
.sr-foot__words { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* videos and tutorials keep Watch's own row; in a list they bleed like the rows */
.sr-list .video-card--row, .sr-res .video-card--row, .sr-one .video-card--row { margin: 0 -16px; padding: 6px 16px; }

/* Pressed, hovered and active: surface-2 behind a row, a 2px ink outline around a card (§4.6, §5.1) */
:is(.sr-row, .sr-recent__row, .sr-all, .sr-foot, .sr-res .video-card--row, .sr-list .video-card--row):active,
:is(.sr-row, .sr-recent__row, .sr-all, .sr-foot, .video-card--row).is-active { background: var(--surface-2); }
@media (hover: hover) {
  :is(.sr-row, .sr-recent__row, .sr-all, .sr-foot, .sr-res .video-card--row, .sr-list .video-card--row):hover { background: var(--surface-2); }
}
.sr-list [role="option"].is-active:not(.sr-row, .sr-recent__row, .sr-all, .sr-foot, .video-card--row) {
  outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--radius-control);
}

/* ---------- The best match (§6) ---------- */
.sr-lead { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.sr-lead.card { margin-bottom: 24px; }
.sr-lead--kit { display: block; }
.sr-lead--kit > .card { margin-bottom: 0; }
.sr-person { position: relative; display: flex; align-items: flex-start; gap: 16px; }
.sr-person__txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.sr-person__name { color: var(--ink); margin-bottom: 4px; text-decoration: none; overflow-wrap: anywhere; }
/* the L chip: the avatar and the name are one link to the card */
.sr-person__name::after { content: ""; position: absolute; inset: 0; }
.sr-facts .t-meta { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-2); }
.sr-facts .sr-you { color: var(--ink); font-weight: 600; }
.sr-lead__name { color: var(--ink); text-decoration: none; }
.sr-lead > .t-meta { margin: -8px 0 0; color: var(--ink-2); }
.sr-lead > .sr-all { align-self: flex-start; margin: -4px 0 0; padding: 0; }

/* ---------- /search (§7) ---------- */
.sr-page { display: flex; flex-direction: column; }
.sr-page__find .input { padding-right: 48px; }
.sr-clear { position: absolute; right: 2px; top: 50%; margin-top: -22px; color: var(--ink-2); }
.sr-page__find + .sr-box { margin-top: 16px; }
.sr-page .sr-roll { margin: -10px 0 7px; }
.sr-page .sr-hint, .sr-page .sr-status { padding-top: 0; }
.sr-sec { padding-top: 24px; }
.sr-sec:first-child { padding-top: 8px; }
.sr-sec .section-head { margin-bottom: 4px; }
.sr-sec .sr-all { margin-top: 2px; }
.sr-one { display: flex; flex-direction: column; }
.sr-one__h1 { margin: 4px 0 12px; text-wrap: balance; }
.sr-one__rows { display: block; }
.sr-one .w-more { margin-top: 16px; align-items: stretch; }
.sr-page .empty--page h2 { text-wrap: balance; }
@media (min-width: 1024px) {
  .sr-page__find { display: none; }
  .sr-page__find + .sr-box { margin-top: 0; }
  .sr-page .sr-roll { margin: 0 0 13px; }
  .sr-page .sr-person__name {
    font-weight: 800; font-size: var(--fs-display); line-height: 1; letter-spacing: -0.01em;
  }
  .sr-one .w-more { align-items: flex-start; }
}

/* ---------- The 404's box (§10) ---------- */
.empty.nf { max-width: 400px; }
.nf__find { width: 100%; margin-top: 24px; text-align: left; }
.nf__find + .btn { margin-top: 16px; }
