/* Статьи и гайды Erudia. Подключается после redesign-v2.css */

.article-page {
  --a-measure: 680px;
  --a-aside: 232px;
  --a-amber: #b45309;
  --a-amber-bg: #fffbeb;
  --a-amber-line: #fde68a;
  --a-paper-shadow: 0 1px 0 var(--line), 0 28px 56px -28px rgba(30, 64, 175, 0.28);
  background: var(--bg);
}

.article-page main {
  -webkit-user-select: text;
  user-select: text;
  cursor: auto;
}

.article-page a:focus-visible,
.article-page summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Полоска прочитанного */
.article-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 100%;
  height: 3px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Шапка статьи */
.article-hero {
  padding: 40px var(--gutter) 64px;
  background: linear-gradient(180deg, var(--bg-wash) 0%, var(--bg-wash) 62%, var(--bg) 100%);
  border-bottom: 1px solid var(--line-soft);
}

.article-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 56px;
  align-items: end;
  max-width: var(--container);
  margin: 0 auto;
}

.article-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--muted);
}

.article-crumbs a:hover {
  color: var(--blue);
}

.article-crumbs span[aria-hidden] {
  color: var(--muted-2);
}

.article-title {
  max-width: 17ch;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.6vw, 54px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-wrap: balance;
}

.article-lead {
  max-width: 58ch;
  margin-top: 24px;
  font-size: clamp(18px, 1.9vw, 21px);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 24px;
  font-size: 15px;
  color: var(--muted);
}

.article-meta > * {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.article-meta svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.article-meta__check {
  color: var(--ok);
  font-weight: 600;
}

.article-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* Лист «Коротко»: бумага с пунктиром полей */
.article-sheet {
  position: relative;
  padding: 30px 22px 26px 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--a-paper-shadow);
}

.article-sheet::before {
  content: "";
  position: absolute;
  inset: 14px 10px 14px 24px;
  border: 1px dashed #bfdbfe;
  border-radius: 2px;
  pointer-events: none;
}

.article-sheet__title {
  position: relative;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.article-sheet dl {
  position: relative;
  margin-top: 14px;
}

.article-sheet dl > div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
  line-height: 1.4;
}

.article-sheet dt {
  color: var(--muted);
}

.article-sheet dd {
  color: var(--ink);
  font-weight: 600;
}

