/* stylelint-disable selector-max-empty-lines */
@import (reference) "../../variables/neptune-tokens.less";
@import (reference) "../mixins/_logical-properties.less";
@import (reference) "../mixins/_links.less";
@import (reference) "../addons/_spacing-utilities.less";

// TITLE

/* `.h*`, `.title-*`, `.np-text-title-*` are DEPRECATED: use `.wds-text-title-*` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
.title-1,
.title-2,
.title-3,
.title-4,
.title-5,
h1,
h2,
h3,
h4,
h5,
h6,
.np-text-title-screen,
.np-text-title-section,
.np-text-title-subsection,
.np-text-title-body,
.np-text-title-group,
.wds-text-title-screen,
.wds-text-title-section,
.wds-text-title-subsection,
.wds-text-title-body,
.wds-text-title-group {
  margin: 0;
  color: var(--color-content-primary);
  .np-text-hyphenated;

  + p,
  + ul:not(.list-unstyled),
  + ol:not(.list-unstyled) {
    margin-top: var(--size-8);
  }
}

/* DEPRECATED: use `.wds-text-title-screen` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.h1,
.title-1,
h1,
.np-text-title-screen,
.wds-text-title-screen {
  &:extend(.wds-text-title-screen);
  margin-bottom: initial;
}

/* DEPRECATED: use `.wds-text-title-section` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.h2,
.title-2,
h2,
.np-text-title-section,
.wds-text-title-section {
  &:extend(.wds-text-title-section);
  margin-bottom: initial;
}

/* DEPRECATED: use `.wds-text-title-subsection` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.h3,
.title-3,
h3,
.np-text-title-subsection,
.wds-text-title-subsection {
  &:extend(.wds-text-title-subsection);
  margin-bottom: initial;
}

/* DEPRECATED: use `.wds-text-title-body` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.h4,
.title-4,
h4,
.np-text-title-body,
.wds-text-title-body {
  &:extend(.wds-text-title-body);
}

/* DEPRECATED: use `.wds-text-title-group` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.h5,
.h6,
.title-5,
h5,
h6,
.np-text-title-group,
.wds-text-title-group {
  &:extend(.wds-text-title-group);
}

/* DEPRECATED: use `.wds-text-title-body` instead */
.lead {
  margin-bottom: var(--size-24);
  font-size: var(--wds-font-size-title-body);
  line-height: var(--wds-line-height-title-body);
}

// DEPRECATED: use `.wds-text-body-default` instead
.tiny {
  color: var(--color-content-secondary);
}

// BODY

/* DEPRECATED: use `.wds-text-body-default` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.body-2,
.body-3,
.small,
.tiny,
body,
small,
.np-text-body-default,
.wds-text-body-default {
  &:extend(.wds-text-body-default);
  .np-text-hyphenated;
}

/* DEPRECATED: use `.wds-text-body-default-bold` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.control-2,

// DEPRECATED: use `Field` component (or in some edge cases `Label` component) instead
.label, .control-label,

.np-text-body-default-bold,
.wds-text-body-default-bold {
  &:extend(.wds-text-body-default-bold);
  .np-text-hyphenated;
}

/* DEPRECATED: use `.wds-text-body-large` instead  */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.body-1,
.value,
.np-text-body-large,
.wds-text-body-large {
  &:extend(.wds-text-body-large);
  .np-text-hyphenated;
}

/* DEPRECATED: use `.wds-text-body-large-bold` instead */
/* stylelint-disable-next-line selector-list-comma-newline-after */
.control-1,
.np-text-body-large-bold,
.wds-text-body-large-bold {
  &:extend(.wds-text-body-large-bold);
  .np-text-hyphenated;
}

// LINK

a,
.np-text-link-default,
.np-text-link-large {
  font-weight: var(--wds-font-weight-title-body);
  .link-underline();
}

.np-text-link-large {
  font-size: var(--wds-font-size-body-large);
  letter-spacing: -0.011em;
  line-height: 150%;
}

.np-text-link-default {
  font-size: var(--wds-font-size-body);
  letter-spacing: -0.006em;
  line-height: 155%;
}

// DISPLAY

/* DEPRECATED: use .wds-text-display-number-small instead */
.np-text-display-number,
.wds-text-display-number {
  &:extend(.wds-text-display-number);
}

.np-text-display-number-small,
.wds-text-display-number-small {
  &:extend(.wds-text-display-number-small);
}

.np-text-display-number-medium,
.wds-text-display-number-medium {
  &:extend(.wds-text-display-number-medium);
}

.np-text-display-number-large,
.wds-text-display-number-large {
  &:extend(.wds-text-display-number-large);
}

.display-1,
.display-2,
.display-3,
.display-4,
.display-5,
.np-text-display-extra-large,
.np-text-display-large,
.np-text-display-medium,
.np-text-display-small {
  &,
  &--forced {
    font-family: var(--wds-font-family-display);
    font-synthesis: none;
  }
}

/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
.np-text-display-extra-large,
.np-text-display-large,
.np-text-display-medium,
.np-text-display-small {
  .np-text-hyphenated;
}

.np-text-display-extra-large,
.np-text-display-large,
.wds-text-display-large {
  &:extend(.wds-text-display-large);
}

.np-text-display-medium,
.wds-text-display-medium {
  &:extend(.wds-text-display-medium);
}

