/*
 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.
 */

@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Inconsolata);

@header_height: 5rem;
@footer_height: 4rem;

@main_desktop_width: 100rem;

@main_column_color: #fff;
@banner_color: #424242;
@link_color: #66f;
@header_border: #8f8f8f;
@code_bg: #f8f8f8;
@code_border: darken(@code_bg, 15%);
@body_bg: #f0f0f0;

.set-font-size(@size) {
  font-size: @size;

  a[id], .property, .function {
    padding-top: @header_height + @size;
    margin-top: -@header_height - @size;
  }
  a[id] {display:inline-block}
}

.code-block() {
  background: @code_bg;
  border-radius: 3px;
  border-left: .2rem solid @code_border;
  line-height: 1.45;
  word-wrap: normal;
}

.clear-header() {
  margin-top: @header_height / 2;
}

.main-column-width(@size) {
  width: @size;
  margin: 0 auto;
}

.rotate(@amount) {
  -ms-transform: rotate(@amount);
  -webkit-transform: rotate(@amount);
  transform: rotate(@amount);
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 10px;
  min-height: 100%;
  position: relative;
}

body {
  color: #333;
  font-family: "Lato", sans-serif;
  line-height: 1.6;
  word-wrap: break-word;
  margin: 0 0 @footer_height;
  padding: 0;
  background: @body_bg;

  .set-font-size(1.4rem);
}

a {
  &, &:visited {
    color: @link_color;
    text-decoration: none;
  }
  &[href]:hover {
    text-decoration: underline;
  }
}

h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0;
}

h1, h2, h3 {
  border-bottom: 1px solid @header_border;
}

h1 {
  .set-font-size(2.5rem);
  & + .tags {
    margin-top: -1rem;
  }
}

h2 {
  .set-font-size(2.2rem);

  &.main {
    border: 0;
  }
}

h3 {
  .set-font-size(1.8rem);
  border: 0;

  & + .tags {
    margin-top: -1.5rem;
  }

  .codelink {
    font-size: 1.4rem;
    font-weight: normal;
    display: inline;

    &:after {
      clear: none;
      display: none;
    }
  }
  code {
    font-size: 75%;
  }
}
h4 { .set-font-size(1.6rem); }
h5 { .set-font-size(1.4rem); }
h6 { .set-font-size(1.2rem); }

pre.inheritance, code, .srcfile table {
  font-family: "Inconsolata", Menlo, Courier, monospace;
}

pre {
  .code-block();
  margin: 1rem 3rem;
  padding: 1rem;
  overflow: auto;

  &.inheritance {
    border: 0;
    background: initial;
    padding: 0;
    margin: .5rem 0 1rem 0;

    h1 + & {
      margin-top: -1rem;
    }
  }
}

p {
  margin: 0 0 1rem 0;
}

p code,
li code {
  background: @code_bg;
  padding: 2px;
  border-radius: 3px;
  border: 1px solid @code_border;
}

pre code {
  border: 0;
}

.fn-details {
  div:first-child {
    border-bottom: 1px solid lighten(@header_border, 20%);
    margin-top: .5rem;
  }
}

hr.fn-sep {
  border: 0;
  border-top: 1px solid #dcdcdc;
  width: 50%;
  margin: auto;
  margin-top: 2rem;
}

.tags span {
  background: fade(@link_color, 40%);
  border: 1px solid @link_color;
  border-radius: 3px;
  color: #fff;
  font-size: 75%;
  font-weight: bold;
  padding: 2px 4px;
  line-height: 1.4rem;

  & + span {
    margin-left: 2px;
  }
}

.function:target > div,
.property:target > dl {
  @width: 3px;
  border-left: @width solid fade(@link_color, 70%);
  padding-left: 3 * @width;
  margin-left: -4 * @width;
}

dt {
  font-weight: bold;

  &.deprecated {
    text-decoration: line-through;
  }

  & > code {
    font-weight: normal;
    color: @link_color;
    margin-left: .5rem;
  }
}

dd {
  margin: 0 0 0 3rem;
}

ol,
ul {
  margin: 1rem 0 1rem 4rem;
}

blockquote {
  margin: 1rem 3rem;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0 auto;

  caption {
    font-style: italic;
  }

  tr {
    background: #fff;
    border-top: 1px solid #ccc;

    &:nth-child(2n) {
      background: @code_bg;
    }
  }
}

th, td {
  padding: .6rem 1.3rem;
  border: 1px solid #ddd;
}

.parentlink { float: left; }

.codelink {
  a {
    float: right;
  }

  &:after {
    clear: both;
    content: "";
    display: table;
  }
}

header, footer {
  background: @banner_color;
}
