@import '~antd/es/style/themes/default.less';

@toc-width: 260px;

.markdown {
  margin-top: 24px;
  font-size: 16px;
  line-height: 2;
  margin-left: 300px;
  &.collapsed {
    margin-left: 0;
  }
  font-family: 'Inter var experimental', 'Inter var', -apple-system,
    BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;

  h1 {
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 30px;
    line-height: 38px;
  }

  h1:first-child {
    margin-top: 8px;
  }

  h2 {
    font-size: 24px;
    line-height: 32px;
  }

  h2,
  h3,
  h4,
  h5,
  h6 {
    clear: both;
    margin: 1em 0 0.3em;
    font-weight: 500;
  }

  h3 {
    font-size: 20px;
    margin-bottom: 4px;
    font-weight: 600;
    line-height: 30px;
    border-bottom: 1px solid @border-color-split;
  }

  h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
  }

  h5 {
    font-size: 14px;
  }

  h6 {
    font-size: 12px;
  }

  hr {
    clear: both;
    height: 1px;
    margin: 56px 0;
    background: @border-color-split;
    border: 0;
  }

  p {
    line-height: 32px;
  }

  p,
  pre {
    margin: 0.6em 0;
  }

  pre > code[class*='language-'] {
    line-height: 1.8;
  }

  pre[class*='language-'] {
    background-color: rgba(0, 0, 0, 0.03);
  }

  code[class*='language-'] {
    background: none;
  }

  code[class*='language-text'] {
    white-space: break-spaces;
    word-break: break-word;
    background: #f0f0f0;
    padding: 2px 6px;
    margin: 0 3px;
  }

  code.language-sign,
  pre.language-sign {
    background: #e6f7ff;
  }

  pre.language-sign {
    border: 1px solid #91d5ff;
  }

  description {
    opacity: 0.68;
  }

  ul,
  ol {
    margin: 0;
    padding: 0;
  }

  ul:not(:global(.ant-skeleton-paragraph)) > li {
    margin-left: 20px;
    padding-left: 4px;
    list-style-type: circle;

    &:empty {
      display: none;
    }
  }

  ol > li {
    margin-left: 20px;
    padding-left: 4px;
    list-style-type: decimal;
  }

  ul > li > p,
  ol > li > p {
    margin: 0.2em 0;
  }

  strong,
  b {
    font-weight: 500;
  }

  table {
    width: 100%;
    margin: 24px 0;
    empty-cells: show;
    border: 1px solid @border-color-split;
    border-collapse: collapse;
    border-spacing: 0;

    img {
      max-width: 400px;
    }
  }

  table th {
    color: #5c6b77;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.02);
  }

  table th,
  table td {
    padding: 4px 12px;
    text-align: left;
    border: 1px solid @border-color-split;
    line-height: 24px;
  }

  table img {
    max-height: 100px;
  }

  table td:first-child {
    width: 20%;
    font-weight: 500;
    background: #fcfcfc;
    color: rgba(0, 0, 0, 0.85);
  }

  blockquote {
    margin: 0.5em 0;
    padding-left: 0.8em;
    color: @text-color-secondary;
    font-size: 90%;
    border-left: 4px solid @border-color-split;
  }

  blockquote p {
    margin: 0;
  }

  p,
  ul,
  li {
    a {
      font-weight: 500;
      color: #5e6687;
      border-bottom: 1px dashed #873bf4;
      transition: color.25s;
      &:hover {
        color: #873bf4;
      }
    }
  }

  > br,
  > p > br {
    clear: both;
  }
}

.layout {
  margin: 0 0 32px;
}

.main {
  width: calc(100% - @toc-width);
  padding-left: 48px;
  padding-right: 24px;
  padding-top: 20px;
  margin-top: 64px;
  overflow: hidden;

  &.collapsed {
    padding-left: 68px;
  }
  .meta {
    margin-bottom: 1.2em;
  }

  .contentReset() {
    min-height: 400px;

    > img,
    > p > img {
      width: 100%;
      max-width: 600px;
      margin: 0.5em 0;
    }

    > br,
    > p > br {
      clear: both;
    }
  }

  .content {
    .contentReset;

    > div {
      .contentReset;
    }
  }
}

.menuWrapper {
  position: relative;
  .collapsedButton {
    position: absolute;
    display: block;
    z-index: 10;
    right: -18px;
    top: 30px;
    cursor: pointer;
    svg {
      width: 24px;
      height: 24px;
      border: 1px solid #d6dee6;
      border-radius: 50%;
      padding: 5px;
      fill: #c1c5c9;
      box-sizing: content-box;
      background: #fff;
    }
    &:hover {
      svg {
        fill: #444;
      }
    }

    &.collapsed {
      right: -50px;
    }
  }
}

.toc {
  width: @toc-width;
  float: right;
  font-size: 12px;
  background: #fff;
  max-height: 100vh;
  overflow: auto;
  margin-top: 64px;

  ul > li {
    list-style: none !important;
    padding: 0 !important;
    margin-left: 1em !important;

    // 超出部分省略号显示
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;

    a {
      color: @text-color;
      &:hover {
        text-decoration: underline;
      }
    }
  }
}

