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

.markdown {
  font-size: 14px;
  line-height: 2;

  h1 {
    margin-top: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 30px;
    font-family: Avenir, @font-family, sans-serif;
    line-height: 38px;
  }

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

  h2,
  h3,
  h4,
  h5,
  h6 {
    clear: both;
    margin: 1.6em 0 0.6em;
    font-weight: 500;
    font-family: Avenir, @font-family, sans-serif;
  }

  h3 {
    font-size: 18px;
  }
  h4 {
    font-size: 16px;
  }
  h5 {
    font-size: 14px;
  }
  h6 {
    font-size: 12px;
  }

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

  p,
  pre {
    margin: 1em 0;
  }

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

  > img,
  > p > img {
    max-width: ~'calc(100% - 32px)';
    margin: 34px 0;
  }

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

  ul > 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: 100%;
    }
  }

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

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

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

  blockquote p {
    margin: 0;
  }

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

.layout {
  margin: 24px 0 32px 0;
}

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

.main {
  width: calc(100% - 160px);
  padding-left: 48px;
  padding-right: 24px;
  overflow: hidden;

  .meta {
    margin-bottom: 1.2em;
  }

  .content {
    min-height: 400px;
  }
}

.toc {
  width: 160px;
  border-left: 2px solid #eee;
  float: right;
  font-size: 13px;
  background: #fff;
  max-height: calc(100vh - 8px);
  overflow: auto;

  ul > li {
    list-style: none;
    padding: 0;
    margin-left: 16px;
    a {
      color: @text-color;
    }
  }
}

.sider {
  width: 280px !important;
}

.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;
  }
}

.gallery {
  display: flex;
  flex-direction: row-reverse;

  .galleryContent {
    flex: 1;
  }

  .anchor {
    width: 160px;
    padding-left: 24px;
    :global {
      .ant-anchor {
        font-size: 12px;
      }
      .ant-anchor-link {
        padding-top: 5px;
        padding-bottom: 5px;
      }
    }
  }

  .galleryList {
    list-style: none;
    margin: 0 -16px !important;
  }

  .galleryCard {
    display: inline-block;
    width: 25%;
    margin: 12px 0;
    padding: 0;

    .galleryCardLink {
      display: block;
      position: relative;
      margin: 0 12px;
      padding: 12px;
      cursor: pointer;
      border: 1px solid @border-color-split;
      transition: all 0.3s;
      border-radius: 4px;
      overflow: hidden;

      img {
        width: 100%;
        height: calc(100vw / 9 - 20px);
        min-height: 100px;
        max-height: 280px;
        object-fit: cover;
      }

      h4 {
        margin: 0;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: all 0.3s;
        text-align: center;
        font-size: 20px;
        display: flex;
        text-align: center;
        align-items: center;
        justify-content: center;
        transform: translateY(4px);
        text-shadow: 0 3px 16px rgba(0, 0, 0, 0.1);
      }

      &:hover {
        border-color: fade(@primary-color, 80%);

        h4 {
          opacity: 1;
          background: fade(@primary-color, 10%);
          transform: translateY(0);
        }
      }
    }
  }
}

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

@media only screen and (max-width: 991.99px) {
  .markdown {
    .main {
      width: 100%;
      padding-left: 32px;
      padding-right: 32px;
    }
    .toc {
      display: none;
    }
  }

  .sider {
    width: 240px !important;
  }

  .gallery {
    .galleryCard {
      width: 50%;
    }
    .anchor {
      display: none;
    }
  }
}

@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;
  }
  .main {
    margin-top: 30px;
    padding-left: 24px;
    padding-right: 24px;
  }
}

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