/* Find in this chapter (lab/find.js): the Find button in the reader's toolbar, the find bar under it (a floating
   panel under the button on wider screens; a full-width sticky row on phones), and the highlight boxes laid over the book's
   page canvases (in % of the page, so they follow any width or zoom). */
.tool.find-btn.on{background:var(--m-soft);color:var(--m-ink);border-color:color-mix(in srgb,var(--m) 30%,var(--line))}
/* where the toolbar is tight, the Find button shows only its magnifier (like Full screen) */
@media (max-width:1240px){
  .find-btn .find-txt{display:none}
}

.find-bar{display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px;padding:6px max(16px,env(safe-area-inset-right,0px)) 6px max(16px,env(safe-area-inset-left,0px));border-bottom:1px solid var(--line);background:var(--panel)}
.find-field{flex:0 1 380px;min-width:0;display:flex;align-items:center;gap:6px;padding:0 10px;border:1.5px solid var(--line);border-radius:12px;background:var(--panel);cursor:text}
.find-field:focus-within{border-color:var(--m);box-shadow:0 0 0 3px var(--m-soft)}
.find-ic{font-size:15px;line-height:1;opacity:.75}
.find-field input{flex:1;min-width:0;width:100%;border:0;outline:0;background:none;font:500 16px/1.2 var(--body);color:var(--text);padding:7px 0}
.find-field input::placeholder{color:var(--muted);opacity:1}
.find-st{flex:0 1 auto;min-width:4.5em;font:600 14px/1.25 var(--body);color:var(--muted);font-variant-numeric:tabular-nums}
.find-st.none{color:var(--bad-ink,#c0262d)}
.find-st.bad{color:var(--text);font-weight:500}
.find-btns{display:flex;gap:6px}
.find-b{width:36px;height:34px;display:grid;place-items:center;padding:0;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--text);font:700 17px/1 var(--body);cursor:pointer}
.find-b:hover:not(:disabled){background:var(--hover);color:var(--m-ink)}
.find-b:disabled{opacity:.4;cursor:default}
.find-b.find-x{margin-left:auto;border-color:transparent;background:none;font-size:24px;font-weight:500;color:var(--muted)}
.find-b.find-x:hover{background:var(--hover);color:var(--text)}
.find-b:focus-visible,.find-btn:focus-visible{outline:3px solid color-mix(in srgb,var(--m) 55%,transparent);outline-offset:2px}
.find-note{flex:1 0 100%;margin:0;font-size:13px;line-height:1.35;color:var(--muted)}
.find-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* matches: a highlighter-yellow box over each one, the current one orange with an outline */
.viewer .page{position:relative}
.find-layer{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.find-hit{position:absolute;transform-origin:0 0;border-radius:3px;background:rgba(255,212,0,.5);mix-blend-mode:multiply}
.find-hit.on{background:rgba(255,128,0,.55);outline:2px solid #d9480f;outline-offset:1px}
@media (forced-colors:active){
  .find-hit{background:none;outline:2px solid Highlight}
  .find-hit.on{outline:3px solid Highlight;outline-offset:2px}
}

/* wider screens: a compact panel floating just under the Find button (find.js place() sets --find-x/-y/-w), so
   nothing below moves and the box is where the child clicked */
@media (min-width:761px){
  #read{position:relative}
  .find-bar{position:absolute;z-index:45;top:var(--find-y,56px);right:var(--find-x,16px);width:var(--find-w,440px);padding:8px 8px 8px 10px;border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 32px rgba(20,32,70,.18)}
  .find-field{flex:1 1 160px}
}

/* the book folded into the rail (Study Lab full width, wide screens): no book to search */
@media (min-width:1101px){
  .book-folded :is(#findBtn,.find-bar){display:none}
}
/* phones: the whole page scrolls, so the bar stays put under the top bar while matches scroll by */
@media (max-width:760px){
  .find-bar{position:sticky;top:var(--find-top,0px);z-index:20}
  .find-field{flex-basis:100%}
  .find-st{flex:1 1 auto}
}