.sider {
  width: 300px !important;
  height: calc(100vh - 64px);
  &.collapsed {
    width: 0 !important;
    overflow: hidden;
  }
  // menu 滚动
  :global {
    .ant-menu-item {
      &::after {
        display: none;
      }
    }
    .ant-menu-inline {
      border-right: none;
      background: #fff;
    }
    .ant-menu-light {
      box-sizing: border-box;
      padding-top: 24px;
    }
    .ant-layout-sider-children {
      overflow: hidden;
      &:hover {
        overflow-y: auto;
      }
    }
    .ant-menu-title-content {
    }
    .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {
      background-color: #fff;
    }
    .ant-menu-inline .ant-menu-item-selected::after {
      border: none;
      width: 40px;
      height: 40px;
      background: url(https://img.alicdn.com/imgextra/i4/O1CN01L67YKW1txOTIasQEC_!!6000000005968-55-tps-32-32.svg)
        no-repeat center center;
      background-size: 50%;
      right: 15px;
    }
    .ant-menu-submenu-arrow {
      right: 30px;
    }
    .ant-menu-submenu-open.ant-menu-submenu-inline
      > .ant-menu-submenu-title
      > .ant-menu-submenu-arrow {
      &::after {
        transform: rotate(-45deg) translateX(-4.5px);
        width: 10px;
      }
      &::before {
        transform: rotate(45deg) translateX(4.5px);
        width: 10px;
      }
    }
    .ant-menu-submenu-inline .ant-menu-submenu-arrow {
      &::after {
        transform: rotate(45deg) translateX(-4.5px);
        width: 10px;
      }
      &::before {
        transform: rotate(-45deg) translateX(4.5px);
        width: 10px;
      }
    }
  }
}

.affix {
  display: grid;
  position: fixed;
  top: 64px;
  left: 0px;
  z-index: 20;
  border-right: 1px solid rgb(214, 222, 230);
  &::after {
    position: absolute;
    right: -1px;
    width: 1px;
    height: 100%;
    z-index: 10;
    background-color: rgb(214, 222, 230);
  }
  & > div {
    height: 100%;
  }
}

.menuIcon {
  opacity: 0.6;
  font-size: 16px !important;
  position: relative;
  top: 1px;
  margin-right: 8px !important;
}

.menuDrawer {
  :global(.drawer) {
    z-index: 9;
  }

  :global(.ant-menu) {
    border-right: 0;
  }

  .menuSwitch {
    position: absolute;
    top: 72px;
    right: -40px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 0;
    text-align: center;
    line-height: 40px;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    border-radius: 0 4px 4px 0;
  }
}

.apiStructure {
  padding: 0;
}

.editOnGtiHubButton {
  margin-left: 0.5em;
  font-size: 16px;
  color: #999;
  vertical-align: middle;
  position: relative;
  top: -2px;
}

.exampleContent {
  margin-top: -24px;

  :global {
    .SplitPane {
      overflow: auto;
      left: 0px;
      height: calc(100vh - 64px) !important;
    }

    .Pane2 {
      overflow: auto;
    }

    .ant-collapse-extra {
      margin-left: 16px;
      display: inline-block;
      float: none !important;
    }
  }
}

@media only screen and (max-width: 1199.99px) {
  .gallery {
    .galleryCard {
      width: 33.3%;
    }
  }
}

@media only screen and (max-width: 991.99px) {
  .markdown {
    .main {
      width: 100vw !important;
      padding-left: 32px;
      padding-right: 32px;
    }

    .toc {
      display: none;
    }
  }

  .sider {
    width: 240px !important;
  }
}

@media only screen and (max-width: 767.99px) {
  .layout {
    flex-direction: column !important;
  }

  .sider {
    width: 100% !important;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #e8e8e8;
    display: none;
  }

  .markdown {
    margin-left: 0;
    margin-top: 60px;
    .main {
      margin-top: 30px;
      padding-left: 24px;
      padding-right: 24px;
    }
  }
}

@media only screen and (max-width: 575.99px) {
  .gallery {
    .galleryCard {
      width: 100%;
    }
  }
}

.galleryAnchor {
  overflow-x: hidden;
  overflow-y: hidden;

  &:hover {
    overflow-y: auto;
  }

  :global(.ant-anchor-link) {
    width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    align-items: center;
  }

  :global(.ant-anchor-ink) {
    display: none;
  }

  :global(.ant-anchor-link-title) {
    width: 100%;
    height: 100%;
    padding: 0;
    display: flex;
    align-items: center;
  }
}

.apiAnchor {
  overflow: hidden;
  color: rgb(49, 70, 89);

  &:hover {
    overflow-y: auto;
  }

  :global(.ant-anchor-ink-ball) {
    width: 2px;
    height: 24px;
    background-color: #873bf4;
    border: none;
    border-radius: 0;
    transform: translateX(-50%) translateY(-8px);
  }

  :global(.anticon) {
    display: none;
  }

  .parent {
    padding: 5px 0 5px 24px;
    font-size: 14px;
  }

  .children {
    padding: 5px 0 5px 24px;
    font-size: 14px;
  }
}

.backTop {
  transition: color 0.3s;
  color: #868484;
  background-color: #fff;
  box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
    0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  transition: color 0.3s;
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 22px;
  border-radius: 50%;
  text-align: center;
}

:global(.ant-anchor-link-title) {
  font-style: normal;
  color: #5b5b5b;
  padding: 0;
}

:global(.ant-anchor-ink) {
  &::before {
    width: 1px;
    background-color: #e8e8e8;
  }
}
