@media (prefers-color-scheme: light) {
  body:not(.dark) {
    --code-color: rgba(55, 53, 47, 0.8); 
    --pre-bg-color: rgba(240,240,240,1);
    --pre-border-color: rgba(225,225,225,1);
    --hr-color: rgb(228, 227, 226);
    --link-border-bottom: rgba(55, 53, 47, 0.3);
    --link-border-bottom-hover: rgba(55, 53, 47, 1);
    --admonition-border-color: rgba(0,0,0,0.1); 
    --admonition-bg-color: rgba(0,0,0,0.1); 

    --admonition-warning-border-color: rgba(244, 153, 35, 0.3);
    --admonition-warning-bg-color: rgba(244, 153, 35, 0.05);

    --admonition-tip-border-color: rgba(0, 42, 79, 0.05);
    --admonition-tip-bg-color: rgba(9, 127, 232, 0.05);
    --admonition-tip-color: rgba(0, 42, 79, 1);
  }
}
@media (prefers-color-scheme: dark) {
  body:not(.light) {
    --code-color: rgba(255, 255, 255, 0.8); 
    /* --pre-bg-color: rgba(0,0,0,0.1); */
    --pre-bg-color: rgba(255,255,255,0.05);
    /* --pre-border-color: rgba(0,0,0,0.15);  */
    --pre-border-color: rgba(255,255,255,0.07);
    --hr-color: rgba(255, 255, 255, 0.1);
    --link-border-bottom: rgba(255,255,255, 0.3);
    --link-border-bottom-hover: rgba(255,255,255, 1);

    --admonition-border-color: rgba(0,0,0,0.5); 
    --admonition-bg-color: rgba(0,0,0,0.3);

    --admonition-warning-border-color: rgba(244, 153, 35, 0.15);
    --admonition-warning-bg-color: rgba(244, 153, 35, 0.05);

    --admonition-tip-border-color: rgba(98, 174, 240, 0.1);
    --admonition-tip-bg-color: rgba(98, 174, 240, 0.07);
    --admonition-tip-color: #e6f3fe;
  }
}

/* .top-nav { */
/*   border-bottom: 1px solid var(--border-color); */
/* } */
.toc-container {
  align-items: flex-end;
  width: 220px;
  flex-shrink: 0;
  @media (max-width: 900px) {
    display: none;
  }

  .toc-nav {
    font-size: 14px;
    width: 220px;
    top: 63px;
    padding-top: 50px;
    position: sticky;

    label {
      display: flex;
      align-items: center;
      gap: 5px;
      font-weight: 500;
      svg {
        width: 16px;
        height: 16px;
        fill: var(--subhead);
      }
    }
    ul {
      margin: 0;
      padding: 0;
      list-style: none;
      margin-left: 8px;
      margin-top: 6px;
      /* line-height: 1.8; */
      li {
        padding-left: 12px;
        border-left: 1px solid var(--border-color);
        opacity: 0.7;
        line-height: 1.3;
        a {
          display: block;
          padding: 0.3em 0;
        }
        &:hover {
          opacity: 1;
        }
        &.active {
          border-left: 1px solid var(--text-color);
          opacity: 1;
          font-weight: 600;
        }
      }
      ul {
        margin-top: 0;
        margin-left: 0;
        li {
          padding-left: 28px;
        }
      }
    }
  }
}

.docs-container {
  display: flex;
  flex-direction: row;
  width: 100vw;
  max-width: 1150px;
  gap: 2em;
  margin-top: 3em;
  @media (max-width: 900px) {
    padding: 1em;
    margin-top: 0;
  }
}

.docs-nav-container {
  width: 14em;
  flex-shrink: 0;
  @media (max-width: 900px) {
    display: none;
  }
  .docs-nav {
    position: sticky;
    top: calc(63px + 2em);
    user-select: none;
    line-height: 2;
    font-size: 14px;
    /* padding-top: 1em; */
    header {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 0 9px;
      svg {
        fill: var(--subhead);
        width: 14px;
        height: 14px;
      }
    }
    ul {
      margin: 0;
      padding: 0;
      list-style: none;
      /* margin-left: 8px; */
      li {
        opacity: 0.8;
        &.current {
          opacity: 1;
          font-weight: 600;
        }
        /* padding-left: 1em; */
        a {
          cursor: pointer;
          display: flex;
          align-items: center;
          gap: 6px;
          border-radius: 6px;
          padding: 0px 9px;
          &:hover {
            background-color: var(--top-bar-background-hover);
          }
          svg {
            opacity: 0.7;
            height: 14px;
            width: 14px;
            fill: var(--subhead);
            transition: transform 100ms;
          }
          &.expanded svg {
            transform: rotate(90deg);
          }
          &:not(.collapsible):not(.api-docs) {
            svg {
              opacity: 0;
            }
          }
        }
        ul {
          display: none;
          &.expanded {
            display: block;
          }
          li {
            font-weight: 400;
            opacity: 1;
            line-height: 1.3;
            a {
              opacity: 0.8;
              padding-left: calc(9px + 23px + 14px);
              padding-top: 0.35em;
              padding-bottom: 0.35em;
              &:hover {
                opacity: 1;
              }
            }
            &.current {
              font-weight: 600;
              a {
                opacity: 1;
              }
            }
          }
        }
      }
    }
  }
}

