.w-richtext,
.content {
  color: var(--content-text);
  font-size: 1rem;
  line-height: 1.65;
}

.w-richtext > *:first-child,
.content > *:first-child {
  margin-top: 0;
}

.w-richtext > *:last-child,
.content > *:last-child {
  margin-bottom: 0;
}

.w-richtext pre,
.content pre {
  box-sizing: border-box;
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  overflow-x: hidden;
  border: 1px solid rgba(var(--blue-rgb), .12);
  border-radius: var(--radius-md);
  background: #f7f9fe;
  color: #17233f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .875rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  tab-size: 2;
}

.w-richtext pre[data-code-language]::before,
.content pre[data-code-language]::before {
  content: attr(data-code-language);
  display: block;
  margin-bottom: .75rem;
  color: var(--content-muted);
  font-family: Google Sans, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.w-richtext p,
.content p {
  color: var(--content-text);
  font-size: 1rem;
  line-height: 1.65;
}

/* Вертикальный ритм заголовков внутри контента. */
.w-richtext h1,
.content h1 {
  color: var(--content-heading);
  margin: 0 0 1rem;
}

.w-richtext h2,
.content h2 {
  color: var(--content-heading);
  margin: 3.5rem 0 1rem;
}

.w-richtext h3,
.content h3 {
  color: var(--content-heading);
  margin: 2.25rem 0 .75rem;
}

.w-richtext h4,
.w-richtext h5,
.w-richtext h6,
.content h4,
.content h5,
.content h6 {
  color: var(--content-heading);
  margin: 1.75rem 0 .5rem;
}

/* Текстовые утилиты из рэмпа. */
.text-display {
  color: var(--content-heading);
  font-size: var(--display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.027em;
}

.text-lead,
.w-richtext .lead,
.content .lead {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--content-text);
}

.text-small {
  font-size: .875rem;
  line-height: 1.6;
  color: var(--content-label);
}

.text-caption {
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--content-muted);
}

.text-overline {
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--content-subtle);
}

/* --------------------------------------------------------------------------
   2. Гиперссылки
   -------------------------------------------------------------------------- */
.w-richtext a,
.content a,
.link {
  color: var(--link-default);
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(49, 130, 206, .35);
  transition: color .18s ease, text-decoration-color .18s ease;
}

.w-richtext a:hover,
.content a:hover,
.link:hover {
  color: var(--link-strong);
  text-decoration-color: currentColor;
}

.w-richtext a:active,
.content a:active,
.link:active {
  color: var(--link-pressed);
}

.w-richtext a:visited,
.content a:visited,
.link:visited {
  color: var(--link-seen);
}

.w-richtext a:focus-visible,
.content a:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--link-default);
  outline-offset: 2px;
  border-radius: 4px;
}

.w-richtext a[aria-disabled="true"],
.content a[aria-disabled="true"],
.link.is-disabled {
  color: var(--link-off);
  text-decoration: none;
  pointer-events: none;
}

/* Ссылка на тёмной подложке. */
.content--on-dark a,
.link--inverse {
  color: var(--link-inverse);
  text-decoration-color: rgba(144, 205, 244, .4);
}

.content--on-dark a:hover,
.link--inverse:hover {
  color: #bee3f8;
}

/* Самостоятельная ссылка со стрелкой. */
.link-arrow,
.link-back {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--link-default);
  transition: color .18s ease, gap .18s ease;
}

.link-arrow:hover {
  color: var(--link-strong);
  gap: .625rem;
}

.link-back {
  color: var(--content-muted);
}

.link-back:hover {
  color: var(--content-heading);
}

/* --------------------------------------------------------------------------
   3. Маркированные списки
   -------------------------------------------------------------------------- */
.w-richtext ul,
.content ul,
.w-richtext ol,
.content ol {
  margin: 1.25rem 0 1.5rem;
  padding-left: 0;
  list-style: none;
  color: var(--content-text);
  font-size: 1rem;
  line-height: 1.65;
}

.w-richtext li,
.content li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 24px;
  line-height: 1.65;
}

.w-richtext li:last-child,
.content li:last-child {
  margin-bottom: 0;
}

/* Уровень 1 — точка. */
.w-richtext ul > li,
.content ul > li {
  color: var(--content-heading);
}

.w-richtext ul > li::before,
.content ul > li::before {
  content: "";
  position: absolute;
  top: .62em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--link-default);
}

/* Уровень 2 — кольцо. Отступ 28 от края списка набирается из padding
   родительского li (24) и небольшой добавки, поэтому здесь всего 4px. */
