.navbar {
  border-bottom: 1px solid #c4cdd4;
  padding-bottom: 0;
  margin-bottom: 1rem;
  flex: 1 1 auto;
  background-color: rgba(14, 29, 36, 0.85);
  border-bottom: 1px solid transparent;
  position: relative;
  z-index: 5;
  height: 66px;

  .region-header-primary .block-system-branding-block,
  .region-primary-menu .block-system-menu-blockmain {
    margin-bottom: 0;
  }
  .region-primary-menu .block-system-menu-blockmain {
    margin-top: 2.25rem;
  }

  @media screen and (min-width: 900px) {
    height: 102px;
  }
  @media screen and (min-width: 1200px) {
    padding-top: 2.5rem;
    padding-bottom: 0;
    padding-bottom: 2rem;
    height: 135px;
  }

  /* Mobile styles */
  @media (width <1200px) {
    .navbar-toggler {
      background: #fff;
    }
    .region-primary-menu .block-system-menu-blockmain {
      margin-top: 0;
    }
    .region-header-secondary {
      border-top: 1px solid #fff;
      padding-top: 16px;
      margin-top: 16px;
    }
    .header-secondary-wrapper {
      position: relative;
    }
    .block-system-menu-blockheader {
      margin-bottom: 1.25rem;
    }
    header-menu__list {
      margin-left: -0.3rem;
    }
    .mobile-menu-wrapper {
      background: #5e686e;
      margin-top: 2rem;
      padding: 1.5rem;
      margin-left: -15px;
      margin-right: -15px;
    }
    .mobile-header-primary {
      height: 57px;
    }
    .nav-item {
      margin: 0.25rem 0;
      display: flex;
      flex-wrap: wrap;
    }
    .l1-link {
      color: #ffffff;
      text-transform: uppercase;
      font-size: 0.875rem;
      font-weight: 600;
      width: calc(100% - 70px);
    }
    a.l1-link:focus-visible {
      background-color: #f8971f
    }
    .dropdown-toggle {
      border-left: 1px solid #ffffff;
      padding-right: 1.5rem;
      padding-top: 10px;
      &:focus-visible {
        background-color: #f8971f
      }
      &::after {
        margin-left: 1.5rem;
        border: 1.5px solid #fff;
        border-right-width: 0;
        border-bottom-width: 0;
        height: 10px;
        width: 10px;
        transform: rotate(135deg) translate(0, 0);
      }
      &.show {
        &::after {
          transform: rotate(45deg);
          transition: transform 0.25s;
          margin-top: 8px;
        }
      }
    }

    .dropdown-menu {
      padding: 0;
      font-size: 0.75rem;
      border: 0;
      border-radius: 0;
      background-color: inherit;
      width: 100%;
      margin-right: 12px;
      max-height: 0;
      transition: max-height 0.1s ease-out;
      overflow: hidden;
      &.show {
        max-height: 1000px;
        transition: max-height 1s ease-in;
      }
      .dropdown-item {
        color: #ffffff;
        text-transform: uppercase;
        padding-left: 0;
        padding-bottom: 0.5rem;
        &:focus {
          background-color: inherit;
        }
      }
    }
    .ut-search-form {
      input[type="search"] {
        height: 2rem;
      }
      & .form-item-keys {
        position: relative;
        &::after {
          background-image: none;
        }
      }
    }
    .ut-logo--shieldtexas {
      position: absolute;
      top: 16px;
      right: 30px;
    }
        /* Mobile menu toggle button */
    .navbar-toggler {
      background-color: inherit;
      border-width: 0 0 0 1px;
      border-radius: 0;

      .navbar-text-closed,
      .navbar-text-open {
        color: #ffffff;
        font-size: 1rem;
        text-transform: uppercase;
        font-weight: 600;
        &:hover {
          color: #ffffff;
        }
      }
      .navbar-text-open {
        display: none;
      }
      .navbar-text-closed {
        display: inline-block;
      }
      /* The "opened" state of the mobile navigation */
      &[aria-expanded="true"] {
        .navbar-text-open {
          display: inline-block;
        }
        .navbar-text-closed {
          display: none;
        }
        .navbar-visualisation-open {
          display: inline-block;
          width: 20px;
          height: 20px;
          border: 4px solid #000;
          position: absolute;
          top: 26px;
          background:
          linear-gradient(45deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 43%, #fff 45%, #fff 55%, rgba(0, 0, 0, 0) 57%, rgba(0, 0, 0, 0) 100%),
          linear-gradient(135deg, #000 0%, #000 43%, #fff 45%, #fff 55%, #000 57%, #000 100%);
        }
        .navbar-visualisation-closed {
          display: none;
        }
      }
      .navbar-visualisation-open {
        display: none;
      }
      .navbar-visualisation-closed {
        width: 16px;
        position: relative;
        display: inline-block;
        height: 8px;
        border-top: 3px solid #ffffff;
        border-bottom: 3px solid #ffffff;
        &::before {
          content: "";
          position: absolute;
          top: -8px;
          left: 0;
          width: 100%;
          border-top: 3px solid #ffffff;
        }
      }

      &:hover {
        background-color: inherit;
        .navbar-text {
          color: #ffffff;
        }
        .navbar-visualisation-open::before,
        .navbar-visualisation-open::after {
          background: #ffffff;
        }
      }
      &:focus-visible {
        box-shadow: 0 0 0 #ffffff;
        border: 1px solid #ffffff;
      }
      &:focus {
        box-shadow: 0 0 0 #ffffff;
      }
    }
  }
  /* Desktop styles */
  @media (width >=1200px) {
    .nav-item {
      padding: 0 1.5rem 1rem 0;
    }
    .nav-item:last-of-type {
      padding-right: 0;
    }
    & .dropdown-toggle {
      &::after {
        position: relative;
        border: 1px solid #fff;
        border-right-width: 0;
        border-bottom-width: 0;
        height: 6px;
        width: 6px;
        top: 1px;
        right: -2px;
        padding-top: 3px;
        transform: rotate(225deg) translate(0, 0);
      }
    }
    .l1-link {
      font-size: 0.875rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: #ffffff;
      font-weight: 600;
    }
    a.l1-link:hover {
      color: #f8971f;
      text-decoration: underline;
    }
    .dropdown {
      &:hover,
      &:focus,
      &:has(> .dropdown-menu.show) {
        border: 1px solid var(--ut-limestone--t70);
        border-bottom: 0;
        z-index: 1;
        /* Arrange L2 items in a FlexBox grid */
        .dropdown-menu {
          display: block;
        }
        .dropdown-toggle::after {
          border-color: #f8971f;
        }
        .l1-link {
          background-color: var(--ut-white);
          z-index: 2;
        }
      }
      .dropdown-menu {
        top: 100%;
        margin-top: 0;
        padding: 0.5rem 1.25rem;
        background-color: #5e686e;
        z-index: 2;
        border-radius: 0;

        a.dropdown-item {
          font-size: 0.75rem;
          color: #ffffff;
          font-weight: 600;
          display: block;
          margin: 0;
          padding: 0.75rem 0.5625rem;
          text-transform: uppercase;
          white-space: nowrap;
          font-weight: normal;
          &:hover,
          &:focus {
            background-color: inherit;
          }
        }
      }
      /* Right-align last item's dropdown to avoid going off-screen */
      &:last-child .dropdown-menu,
      &:nth-last-child(2):not(:first-child) .dropdown-menu {
        right: 0;
        left: unset;
        margin-left: -1px;
        margin-right: -1px;
      }
    }
  }
}
