.wi-popover{box-sizing:border-box;padding:var(--space-1);background-color:var(--wi-popover-bg,var(--background-surface));border:var(--border-1) solid var(--border-default);border-radius:var(--wi-popover-radius,var(--radius-lg));box-shadow:var(--shadow-lg)}.wi-popover__item{padding:var(--space-2) var(--space-3);border-radius:var(--radius-md);font-family:var(--font-family-sans);font-size:var(--wi-popover-font-size,var(--font-size-sm));line-height:var(--wi-popover-line-height,var(--font-line-height-sm));color:var(--text-primary);cursor:pointer;outline:none}.wi-popover__item[data-focused],.wi-popover__item[data-hovered]{background-color:var(--background-sunken)}.wi-popover__item[data-focus-visible]{box-shadow:inset 0 0 0 var(--border-2) var(--border-focus)}

/* A menu of options (FilterSelect's values, Combobox's options): the list, an option's row with its label and check, the
   chosen one on a pale row, and the message when there is nothing to show. */
.wi-menu-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.wi-popover__item.wi-menu-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-control-sm);
  padding-block: 0;
  border-radius: var(--radius-sm);
}
.wi-menu-option__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The chosen option keeps its pale row when pointed at, focused or clicked: the grey hover above would otherwise switch
   it back and forth. */
.wi-popover__item.wi-menu-option:is([aria-current="true"], [aria-selected="true"]) {
  background-color: var(--background-accent-subtle);
  font-weight: var(--font-weight-semibold);
}
.wi-menu-option__check {
  flex: none;
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
  color: var(--brand-secondary-bg);
}
.wi-menu-message {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
}

/* A menu's own list, scrolled to its end, doesn't scroll the page on: the page's scroll would close it
   (popover_controller.js) while a choice is being made. */
.wi-popover[popover] {
  overscroll-behavior: contain;
}

/* A popover by its trigger (popover_controller.js says which path places it and why), where the browser has CSS
   anchor positioning and all it uses here: by its trigger as its placement says (the controller copies the trigger's
   `data-placement`), kept there as the page scrolls, flipped to stay on screen, its height capped by the room it has
   (`--wi-popover-room`). Each popover's own trigger is its anchor: a trigger's name is seen only within its
   controller's element (`anchor-scope`), and of the account menu's two triggers only the one on screen can be one. */
@supports (anchor-name: --a) and (anchor-scope: --a) and (position-area: bottom) and
  (position-try-fallbacks: flip-block) and (width: anchor-size(width)) {
  :root {
    --wi-popover-anchored: 1;
  }
  [data-controller~="popover"] {
    anchor-scope: --wi-popover-trigger;
  }
  [data-popover-target="trigger"] {
    anchor-name: --wi-popover-trigger;
  }
  .wi-popover[popover]:not([data-placed-by-script], [data-sheet]) {
    --wi-popover-room: calc(100% - var(--space-1)); /* the room under the trigger, less the gap */
    position-anchor: --wi-popover-trigger;
    position-area: bottom span-right;
    position-try-fallbacks: flip-block, flip-inline;
    inset: auto;
    margin: var(--space-1) 0 0;
    min-width: anchor-size(width);
    --wi-popover-anchor-width: anchor-size(width); /* for a menu that is exactly as wide as its trigger */
  }
  .wi-popover[popover][data-placement="bottom-end"]:not([data-placed-by-script], [data-sheet]) {
    position-area: bottom span-left;
  }
  /* Beside its trigger, bottom to bottom (the account menu's language row opens its choices there). */
  .wi-popover[popover][data-placement="right-end"]:not([data-placed-by-script], [data-sheet]) {
    position-area: right span-top;
    margin: 0 0 0 var(--space-1);
  }
  .wi-popover[popover][data-placement="top-start"]:not([data-placed-by-script], [data-sheet]) {
    position-area: top span-right;
    margin: 0 0 var(--space-1);
  }
}

/* A popover shown as a bottom sheet (`data-sheet`, set by popover_controller.js on a phone for a popover that asks for it):
   not placed by its trigger but at the bottom of the screen over the dimmed page, on top of the keyboard when one is up
   (`--wi-keyboard-inset`, keyboard_inset_controller.js), rising as a sheet does (`Sheet.css`, which also draws its surface).
   What it holds that says `data-hidden-while-typing` folds away while a text field in it has the focus, so the fields stay in sight
   above the keyboard. */
.wi-popover[data-sheet] {
  position: fixed;
  inset: auto 0 var(--wi-keyboard-inset, 0px) 0;
  width: auto;
  max-width: none;
  max-height: calc(100dvh - var(--wi-keyboard-inset, 0px) - var(--space-10));
  margin: 0;
  overflow-y: auto;
}
.wi-popover[data-sheet]::backdrop {
  background-color: var(--background-scrim-light);
}
.wi-popover[data-sheet]:popover-open {
  animation: wi-sheet-rise 0.3s var(--wi-ease-enter) both;
}
.wi-popover[data-sheet]:has(input:focus) [data-hidden-while-typing] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .wi-popover[data-sheet]:popover-open {
    animation: none;
  }
}
