@mixin tbd($color: red) { // TODO: Refactor disabled item doc navigation links with this mixin in mind position: relative; padding: 0 .3em; border: 1px dashed lighten($main-font-color, 70); &:after { position: absolute; left: 100%; content: "TBD"; color: lighten($main-font-color, 70); font-size: .6em; line-height: 1; padding: .05em .4em; } } @mixin padded-code-snippet() { padding: 0 1em; margin: 0 .2em; background: rgba($main-font-color, 0.03); border: 1px dashed lighten($main-font-color, 70); border-radius: .5em; font-size: 80%; } @mixin padded-code-snippet--reset() { padding: 0; margin: 0; background: transparent; border: 0; border-radius: 0; font-size: 100%; } @mixin code-snippet-container() { overflow-x: scroll; overflow-y: hidden; line-height: 1.2; @include padded-code-snippet(); padding-top: .5em; padding-bottom: .75em; margin-top: 1em; margin-bottom: 1em; > code { // Avoid bad formatting in case of element nested // inside a
    @include padded-code-snippet--reset();
  }
}

@mixin code-snippet() {
  color: lighten($main-font-color, 24);

  @include padded-code-snippet();
  margin-top: -1px;
  margin-bottom: -1px;

  code {
    // Avoid bad formatting in case of  elements nested
    // into each other (possible with adoc output)
    @include padded-code-snippet--reset();
  }
}

@mixin cta-button($bgcolor, $color) {
  font-weight: 800;
  font-size: 18px;
  padding: 12px 32px;
  display: inline-block;

  .icon {
    margin-right: 10px;
    font-weight: 400;
    position: relative;
    top: 2px;
    font-size: 120%;
  }

  margin-right: 10px;

  &, &:link, &:visited {
    color: $color;
    background-color: $bgcolor;
  }

  transition: box-shadow .2s ease-out;

  &:hover {
    box-shadow: 0 0 0 4px rgba(black, 0.2);
  }
}

@mixin cta-button-mini($bgcolor, $color) {
  @include cta-button($bgcolor, $color);
  font-size: 14px;
  padding: 6px 16px;
}

@mixin hoverable-card($base-y, $base-blur, $color) {
  $hovered-y: $base-y * 2;
  $hovered-blur: $base-blur * 2;

  box-shadow: 0px $base-y $base-blur $color;

  transition: box-shadow .17s ease, transform .17s ease;

  &:hover {
    transform: translateY(-1px);
    box-shadow: 0px $hovered-y $hovered-blur $color;
  }
}

@mixin reset-list() {
  list-style: none;
  margin: 0;
  padding: 0;
}

@mixin static-link-color($color) {
  &:link, &:hover, &:visited {
    color: $color;
  }
}

