/**
 * API Wrapper
 *
 * @class     .__slate
 * @selector  {::after}
 */

.__slate {
  width: 100%;
  height: 100%;
  position: relative;

  &::after {
    @include clearfix;
  }
}

.api__header
{
  padding: 2rem;
}


/**
 * API | Table of Contents
 *
 * @class     .api__toc
 * @class     .api__toc__search
 * @class     .api__toc__search__field
 *
 * @class     .api__toc__search__clear
 * @state     {.active}
 *
 * @class     .api__toc__items
 *
 * @class     .api__toc__item
 * @state     {:hover}
 */

.api__toc {
  width: 200px; height: calc(100vh - 4rem); // navigation is 4rem tall
  left: 0; bottom: 0;

  background-color: $white;
  border-right: 1px solid rgba($gray, 0.3);
  float: left;
  overflow-x: hidden;
  overflow-y: auto;
  position: fixed;
  z-index: 3;
}

.api__toc__search {
  position: relative;
}

.api__toc__search__field {
  border-bottom: 1px solid rgba($gray, 0.3);
  font-size: 0.8rem;
  line-height: 2rem;
  padding: 0.25rem calc(2rem + 4px) 0.25rem 0.75rem;
  width: 100%;
}

.api__toc__search__clear {
  width: 1.25rem; height: 1.25rem;
  top: 0.6rem; right: 0.75rem;

  background-color: $black;
  border-radius: 50%;
  color: $white;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.15;
  position: absolute;
  text-align: center;
  transition: opacity 0.2s;

  &:not(.active) {
    opacity: 0;
    visibility: hidden;
  }

  &.active {
    opacity: 1;
    visibility: visible;
  }
}

.api__toc__items {
  font-size: 0.8rem;
  line-height: 1.33;
  list-style-type: none;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.api__toc__item {
  &:hover {
    background-color: rgba($gray, 0.3);
  }

  a {
    display: block;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  }
}

.api__content {
  float: right;
  width: calc(100% - 200px);
}

.api__documentation {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50%, 1fr));

  h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  h3 {
    font-size: 0.8rem;
    letter-spacing: 0.1rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
  }

  p, ol, ul {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
  }

  pre {
    font-size: 0.8rem;
  }

  table {
    border: 1px solid rgba($white, 0.1);
    border-radius: 0.3rem;
    border-spacing: 0;
    font-size: 0.8rem;
    line-height: 1.33;
    width: 100%;
  }

  thead {
    display: none;
  }

  th, td {
    padding: 0.5rem 1rem 0.5rem 0.5rem;
  }

  th {
    border-bottom: 1px solid rgba($white, 0.1);
  }

  tr:nth-child(even) {
    background-color: rgba($white, 0.1);
  }
}

.api__content__body {
  border-bottom: 1px solid rgba($gray, 0.3);
  padding: 2rem;

  pre {
    border: 1px solid rgba($gray, 0.3);
  }
}

.api__content__body__arguments {
  border: 1px solid rgba($gray, 0.3);
  border-radius: 3px;
  list-style-type: none;
}

.api__content__body__argument {
  &:not(:last-of-type) {
    border-bottom: 1px solid rgba($gray, 0.3);
  }

  &:nth-child(even) {
    background-color: rgba($gray, 0.1);
  }

  .left,
  .right {
    padding: 0.5rem 0.75rem;
  }

  .left {
    border-right: 1px solid rgba($gray, 0.3);
    float: left;
    width: 30%;
    word-wrap: break-word;

    span {
      color: $gray;
      font-size: 0.8rem;

      &:not(:first-of-type) {
        margin-left: 0.5rem;
      }
    }
  }

  .right {
    float: right;
    width: 70%;
  }

  &::after {
    @include clearfix;
  }
}

.api__content__example {
  background-color: mix($gray, $black, 10%);
  border-bottom: 1px solid rgba($white, 0.1);
  color: $white;
  padding: 2rem;

  pre {
    background-color: $black;
  }
}