.w-richtext ul ul,
.content ul ul,
.w-richtext ul ol,
.content ul ol,
.w-richtext ol ul,
.content ol ul {
  margin: 10px 0 0;
  padding-left: 4px;
}

.w-richtext ul ul > li,
.content ul ul > li {
  color: var(--content-text);
  font-size: .9375rem;
}

.w-richtext ul ul > li::before,
.content ul ul > li::before {
  background: none;
  border: 1.5px solid var(--content-subtle);
}

/* Уровень 3 — тире. */
.w-richtext ul ul ul > li::before,
.content ul ul ul > li::before {
  top: .8em;
  width: 8px;
  height: 1.5px;
  border: 0;
  border-radius: 1px;
  background: #cbd3df;
}

/* --------------------------------------------------------------------------
   4. Нумерованные списки
   -------------------------------------------------------------------------- */
.w-richtext ol,
.content ol {
  counter-reset: ol-counter;
}

.w-richtext ol > li,
.content ol > li {
  counter-increment: ol-counter;
  padding-left: 34px;
  color: var(--content-heading);
}

.w-richtext ol > li::before,
.content ol > li::before {
  content: counter(ol-counter) ".";
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  text-align: right;
  color: var(--link-default);
  font-weight: 500;
}

/* Второй уровень — нумерация вида 1.1. */
.w-richtext ol ol,
.content ol ol {
  counter-reset: ol-sub;
  margin: 10px 0 0;
  padding-left: 0;
}

.w-richtext ol ol > li,
.content ol ol > li {
  counter-increment: ol-sub;
  padding-left: 38px;
  color: var(--content-text);
  font-size: .9375rem;
}

.w-richtext ol ol > li::before,
.content ol ol > li::before {
  content: counter(ol-counter) "." counter(ol-sub);
  width: 26px;
  color: var(--content-subtle);
  font-size: .875rem;
}

/* --------------------------------------------------------------------------
   5. Шаги (нумерованный список с заголовком и описанием)
   -------------------------------------------------------------------------- */
.content-steps {
  counter-reset: step-counter;
  margin: 1.5rem 0 2rem;
  padding: 0;
  list-style: none;
}

.content-steps__item {
  counter-increment: step-counter;
  position: relative;
  padding: 0 0 1.125rem 42px;
}

.content-steps__item:last-child {
  padding-bottom: 0;
}

.content-steps__item::before {
  content: counter(step-counter);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: #ebf8ff;
  color: #1a6fc4;
  font-size: .875rem;
  font-weight: 700;
}

/* Соединитель между шагами. */
.content-steps__item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 34px;
  left: 13px;
  bottom: 6px;
  width: 2px;
  border-radius: 1px;
  background: var(--content-line);
}

.content-steps__title {
  display: block;
  margin: 3px 0 3px;
  color: var(--content-heading);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}

.content-steps__text {
  display: block;
  color: var(--content-muted);
  font-size: .875rem;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   6. Изображения и подписи (figcaption)
   -------------------------------------------------------------------------- */
.w-richtext figure,
.content figure {
  margin: 1.5rem 0 2rem;
}

.w-richtext figure img,
.content figure img {
  display: block;
  width: 100%;
  border-radius: var(--radius-lg);
}

.w-richtext figcaption,
.content figcaption {
  margin-top: 10px;
  text-align: left;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--content-muted);
}

/* Центрированные вставки редактора сохраняют своё выравнивание. */
.w-richtext figure.w-richtext-align-center figcaption,
.w-richtext figure.w-richtext-align-fullwidth figcaption {
  text-align: center;
}

/* Источник внутри подписи. */
.w-richtext figcaption a,
.content figcaption a {
  color: var(--link-default);
}

/* --------------------------------------------------------------------------
   7. Планшет и мобильные
   -------------------------------------------------------------------------- */
@media screen and (max-width: 991px) {
  .w-richtext h2,
  .content h2 {
    margin-top: 2.75rem;
  }

  .w-richtext h3,
  .content h3 {
    margin-top: 2rem;
  }
}

@media screen and (max-width: 767px) {
  .w-richtext h2,
  .content h2 {
    margin-top: 2.25rem;
  }

  .w-richtext h3,
  .content h3 {
    margin-top: 1.75rem;
  }

  .w-richtext figure,
  .content figure {
    margin: 1.25rem 0 1.5rem;
  }

  .w-richtext figure img,
  .content figure img {
    border-radius: var(--radius-md);
  }

  .w-richtext figcaption,
  .content figcaption {
    font-size: .78125rem;
  }

  .w-richtext ul,
  .content ul,
  .w-richtext ol,
  .content ol {
    margin: 1rem 0 1.25rem;
  }
}
