@charset "utf-8";

@mixin lhCrop($line-height) {
  &::before {
    content: '';
    display: block;
    height: 0;
    width: 0;
    margin-top: calc((1 - #{$line-height}) * 0.5em);
  }
}

* {
  padding:0;
  margin: 0;
  box-sizing: border-box;

  ::selection {
    background: #222;
    color: #fafafa;
  }

  html {
    font-kerning: normal;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;


    &.threme-change-active {
      animation: fade-in ease-out 0.6s;
    }
  }
}


body {
  text-rendering: optimizeLegibility;
  font-family: sans-serif;
  line-height:1.333;
  display: flex;
  flex-flow: column nowrap;
  width: 100%;
  font-family: "SF Pro", "SFPro", "SF", ui-sans-serif, sans-serif;
}

body.grid {
  background: linear-gradient(rgba(0,128,128,0.7) 0px, transparent 0.1rem, transparent 1.3333rem, rgba(0,128,128,0.7) 1.3333rem, transparent 1.4333rem) top left/2rem 2rem,
  linear-gradient(90deg, rgba(0,128,128,0.7) 0.1rem, transparent 0.1rem) top left/1.666rem 1.666rem;
}

pre {
  overflow: auto;
  font:0.966rem "SF Mono", SFMono-Regular, ui-monospace, monospace;
  line-height: 1.666;
}

pre * {
  text-decoration: none !important;
}

code {
  font-family: "SF Mono", SFMono-Regular, ui-monospace, monospace;
}

p code {
  font-size: 0.966rem;
}

a:link {
  text-decoration: none;
  color:royalblue;
}

a:hover {
  color: royalblue;
}

a:visited {
  color: royalblue;
}

h1, h2, h3, h4, h5 {
  position: relative;
  padding-left: 1.25rem;
  left: -1.25rem;

  .anchor {
    position: absolute;
    left: -1.25rem;
    visibility: hidden;
    text-decoration: none;
    border-bottom-color: transparent;
    cursor: pointer;
    padding-left:1rem;
  }

  &:hover {
    .anchor {
      visibility: visible;
    }
  }
}

@keyframes blink {
  from {
    opacity: 0;
  }

  to {
    opacity: 0.75;
  }
}

body > header {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background:linear-gradient(33deg, rgba(77, 33, 93, 0.5) 0%, rgba(65, 65, 97, 0.25) 33%, rgba(125, 123, 33, 0.35), rgba(120, 87, 33, 0.25) 66%, rgba(97, 40, 33, 0.5) 100%), rgba(33,33,33,0.5);

  color: white;
  margin-bottom: 2.0rem;
  position: fixed;
  width: 100%;
  z-index: 10000;
  border-bottom: 3px wavy white;

  nav {
    display: flex;
    justify-content: center;
    max-width: 76rem;
    align-items: center;
    margin: 0 auto;
    padding: 1.6666rem 0.1rem 0.3333rem 0.1rem;

    a, a:visited, a:active, a:link {
      color: white;
    }

    h1 {
      padding: 0;
      margin: 0;
      font-size: 2.6666rem;
      line-height:0;
      font-variant: small-caps;
    }

    ul#sitenav {
      display: flex;
      flex-flow: row nowrap;
      justify-content: center;
      list-style: none;

      li {
        padding: 0.5em;
      }
    }

    #searchbox {
      width: 100%;
      max-width: 46rem;
      position: relative;

      input#search {
        display: block;
        font-size: 1.166rem;
        line-height:0;
        width: 100%;

        border: none;
        border-bottom: 1px solid #CCC;
        background: none;
        color: white;

        &::placeholder {
          color: white;
        }
      }

      input#search + i {
        top: 0px;
        line-height: 1.1;
        font-size: 1.5em;
        left: 9rem;
        position: absolute;
        font-style: normal;
        animation: blink 800ms infinite;
        user-select: none;
      }

      input#search:not(:placeholder-shown) + i {
        display: none;
      }
    }

    #versions {
      position: relative;

      &>a:first-child {
        color: white;

        &:before {
          content: 'Current Version ';
        }
      }

      &:target div,
      &.open div {
        display: block;
      }

      &.prerelease .prerelease {
        display: block;
        position: relative;
        a {
          color: #ccc;
        }
      }

      div {
        display: none;
        position: absolute;
        top: 100%;
        left: -3em;
        padding: 0em 1.5em 1.5em 1.5em;

        ul {
          background:#333;
          padding: 0em 1.6666em 0.25em 1.6666em;
          min-height: 16vh;
          max-height: 24vh;
          overflow: scroll;
          li {
            list-style: none;
            line-height: 2;
            position: relative;
            a {
              color: #eee;
            }

            &.active:before {
              content: '→';
              position: absolute;
              left: -1.25em;
            }

            &.active a {
              text-decoration: underline;
            }
          }
          li.prerelease {
            display: none;
          }
        }

        p {
          min-width: 16em;
          background:#333;
          font-style: italic;
          padding: 0.75em 1.6666em; 
          label {
          position: relative;
          left: -0.666em;
          }
        }
      }
    }
  }
}

