@import "normalize";
@import "bourbon/bourbon";
@import "base/grid-settings";
@import "base/base";
@import "neat/neat";
@import "mixins";
@import "accessibility";
@import "fonts";

html, body {
  height: 100%;
}

#main {
  min-height: 100%;
  margin: 1em auto -4.8em; /* the bottom margin is the negative value of the footer's height */
  @include media($small) {
    margin-bottom: -5.5em;
  }
}

footer, .push {
  height: 4.8em; /* '.push' must be the same height as 'footer' */
  @include media($small) {
    height: 5.5em;
  }
}

// all focused links should be underlined
a:focus {
  text-decoration: underline !important;
}

body > header {
  background-color: white;
  border-bottom: 1px solid #dedede;

  div#usa {
    background-color: $dark-gray;
    color: $light-gray;
    padding: 0.25em 0;

    .usa--content {
      font-size: 0.8em;
      font-weight: 400;
    }

    .alpha {
      padding-left: 1.5em;
    }

    .official, .alpha {
      float: left;
      display: none;
    }

    .foiagov {
      float: right;
    }

    .official,
    .alpha,
    .foiagov {
      display: inline-block;

      a {
        color: $aqua-blue;
      }

      @include media($medium) {
        float: none;
        display: block;
        text-align: center;
      }
    }
  }

  #topnav {
    padding-top: 1em;
    padding-bottom: 1em;

    nav ul {
      border-top: 1px solid $medium-gray;
      padding-top: .8em;
      padding-bottom: .5em;

      li {
        a {
          display: inline-block;
          color: $gray;
          font-size: 1.2em;
          font-weight: 800;
          // border: 1px dotted red;
          margin-bottom: .3em;
        }

        a.active, a:hover, a:focus {
          text-decoration: none !important;
          color: $dark-gray;
          border-bottom: 4px solid $aqua-blue;
        }
        a.active {
          border-bottom: 4px solid $aqua-blue;
        }
        a:hover, a:focus {
          border-bottom: 4px solid $medium-blue;
        }
      }
    }

  }

  @media (screen and max-width: $medium-screen) {
    #topnav {
      nav ul {
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
      }
      li {
        min-height: 2.4em;
      }
    }
  }

  @media (screen and min-width: $small-screen) {
    #topnav {
      // XXX
      padding-bottom: 0;

      .container {
        position: relative;
      }

      #search {
        position: absolute;
        top: .3em;
        right: 1em;
      }
    }
  }

  @media (screen and min-width: $medium-screen) {
    #topnav {
      padding-bottom: 0;

      nav ul {
        border-top: none;
        padding-top: 0;
        padding-bottom: .6em;

        li {
          display: inline-block;
          margin-right: 1em;

          a {
            display: inline;
            padding-bottom: .5em;
          }
        }
      }
    }
  }

  @media (screen and min-width: $large-screen) {
    #topnav {
      @include outer-container();

      #logo {
        position: absolute;
      }

      nav {
        @include shift(4);
        @include inner(16);

        padding-bottom: 1em;

        ul {
          position: relative;
          top: 1em;

          li {
          }
        }
      }
    }
  }

  #logo {
    @include prefixer(box-sizing, border-box, $vendor-prefixes);
    color: $blue;

    h4 {
      font-size: $base-font-size * 2;
    }

    a {
      color: $blue;

      span,
      em {
        padding-bottom: 0.18em;
        border-bottom: none;
      }

      em {
        color: $dark-gray;
      }

      &:hover,
      &:focus {
        text-decoration: none !important;
        span,
        em {
          border-bottom: 0.15em solid $aqua-blue;
        }
        em {
          color: $dark-gray !important;
        }
      }
    }
  }

  #notice {
    background: $aqua-blue;
    padding: 1.2em 0;
    box-shadow: 0 6px 3px -3px $medium-gray;
    h2 {
      margin-bottom: 0.5em;
    }
    .notice--content {
      a {
      color: $dark-gray;
      text-decoration: underline;
      &:hover, &:active, &:focus {
        color: $light-gray;
      }
      }
      @include span-columns(18);
      @include media($medium) {
            @include span-columns(12);
      }
    }
    &.hidden {
      display: none;
    }
    #notice--close {
      cursor: pointer;
      text-align: right;
      float:right;
      font-size: $base-font-size * 1.4;
      i {
       color: $dark-gray; 
      }
    }
  }

}

