/* Player search (search.js): a pill in the masthead beside the season picker, a wide box in the
   front page's head, a button on a phone's masthead that opens the box across it. The list is a
   white panel with a 1px border, as the team picker's is. */

.ps-slot { display: contents; }

.ps {
  position: relative;
  flex: none;
  align-self: flex-start;
  font-family: var(--body);
}

/* The box: the season picker's pill, white once it has the focus */
.ps-box {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(170px, 22vw, 250px);
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--team-ink) 45%, transparent);
  border-radius: 999px;
  color: var(--team-ink);
}
.ps-box:focus-within {
  background: var(--surface);
  border-color: var(--surface);
  color: var(--ink);
  outline: 2px solid var(--team-ink);
  outline-offset: 2px;
}
.ps-box > .ps-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .8; pointer-events: none; }
.ps-q {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 32px 0 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 500 16px/1 var(--body); /* 16px: iOS doesn't zoom into it */
  text-overflow: ellipsis; /* a placeholder too long for the box even at its shortest (search.js fits it) */
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.ps-q::placeholder { color: inherit; opacity: .78; }
.ps-k {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  border-radius: 4px;
  font: 600 12px/16px var(--body);
  text-align: center;
  opacity: .75;
  pointer-events: none;
}
.ps-box:focus-within .ps-k, .ps-q:not(:placeholder-shown) ~ .ps-k { display: none; }

/* The phone's button, and its box's close button: hidden elsewhere */
.ps-btn, .ps-x {
  display: none;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.ps-btn {
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--team-ink) 45%, transparent);
  border-radius: 999px;
  color: var(--team-ink);
}
.ps-btn:focus-visible { outline: 2px solid var(--team-ink); outline-offset: 2px; }
.ps-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 999px; color: var(--muted); }
.ps-x:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* The list */
.ps-pop {
  position: absolute;
  z-index: 70;
  top: calc(100% + 8px);
  right: 0;
  width: min(440px, calc(100vw - 24px));
  max-height: min(600px, calc(100vh - 150px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  text-align: left;
}
.ps-list { display: grid; gap: 1px; }
.ps-o {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ps-o[aria-selected="true"] { background: var(--bg); }
.ps-pic {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}
.ps-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ps-ph { font: 600 15px/1 var(--display); color: var(--muted); user-select: none; }
.ps-t { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; overflow: clip; overflow-clip-margin: 2px; }
.ps-n { font-size: 15px; font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.ps-n b { font-weight: 700; }
/* The sport, then country, team, position, honors, years: whole pieces that wrap, never cut. The
   dot before each piece hangs left of .ps-t's clip, so no line starts with one. */
.ps-m {
  display: flex;
  flex-wrap: wrap;
  margin: 1px 0 0 -14px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
}
.ps-m > span { white-space: nowrap; }
.ps-m > span::before { content: "·"; display: inline-block; width: 14px; text-align: center; }
.ps-m > .ps-s { font-weight: 600; color: var(--ink); }
.ps-none { margin: 0; padding: 12px 10px; color: var(--muted); font-size: 14px; }

/* The front page: a wide white box under the head's line */
.ps-home { margin-top: 20px; max-width: 520px; }
.ps-home .ps-box {
  width: 100%;
  height: 46px;
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.ps-home .ps-box:focus-within { border-color: var(--ink); outline: 1px solid var(--ink); outline-offset: 0; }
.ps-home .ps-box > .ps-ic { left: 16px; }
.ps-home .ps-q { padding-left: 42px; }
.ps-home .ps-k { right: 14px; }
.ps-home .ps-pop { left: 0; right: 0; width: auto; }

/* A phone: the masthead's button beside the title, opening the box over the masthead (under the
   crumbs) in the sport's color, the list under it */
@media (max-width: 600px) {
  .ps-k { display: none; }
  .ps:not(.ps-home) { order: 2; }
  .ps:not(.ps-home) .ps-btn { display: grid; }
  .ps:not(.ps-home):not(.ps-open) .ps-box,
  .ps:not(.ps-home):not(.ps-open) .ps-pop { display: none; }
  .ps.ps-open:not(.ps-home) { position: absolute; z-index: 71; inset: 0; padding: 10px 12px; background: var(--team); }
  .ps.ps-open .ps-btn { display: none; }
  .ps.ps-open:not(.ps-home) .ps-box {
    width: 100%;
    height: 44px;
    background: var(--surface);
    border-color: var(--surface);
    color: var(--ink);
    outline: none;
  }
  .ps.ps-open:not(.ps-home) .ps-q { padding-right: 44px; }
  .ps.ps-open:not(.ps-home) .ps-x { display: grid; }
  .ps.ps-open:not(.ps-home) .ps-pop { top: 62px; left: 12px; right: 12px; width: auto; max-height: calc(100vh - 140px); }
  .ps-home { margin-top: 16px; }
}