.breadcrumbs {
  font-size: 14px;
  ol {
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    flex-grow: 1;
    padding: 0;
    margin: 0 auto 19px;
    li {
      display: flex;
      margin-right: 10px;
      line-height: 1.1875rem;
      transition: opacity 100ms;
      &:not(:last-child) {
        opacity: 0.5;
        &:hover {
          opacity: 1;
        }
        &::after {
          margin-left: 10px;
          content: "/";
          opacity: 0.3;
          font-size: 1.25em;
          line-height: 1rem;
        }
      }
    }
  }
}

.docs-content {
  h1 {
    font-size: 2.6em;
    margin: 0 0 0.7em;
    line-height: 1;
  }
  h2 {
    font-size: 1.6em;
  }
  p, ol, ul, table {
    svg {
      fill: var(--text-color);
      width: 1em;
      height: 1em;
      position: relative;
      top: 0.1875em;
    }
  }
  a {
    font-weight: 500;
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-color: var(--link-border-bottom);
    text-underline-offset: 2px;
    &:hover {
      text-decoration-color: var(--link-border-bottom-hover);
      color: var(--text-color);
    }
    &.external-link::after {
      content: "";
      display: inline-block;
      margin-left: 2px;
      margin-bottom: -1px;
      width: 12px;
      height: 12px;
      opacity: 0.5;
      mask-repeat: no-repeat;
      mask-position: center;
      mask-size: contain;
      mask-image: url("/assets/icons/octicons/link-external-16.svg");
      background-color: var(--text-color);
      -webkit-mask-repeat: no-repeat;
      -webkit-mask-position: center;
      -webkit-mask-size: contain;
      -webkit-mask-image: url("/assets/icons/octicons/link-external-16.svg");
    }
  }
  code {
    font-family: Menlo, Consolas, monospace;
    /* color: var(--code-color); */
    /* color: rgba(55, 53, 47, 0.9); */
  }

  *:not(pre) > code {
    font-size: 0.85em;
    font-weight: 500;
    background-color: var(--pre-bg-color);
    border-radius: 4px;
    border: 1px solid var(--pre-border-color);
    padding: 1px 5px;
    margin: 0 1px;
  }

  pre {
    background-color: var(--pre-bg-color);
    border: 1px solid var(--pre-border-color);
    padding: 12px;
    border-radius: 6px;
    margin-top: 20px;
    font-size: 0.875em;
    overflow: auto;
  }

  ul, ol {
    padding-inline-start: 3ch;
    li p {
      margin: 0;
    }
  }

  li::marker {
    color: var(--marker-color);
    font-weight: 500;
  }

  h1, h2, h3 {
    scroll-margin-top: calc(63px + 16px);
  }

  h2 {
    margin: 1.5em 0 0.5em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5em;
    letter-spacing: -0.015em;
    line-height: 1.2;
  }
  .screenshot {
    max-width: min(600px, 100%);
    margin: 2em 0;
  }
  table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 2em;
    thead {
      border-bottom: 2px solid var(--border-color);
      th {
        text-align: start;
        padding: 0.5em 0.5em 0.5em 0;
      }
    }
    tr {
      border-bottom: 1px solid var(--border-color);
      td {
        padding: 0.5em 0.5em 0.5em 0;
      }
    }
  }
}