#main {
  .search--box {
    height: 3em;
  }

  // TODO: consolidate this with `#main .search form` below
  .search {
    background: $dark-gray;
    color: $light-gray;
    padding: 3.4em 0;
    margin-bottom: 1em;
  }
  .search.search__error {
    background: none;
    padding: 1em 0;
    color: $dark-gray;
  }
  .search--content {
    @include inner(16);
    h2 {
      border-bottom: none;
    }

    .browse {
      margin-top: 1em;
      a {
        color: $aqua-blue;
        font-weight: 600;
      }
    }
  }
}

footer {
  background-color: white;
  padding-top: 1em;
  margin-top: 4em;
  img {
    width: 45px;
    height: 45px;
    margin-right: 1em;
    // display: inline-block;
    float: left;
  }
  h4 {
    font-weight: 500;
    vertical-align: top;
    // display: inline-block;
  }
}


.container {
  @include outer-container();
  padding: 0 1rem;
}

.row {
  @include span-columns(24);
  @include clearfix();
}

.clearfix {
  @include clearfix();
}

.hero {
//  padding: 2em 0;
  & > .container > .hero--content {
    @include inner(16);
    a.more {
      font-weight: $header-font-weight;
      .fa {
        color: $blue;
      }
    }
  }
}

@include media($small) {
  .hero {
    padding: 2em 0;
  }
}

#main.home {
  margin-top: 0;
  .tag h1 {
    margin: 0.2em;
  }
  .tag,
  .what,
  .process {
    padding: 2em 0;
    border-bottom: 1px solid $medium-gray;
  }

  section.process {
    h2 {
      padding-top: 0.5em;
      margin-bottom: 0.5em;
    }
    ol {
      @extend %default-ol;
      li {
        margin-bottom: 0.8em;
      }
    }
  }

  p,
  li {
    font-size: $base-font-size * 1.2;
  }
}

.fa {
  color: $aqua-blue;
}

.content {
  @include shift(4);
  @include inner(16);
}

#main .searchresults {
  @include inner(16);
  h2 {
    margin-bottom: 0;
  }
  hr {
    margin-top: 0.5em;
  }
  a .fa {
    color: $blue;
  }
  header {
    border-bottom: 1px solid $dark-gray;
    margin: 2em 0 1em 0;
    padding-bottom: 0.25em;
    @include clearfix();
  }
  .searchresults--list {
    em {
      color: $medium-blue;
      font-style: normal;
      font-weight: 600;
    }
    li {
      padding: 0.5em 0;
    }
  }
  #searchresults--index {
    li {
      display: inline-block;
      font-weight: 600;
      font-size: $base-font-size * 1.2;
    }
  }
  .searchresults--letter {
    // margin: 2em 0 0;
    float: left;
    line-height: 1.5em;
    h2 {
      font-size: $base-font-size * 1.2;
      color: $dark-gray;
    }
  }
  .searchresults--back {
    text-align: right;
    line-height: 2em;
  }
}

.breadcrumbs_container {
  background: white;
}

.breadcrumbs {
  padding: 0.5em 0;
  font-size: 0.8em;
}

#main {
  h1, h2 {
    margin-bottom: 1.2em;
  }
  h3, h4, h5, h6 {
    margin-bottom: $header-line-height;
    .department & {
      margin-top: 0;
    }
  }
}

#main .learn,
#main .about {
  section, article {
    padding-bottom: 1em;
    margin-bottom: 3.5em;
    border-bottom: 1px solid $medium-gray;
    &.last {
      border-bottom: none;
    }
  }

  h2 {
    border-bottom: 1px solid $dark-gray;
    padding-bottom: 0.5em;
    display: block;
  }
}

#main .learn {
  .toc {
    h1, h2, h3, h4, h5, h6 {
      margin: 0;
    }
  }
  .question {
    margin-top: 2em;
  }
}

#main .about {
  .last {
    border-bottom: none;
  }

  ul {
    .fa {
      text-align: center;
      position: absolute;
      width: 4rem;
      margin-left: -4rem;
      font-size: 1.4em;
    }
    li {
      padding: 0 0 1em 4em;
      margin: 2em 0;
      border-bottom: 1px solid $medium-gray;
    }
    ul > li {
        border-bottom: none;
        padding-left: 0;
    }
  }
}

