@import '../../../../lib/style/themes/default';
@import '../../../../lib/style/mixins/index';

@typography-prefix-cls: ~'@{c7n-pro-prefix}-typography';

// =============== Basic ===============
.@{typography-prefix-cls} {
  color: @text-color;
  overflow-wrap: break-word;

  &&-secondary {
    color: @text-color-secondary;
  }

  &&-success {
    color: @success-color;
  }

  &&-warning {
    color: @warning-color;
  }

  &&-danger {
    color: @error-color;

    a&:active,
    a&:focus,
    a&:hover {
      color:~`colorPalette('@{error-color}', 5) `;
    }
  }

  &&-disabled {
    color: @disabled-color;
    cursor: not-allowed;
    user-select: none;
  }

  &&-text,
  &&-link,
  &&-paragraph {
    line-height: @typography-line-height;
  }

  // Tag
  div&,
  p {
    .typography-paragraph();
  }

  h1&,
  div&-h1,
  div&-h1>textarea,
  h1 {
    .typography-title-1();
  }

  h2&,
  div&-h2,
  div&-h2>textarea,
  h2 {
    .typography-title-2();
  }

  h3&,
  div&-h3,
  div&-h3>textarea,
  h3 {
    .typography-title-3();
  }

  h4&,
  div&-h4,
  div&-h4>textarea,
  h4 {
    .typography-title-4();
  }

  h5&,
  div&-h5,
  div&-h5>textarea,
  h5 {
    .typography-title-5();
  }


  h1& {
    .@{typography-prefix-cls}+& {
      margin-top: @typography-title-1-margin-top;
    }
  }
  h2& {
    .@{typography-prefix-cls}+& {
      margin-top: @typography-title-2-margin-top;
    }
  }
  h3& {
    .@{typography-prefix-cls}+& {
      margin-top: @typography-title-3-margin-top;
    }
  }
  h4& {
    .@{typography-prefix-cls}+& {
      margin-top: @typography-title-4-margin-top;
    }
  }
  h5& {
    .@{typography-prefix-cls}+& {
      margin-top: @typography-title-5-margin-top;
    }
  }

  div,
  ul,
  li,
  p,
  h1,
  h2,
  h3,
  h4,
  h5 {

    +h1,
    +h2,
    +h3,
    +h4,
    +h5 {
      margin-top: @typography-title-margin-top;
    }
  }

  a&-ellipsis,
  span&-ellipsis {
    display: inline-block;
    max-width: 100%;
  }

  a&,
  a {
    .operation-unit();
    text-decoration: @link-decoration;

    &:active,
    &:hover {
      text-decoration: @link-hover-decoration;
    }

    &[disabled],
    &.@{typography-prefix-cls}-disabled {
      color: @disabled-color;
      cursor: not-allowed;

      &:active,
      &:hover {
        color: @disabled-color;
      }

      &:active {
        pointer-events: none;
      }
    }
  }

  code {
    margin: 0 0.022rem;
    padding: 0.022rem 0.04rem 0.01rem;
    font-size: 85%;
    background: rgba(150, 150, 150, 0.1);
    border: @typography-code-border;
    border-radius: 0.03rem;
  }

  kbd {
    margin: 0 0.022rem;
    padding: 0.015rem 0.04rem 0.01rem;
    font-size: 90%;
    background: rgba(150, 150, 150, 0.06);
    border: 0.01rem solid rgba(100, 100, 100, 0.2);
    border-bottom-width: 0.02rem;
    border-radius: 0.03rem;
  }

  mark {
    padding: 0;
    background-color: @typography-mark-bg;
  }

  u,
  ins {
    text-decoration: underline;
    text-decoration-skip-ink: auto;
  }

  s,
  del {
    text-decoration: line-through;
  }

  strong {
    font-weight: 600;
  }

  // Operation
  &-expand,
  &-copy {
    .operation-unit();

    margin-left: @typography-operation-margin-left;
  }

  &-copy-success {

    &,
    &:hover,
    &:focus {
      color: @success-color;
    }
  }

  // list
  ul,
  ol {
    margin: 0 0 0.1rem;
    padding: 0;

    li {
      margin: 0 0 0 0.20rem;
      padding: 0 0 0 0.04rem;
    }
  }

  ul {
    list-style-type: circle;

    ul {
      list-style-type: disc;
    }
  }

  ol {
    list-style-type: decimal;
  }

  // pre & block
  pre,
  blockquote {
    margin: 0.1rem 0;
  }

  pre {
    padding: 0.04rem 0.06rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: rgba(150, 150, 150, 0.1);
    border: 0.01rem solid rgba(100, 100, 100, 0.2);
    border-radius: 0.03rem;

    // Compatible for marked
    code {
      display: inline;
      margin: 0;
      padding: 0;
      font-size: inherit;
      font-family: inherit;
      background: transparent;
      border: 0;
    }
  }

  blockquote {
    padding: @typography-blockquote-padding;
    border-left: 0.04rem solid rgba(100, 100, 100, 0.2);
    opacity: 0.85;
  }

  // ============ Ellipsis ============
  &-single-line {
    white-space: nowrap;
  }

  &-ellipsis-single-line {
    overflow: hidden;
    text-overflow: ellipsis;

    a&,
    span& {
      vertical-align: bottom;
    }
  }

  &-ellipsis-multiple-line {
    /* stylelint-disable-next-line value-no-vendor-prefix */
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;

    /*! autoprefixer: ignore next */
    -webkit-box-orient: vertical;
  }
}
