/* The current user's menu in the header (layout/account-menu.html.twig). */
.account-menu {
  position: relative;
  margin-left: auto;
}

.account-menu__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.account-menu__toggle::-webkit-details-marker {
  display: none;
}

.account-menu__toggle:focus-visible {
  outline: 0.2rem solid var(--tertiary);
  outline-offset: 0.2rem;
}

.account-menu__caret {
  font-size: 0.75rem;
}

.account-menu__list {
  --focus: var(--black);
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 60;
  min-width: 12rem;
  padding: 0.375rem 0;
  border: 0.125rem solid var(--black);
  border-radius: 0.5rem;
  box-shadow: 0.375rem 0.375rem var(--black);
  background-color: var(--white);
  color: var(--black);
}

.account-menu__link {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--black);
  font-weight: 700;
  text-decoration: none;
}

.account-menu__link:hover,
.account-menu__link:focus-visible {
  background-color: var(--tertiary);
}

.account-menu__link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 0.15rem;
}

/* Phones: just the initials - the name is still read out. */
@media (max-width: 47.99rem) {
  .account-menu__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .account-menu__toggle .avatar {
    width: 2.25rem;
    height: 2.25rem;
  }

  /* Profile is in the bottom bar on phones (docs/adr/0120). */
  .account-menu__item--wide {
    display: none;
  }
}

/* Feature requests (docs/adr/0089): in the main nav instead, on wider screens. */
@media (min-width: 48rem) {
  .account-menu__item--phone {
    display: none;
  }

  /*
   * A long name takes two lines at most, ending in "…", rather than squeeze
   * the main nav beside it; it's still read out in full (docs/adr/0108).
   */
  .account-menu__name {
    display: -webkit-box;
    max-width: 15rem;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}