#main.landing {
  .contact {

    h3 {
      margin-top: 30px;
      margin-bottom: 10px;
    }

    ul,
    li {
      list-style-type: none;
      list-style-position: outside;
      padding: 0;
      margin: 0;
    }

  }

  .department {

    .department--container {
      @include span-columns(15 of 24);
      @include media($medium) {
        @include span-columns(12);
      }
    }

    .resources {
      @include span-columns(8 of 24);
      @include shift(1);
      padding: 1em;
      background-color: white;
      @include prefixer(box-shadow, 4px 4px 8px $medium-gray, $vendor-prefixes);

      @include media($medium) {
        @include span-columns(12);
        @include shift(0);
        margin-bottom: 2em;
      }

      @include media($small) {
        @include span-columns(4);
        @include shift(0);
      }    
    }

    .description {
      p {
        margin-bottom: 1.2em;
        font-size: $base-font-size * 1.2;
      }
    }

    .details {
      h2 {
        padding-bottom: 1em;
        border-bottom: 1px solid $dark-gray;
      }
     .offices {
        ul, li {
          list-style-type: none;
          list-style-position: outside;
          margin: 0; padding: 0;
        }

        li {
          margin: 10px 0;
          font-size: 1.2em;
          line-height: 30px;
        }
      }
      .contact_type {
        border-bottom: 1px solid $medium-gray;
        padding: 0.5em 0 1em;
        .fa {
          font-size: 1.8em;
        }
      }
    }

    .librarynudge {
      border: 1px solid $medium-gray;
      background: #e0e3e6;
      padding: 1.8em 2.2em;
      margin-bottom: 2em;
      ul, li {
        list-style-type: disc;
        list-style-position: outside;
        margin-left: 0.6em;
        padding-left: 0.6em;
      }
      li {
        margin-bottom: 0.2em;
      }
    }

    .resource_type {
        padding-left: 1em;
        .fa {
          font-size: 1.5em;
        }

        .fa-question-circle,
        .fa-times-circle {
          color: $blue;
          font-size: 1em;
        }
    }

    .resource_type,
    .contact_type {

      margin: 15px 0;

      .icon {
        // @include span-columns(2 of 24);
        float: left;
        text-align: center;
        margin-right: 1.7em;
        // position:absolute;
        width: 24px;
      }

      .subdetails {
        // display: inline-block;
        overflow: hidden;
      }

      ul,
      li {
        list-style-type: none;
        list-style-position: outside;
        margin: 0;
        padding: 0;
      }
      li {
        margin-bottom: 0.3em;
        &.hidden {
          display:none
        }

        &.expandable {
          padding: 5%;
          margin: 5% 0;
          background-color: $light-light-gray;
          font-size: .8em;
        }
      }
    }

    .resource_type {
      h3 {
        font-size: 1em;
        margin-bottom: 0.5em;
      }
    }

    .contact_type {
      h3 {
        margin-bottom: 5px;
      }
    }
}
  .inaccurate {
    clear: both;
    padding-bottom: 2em;
  }

}

.department__decentralized {
  @include inner(16);
}

$search-height: 2em;

input.typeahead {
  color: $dark-gray;
  background-color: white;
  @include prefixer(box-sizing, border-box, $vendor-prefixes);
  @include placeholder {
    color: $gray;
  }
}

#topnav .search {
  position: relative;
  top: .3em;
  height: $search-height;

  input.typeahead {
    height: $search-height;
    padding-left: 2em;
    margin-bottom: 0;

    width: 100%;
    display: block !important;
    @include border-left-radius(1em);
    @include border-right-radius(1em);
  }

  .fa {
    color: inherit !important;
  }

  .search-icon {
    color: $gray;
    height: 100%;
    width: 2em;
    position: absolute;
    top: 0;
    left: .7em;
    z-index: 100;

    .fa {
      color: inherit;
      position: relative;
      top: .25em;
    }
  }

  .submit-button {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    padding: 0 .8em;
    height: 100%;
    line-height: 100%;
    color: $dark-gray;

    @include prefixer(box-sizing, border-box, $vendor-prefixes);
    @include border-left-radius(0);
    @include border-right-radius(1em);

    .fa {
      position: relative;
    }

    &:hover,
    &:focus {
      background: $the-other-blue;
    }
  }
}

