@import './markdown.less';
@import './variables.less';

@s-toc-width: 136px;

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB,
  Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji,
  Segoe UI Symbol;
  font-variant: tabular-nums;
  font-feature-settings: 'tnum';
  transition: background 0.2s cubic-bezier(0.075, 0.82, 0.165, 1), color 0.2s cubic-bezier(0.075, 0.82, 0.165, 1);

  [data-prefers-color=dark] & {
    color: @c-text-dark;
    background-color: @c-body-bg-dark;
  }

  > * {
    box-sizing: border-box;
  }
}

* {
  box-sizing: border-box;
}

.@{prefix}-layout {
  box-sizing: border-box;
  min-height: 100vh;
  padding: 16px (@s-content-margin + @s-toc-width) 50px @s-menu-width + @s-content-margin;

  @media @mobile {
    padding-top: 66px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  &[data-gapless='true'] {
    // padding top === @s-nav-height
    padding: 0 !important;

    @media @mobile {
      padding-top: @s-mobile-nav-height !important;
    }
  }

  &[data-show-sidemenu='false'] {
    padding-left: @s-content-margin;
  }

  &[data-show-slugs='false'] {
    padding-right: @s-content-margin;
  }

  &[data-site-mode='true'] {
    padding-top: @s-nav-height + 50px;

    &[data-show-sidemenu='true'] {
      padding-left: @s-site-menu-width + 50px;
    }

    &[data-show-slugs='true'] {
      padding-right: @s-content-margin + @s-toc-width + 14;
    }

    .@{prefix}-layout-content > .markdown:first-child > *:first-child {
      margin-top: 0;
    }

    .@{prefix}-layout-toc {
      top: 114px;
      max-height: calc(90vh - 144px);
    }
  }

  &-toc {
    list-style: none;
    position: fixed;
    z-index: 10;
    top: 50px;
    right: 0;
    width: @s-toc-width;
    max-height: calc(90vh - 80px);
    margin: 0;
    padding: 0 24px 0 0;
    background-color: #fff;
    box-sizing: content-box;
    overflow: auto;

    [data-prefers-color=dark] & {
      background-color: @c-bg-dark;
    }

    @media @mobile {
      display: none;
    }

    li {
      position: relative;
      margin: 0;
      padding: 4px 0 4px 6px;
      text-indent: 12px;
      font-size: 13px;
      line-height: 1.40625;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;

      a {
        color: @c-text;
        text-decoration: none;

        [data-prefers-color=dark] & {
          color: @c-text-dark;
        }

        &::before {
          content: '';
          position: absolute;
          top: 0;
          left: 0;
          bottom: 0;
          display: inline-block;
          width: 2px;
          background: @c-border;
        }

        &:hover {
          color: lighten(@c-primary, 5%);

          [data-prefers-color=dark] & {
            color: lighten(@c-primary-dark, 5%);
          }
        }

        &:active {
          color: lighten(@c-primary, 3%);

          [data-prefers-color=dark] & {
            color: lighten(@c-primary-dark, 3%);
          }
        }

        &.active {
          color: @c-primary;

          [data-prefers-color=dark] & {
            color: @c-primary-dark;
          }

          &::before {
            background: @c-primary;

            [data-prefers-color=dark] & {
              background: @c-primary-dark;
            }
          }
        }
      }
    }
  }

  &-footer-meta {
    margin-top: 40px;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    color: @c-secondary;
    font-size: 14px;
    justify-content: space-between;
    border-top: 1px solid @c-border;

    [data-prefers-color=dark] & {
      color: @c-secondary-dark;
      border-color: @c-border-dark;
    }

    @media only screen and (max-width: 960px) {
      display: block;
    }

    > a {
      margin-bottom: 4px;
      display: block;
      color: @c-primary;
      text-decoration: none;

      [data-prefers-color=dark] & {
        color: @c-primary-dark;
      }
    }

    > span:last-child {
      &::before {
        content: attr(data-updated-text);
        color: @c-primary;

        [data-prefers-color=dark] & {
          color: @c-primary-dark;
        }
      }
    }
  }

  &-footer-records {
    margin-right: -208px;
    margin-left: -50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 19px 0 18px;
    background: #000000;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    font-family: MicrosoftYaHei;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 22px;
    font-weight: 400;
  }

  &-content {
    height: 100vh;
  }

  .fixed-widgets {
    position: fixed;
    right: 32px;
    bottom: 102px;
    z-index: 2147483640;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    &-tooltip {
      .ant-tooltip-inner {
        min-width: 100px;
      }
    }
    & > div {
      display: block;
    }
    &-active {
      color: #6680FF;
    }
    &-avatar {
      color: #000;
      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;
      &:hover {
        color: #6680FF;
      }
    }
  }
}

.__dumi-default-layout {
  div.__dumi-default-menu {
    padding-top: 0;

    .__dumi-default-menu-inner {
      padding: 8px 0;
    }
  }
}

