$sidebar-summary-color: #333;
$sidebar-link-color: #3d7e9a;

* {
  box-sizing: border-box;
}

h1.page-title {
  background-color: #f5f9fa;
  padding: 10px;
}

div.sidebar {
  float: left;
  max-height: 100vh;
  max-width: 300px;
  position: sticky;
  top: 0;
  margin-bottom: 20px;
  overflow-x: hidden;
  overflow-y: scroll;
  font-size: 16px;
  font-size: 0.88889rem;

  h3,
  h4,
  h5,
  h6 {
    // The main content area might not start with a <hX> tag.
    // By doing this, the top of the sidebar aligns with the top
    // of the content.
    margin-top: 0;
  }

  ul {
    padding-left: 0;
    margin-bottom: 50px;

    li {
      list-style: none;
      margin-top: 20px;
    }
  }

  details {
    margin-bottom: 10px;
    margin-left: 0;
    padding-left: 20px;

    summary {
      color: $sidebar-summary-color;
      display: inline-block;
      margin-right: 5px;
      cursor: pointer;
    }

    summary::-webkit-details-marker {
      display: none;
    }

    summary:before {
      content: "▶︎";
      display: inline-block;
      width: 20px;
      color: $sidebar-link-color;
    }
  }

  details[open] > summary:before {
    content: "\25BC\FE0E";
  }

  ol {
    list-style-type: none;
    padding-left: 20px;

    li {
      padding-left: 0;
      margin-top: 0;
      line-height: 1.2;
      padding-bottom: 10px;

      &.active {
        a {
          font-style: italic;
          color: $sidebar-summary-color;
          &:hover {
            text-decoration: none;
          }
        }
      }

      a {
        color: $sidebar-link-color;
        display: inline-block;
        max-width: 100%;
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
        hyphens: auto;
      }
    }

    li:first-child {
      padding-top: 10px;
    }
  }
}

div.content {
  margin-left: 22.75%;

  .hidden,
  .is-hidden {
    display: none;
  }

  h2::before {
    border-top: 3px solid #3d7e9a;
    content: "";
    display: block;
    margin: 40px 0 40px 0;
    width: 100%;
  }

  h3 {
    padding: 2px 4px 2px 40px;
    background-color: #333;
    color: #fff;
    font-weight: 400;
    line-height: 1.25;
    max-width: -moz-fit-content;
  }

  h3 {
    max-width: fit-content;
  }

  .interactive-example {
    box-sizing: border-box;
    background-color: #f5f9fa;
    color: #333;
    padding: 10px;
    border: 1px solid #eaf2f4;
    width: 100%;
    max-width: 70rem;
  }

  .live-sample-frame {
    border: 1px solid #3d7e9a;
    border-width: 1px 1px 1px 5px;
    padding: 10px;
  }

  p,
  dl,
  ul,
  ol,
  pre,
  .live-sample-frame {
    max-width: 42rem;
  }

  pre > code {
    background-color: #efefef;
    padding: 6px;
    border-radius: 3px;
  }

  .link-list {
    h2 {
      border-bottom: 1px solid #eaecef;
    }
  }
}

.external-icon:not([href^='https://mdn.mozillademos.org']):not(.ignore-external)
{
  white-space: pre-line;
}

.external-icon:not([href^='https://mdn.mozillademos.org']):not(.ignore-external):before, .external-icon:not([href^='https://mdn.mozillademos.org']):not(.ignore-external):after
{
  background-image: url("./icons/general/external-link.svg");
  background-size: 12px;
  width: 12px;
  height: 20px;
  margin-top: 3px;
  margin-right: 3px;
  vertical-align: text-top;
}

.external-icon:not([href^='https://mdn.mozillademos.org']):not(.ignore-external):before, .external-icon:not([href^='https://mdn.mozillademos.org']):not(.ignore-external):before
{
  display: inline-block;
  content: "";
  background-repeat: no-repeat;
}

// :not(pre)>*>code, :not(pre)>code {
//   // background-color: #bbb;
//   // background-color: rgba(220,220,220,.5);
//   border-radius: 2px;
//   box-decoration-break: clone;
//   padding: 0 2px;
//   word-wrap: break-word;
// }