.admonition {
  margin-top: 1em;
  line-height: 1.5;
  /* padding: 10px 20px; */
  border-radius: 8px;
  /* color: rgba(255, 255, 255, 0.75); */
  background-color: var(--admonition-bg-color);
  border: 1px solid var(--admonition-border-color);
  &.info {
    .admonition-title {
      /* background-color: var(--admonition-bg-color); */
      /* background-color: rgba(244, 153, 35, 0.07); */
      &:before {
        /* content:url('../img/icons/alert-triangle.svg'); */
        width: 18px;
        height: 18px;
        display: inline-block;
        margin-right: 6px;
        content: '';
        -webkit-mask: url('/assets/icons/octicons/info-16.svg') no-repeat 50% 50%;
        mask: url('/assets/icons/octicons/info-16.svg') no-repeat 50% 50%;
        -webkit-mask-size: cover;
        mask-size: cover;
        /* background-color: rgba(255, 255, 255, 0.75);  */
        background-color: var(--text-color);
      }
    }
  }
  &.tip {
    border-color: var(--admonition-tip-border-color);
    background-color: var(--admonition-tip-bg-color);
    color: var(--admonition-tip-color);
    .admonition-title {
      /* background-color: rgba(244, 153, 35, 0.07); */
      &:before {
        /* content:url('../img/icons/alert-triangle.svg'); */
        width: 18px;
        height: 18px;
        display: inline-block;
        margin-right: 6px;
        content: '';
        -webkit-mask: url('/assets/icons/octicons/light-bulb-16.svg') no-repeat 50% 50%;
        mask: url('/assets/icons/octicons/light-bulb-16.svg') no-repeat 50% 50%;
        -webkit-mask-size: cover;
        mask-size: cover;
        /* background-color: rgba(255, 255, 255, 0.75);  */
        background-color: var(--admonition-tip-color);
      }
    }
  }
  &.warning {
    border: 1px solid var(--admonition-warning-border-color);
    background-color: var(--admonition-warning-bg-color);
    .admonition-title {
      /* background-color: rgba(244, 153, 35, 0.07); */
      &:before {
        /* content:url('../img/icons/alert-triangle.svg'); */
        width: 18px;
        height: 18px;
        display: inline-block;
        margin-right: 6px;
        content: '';
        -webkit-mask: url('/assets/icons/alert-triangle.svg') no-repeat 50% 50%;
        mask: url('/assets/icons/alert-triangle.svg') no-repeat 50% 50%;
        -webkit-mask-size: cover;
        mask-size: cover;
        /* background-color: rgba(255, 255, 255, 0.75);  */
        background-color: rgb(244, 153, 35, 0.5); 
      }
    }
  }
  .admonition-title {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    /* padding: 10px 20px; */
    padding: 10px 20px 0;
    & + p {
      padding: 10px 20px;
      margin: 0;
    }
  }
}

.prev-next {
  display: flex;
  gap: 8px;
  margin-top: 3em;
  @media (max-width: 900px) {
    .prev {
      display: none;
    }
    flex-direction: column;
  }
  a {
    border-radius: 8px;
    padding: 1em;
    border: 1px solid var(--border-color);
    gap: 0.5em;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;

    flex-grow: 1;
    flex-basis: 0;
    &:hover {
      background-color: var(--feature-box-bg-hover);
      cursor: pointer;
    }
    svg {
      fill: var(--subhead);
    }
    & > div {
      text-decoration: none;
      .direction {
        font-size: 0.8em;
        opacity: 0.5;
        text-decoration: none;
        text-decoration-color: none;
        text-decoration-style: none;
      }
    }
    &.prev > div {
      text-align: right;
    }
  }
}

h1 {
  font-size: 2.6em;
  margin: 0 0 1em;
  line-height: 1;
  svg {
    width: 0.8em;
    height: 0.8em;
    fill: var(--subhead);
    position: relative;
    top: 0.05em;
    margin-right: 0.1em;
  }
}

.icon-text {
  white-space: nowrap;
  &.sort svg {
    transform: rotate(90deg);
  }
}

.learned-icon {
  width: 1em;
  height: 1em;
  position: relative;
  top: 0.12em;
  display: inline-block;
  border: 2px solid var(--text-color);
  border-radius: 100px;
}

.card-group {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  flex-wrap: wrap;
  gap: 1em;
  margin-top: 2em;
  @media (max-width: 900px) {
    grid-template-columns: repeat(1,minmax(0,1fr));
  }
  .card {
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1em;
    cursor: pointer;
    text-decoration: none;
    &:hover {
      border: 1px solid var(--link-border-bottom);
    }
    svg {
      fill: var(--text-color);
      opacity: 0.8;
      width: 1em;
      height: 1em;
    }
    header {
      display: flex;
      align-items: center;
      gap: 0.5em;
      font-size: 1em;
      font-weight: 700;
      margin-bottom: 0.5em;
    }
  }
}