@mixin docs-page($primary-dark-color) {
  $side-margin: 16px;  // for external links

  flex: 1;
  display: flex;
  flex-flow: column nowrap;

  .external-links {
    margin-left: -$side-margin;

    ul.section-items {
      @include reset-list();
    }

    > .section-items > .item {
      margin-bottom: 10px;
      margin-right: -$side-margin;

      > a {
        @include static-link-color(#444);
        background-color: #F7F7F7;

        display: block;
        font-weight: bold;
        padding: 4px $side-margin 4px $side-margin;
        border-radius: 10px;

        display: flex;
        flex-flow: row nowrap;

        .lbl {
          flex: 1;
          white-space: nowrap;
          text-overflow: ellipsis;
          overflow: hidden;
        }
        .ico {
          flex-shrink: 0;
          text-align: right;
          width: 32px;
          padding-right: 10px;
        }
        .ico-ext {
          flex-shrink: 0;
          text-align: right;
          width: 32px;
          padding-left: 10px;
          padding-right: 10px;
        }
      }
    }
  }

  > .docs-nav {
    padding-top: 50px;

    > .sidebar-header, > section {
      margin-bottom: 15px;
    }

    > .sidebar-header {
      display: flex;
      flex-flow: row nowrap;
      align-items: center;

      .title {
        flex: 1;
        line-height: 1;
        font-weight: normal;
        font-size: 15px;
        text-transform: uppercase;
        letter-spacing: 0.08em;

        a { @include static-link-color(#444); }
      }
      .logo-container {
        margin-right: 10px;

        .logo > :only-child {
          width: 32px;
          height: 32px;
        }
      }
    }

    > section {
      > .section-title {
        font-size: 20px;
        font-weight: bold;
        margin: 0;
        line-height: 1.8;
      }

      > .section-items {
        @include reset-list;

        line-height: 2;

        > .item {
          font-size: 15px;
          font-weight: normal;

          &.disabled {
            span {
              $disabled-label-width: 50px;
              opacity: 0.5;
              position: relative;

              &:before {
                opacity: 0.4;
                position: absolute;
                width: $disabled-label-width;
                left: -$disabled-label-width;;
                content: "TBD";
                font-weight: bold;
              }
            }
          }
          &.selected {
            span {
              font-weight: bold;
              color: $primary-dark-color;
            }
          }
          a { @include static-link-color(#444); }
        }
      }
    }
  }

  > article {
    @extend .main-article;
    flex: 1;

    background: white;
    z-index: 1;
    overflow-x: hidden;

    > header {
      > .title {
        @media screen and (min-width: $bigscreen-breakpoint) {
          display: flex;
          flex-flow: row nowrap;
        }

        border-bottom: 2px solid $primary-dark-color;
        padding-top: 70px;
        padding-bottom: 20px;

        > .logo-container {
          margin-right: 22px;

          > :only-child {
            width: 58px;
            height: 58px;
          }
        }

        .text {
          flex: 1;
          font-size: 36px;

          margin: 0;
          font-weight: 500;
        }
      }
      .lead {
        font-weight: normal;
        font-size: 20px;
      }
    }

    > .body {
      // Used for e.g. code listing headings and tip block labels
      .title {
        text-transform: uppercase;
        font-size: 12px;
        border-radius: .25em;
        background-color: $primary-dark-color;
        color: white;
        font-weight: bold;
        padding: .3em .6em;
      }

      // Used for tip block labels
      .admonitionblock {
        overflow-x: scroll;

        table:first-child {
          margin-top: 0;
        }
        table:last-child {
          margin-bottom: 0;
        }

        td.icon {
          vertical-align: top;
          padding-left: 0;
        }
        .content {
          font-size: 80%;

          > div:first-child {
            > :first-child {
              margin-top: 0;
            }
          }
          > div:last-child {
            > :last-child {
              margin-bottom: 0;
            }
            &.ulist {
              li:first-child > :first-child {
                margin-top: 0;
              }
              li:last-child > :last-child {
                margin-bottom: 0;
              }
            }
          }
        }
      }
    }
  }

  &.docs-landing {
    flex-direction: column-reverse;

    .external-links > .section-items > .item {
      margin: 0 $side-margin $side-margin $side-margin;

      > a {
        @include static-link-color(#fff);
        background-color: $primary-dark-color;
      }
    }

    > .docs-nav {
      padding-top: 0;
    }

    > article {
      max-width: none;

      > header > .title {
        border-bottom-width: 0;
        padding-bottom: 0;
      }
    }
  }

  @media screen and (min-width: $bigscreen-breakpoint) {
    flex-flow: row nowrap;

    > .docs-nav {
      flex: 1;
      flex-grow: 1;
      padding-top: 70px;

      > section > .section-items {
        padding-right: 40px;
      }
    }

    > article {
      flex: 2;
      border-left: #F7F7F7 2px solid;

      > header,
      > .body {
        margin-left: 60px;
      }
    }

    &.docs-landing {
      flex-direction: column-reverse;

      > article {
        border-left-width: 0;

        .external-links {
          > .section-items {
            display: flex;
            flex-flow: row nowrap;
            justify-content: space-between;

            > * {
              flex: 1;
            }
          }
        }

        > header,
        > .body {
          margin-left: 0;
        }

        @media screen and (min-width: $bigscreen-breakpoint) {
          > .body {
            padding-top: 70px;
          }
        }
      }
    }
  }
}