.np-text-display-small,
.wds-text-display-small {
  &:extend(.wds-text-display-small);
}

/* Disable hyphenation for English
 * and Japanese, Thai, Chinese (these languages use character-level breaks and should never insert hyphens). */
:lang(en),
:lang(ja),
:lang(th),
:lang(zh-CN),
:lang(zh-HK) {
  hyphens: none;
}

/* DEPRECATED: use `.np-text-display-*` instead */
.display-1 {
  margin-bottom: var(--size-24);
  /* stylelint-disable-next-line number-max-precision */
  font-size: 3.7333333333rem;

  @media (--screen-md) {
    margin-bottom: var(--size-8);
    font-size: 6.5rem;
  }
}

/* DEPRECATED: use `.np-text-display-*` instead */
.display-2 {
  margin-bottom: var(--size-24);
  /* stylelint-disable-next-line number-max-precision */
  font-size: 3.7333333333rem;

  @media (--screen-md) {
    margin-bottom: var(--size-16);
    font-size: 5.5rem;
  }
}

/* DEPRECATED: use `.np-text-display-*` instead */
.display-3 {
  margin-bottom: var(--size-8);
  font-size: 2.8rem;

  @media (--screen-md) {
    margin-bottom: var(--size-24);
    font-size: 4.5rem;
  }
}

/* DEPRECATED: use `.np-text-display-*` instead */
.display-4 {
  margin-bottom: var(--size-4);
  /* stylelint-disable-next-line number-max-precision */
  font-size: 1.8666666667rem; // 28/15px

  @media (--screen-md) {
    margin-bottom: var(--size-24);
    font-size: 3.5rem; // 56px
  }
}

/* DEPRECATED: use `.np-text-display-*` instead */
.display-5 {
  margin-bottom: var(--size-4);
  /* stylelint-disable-next-line number-max-precision */
  font-size: 1.8666666667rem; // 28/15px

  @media (--screen-md) {
    margin-bottom: var(--size-8);
    font-size: 2.625rem; // 42px
  }
}

p {
  margin: 0 0 var(--size-16);

  + h1,
  + h2,
  + h3,
  + h4,
  + h5,
  + h6,
  + .h1,
  + .h2,
  + .h3,
  + .h4,
  + .h5,
  + .h6,
  + .title-1,
  + .title-2,
  + .title-3,
  + .title-4,
  + .title-5,
  + .np-text-title-screen,
  + .np-text-title-section,
  + .np-text-title-subsection,
  + .np-text-title-body,
  + .np-text-title-group,
  + .wds-text-title-screen,
  + .wds-text-title-section,
  + .wds-text-title-subsection,
  + .wds-text-title-body,
  + .wds-text-title-group {
    margin-top: 0;
    margin-bottom: var(--size-8);
  }
}

.control-1,
.control-2 {
  color: var(--color-content-accent);
}

strong,
b {
  font-weight: var(--wds-font-weight-title-body);
  color: var(--color-content-primary);
}

mark,
.mark {
  padding: var(--size-4);
  background-color: var(--color-background-warning);
}

address {
  margin-bottom: var(--size-24);
  font-style: normal;
}

blockquote {
  margin: var(--size-16) 0;
  padding: 0 var(--size-16) 0 calc(var(--size-16) - 2px);
  font-size: var(--wds-font-size-body-large);
  .border(left, 2px, solid, var(--color-content-accent));

  p {
    margin-bottom: var(--size-8);
  }

  p,
  ol,
  ul {
    &:last-child {
      margin-bottom: 0;
    }
  }

  footer {
    display: block;
    color: var(--color-content-secondary);
    font-size: var(--wds-font-size-body);
    line-height: var(--wds-line-height-body-large);

    &::before {
      content: "\2014 \00A0"; // em dash, nbsp
    }
  }

  @media (--screen-sm) {
    margin: var(--size-24);
  }

  @media (--screen-lg) {
    margin: var(--size-32);
    font-size: var(--wds-font-size-body-large);
  }
}

.blockquote-reverse {
  .padding(right, 22px);

  .padding(left, 0);

  .text-align(right);

  .border(right, 2px, solid, var(--color-content-accent));

  .border(left, 0);

  footer {
    &::before {
      content: "";
    }

    &::after {
      content: "\00A0 \2014"; // nbsp, em dash
    }
  }
}

pre,
code,
kbd {
  border-radius: var(--radius-small);
}

pre {
  margin: 0 0 var(--size-24);
  padding: var(--size-16);
  overflow: auto;
  color: var(--color-content-secondary);
  font-size: var(--wds-font-size-body);
  line-height: var(--wds-line-height-body-large);
  word-wrap: break-word;
  word-break: break-all;
  background-color: var(--color-background-neutral);

  code {
    padding: 0;
    font-size: inherit;
    white-space: pre-wrap;
    background-color: transparent;
    border-radius: 0;
  }
}

code {
  padding: 2px var(--size-4);
  font-size: 90%;
  color: var(--color-content-secondary);
  background-color: var(--color-background-neutral);
}

kbd {
  padding: 2px var(--size-4);
  font-size: 90%;
  color: #fff;
  background-color: #333;

  kbd {
    padding: 0;
    font-weight: var(--wds-font-weight-title-body);
    font-size: 100%;
  }
}
