/* ============================================================
   Navigation — the page navbar, its mobile disclosure, tab-style
   pill navs, and the dropdown menus hung off the navbar and the
   room header.
   ============================================================ */

@layer components {
  .navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-block: var(--space-2);
  }

  .navbar > .container {
    display: flex;
    flex-wrap: inherit;
    align-items: center;
    justify-content: space-between;
  }

  .navbar-brand {
    padding-block: 0.3125rem;
    margin-right: var(--space-3);
    font-size: 1.25rem;
    color: #000;
    text-decoration: none;
    white-space: nowrap;
  }

  .navbar-nav {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
  }

  .navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
    align-items: center;
  }

  .navbar-toggler {
    padding: 0.25rem 0.75rem;
    font-size: 1.25rem;
    line-height: 1;
    color: rgb(0 0 0 / 0.65);
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: box-shadow var(--transition);
  }

  .navbar-toggler:hover {
    text-decoration: none;
  }

  .navbar-toggler:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--primary-ring);
  }

  .navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2830, 27, 75, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
  }

  /* Below the md breakpoint the nav is a disclosure: the toggler shows it.
     At and above it, the toggler disappears and the nav is always laid out
     as a row, so .collapse must stop hiding it. */
  .navbar-expand-md .navbar-toggler { display: block; }
  .navbar-expand-md .navbar-nav { flex-direction: column; }
}

@media (min-width: 768px) {
  @layer components {
    .navbar-expand-md {
      flex-wrap: nowrap;
      justify-content: flex-start;
    }

    .navbar-expand-md .navbar-nav {
      flex-direction: row;
    }

    .navbar-expand-md .navbar-collapse {
      display: flex !important;
      flex-basis: auto;
    }

    .navbar-expand-md .navbar-toggler {
      display: none;
    }

    .navbar-expand-md .navbar-nav .nav-link {
      padding-inline: var(--space-2);
    }

    .navbar-expand-md .navbar-nav .dropdown-menu {
      position: absolute;
    }
  }
}

@layer components {
  /* Generic nav, and the pill variant used for the location tabs. */
  .nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
  }

  .nav-link {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--color-primary);
    background: none;
    border: 0;
    transition: color var(--transition), background-color var(--transition), border-color var(--transition);
  }

  @media (prefers-reduced-motion: reduce) {
    .nav-link,
    .navbar-toggler {
      transition: none;
    }
  }

  .nav-link:hover,
  .nav-link:focus {
    color: var(--primary-hover);
    text-decoration: none;
  }

  .nav-link:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem var(--primary-ring);
  }

  .nav-link.disabled,
  .nav-link:disabled {
    color: var(--color-muted);
    pointer-events: none;
    cursor: default;
  }

  /* Inside the navbar the links are tighter and take the navbar's own ink.
     They gain horizontal padding back only once the bar lays out as a row. */
  .navbar-nav .nav-link {
    padding-block: var(--space-2);
    padding-inline: 0;
    color: rgb(0 0 0 / 0.65);
  }

  .navbar-nav .nav-link:hover,
  .navbar-nav .nav-link:focus {
    color: rgb(0 0 0 / 0.8);
  }

  .navbar-nav .nav-link.active {
    color: rgb(0 0 0);
  }

  .nav-pills .nav-link {
    border-radius: var(--radius);
  }

  .nav-pills .nav-link.active {
    color: #fff;
    background-color: var(--color-primary);
  }

  /* Dropdowns. Bootstrap positioned these with Popper; plain absolute
     positioning covers both of the app's two menus, which open under a
     trigger that sits near the right edge of its own container. */
  .dropdown {
    position: relative;
  }

  /* Inside the collapsed navbar there is no room to hang a menu off its
     trigger: the avatar toggle is narrow and sits at the right edge, so an
     absolute right-aligned menu runs off the left of the screen as soon as a
     location name makes it wide. In flow it simply stacks in the open nav,
     which is what it did before. */
  .navbar-nav .dropdown-menu {
    position: static;
  }

  .dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.255em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
  }

  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 10rem;
    /* Popper used to hold the menu off its trigger with a 2px margin plus its
       own 2px offset. Neither survived it, so the gap is declared here. A menu
       that carries its own mt-* utility still wins, since utilities are the
       last layer and carry !important. */
    margin-top: 0.25rem;
    padding-block: var(--space-2);
    padding-inline: 0;
    color: var(--color-body);
    text-align: left;
    list-style: none;
    background-color: var(--color-body-bg);
    background-clip: padding-box;
    border: 1px solid color-mix(in srgb, var(--color-dark) 15%, transparent);
    border-radius: var(--radius);
  }

  .dropdown-menu.show {
    display: block;
  }

  .dropdown-menu-end {
    right: 0;
    left: auto;
  }

  .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.25rem var(--space-3);
    clear: both;
    font-weight: 400;
    color: var(--color-body);
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
  }

  .dropdown-item:hover,
  .dropdown-item:focus {
    color: var(--color-dark);
    text-decoration: none;
    background-color: color-mix(in srgb, var(--color-dark) 8%, transparent);
  }

  .dropdown-item.active,
  .dropdown-item:active {
    color: #fff;
    text-decoration: none;
    background-color: var(--color-primary);
  }

  .dropdown-item.disabled,
  .dropdown-item:disabled {
    color: var(--color-muted);
    pointer-events: none;
    background-color: transparent;
  }

  .dropdown-item-text {
    display: block;
    padding: 0.25rem var(--space-3);
    color: var(--color-body);
  }

  .dropdown-header {
    display: block;
    padding: var(--space-2) var(--space-3);
    margin-bottom: 0;
    font-size: 0.875rem;
    color: #6c757d;
    white-space: nowrap;
  }

  .dropdown-divider {
    height: 0;
    margin-block: var(--space-2);
    overflow: hidden;
    border-top: 1px solid rgb(0 0 0 / 0.175);
    opacity: 1;
  }

  /* The disclosure primitive the navbar and the FAQ share. */
  .collapse:not(.show) {
    display: none;
  }
}