.article-sheet__note {
  position: relative;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

/* Раскладка: оглавление слева, текст справа */
.article-layout {
  display: grid;
  grid-template-columns: var(--a-aside) minmax(0, var(--a-measure));
  justify-content: center;
  gap: 72px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 56px var(--gutter) 0;
}

.article-aside {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 56px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.article-toc summary {
  list-style: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.article-toc summary::-webkit-details-marker {
  display: none;
}

.article-toc ol {
  margin-top: 14px;
}

.article-toc a {
  display: block;
  padding: 7px 0 7px 14px;
  border-left: 2px solid var(--line);
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.article-toc a:hover {
  color: var(--ink);
}

.article-toc a[aria-current] {
  border-left-color: var(--blue);
  color: var(--blue-deep);
  font-weight: 600;
}

.article-aside__cta {
  margin-top: 28px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.article-aside__cta p {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
}

.article-aside__cta .btn {
  width: 100%;
  margin-top: 14px;
  justify-content: center;
}

/* Тело статьи */
.article-body {
  min-width: 0;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-2);
}

.article-body > * + * {
  margin-top: 20px;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.2;
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.article-body h2 {
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-size: clamp(27px, 3.2vw, 34px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.article-body > h2:first-child {
  padding-top: 0;
  border-top: 0;
}

.article-body h3 {
  margin-top: 44px;
  font-size: clamp(21px, 2.4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.article-body h4 {
  margin-top: 32px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.article-body :is(h2, h3, h4) + * {
  margin-top: 14px;
}

.article-body a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: var(--blue-mist);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.18s var(--ease);
}

.article-body a:hover {
  text-decoration-color: currentColor;
}

.article-body strong {
  color: var(--ink);
  font-weight: 650;
}

.article-body hr {
  margin: 48px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* Списки */
.article-body ul {
  padding-left: 1.3em;
  list-style: disc;
}

.article-body ul li::marker {
  color: var(--blue);
}

.article-body ol {
  counter-reset: a-step;
  list-style: none;
}

.article-body ol > li {
  position: relative;
  padding-left: 42px;
  counter-increment: a-step;
}

.article-body ol > li::before {
  content: counter(a-step);
  position: absolute;
  top: 1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue-soft);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: var(--blue-deep);
}

.article-body li + li {
  margin-top: 10px;
}

.article-body li > ul,
.article-body li > ol {
  margin-top: 10px;
}

/* Цитата */
.article-body blockquote {
  margin: 32px 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--blue);
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink);
}

.article-body blockquote cite {
  display: block;
  margin-top: 10px;
  font-size: 15px;
  font-style: normal;
  color: var(--muted);
}

/* Образец «как в работе»: лист с полем, Times New Roman */
.article-sample {
  position: relative;
  padding: 18px 22px 18px 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.5;
  color: #000;
}

.article-sample::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 26px;
  border-left: 1px dashed #bfdbfe;
}

.article-sample p + p {
  margin-top: 2px;
}

.article-sample--indent p {
  text-indent: 1.25cm;
}

/* Код */
.article-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--line-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.86em;
  color: var(--ink);
}

.article-body pre {
  margin: 28px 0;
  padding: 20px 24px;
  overflow-x: auto;
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1.6;
}

.article-body pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

/* Изображения */
.article-body img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-body figure {
  margin: 36px 0;
}

.article-body figcaption,
.article-body .image-caption {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

/* Таблицы: обёртка .article-table даёт прокрутку на телефоне */
.article-table__caption {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.article-body .article-table {
  margin-top: 32px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-body .article-table__caption + .article-table {
  margin-top: 12px;
}

.article-body .article-table + * {
  margin-top: 32px;
}

.article-table table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.5;
}

.article-table th,
.article-table td {
  padding: 13px 16px;
  text-align: left;
  vertical-align: top;
}

.article-table th {
  background: var(--blue-soft);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--blue-deep);
  white-space: nowrap;
}

.article-table td {
  border-top: 1px solid var(--line-soft);
}

.article-table td:first-child {
  font-weight: 600;
  color: var(--ink);
}

.article-table tbody tr:nth-child(even) {
  background: var(--bg-soft);
}

/* Выноски */
.article-note,
.article-warning {
  position: relative;
  padding: 18px 20px 18px 54px;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
}

.article-body .article-note,
.article-body .article-warning {
  margin-top: 28px;
}

.article-body .article-note + *,
.article-body .article-warning + * {
  margin-top: 28px;
}

.article-note::before,
.article-warning::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--a-icon) center / contain no-repeat;
  mask: var(--a-icon) center / contain no-repeat;
}

.article-note {
  --a-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.4 1 1.1 1 1.8V16h5v-.3c0-.7.4-1.4 1-1.8A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
  border-color: var(--blue-mist);
  background: var(--blue-soft);
}

.article-note::before {
  color: var(--blue);
}

.article-warning {
  --a-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 20h20L12 3z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
  border-color: var(--a-amber-line);
  background: var(--a-amber-bg);
}

.article-warning::before {
  color: var(--a-amber);
}

/* Частые вопросы */
.article-faq {
  border-top: 1px solid var(--line);
}

.article-faq details {
  border-bottom: 1px solid var(--line);
}

.article-faq summary {
  position: relative;
  padding: 20px 44px 20px 0;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.article-faq summary::-webkit-details-marker {
  display: none;
}

.article-faq summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 12px;
  height: 12px;
  margin-top: -8px;
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(45deg);
  transition: transform 0.22s var(--ease);
}

.article-faq details[open] summary::after {
  margin-top: -2px;
  transform: rotate(-135deg);
}

.article-faq details p {
  padding-bottom: 20px;
  font-size: 17px;
}

/* Источники */
.article-body .article-sources {
  font-size: 16px;
  line-height: 1.55;
}

.article-body .article-sources > li::before {
  background: var(--line-soft);
  color: var(--muted);
}

.article-body .article-sources a {
  color: var(--ink-2);
}

/* Подвал статьи: похожие материалы */
.article-footer {
  max-width: var(--container);
  margin: 88px auto 0;
  padding: 0 var(--gutter);
}

.article-related {
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.article-related__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.article-related__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.article-related__card {
  display: block;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.article-related__card:hover {
  border-color: var(--blue-mist);
  background: var(--blue-soft);
}

.article-related__card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.article-related__card span {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

/* Планшет и телефон: оглавление сворачивается над текстом */
@media (max-width: 1023px) {
  .article-hero__inner {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .article-sheet {
    max-width: 440px;
  }

  .article-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    max-width: calc(var(--a-measure) + var(--gutter) * 2);
    padding-top: 36px;
  }

  .article-aside {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .article-toc {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
  }

  .article-toc summary {
    position: relative;
    padding: 16px 44px 16px 18px;
    cursor: pointer;
  }

  .article-toc summary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 20px;
    width: 9px;
    height: 9px;
    margin-top: -7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
  }

  .article-toc[open] summary::after {
    margin-top: -2px;
    transform: rotate(-135deg);
  }

  .article-toc ol {
    margin: 0;
    padding: 0 18px 14px;
  }

  .article-aside__cta {
    display: none;
  }
}

@media (max-width: 640px) {
  .article-hero {
    padding-top: 28px;
    padding-bottom: 44px;
  }

  .article-crumbs {
    margin-bottom: 20px;
  }

  .article-hero__actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .article-sheet {
    padding: 26px 16px 22px 34px;
  }

  .article-sheet::before {
    inset: 12px 8px 12px 20px;
  }

  .article-body {
    font-size: 17px;
  }

  .article-body h2 {
    margin-top: 56px;
    padding-top: 28px;
  }

  .article-sample {
    padding-left: 36px;
    font-size: 17px;
  }

  .article-sample::before {
    left: 20px;
  }

  .article-sample--indent p {
    text-indent: 1em;
  }

  .article-table th,
  .article-table td {
    padding: 11px 12px;
  }

  .article-footer {
    margin-top: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-toc a,
  .article-related__card,
  .article-faq summary::after {
    transition: none;
  }
}
