@import "bourbon/bourbon";
@import "neat/neat";

// Override bourbon _grid.scss
$max-width: em(1120); // Max-width of the outer container, divided by 16

$blue: #2980b9;
$strong-blue: #6ab0de;
$background-blue: #e7f2fa;
$text: #2f2f2f;
$muted-grey: #151515;

$code-background-color: #eeeeee;
$code-block-background-color: #f3f3f3;
$code-block-border-color: #d3d3d3;

$admon-todo: #f0b37e;
$highlighted: #f1c40f;
$versionchanged: lightyellow;

$monospace: Monaco, Menlo, Consolas, monospace;

* {
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: normal;
  font-style: normal;
}

body {
  font-size: 16px;
  font-family: sans-serif;
  color: black;
}

.wrapper {
  min-height: 100%;
  height: auto !important;
  height: 100%;
  margin: 0 auto -2em;
}

.push, .footer {
  height: 2em;

  a, a:visited {
    color: $blue;
    text-decoration: none;
  }
}

.header {
  @include outer-container;
  padding-top: 1em;
  padding-bottom: 1em;

  a, a:visited {
    color: $muted-grey;
    text-decoration: none;
  }

  header {
    @include span-columns(1 of 2);

    // Override @span-columns mixin
    margin-right: 0;

    font-weight: normal;

    .logo {
      max-height: 60px;
      padding-right: 12px;
      float: left;
    }

    h1 {
      font-size: 1.55em;
      margin-bottom: 0.3em;
    }

    h2 {
      font-size: 1.05em;
    }
  }

  nav {
    @include span-columns(1 of 2);

    // Override @span-columns mixin
    &:last-child {
      float: right;
    }

    padding-top: 1.55em + 0.3em;

    a {
      display: inline-block;
      margin-left: 1.4em;

      font-weight: bold;
      text-transform: uppercase;

      color: $muted-grey;
      letter-spacing: 0.1em;
    }
  }
}

.outer {
  background-color: #eeeeee;
  box-shadow: inset 0 0 0.5em #c0c0c0;

  header {
    @include outer-container;
    padding: 1em 0;
  }

  footer {
    @include outer-container;
  }

  .index {
    @include outer-container;
    padding: 1em;

    figure {
      @include span-columns(2 of 5);

      text-align: center;
      max-width: 300px;

      img {
        max-width: 100%;
        max-height: 100%;
      }
    }

    ul, ol {
      @include span-columns(3 of 5);
      margin-top: 1em;

      li {
        margin-bottom: 2em;

        strong {
          font-weight: normal;
          font-size: 18px;
          color: black;
        }

        p {
          color: $text;
        }

        p + p {
          margin-top: 0.5em;
        }
      }
    }
    ul {
        li {
          list-style-type: none;
        }
    }
  }
}

.footer {
  text-align: right;
  padding: 0.5em 0;
}

