@import './markdown.less';
@import './variables.less';

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';

  [data-prefers-color='dark'] & {
    color: @c-text-dark;
    background-color: @c-bg-dark;
  }
}

.@{prefix}-layout {
  box-sizing: border-box;
  min-height: 100vh;
  padding: 16px @s-content-margin 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 !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
    padding-bottom: 0;

    @media @mobile {
      padding-top: @s-mobile-nav-height !important;
    }
  }

  &[data-show-sidemenu='false'] {
    padding-left: @s-content-margin;
  }

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

    .@{prefix}-layout-content > .markdown:first-child > *:first-child {
      margin-top: 0;
    }

    .@{prefix}-layout-toc {
      top: 114px;
      max-height: calc(90vh - 144px);
    }
  }

  &-hero {
    margin: -50px -58px 0;
    padding: 100px 0;
    text-align: center;
    background-color: #f5f6f8;

    [data-prefers-color='dark'] & {
      background-color: @c-light-bg-dark;
    }

    @media @mobile {
      margin: -16px -16px 0;
      padding: 48px 0;
    }

    img {
      max-width: 100%;
      max-height: 200px;
      margin-bottom: 1rem;
    }

    h1 {
      margin: 0 0 16px;
      font-size: 48px;
      font-weight: 600;
      line-height: 56px;
      color: #080e29;

      [data-prefers-color='dark'] & {
        color: @c-heading-dark;
      }

      + div {
        margin: 16px 0 32px;
        opacity: 0.78;

        .markdown {
          font-size: 16px;
        }
      }
    }

    button {
      margin-right: 16px;
      padding: 0 32px;
      height: 44px;
      color: @c-primary;
      font-size: 16px;
      background: transparent;
      border: 1px solid @c-primary;
      border-radius: 22px;
      box-sizing: border-box;
      cursor: pointer;
      outline: none;
      transition: all 0.3s;

      &:hover {
        opacity: 0.8;
      }

      &:active {
        opacity: 0.9;
      }
    }

    a:last-child button {
      margin-right: 0;
      color: #fff;
      background: @c-primary;
    }
  }

  &-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-column-gap: 96px;
    grid-row-gap: 56px;
    padding: 72px 0;

    > dl {
      flex: 1;
      margin: 0;
      text-align: center;
      background: no-repeat center top / auto 48px;

      &[style*='background-image'] {
        padding-top: 64px;
      }

      dt {
        margin-bottom: 12px;
        font-size: 20px;
        line-height: 1;
        color: @c-heading;
        [data-prefers-color='dark'] & {
          color: @c-text-dark;
        }
      }

      a {
        transition-duration: none;
      }

      a dt {
        color: @c-link;
        transition: opacity 0.2s;
        &:hover {
          opacity: 0.7;
          text-decoration: underline;
        }

        &:active {
          opacity: 0.9;
        }
      }

      dd {
        margin: 0;

        .markdown {
          color: @c-secondary;
          font-size: 14px;
          line-height: 22px;

          [data-prefers-color='dark'] & {
            color: @c-secondary-dark;
          }

          > p:first-child {
            margin-top: 0;
          }

          > p:last-child {
            margin-bottom: 0;
          }
        }
      }
    }

    @media @mobile {
      display: block;
      padding: 40px 0;

      > dl {
        text-align: left;
        background-position: left top;

        &[style*='background-image'] {
          padding: 0 0 0 60px;
        }

        + dl {
          margin-top: 32px;
        }
      }
    }
  }

  &-features,
  &-features + &-content,
  &-hero + &-content {
    margin-left: auto;
    margin-right: auto;
    max-width: 960px;
  }

  &-hero + &-content {
    margin-top: 60px;
  }

  &-footer-meta {
    margin-top: 40px;
    padding-top: 24px;
    display: flex;
    color: @c-secondary;
    font-size: 14px;
    justify-content: space-between;
    border-top: 1px solid var(--doc-border-color);

    [data-prefers-color='dark'] & {
      color: @c-secondary-dark;
    }

    @media only screen and (max-width: 960px) {
      display: block;
    }

    > a {
      margin-bottom: 4px;
      display: block;
      color: @c-primary;
      transition: opacity 0.2s;
      text-decoration: none;

      [data-prefers-color='dark'] & {
        color: @c-primary-dark;
      }

      &:hover {
        opacity: 0.7;
        text-decoration: underline;
      }

      &:active {
        opacity: 0.9;
      }
    }

    > span:last-child {
      &::before {
        content: attr(data-updated-text);
        color: @c-primary;

        [data-prefers-color='dark'] & {
          color: @c-primary-dark;
        }
      }
    }
  }
}

.__dumi-default-layout-footer {
  margin: 72px 0 -32px;
  padding-top: 24px;
  border-top: 1px solid var(--doc-border-color);
  text-align: center;

  .markdown {
    color: #b0b1ba;

    [data-prefers-color='dark'] & {
      color: rgba(255, 255, 255, 0.45);
    }
  }
}
