/* Popup menus
 * -------------------------------------------------------------------------- */

/* Hide popup links to avoid flash of unstyled content during load */
[data-popup-menu-target~=link] { display: none; }

.popup-menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  list-style-type: none;
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-tertiary) 100%);
  color: var(--color-txt--reversed);
  padding: 1.25em;
  border-radius: 1.5em;
  max-height: calc(100vh - 7.2rem - 6.6rem - 1rem); /* viewport height - page-toolbar height - navbar height - a little extra */
  width: 30rem;
  overflow-y: auto;
  font-size: var(--font-size-small);
  text-align: left;
  z-index: 10;
  opacity: 0.99;
  -webkit-overflow-scrolling: touch;

  [open] > & {
    animation: pop-open 0.1s both;
  }

  &[disabled] {
    display: none;
  }

  @media (min-height: 730px) {
    max-height: calc(35rem + 11rem + var(--base-space));
  }
}

.page__content:has(.compressed-entries--count-2 .entry--internal) {
  .popup-menu {
    max-height: calc(31rem + var(--base-space));
  }
}

.popup-menu--top { top: 0; }
.popup-menu--right { right: -1em; }
.popup-menu--bottom { bottom: 0; }
.popup-menu--left { left: -1em; }
.popup-menu--centered { left: 50%; margin-left: -15rem; }
.popup-menu--tall { max-height: calc(100vh - 5.5rem - var(--page-padding)); } /* viewport height - navbar height - bottom-page-padding */
.popup-menu--padded { padding: 1.5em; }

.popup-menu--wide {
  @media (min-width: 40em) {
    --width: 36rem;
    width: var(--width);

    &.popup-menu--centered {
      margin-left: calc(var(--width) / -2);
    }
  }
}

.popup-menu__input {
  color: var(--color-txt);
  background-color: var(--color-bg--main);

  [data-color-scheme="dark"] & { background-color: var(--color-bg--surface-glint-thick); }
}

textarea.popup-menu__input {
  max-height: 20rem;
}

.popup-menu--filings:empty { display: none; }

.popup-menu--bubble-up:empty { display: none; }

.popup-menu--recycling {
  background: linear-gradient(135deg, var(--color-positive) 0%, var(--color-recycling) 100%);

  .action-group__title {
    color: var(--color-txt--reversed);
    opacity: 1 !important;
  }
}