main {
  @include outer-container;
  margin-top: 1.6em;
  margin-bottom: 2em;
  line-height: 1.6em;

  .links {
    @include span-columns(1 of 3);

    h2 {
      margin-bottom: 1em;
      margin-top: 1em;
    }

    > h2:first-child {
      margin-top: 0;
    }

    p + p {
      margin-top: 1em;
    }

    p + p:last-child {
      margin-top: 0;
    }

    li {
      list-style-type: none;
    }
  }

  .highlighted {
    background: $highlighted;
    box-shadow: 0 0 0 2px $highlighted;
    font-weight: bold;
    color: $text;
  }

  .search {
    input {
      padding: 0.1em 0.4em;
      margin-top: 0.3em;
      max-width: 100%;
    }
  }

  .demo {
    @include span-columns(2 of 3);

    h2 {
      margin-bottom: 1em;
    }

    h4 {
      margin-bottom: 0.5em;
    }

    blockquote {
      margin-top: 10px;
      margin-bottom: 10px;
      padding-left: 15px;
      border-left: 3px solid #ccc;
    }

    pre {
      background: #eee;
      border: 1px solid #ddd;
      padding: 10px 15px;
      color: #4d4d4c;
      overflow: auto;
    }
  }

  .sidebar {
    @include span-columns(2 of 9);
    display: block;
    font-size: 15px;

    strong {
      color: $blue;
      font-weight: bold;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    ul, ol {
      margin-top: 0.5em;
      margin-bottom: 1em;

      &:last-child {
        margin-bottom: 0;
      }
    }

    li {
      border-left: solid 2px $code-block-border-color;
      margin-left: 0.25em;
      padding-left: 0.75em;

      padding-top: 0.25em;
      padding-bottom: 0.25em;

      font-weight: normal;
      list-style-type: none;

      a {
        color: $text;
      }
    }

    .current {
      border-left-color: $blue;

      a.current {
        color: $blue;
        font-weight: bold;
      }
    }

    #searchbox {
      color: $text;
      margin: 0 0 0.8em;

      h2 {
        color: $blue;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 14px;
      }
    }
  }

  .docs {
    @include span-columns(7 of 9);

    font-size: 16px;
    color: $text;

    h2, h3, h4 {
      margin-top: 1.2em;
      margin-bottom: 1em;

    }

    h2 {
      font-size: 32px;
    }

    h3 {
      font-size: 24px;
      font-weight: bold;
    }

    h4 {
      font-size: 18px;
      font-weight: bold;
    }

    .reference > img {
      margin: 1em 0;
      border: 2px solid $code-background-color;
    }

    pre {
      color: rgb(77, 77, 76);
    }

    pre, code {
      font-size: 14px;
      font-family: $monospace;
    }

    code {
      color: #002e40;
      background-color: $code-background-color;
      padding: 0.2em 0.3em;
    }

    .code-block-caption {
        border: 1px solid $code-block-border-color;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        padding: 0.2em 0.5em;
        margin-top: 1.2em;
    }

    // Highlight blocks preceded by code block captions:
    // Remove rounded top border & top margin to that they visually fit
    // together as a single unit
    .code-block-caption + .notranslate > .highlight {
      margin: 0 0 1.2em 0;
      border-top: none;
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }

    .highlight {
      margin: 1.2em 0;
      padding: 10px 15px;

      background-color: $code-block-background-color;
      color: $text;

      border: 1px solid $code-block-border-color;
      border-radius: 4px;
      overflow: auto;

      // Make '$' at beginning of bash code blocks non-selectable
      // See sphinx-rtd-theme: basic.css_t
      .gp {  /* gp: Generic.Prompt */
         user-select: none;
         -webkit-user-select: text; /* Safari fallback only */
         -webkit-user-select: none; /* Chrome/Safari */
         -moz-user-select: none; /* Firefox */
         -ms-user-select: none; /* IE10+ */
      }
    }

    .headerlink {
      opacity: 0;
      margin-left: 0.5em;
    }
    *:hover > .headerlink {
      opacity: 1;
    }

    p + p {
      margin-top: 1em;
    }

    p + p:last-child {
      margin-bottom: 0;
    }

    blockquote {
      margin: 1em 0;
      border-left: 5px solid #eee;
      padding: 0 1em;
    }

    ul, ol {
      margin: 1em 0;

      li {
        margin-left: 2em;
        margin-right: 2em;

        > {
          // Nested lists shouldn't have margins
          ul, ol {
              margin: 0;
          }
        }
      }
    }
    ul {
      li {
        list-style-type: square;
      }
    }
    ol.simple {
      li {
        padding-left: 0.2em;
        margin-left: 1.8em;
      }
    }

    // For `.. hlist::` directive, do not vertically center columns:
    table.hlist * {
        vertical-align: top;
    }

    table.docutils {
      margin: 1em 0;
      border-collapse: collapse;

      th, td {
        padding: 0.4em 0.5em;
        border: 1px solid $code-block-border-color;
        border-collapse: collapse;
      }
    }

    .versionadded,
    .versionchanged,
    .deprecated {

        margin: 0.3em 0;

        span.added,
        span.changed {
            background: $versionchanged;
        }
        span.deprecated {
            background: #ffe0e0;
        }
        span.versionmodified {
            font-style: italic;
            margin-right: 0.6em;
        }
    }
  }

  // "Edit on Github" link
  .vcs-edit {
      font-size: 1.16em;
      line-height: 1.16em;
      float: right;
      & img {
        height: 20px;
        width: 20px;
        margin-right: 0.2em;
        vertical-align: top;
      }
  }

  a {
    text-decoration: none;
    color: $blue;
  }

  dt {
    font-family: $monospace;
    font-weight: bold;
    font-size: 16px;
    line-height: 1.4em;
    display: inline-block;
    margin: 1.4em 0 0.4em;
    padding: 3px 6px;

    background: $background-blue;
    color: $text;

    border-top: 2px solid lighten($strong-blue, 14);
  }
  dd {
    margin-left: 1.2em;

    // Nested definitions should not have blue styling
    & dl.simple dt {
      border-top: none;
      background: inherit;
      color: inherit;
    }
  }
  dl {
    margin-bottom: 0.4em;
  }

}

/* Admonitions
 * Colors taken from sphinx-rtd-theme */
.admonition {
  padding-bottom: 1em;
  margin-bottom: 1em;

  &.attention, &.caution, &.warning, &.admonition-todo {
    background: #ffedcc;

    .admonition-title {
      background: $admon-todo;

      &:before {
        color: $admon-todo;
      }
    }
  }
  &.danger, &.error {
    background: #fdf3f2;

    .admonition-title {
      background: #f29f97;

      &:before {
        color: #f29f97;
      }
    }
  }
  &.hint, &.important, &.tip, &.seealso {
    background: #dbfaf4;

    .admonition-title {
      background: #1abc9c;

      &:before {
        color: #1abc9c;
      }
    }
  }
  &.note {
    background: #e7f2fa;

    .admonition-title {
      background: #6ab0de;

      &:before {
        color: #6ab0de;
      }
    }
  }
  .admonition-title {
    padding: 0.3em 0.52em;
    margin: 1em 0;
    font-weight: bold;
    color: white;

    &:before {
      content: "!";
      background: white;
      display: block;
      margin-right: 0.4rem;
      float: left;
      width: 1.4rem;
      height: 1.4rem;
      font-family: $monospace;
      font-size: 1.3rem;
      border-radius: 999px;
      text-align: center;
      line-height: 1.4rem;
    }
  }
  p {
    padding: 0 0.8em;
  }
}
