header.navigation {
  @include clearfix;

  $base-border-color: gainsboro !default;
  $base-border-radius: 3px !default;
  $action-color: #477DCA !default;
  $dark-gray: #333 !default;
  $large-screen: 53.75em !default;
  $navigation-padding: 1em;
  $navigation-background: #333949;
  $navigation-color: transparentize(white, 0.3);
  $navigation-color-hover: white;
  $navigation-height: $magic-number*2;
  $navigation-nav-button-background: $action-color;
  $navigation-nav-button-background-hover: lighten($navigation-background, 10%);
  $navigation-nav-button-border: 1px solid lighten($navigation-nav-button-background, 20%);
  $navigation-search-background: lighten($navigation-background, 5);
  $navigation-search-border: 1px solid darken($navigation-background, 5);
  $navigation-active-link-color: transparentize(white, 0.5);

  background-color: $navigation-background;
  border-bottom: 1px solid darken($navigation-background, 10);
  color: white;
  min-height: $navigation-height;
  width: 100%;
  z-index: 999;

  .icon-eye-slash,
  .icon-search {
    color: $navigation-color;
  }

  .navigation-wrapper {
    @include outer-container;
    @include clearfix;
    padding-left: 8px;
    padding-right: 8px;
    position: relative;
    z-index: 9999;
  }

  .logo {
    float: left;
    max-height: $navigation-height;
    padding-left: 0;
    padding-right: 2em;

    img {
      max-height: $navigation-height;
      padding: 0.8em 0;
    }
  }

  // Nav menu

  nav {
    //float: none;
    min-height: $navigation-height;
    z-index: 9999999;
    float: left;

    @include media($mobile) {
      float: none;
    }
  }

  ul.navigation-menu {
    clear: both;
    display: inline;
    margin: 0;
    padding: 0;
    overflow: visible;
    width: 100%;
    z-index: 9999;

    &.show {
      display: block;
    }
  }

  // The nav items

  ul li.nav-link {
    overflow: hidden;
    padding-right: 0.8em;
    text-align: right;
    z-index: 9999;

    background: transparent;
    display: inline;
    line-height: $navigation-height;
    text-decoration: none;
    width: auto;
    position: relative;

    a {
      color: $navigation-color;
      display: inline-block;
      text-decoration: none;
      padding-right: 1em;

      &:focus,
      &:hover {
        color: $navigation-color-hover;
      }
    }

    &.logo a {
      color: white;
    }

    .icon-eye-slash {
      font-style: normal;
      font-size: modular-scale(1);
      padding-right: 0.4rem;
      vertical-align: sub;
    }

    /* Dropdown based on https://css-tricks.com/solved-with-css-dropdown-menus/
       by Una Kravets */
    ul {
      background: $navigation-background;
      visibility: hidden;
      opacity: 0;
      min-width: 5rem;
      position: absolute;
      transition: all 0.5s ease;
      margin-top: 1rem;
      left: 0;
      display: none;
      margin: 0;
      text-align: left;
    }

    &:hover > ul,
    &:focus-within > ul,
    ul:hover,
    ul:focus {
       visibility: visible;
       opacity: 1;
       display: block;
    }

    ul li {
      clear: both;
      padding-left: 1rem;
      width: 100%;
    }

    .language-select::before {
      font-family: "icomoon";
      font-weight: normal;
      content: "\e9c9";
      font-size: 0.85em;
      padding-right: 0.4rem;
    }

    @include media($mobile) {
      &.logo {
        clear: both;
        display: block;
        float: none;
        text-align: left;
      }

      padding-right: 0;
    }
  }

  .active-nav-item a {
    border-bottom: 1px solid $navigation-active-link-color;
    padding-bottom: 3px;
  }

  // Elements on the far right

  .navigation-tools {
    display: block;
    height: $navigation-height;
    clear: none;
    float: right;
    
    @include media($mobile) {
      clear: both;
      float: none;
      margin-bottom: $magic-number/4;
    }
  }

  // Search bar

  .search-bar {
    $search-bar-border-color: $base-border-color;
    $search-bar-border: 1px solid $search-bar-border-color;
    $search-bar-background: lighten($search-bar-border-color, 10%);

    float: left;
    //padding: 0.85em 0.85em 0.7em 0.6em;
    padding: 0.40rem 0em 0.40rem 0.6em;
    width: 60%;

    form {
      position: relative;

      input[type=search] {
        background: $navigation-search-background;
        border: $navigation-search-border;
        border-radius: $base-border-radius * 2;
        box-sizing: border-box;
        color: $navigation-color;
        font-size: 0.9em;
        font-style: italic;
        margin: 0;
        padding: 0.5em 0.8em;
        width: 100%;

        &::placeholder {
          color: rgba(255,255,255,0.8);
        }
      }

      button[type=submit] {
        background: $navigation-search-background;
        border: 0;
        bottom: 0.3em;
        left: auto;
        outline: none;
        padding: 0 9px;
        position: absolute;
        right: 0.3em;
        top: 0.3em;

        img {
          height: 12px;
          opacity: 0.7;
          padding: 1px;
        }
      }
    }

    display: inline-block;
    position: relative;
    width: 16em;

    input {
      box-sizing: border-box;
      display: block;
    }

    @include media($mobile) {
      float: none;
      padding-left: 0;
    }
  }
}
