/* The rebuilt pages' Discovery pop-up (board 07 "The dock opens Discovery"; src/fp/rb/find/). A phone first: the same
   list full screen. From 900px it rises above the dock, 760px wide, over a scrim. Tokens and .px are rb.css's.
   A page lists this sheet beside its own when it draws the dock (src/fp/homePage.ts, src/fp/rb/market/page.ts). */
body[data-rb-find-open] { overflow: hidden; }
/* the page under the full-screen list never widens the screen (a small phone at 200% text): the list is the screen's width */
body[data-rb-find-open] .rb-page { overflow-x: clip; }
.rb-fd-scrim { display: none; }
.rb-fd { container: rbfd / inline-size; position: fixed; inset: 0; z-index: 21; background: var(--bg); display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 0; }
.rb-fd-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.rb-fd-in { display: flex; align-items: center; gap: 8px; margin: 12px 16px 6px; padding: 0 4px 0 12px; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; background: var(--surf2); }
.rb-fd-in:focus-within { border-color: var(--sig); }
.rb-fd-in > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rb-fd-in input { flex: 1; min-width: 0; height: 46px; border: 0; background: none; color: var(--fg); font: 400 1rem/1.2 var(--body); caret-color: var(--sig); outline: none; }
.rb-fd-in input::placeholder { color: var(--faint); opacity: 1; }
.rb-fd-x { flex: none; min-height: 44px; padding: 0 10px; font: 600 .875rem var(--body); color: var(--fg); }
.rb-fd-x kbd { display: none; font: 500 .6875rem var(--body); color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.rb-fd-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 max(16px, env(safe-area-inset-bottom)); }

