.search {
  position: relative;

  &_powered {
    font-size: 12px;
    padding: 5px 15px;
    text-align: center;
    color: $c-secondary;

    a {
      background-image: none;
    }
    svg {
      margin-right: 3px;
    }
  }

  &_form {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
  }

  &_input {
    outline: none;
    border: none;
    background: #fff;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    -webkit-appearance: none;
  }
  &_input--large {
    width: 100%;
    font-size: 1rem;
    padding: 12px 12px 12px 45px;
  }
  &_input--small {
    width: 200px;
    font-size: .9375rem;
    padding: 6px 6px 6px 25px;
  }
}

.search-icon {
  position: absolute;
  left: 15px;
  pointer-events: none;
  color: #ddd;

  &--small {
    left: 10px;
    width: 10px;
  }
  &--large {
    left: 15px;
    width: 15px;
  }
}

.search-hits {
  opacity: 0;
  visibility: hidden;
  height: 0;
  box-sizing: border-box;
  position: absolute;
  max-height: 50vh;
  overflow: scroll;
  z-index: 2;
  right: 0;
  top: calc(100% + 0.5em);
  width: 100%;
  box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.2);
  background: white;
  border-radius: 2px;
  text-align: left;
  transition: 100ms all linear;
  -webkit-overflow-scrolling: touch;

  &.is-active {
    opacity: 1;
    visibility: visible;
    height: auto;
  }

  &--small {
    width: 300px;

    h3 {
      padding: 5px 15px;
    }

    li a {
      padding: 8px 15px;
    }
  }

  &--large {
    width: 100%;

    h3 {
      padding: 5px 45px;
    }

    li a {
      padding: 8px 45px;
    }
  }

  &_message {
    text-align: center;
    padding: 40px 15px;
    border-bottom: 1px solid #eee;

    h5::before {
      display: block;
      animation-iteration-count: infinite;
      font-family: 'Source Code Pro', monospace;
      color: $c-secondary;
    }
    p {
      margin-top: .5em;
      font-size: .875rem;
      color: $c-secondary;
    }
  }

  &_loading {
    h5::before {
      content: '|';
      animation-name: glitch;
      animation-duration: 300ms;
      line-height: .8;
      font-size: 1.25rem;
      overflow: hidden;
    }
  }

  &_empty {
    h5::before {
      content: '(╯°□°）╯︵┻┻';
      font-size: .6875rem;
    }
  }

  ul {
    list-style: none;
    margin: 0;
  }

  li {
    margin: 0;
  }

  li a {
    display: block;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    line-height: 1;
    background-image: none;
  }

  li a:hover {
    background-color: #fafafa;
    text-decoration: none;
    opacity: 1;
  }

  a {
    color: #3b377b;
  }

  mark {
    color: #3b377b;
    background: #ffcc00;
  }

  h3 {
    font-weight: bold;
    margin: 0;
    border-bottom: 1px solid #eee;
    color: #3b377b;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 11px;
  }

  h4 {
    margin: 0;
  }

  code {
    font-size: 11px;
    word-break: break-word;
    font-weight: normal;
  }

}

@keyframes glitch {
  0%   {content: '▓';}
  16%  {content: '/';}
  32%  {content: '░';}
  48%  {content: '\\';}
  64%  {content: '▒';}
  80%  {content: ':';}
  90% {content: '░';}
  100% {content: '█';}
}