.search input[type=search] {
  color: $dark-gray;
  background-color: white;
  height: 3em;
  padding-left: 2em;
  margin-bottom: 0;
  @include border-left-radius(3px);
  @include border-right-radius(3px);
  @include placeholder {
    color: $gray;
  }
}

.search input[type=submit] {
  color: $dark-gray;
  @include border-right-radius(3px);
  @include border-left-radius(0);
  height: 3em;
  width: 6em;
  text-align: center;
  float:right;
  position: relative;
  top: -3em;

  &:focus,
  &:hover {
    background-color: $the-other-blue;
  }
}

/* agency autocomplete */
.twitter-typeahead {
  width: 100%;
  display: block !important;
}

.scrollable-dropdown-menu .tt-dropdown-menu {
  max-height: 300px;
  width: 100%;
  min-width: 375px;
}

.typeahead {
  background-color: #fff;
}

.typeahead:focus {
  // border: none;
}

.tt-query {
  // @include prefixer(box-shadow, inset 0 1px 1px rgba(0, 0, 0, 0.075), $vendor-prefixes);
}

.tt-hint {
  color: #999;
}

.tt-dropdown-menu {
  @include prefixer(border-radius, 3px, $vendor-prefixes);
  @include prefixer(box-shadow, 0 5px 10px rgba(0, 0, 0, 0.2), $vendor-prefixes);
  @include arrow-top(10px, #fff, 1px, $medium-gray);
  padding: 0;
  // position: absolute; // this is handled by typeahead.js
  // make this thing stick out to the left
  right: 0 !important;
  left: auto !important;
  width: 375px; // XXX: this will need to shrink on mobile
  margin-top: 12px;

  &.tt-cursor-first:after {
    border-bottom-color: $light-blue;
  }
}

.tt-dropdown-wrap {
  position: relative;
  max-height: 300px;
  overflow-y: auto;
}

.tt-suggestion {
  color: $dark-gray !important;
  font-size: .9em;
  line-height: 1.3em;
  padding: .7em 1.2em;
  cursor: pointer;
}

.tt-suggestion:first-child {
  padding-top: .9em;
}

.tt-suggestion:last-child {
  padding-bottom: .8em;
}

.tt-suggestion.tt-cursor {
  color: $dark-blue;
  background-color: $light-blue;
}

.tt-dataset-agencies .tt-suggestion:last-child {
  border-bottom: 1px solid $medium-gray;
}

.tt-suggestion p {
  margin: 0;
  padding: 0;
}

.search-prompt {
  word-wrap: break-word;
  .return {
    color: #fff;
    background: $medium-gray;
    @include prefixer(border-radius, 4px, $vendor-prefixes);
    font-size: .6em;
    vertical-align: baseline;
    margin-right: .5em;
    padding: 4px 6px 2px;
    position: relative;
    top: -.1em;
  }
}

.tt-cursor .return {
  background: $dark-gray;
}

#main .search form {
  position: relative;
  height: $search-height + 1em;

  input.typeahead {
    color: $dark-blue;
    padding-left: 2.2em;
  }

  .search-icon,
  input.submit {
    position: absolute;
    top: 0;
    z-index: 100;
  }

  .search-icon {
    color: $gray;
    position: absolute;
    z-index: 100;
    padding-top: 0.4em;
    padding-left: 0.75em;
    .fa {
      color: inherit;
    }
  }

  input.typeahead,
  input.submit {
    height: $search-height + 1em;
    @include prefixer(box-sizing, border-box, $vendor-prefixes);
  }

  input.submit {
    right: 0;
    color: $dark-gray;
    @include border-left-radius(0);
    @include padding-horizontal(1.5em);

    &:hover,
    &:focus {
      background: $light-blue;
    }
  }

  .twitter-typeahead {
    display: block !important;
    width: 100%;
  }

  .tt-dropdown-menu {
    right: auto;
    left: 0;
    width: 100%;
    min-width: auto;
    max-width: auto;
  }
}
