/* Search of the map (js/search.js): the field on the HUD title line, its list under the HUD, the pin on the map */
#hud .title { display: inline-block; vertical-align: middle; }
#pkFind { display: inline-flex; align-items: center; vertical-align: middle; position: relative; margin-left: 14px; }
#pkFind input { font: 400 15px/1 "Pixelify Sans", monospace; width: 262px; height: 26px; margin: 0; padding: 0 24px 0 28px; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 0; outline: none; -webkit-appearance: none; appearance: none; }
#pkFind input::-webkit-search-cancel-button, #pkFind input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
#pkFind input::placeholder { color: #8a8170; opacity: 1; }
#pkFind input:focus { background: #fffbe9; box-shadow: 0 0 0 2px var(--accent); }
/* the magnifier: an ornament inside the field on a desktop, the button that opens the field on a phone */
#hud #pkFindOpen { position: absolute; left: 2px; top: 0; width: 26px; height: 26px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; pointer-events: none; }
#hud #pkFindOpen svg { display: block; width: 14px; height: 14px; }
#hud #pkFindClear { position: absolute; right: 2px; top: 2px; width: 22px; height: 22px; padding: 0; border: 0; background: none;
  font-size: 17px; line-height: 1; color: var(--ink); cursor: pointer; }
#hud #pkFindClear[hidden] { display: none; }
#hud #pkFindClear:active, #hud #pkFindOpen:active { transform: none; }

#pkFindList { position: fixed; left: 12px; top: 104px; z-index: 27; width: 400px; margin: 0; padding: 0; list-style: none; background: var(--paper);
  border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); max-height: min(62vh, 430px); overflow: auto; overscroll-behavior: contain;
  font-family: "Pixelify Sans", monospace; color: var(--ink); }
#pkFindList[hidden] { display: none; }
#pkFindList li { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid rgba(43, 36, 51, .18); }
#pkFindList li:last-child { border-bottom: 0; }
#pkFindList li b { font-weight: 500; font-size: 15px; }
#pkFindList li span { margin-left: auto; font-size: 12px; color: #766b58; text-align: right; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 58%; flex: 0 1 auto; }
#pkFindList li[aria-selected="true"], #pkFindList li[data-i]:hover { background: var(--accent); }
#pkFindList li[aria-selected="true"] span, #pkFindList li[data-i]:hover span { color: var(--ink); }
#pkFindList li.none { cursor: default; font-size: 13px; color: #766b58; }

/* the pin: its tip stands on the place, the name tag beside it (the tag takes clicks, the rest lets the map through) */
.pk-pin { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; will-change: transform; }
.pk-pin-in { position: absolute; left: -13px; bottom: 0; display: flex; align-items: flex-start; gap: 3px; animation: pk-pin-drop .4s steps(5, end); }
.pk-pin svg { display: block; flex: 0 0 auto; animation: pk-pin-bob 1.1s steps(4, end) 3 .4s; }
.pk-pin-tag { pointer-events: auto; display: flex; align-items: center; gap: 6px; margin-top: -3px; padding: 2px 3px 2px 7px; white-space: nowrap;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 500 14px/1.2 "Pixelify Sans", monospace; color: var(--ink); }
.pk-pin-tag span { font-size: 11px; font-weight: 400; color: #766b58; }
.pk-pin-tag button { width: 20px; height: 20px; padding: 0; border: 0; background: none; font: inherit; font-size: 16px; line-height: 1; color: var(--ink); cursor: pointer; }
@keyframes pk-pin-drop { from { transform: translateY(-36px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pk-pin-bob { 0%, 100% { transform: none; } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .pk-pin-in, .pk-pin svg { animation: none; } }

/* the search is the map's: no field while walking or driving (the HUD folds there), none under the intro */
body.walking #pkFind, body.driving #pkFind, body.intro-on #pkFind,
body.walking #pkFindList, body.driving #pkFindList, body.walking .pk-pin, body.driving .pk-pin { display: none !important; }

/* phone: a magnifier button after the title; a tap swaps the title line for the field (16 px: no zoom-in on iOS) */
@media (max-width: 600px) {
  #pkFind { margin-left: 8px; }
  #hud:not(.finding) #pkFind input, #hud:not(.finding) #pkFindClear { display: none; }
  #hud:not(.finding) #pkFindOpen { position: static; width: 30px; height: 24px; border: 2px solid var(--ink); background: #fff; pointer-events: auto; cursor: pointer; }
  #hud.finding .title, #hud.finding .lbl-where { display: none; }
  #hud.finding #pkFind { display: flex; margin-left: 0; }
  #hud.finding #pkFind input { flex: 1 1 auto; width: auto; min-width: 0; height: 30px; font-size: 16px; }
  #hud.finding #pkFindOpen { top: 2px; }
  #hud.finding #pkFindClear { top: 4px; }
  #pkFindList { left: 8px; right: 8px; width: auto; max-height: 46vh; }
  #pkFindList li { padding: 9px 10px; }
  /* the name tag sits over the pin, centred on it (beside it a long name would leave the screen) */
  .pk-pin-tag { position: absolute; left: 13px; bottom: 40px; margin: 0; transform: translateX(-50%); font-size: 13px; max-width: 84vw; }
  .pk-pin-tag b { overflow: hidden; text-overflow: ellipsis; }
}
