.backdrop {
  background-color: color-mix(in srgb, var(--ink), transparent 50%);
  display: none;
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100vw;
  z-index: 10;

  &[active] {
    display: block;
  }
}

nav.main-nav { /* Main Nav */
  align-items: center;
  background: var(--pure-white);
  box-shadow: 0 2px 6px 0 var(--theme-tenth-opacity-color);
  display: flex;
  flex-flow: row nowrap;
  height: var(--navbar-height);
  justify-content: space-between;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;

  section {
    &.nav-control {
      align-items: center;
      display: flex;
      height: var(--navbar-height);
      padding: .25rem 1rem;
      width: var(--sidebar-width);

      &#organisation-navigation-control { /* Left .nav-control */
        flex-direction: column;
        gap: 0.25rem;
        justify-content: center;

        .logo {
          align-items: center;
          display: inline-flex;
          justify-content: center;
          width: 100%;
          max-height: 2.75rem;
          max-width: var(--sidebar-width);
          min-height: 2.75rem;
          overflow: hidden;

          img {
            max-height: inherit;
            width: auto;
            max-width: 100%;
            object-fit: contain;
          }
        }

        @media screen and (max-width: 768px) {
          align-items: flex-start;

          .logo {
            justify-content: flex-start;
            margin: auto 0;
            max-height: 2rem;
            min-height: 2rem;
          }
        }
      }

      &#global-navigation-control { /* Right .nav-control */
        flex-direction: row;
        gap: 1rem;
        justify-content: flex-end;

        @media screen and (max-width: 768px) {
          padding: 0.25rem 0.5rem;
          gap: 0.25rem;
          width: fit-content;
        }
      }
    }

    &.nav-links { /* Links Section */
      align-items: flex-end;
      height: var(--navbar-height);
      justify-content: space-between;
      max-width: var(--container-sm);
      width: calc(100vw - (var(--sidebar-width)) * 2);

      .nav-link {
        flex-direction: column;
        font-size: 1.2rem;
        font-weight: 600;
        height: 3rem;
        justify-content: space-between;

        &:after {
          background-color: var(--secondary-theme-color);
          border-radius: 0.2rem;
          color: var(--secondary-theme-color);
          content: "";
          display: block;
          height: 0.2rem;
          margin: 0;
          opacity: 0;
          position: relative;
          transition: width 400ms;
          width: 0;
        }

        &:hover:after, &.active:after {
          opacity: 1;
          width: 100%;
        }

        &.active {
          color: var(--theme-color-darker);
          font-weight: 800;

          .chat-count {
            display: none;
          }
        }
      }

      @media screen and (max-width: 768px) {
        .nav-link {
          display: none;
        }
      }
    }
  }

  .menu__wrapper.nav-menu {
    max-height: calc(100vh - (var(--navbar-height) + 1rem));
    min-width: var(--container-s);

    .menu__section#switch-organisation {
      .menu__list-item--org-btn {
        max-height: 80px;
        overflow: clip;
        transition: all 0.2s ease-in-out;
        width: 100%;
        &.buttons-container{
          display: flex;
          gap: 0.5em;
          align-items: center;
          & :first-child {
            width: 100%;
          }
        }
        &.menu__list-item--org-btn--hidden {
          max-height: 0;
          opacity: 0;
          transform: translateX(100%);
          padding: 0 !important;
          margin-top: -8px !important; /* needed to collapse the gap from flex container without having to use display: none */
        }
      }
    }

    .menu__section#nav-main-menu-links, .menu__section#nav-main-menu-links + hr {
      display: none;
    }

    @media screen and (max-width: 768px) {
      .menu__section#nav-main-menu-links, .menu__section#nav-main-menu-links + hr {
        display: block;

        .nav-link {
          display: block;
          height: fit-content;

          &:after {
            display: none;
          }
        }
      }
    }

    @media screen and (max-width: var(--screen-sm)) {
      max-width: calc(100vw - 2rem);
    }
  }
}