.rb-fd-rec { display: flex; gap: 8px; align-items: center; padding: 0 16px 2px; font-size: .78125rem; color: var(--faint); overflow-x: auto; scrollbar-width: none; }
.rb-fd-rec::-webkit-scrollbar, .rb-fd-chips::-webkit-scrollbar { display: none; }
.rb-fd-rec > span { flex: none; }
.rb-fd-rec a { flex: none; display: inline-flex; align-items: center; min-height: 40px; max-width: 15rem; color: var(--muted); }
.rb-fd-rec a { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.rb-fd-rec a:hover { color: var(--fg); }

.rb-fd-chips { display: flex; gap: 5px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.rb-fd-chips button { flex: none; display: inline-flex; align-items: center; min-height: 44px; }
.rb-fd-chips span { font-size: .78125rem; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.rb-fd-chips button:hover span { color: var(--fg); }
.rb-fd-chips [aria-pressed="true"] span { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 600; }

.rb-fd-cap { display: flex; align-items: center; gap: 2px; padding: 0 16px; min-height: 40px; font-size: .75rem; color: var(--muted); }
.rb-fd-i { flex: none; width: 40px; height: 40px; display: grid; place-items: center; }
.rb-fd-i span { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font: 600 .6875rem/1 var(--body); color: var(--muted); }
.rb-fd-i:hover span, .rb-fd-i[aria-expanded="true"] span { color: var(--fg); border-color: var(--muted); }
.rb-fd-about { margin: 0 16px 8px; padding: 10px 12px; border-radius: 10px; background: var(--surf2); font-size: .78125rem; color: var(--muted); }
.rb-fd-note { padding: 14px 16px; font-size: .84375rem; color: var(--muted); }
.rb-fd-lk { text-decoration: underline; text-underline-offset: 3px; color: var(--fg); min-height: 40px; display: inline-flex; align-items: center; margin-left: 6px; }
.rb-fd-link { display: grid; gap: 12px; justify-items: start; padding: 14px 16px; font-size: .84375rem; color: var(--muted); }
.rb-fd-hd { display: none; }

.rb-fd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.rb-fd-a { grid-column: 1; grid-row: 1 / span 2; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; }
.rb-fd-a .rb-pic { margin-top: 2px; }
.rb-fd-q { min-width: 0; display: grid; gap: 3px; }
.rb-fd-q b { font: 600 .90625rem/1.3 var(--body); overflow-wrap: break-word; }
.rb-fd-q b i { font-style: normal; font-weight: 500; color: var(--muted); }
.rb-fd-why { font-size: .78125rem; color: var(--muted); }
.rb-fd-top { font-size: .75rem; line-height: 1.35; color: var(--muted); display: block; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-fd-p { grid-column: 2; grid-row: 1; justify-self: end; text-align: right; display: grid; justify-items: end; gap: 2px; }
.rb-fd-p .px { font-size: 1.375rem; }
.rb-fd-p small { font-size: .6875rem; color: var(--muted); }
.rb-fd-c { display: none; }
.rb-fd-w { grid-column: 2; grid-row: 2; align-self: end; justify-self: end; min-height: 40px; min-width: 76px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: 600 .78125rem var(--body); color: var(--fg); }
.rb-fd-w:hover { background: var(--surf2); }
.rb-fd-w.on { color: var(--muted); border-color: transparent; }
.rb-fd-more { display: flex; align-items: center; min-height: 44px; padding: 0 16px; font: 600 .8125rem var(--body); color: var(--muted); }
.rb-fd-more:hover { color: var(--fg); }
.rb-fd-foot { padding: 10px 16px 0; font-size: .75rem; color: var(--faint); }

/* a narrow pop-up (a small phone, or large text): the field's hint fits beside Cancel */
@container rbfd (max-width: 21rem) {
  .rb-fd-in input { text-overflow: ellipsis; }
  .rb-fd-in input::placeholder { font-size: .875rem; }
}
/* large text on a phone: the name takes the row's full width, the price and Watch sit under it, so no word is cut */
@container rbfd (max-width: 18rem) {
  .rb-fd-a { grid-column: 1 / -1; grid-row: 1; }
  .rb-fd-p { grid-column: 1; grid-row: 2; justify-self: start; justify-items: start; text-align: left; align-self: center; }
  .rb-fd-w { grid-column: 2; grid-row: 2; align-self: center; }
}

@media (min-width: 900px) {
  body[data-rb-find-open] { overflow: visible; }
  body[data-rb-find-open] .rb-page { overflow-x: visible; }
  .rb-fd-scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5); }
  /* the dock stays lit over the scrim, its bar marked open (a click on it closes) */
  body[data-rb-find-open] .rb-dock { z-index: 22; background: none; }
  body[data-rb-find-open] .rb-find { border-color: var(--sig); color: var(--fg); }
  .rb-fd { inset: auto 0 86px; margin: 0 auto; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); background: var(--surf); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px -20px #000; padding: 8px 8px 6px; }
  .rb-fd-in { margin: 0; padding: 0 6px 0 14px; min-height: 50px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
  .rb-fd-in input { font-size: .9375rem; height: 48px; }
  .rb-fd-x { min-height: 36px; padding: 0 8px; }
  .rb-fd-x kbd { display: inline; } .rb-fd-x span { display: none; }
  .rb-fd-body { padding: 4px 0 0; }
  .rb-fd-rec { padding: 4px 12px 0; overflow: hidden; }
  .rb-fd-rec a { min-height: 32px; }
  .rb-fd-chips { gap: 6px; padding: 2px 8px 0; overflow: hidden; }
  .rb-fd-chips button { min-height: 40px; }
  .rb-fd-chips span { font-size: .8125rem; padding: 6px 12px; }
  .rb-fd-cap { padding: 0 4px 0 12px; min-height: 32px; }
  .rb-fd-i { height: 32px; }
  .rb-fd-about { margin: 0 8px 6px; }
  .rb-fd-note { padding: 14px 12px; }
  .rb-fd-link { padding: 14px 12px; }
  /* the table's columns only while the dialog is wide in the reader's own text size (at 200% text the rows stack, as on a phone) */
  @container rbfd (min-width: 40rem) {
    .rb-fd-hd, .rb-fd-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem 9.5rem 4.75rem; column-gap: 14px; align-items: center; }
    .rb-fd-hd { padding: 6px 12px 2px 56px; font-size: .71875rem; color: var(--faint); }
    .rb-fd-hd > span:first-child { display: none; }
    .rb-fd-hd > span:nth-child(3) { text-align: right; }
    .rb-fd-hd > span:nth-child(4) { color: var(--fg); font-weight: 600; }
    .rb-fd-row { padding: 0 12px; border-bottom: 0; border-radius: 10px; }
    .rb-fd-row:hover, .rb-fd-row:focus-within { background: var(--surf2); }
    .rb-fd-a { grid-column: auto; grid-row: auto; gap: 14px; align-items: center; padding: 9px 0; }
    .rb-fd-a .rb-pic { margin-top: 0; }
    .rb-fd-q { gap: 0; }
    .rb-fd-q b { font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rb-fd-why { display: none; }
    .rb-fd-top { display: block; white-space: nowrap; text-overflow: ellipsis; }
    .rb-fd-p { grid-column: auto; grid-row: auto; }
    .rb-fd-c { display: block; font-size: .8125rem; line-height: 1.3; min-width: 0; }
    .rb-fd-c small { display: block; color: var(--muted); font-size: .71875rem; }
    .rb-fd-w { grid-column: auto; grid-row: auto; align-self: center; justify-self: stretch; min-height: 32px; min-width: 0; padding: 0 4px; }
  }
  .rb-fd-more { padding: 0 12px; min-height: 40px; }
  .rb-fd-foot { padding: 6px 12px 4px; }
}
@media (prefers-reduced-motion: no-preference) {
  .rb-fd { animation: rb-fd-rise var(--rb-t-fast) var(--rb-ease); }
  .rb-fd-scrim { animation: rb-fd-fade var(--rb-t-fast) var(--rb-ease); }
  .rb-fd-w, .rb-fd-chips span { transition: color var(--rb-t-fast) var(--rb-ease), background-color var(--rb-t-fast) var(--rb-ease); }
}
@keyframes rb-fd-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes rb-fd-fade { from { opacity: 0; } }

/* the saved toast never hides the last row: while it shows, the list ends with room for it */
.rb-fd:has(+ .rb-fd-toast) .rb-fd-foot { padding-bottom: 72px; }
/* large text on a computer: the lit bar under the open pop-up keeps its words on one line, inside the bar */
body[data-rb-find-open] .rb-find > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* rebuild 138 (SW-26): a cut Recent name ends in "…" (a flex box drops text-overflow, so the link is an inline block) */
.rb-fd-rec a { display: inline-block; line-height: 40px; }

/* KHA-136: while the list loads, grey rows hold its place, so nothing under the field moves when it lands */
.rb-fd-sk { list-style: none; margin: 0; padding: 0 16px; }
.rb-fd-sk li { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.rb-fd-sk i { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--surf2); }
.rb-fd-sk i:last-child { width: 56px; height: 24px; margin-left: auto; }
.rb-fd-sk span { flex: 1; display: grid; gap: 6px; }
.rb-fd-sk b { height: 10px; width: 70%; border-radius: 4px; background: var(--surf2); }
.rb-fd-sk b + b { width: 40%; }
/* KHA-136 (Kha: "the same box in the same spot"): opened from the landing's hero box on a computer, the pop-up is that
   box, where it sits: the field at the box's own place and height, the list opening downward under it (client.js fit) */
@media (min-width: 900px) {
  .rb-fd-sk { padding: 0 12px; }
  body[data-rb-find-at="hero"] { overflow: hidden; }
  body[data-rb-find-at="hero"] .rb-fd { inset: var(--fd-t) auto auto var(--fd-l); width: var(--fd-w); height: var(--fd-h); max-height: none; margin: 0; padding: 0; border: 0; outline: 1px solid #34343a; outline-offset: -1px; border-radius: 14px; overflow: hidden; animation: none; }
  body[data-rb-find-at="hero"] .rb-fd-scrim { animation: none; }
  body[data-rb-find-at="hero"] .rb-fd-in { flex: none; box-sizing: border-box; height: var(--fd-bh); min-height: var(--fd-bh); padding: 0 8px 0 18px; gap: 12px; }
  body[data-rb-find-at="hero"] .rb-fd-in input { height: 100%; font-size: 1rem; }
  body[data-rb-find-at="hero"] .rb-fd-body { padding: 4px 0 8px; }
}
/* on a phone the hero's pop-up rides up out of the box (client.js grow), so it skips the dock's rise */
body[data-rb-find-at="hero"] .rb-fd { animation: none; }
/* the field is the box's own height on a phone too (56, not the dock's 48) */
body[data-rb-find-at="hero"] .rb-fd-in { min-height: var(--fd-bh); }