body > footer {
  background: #363333;
  color: white;
  margin-top: 2.0rem;
  nav {
    display: flex;
    justify-content: center;
    max-width: 76rem;
    align-items: center;
    margin: 0 auto;
    padding: 1.6666rem 0.1rem 0.3333rem 0.1rem;
  }
}

main {
  display: flex;
  justify-content: center;
  min-width: 72rem;
  align-items: flex-start;
  margin: 0 auto;
  padding-top: 7.5em;

  nav {
    padding-top: 0.75rem;
    width: 16.666rem;
    position: sticky;
    height: calc(100vh - 6.12em);
    overflow: scroll;
    top: 6.12em;

    ul {
      list-style:none;
      line-height: 2;

      li {
        padding: 0 0.875rem;
        li {
          padding: 0 0 0 1.6666rem;
        }

        code {
          white-space: nowrap;
        }
      }

      li {
        border-left: 3px solid transparent;
        position: relative;
        left:-3px;

        &:after {
          content: '';
          position: absolute;
          width: calc(100% - 2rem);
          height: 1px;
          display: block;
          bottom: 1px;
          border-top: 1px solid #eee;
        }
      }

      li.active {
        border-left: 3px solid #0ce;
      }

      li:hover {
        border-left: 3px solid #cce;
      }

      &>li>ul>li:last-child {
        padding-bottom:0;
      }
    }

    .subsections {
      display: none;
    }

    .open .subsections {
      display: block;
    }
  }

  &>article {
    .search-results__items {
      display: none;
    }

    font-size:1.1666rem;
    line-height: 1.75;
    padding: 0 0.8666rem;
    color: #222;

    max-width: 50rem;
    width: 100%;
    p {
      word-break: break-word;
      margin-bottom: 2rem;
      code {
        white-space: nowrap;
      }
    }

    h1 {
      margin-bottom: 0.75rem;
    }

    h1, h2, h3, h4, h5 {
      scroll-margin-top: 4em;
    }

    ul, ol {
      list-style-position: outside;
      margin-bottom: 2rem;
    }

    pre {
      margin-bottom: 2rem;
    }

    hr {
      margin-bottom: 2rem;
      border: 1px solid #ccc;
    }

    a:visited {
      color: royalblue;
    }
  }

  img {
    max-width:100%;
  }
}

#toc {
  list-style: none;

  ul {
    list-style: none;
  }
}

@media screen and (max-width: 1023px) {
  body {
    font-size:1rem;

    &>header {
      position: initial;

      nav {
        input#search {
          max-width: 16rem;
        }
      }
    }
  }

  main {
    flex-wrap: wrap;
    justify-content: left;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
    padding-top: 0;

    h1, h2, h3, h4, h5 {
      scroll-margin-top: 0;
    }

    &>nav {
      order: 1;
      position: initial;
      height: auto;
    }

    &>article {
      order: 2;
      width: auto;
      max-width: 75vw;
    }
  }

  .search-results__items {
    list-style-position:inside;
  }
}
