/*
 Copyright 2013-2015 Jason Leyba

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

#nav-modules,
#nav-types {
  display: none;

  & ~ label h3:after {
    content: '\2335';
    display: inline-block;

    float: right;
    margin-right: 1rem;
    .rotate(0);
  }

  &:checked ~ label h3:after {

    float: right;
    margin-right: 1rem;
    .rotate(-90deg);
  }

  &:checked ~ div {
    display: none;
  }
}

nav {
  margin: 0 0 3rem 1rem;

  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

  .selectable, a {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
  }

  .current {
    font-weight: bold;
    font-size: 1.1em;
    text-decoration: underline;
  }

  .interface {
    font-style: italic;
  }

  ul {
    margin: 0;
    padding: 0;

    &.nav-tree {
      margin: 0 0 0 .3rem;
      padding: 0 0 0 .5rem;
      border-left: 1px dotted fade(@banner_color, 50%);
    }
  }

  li {
    list-style: none;
    word-wrap: initial;
    overflow: hidden;
    text-overflow: ellipsis;

    input { display: none; }
    input ~ ul.nav-tree > li { display: block; }
    input:checked ~ ul.nav-tree > li { display: none; }

    label, & > a {
      display: block;
      width: 100%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    label:hover, & > a:hover {
      background: fade(@link_color, 10%);
    }

    // TODO: Find a better way to ensure label:before stays in the gutter and
    // actual content stays aligned.
    & > a:before { visibility: hidden; }
    & > a:before,
    label:before {
      float: left;
      margin-right: 1rem;
      content: '\2212';
    }
    input:checked + label:before { content: '\002b'; }
  }

  h3 {
    font-size: 2rem;
    border: 0;
    border-top: 1px solid @header_border;
    margin-top: 1.2rem;

    a, a:visited {
      color: @banner_color;
    }
  }

  & > h3:first-child {
    border-top: 0;
    margin-top: 0;
  }
}

@media (min-width: 1000px) {
  nav {
    font-size: 1.2rem;
  }
}