/* The main nav (docs/adr/0038): links in the header on wide screens. */
.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0;
  border-bottom: 0.2rem solid transparent;
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  border-bottom-color: var(--white);
}

.site-nav__link[aria-current="page"] {
  border-bottom-color: var(--tertiary);
}

/* The nav fills the header, so a visitor's Log in can sit on the right. */
.site-nav {
  flex-grow: 1;
}

.site-nav__item--account {
  margin-left: auto;
}

/* In the header the words are enough; the icons are for the bottom bar. */
@media (min-width: 48rem) {
  .site-nav--app .icon,
  .site-nav__item--phone {
    display: none;
  }
}

@media (max-width: 47.99rem) {
  .site-nav__list {
    gap: 0.5rem 1rem;
  }

  /* Feature requests (docs/adr/0089): in the account menu instead, on phones. */
  .site-nav__item--wide {
    display: none;
  }

  /*
   * Phones, logged in: a bar fixed to the bottom of the screen - Home, Teams,
   * Profile, and Admin for site admins (docs/adr/0086) - within reach of a
   * thumb, as in most phone apps. Its links share the width, however many
   * there are. The page gets room at the bottom so the bar never covers the
   * end of it.
   */
  .site-nav--app {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    /* 4rem tall, as the page's room for it and what sits on it (the slot picker, a form's Save) take it to be. */
    min-height: calc(4rem + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 0.25rem solid var(--tertiary);
    background-color: var(--black);
  }

  .site-nav--app .site-nav__list {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 0;
  }

  .site-nav--app .site-nav__link {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    width: 100%;
    padding: 0.5rem 0.25rem 0.375rem;
    border-bottom: 0;
    font-size: 0.75rem;
  }

  .site-nav--app .site-nav__link .icon {
    width: 1.5rem;
    height: 1.5rem;
  }

  .site-nav--app .site-nav__link[aria-current="page"] {
    color: var(--tertiary);
  }

  body:has(.site-nav--app) {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
  }
}
