/*
 * Документация /docs и справочник API /api — раскладка макета Docs.dc.html (шаг 5 плана нового вида):
 * разделы слева, статья, «На странице» справа. Только токены --st-* кита: тёмная тема получается сама.
 */

.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 60vh;
}

/* Левая колонка: разделы обеих страниц, активный пункт — плашка */
.docs-sidebar {
  box-sizing: border-box;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--st-color-sidebar);
  color: var(--st-color-sidebar-foreground);
  border-right: 1px solid var(--st-color-sidebar-border);
}

.docs-nav-group {
  display: flex;
  flex-direction: column;
}

.docs-nav-title,
.docs-toc-title {
  margin: 0;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--st-color-muted-foreground);
}

.docs-nav-title {
  padding: 0 10px 5px;
}

.docs-nav-list,
.docs-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.docs-nav-link {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: var(--st-radius-md);
  font-size: 14px;
  line-height: 20px;
  color: var(--st-color-sidebar-foreground);
  text-decoration: none;
}

.docs-nav-link:hover {
  background: var(--st-color-sidebar-accent);
  color: var(--st-color-sidebar-accent-foreground);
}

.docs-nav-link[aria-current] {
  background: var(--st-color-card);
  color: var(--st-color-primary);
  font-weight: 600;
  box-shadow: var(--st-shadow-sm);
}

/* В тёмной теме карточка и колонка одного цвета, а primary на них ниже 4.5:1 — плашка светлее, текст — ссылка */
.dark .docs-nav-link[aria-current] {
  background: var(--st-color-sidebar-accent);
  color: var(--st-color-link);
}

.docs-nav-link:focus-visible,
.docs-toc a:focus-visible,
.docs-card-link:focus-visible,
.docs-code:focus-visible,
.docs-table-wrap:focus-visible {
  outline: 2px solid var(--st-color-ring);
  outline-offset: 2px;
}

/* Статья и правая колонка */
.docs-main {
  min-width: 0;
  box-sizing: border-box;
  padding: 28px 32px 64px;
  display: grid;
  grid-template-columns: minmax(0, 820px) 220px;
  gap: 28px;
  align-items: start;
}

.docs-article {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.docs-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.docs-lead {
  margin: 0;
  font-size: 16px;
  line-height: 25px;
  color: var(--st-color-muted-foreground);
}

.docs-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.docs-section h2 {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
  letter-spacing: -0.01em;
  color: var(--st-color-foreground);
}

.docs-section h3 {
  color: var(--st-color-foreground);
}

.docs-section p {
  margin: 0;
}

.docs-note {
  font-size: 14px;
  line-height: 21px;
  color: var(--st-color-muted-foreground);
}

/* Строчный код в тексте: путь, заголовок, тип */
.docs-article :not(pre) > code {
  font-family: var(--font-family-mono);
  font-size: 13px;
  padding: 1px 6px;
  border-radius: var(--st-radius-sm);
  background: var(--st-color-muted);
  color: var(--st-color-foreground);
}

/* Нумерованные шаги */
.docs-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.docs-steps > li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.docs-step-number {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--st-color-accent);
  color: var(--st-color-accent-foreground);
}

.docs-step-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-step-body h3 {
  margin: 0;
  font-size: 15px;
  line-height: 23px;
  font-weight: 600;
  letter-spacing: 0;
}

.docs-step-body p {
  font-size: 15px;
  line-height: 23px;
  color: var(--st-color-muted-foreground);
}

/* Карточки разделов */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.docs-cards .card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.docs-card-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: 0;
}

.docs-icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--st-color-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.docs-cards p,
.docs-cards ul {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--st-color-muted-foreground);
}

.docs-cards ul {
  padding-left: 18px;
}

.docs-card-link {
  margin-top: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--st-color-link);
  text-decoration: none;
}

.docs-card-link:hover {
  color: var(--st-color-primary-hover);
}

/* Тёмные блоки кода с прокруткой по горизонтали */
.docs-code {
  margin: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: var(--st-radius-xl);
  background: var(--st-color-foreground);
  color: var(--st-color-background);
  font-family: var(--font-family-mono);
  font-size: 13px;
  line-height: 20px;
  white-space: pre;
  overflow-x: auto;
}

/* В тёмной теме --st-color-foreground светлый: блок кода остаётся тёмным на приглушённом фоне */
.dark .docs-code {
  background: var(--st-color-muted);
  color: var(--st-color-foreground);
}

.docs-code code {
  font: inherit;
  color: inherit;
  background: none;
  padding: 0;
  overflow-wrap: normal;
}

/* Эндпоинты */
.docs-endpoint-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docs-endpoint-group h3 {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  letter-spacing: 0;
}

.docs-endpoint {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.docs-endpoint-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.docs-endpoint p {
  font-size: 14px;
  line-height: 21px;
  color: var(--st-color-muted-foreground);
}

.docs-method,
.docs-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--st-radius-sm);
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  text-align: center;
}

.docs-method-post,
.docs-status-ok {
  background: var(--st-color-success);
  color: var(--st-color-success-foreground);
}

.docs-method-get {
  background: var(--st-color-info);
  color: var(--st-color-info-foreground);
}

.docs-status {
  min-width: 40px;
  box-sizing: border-box;
}

.docs-status-client {
  background: var(--st-color-muted);
  color: var(--st-color-muted-foreground);
}

.docs-status-limit {
  background: var(--st-color-warning);
  color: var(--st-color-warning-foreground);
}

.docs-article .docs-path {
  padding: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
}

/* Базовая информация */
.docs-defs {
  margin: 0;
  display: grid;
  gap: 14px;
}

.docs-defs div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.docs-defs dt {
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  color: var(--st-color-muted-foreground);
}

.docs-defs dd {
  margin: 0;
}

/* Таблица кодов ответов */
.docs-table-wrap {
  overflow-x: auto;
  background: var(--st-color-card);
  border: 1px solid var(--st-color-border);
  border-radius: var(--st-radius-xl);
}

.docs-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 19px;
  color: var(--st-color-card-foreground);
}

.docs-table th,
.docs-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--st-color-border);
}

.docs-table th {
  font-size: 12px;
  font-weight: 600;
  background: var(--st-color-muted);
  color: var(--st-color-muted-foreground);
}

.docs-table tbody tr:last-child td {
  border-bottom: 0;
}

.docs-table td:last-child {
  color: var(--st-color-muted-foreground);
}

/* Призыв в конце страницы */
.docs-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.docs-cta p {
  font-size: 15px;
  line-height: 23px;
  color: var(--st-color-muted-foreground);
}

/* Правая колонка «На странице» */
.docs-toc {
  position: sticky;
  top: calc(var(--st-shell-header-height, 0px) + 72px);
  font-size: 13px;
  line-height: 20px;
}

.docs-toc nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-toc-list {
  gap: 6px;
}

.docs-toc a {
  color: var(--st-color-link);
  text-decoration: none;
}

.docs-toc a:hover {
  color: var(--st-color-primary-hover);
}

/* Уже 1180 px правой колонке нет места: те же разделы есть в левой колонке */
@media (max-width: 1180px) {
  .docs-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

/* Телефон: колонки друг под другом, разделы — плашками в строку */
@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-sidebar {
    padding: 14px 16px;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--st-color-sidebar-border);
  }

  .docs-nav-title {
    padding: 0 0 5px;
  }

  .docs-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .docs-nav-link {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 13px;
    border: 1px solid var(--st-color-sidebar-border);
  }

  .docs-main {
    padding: 20px 16px 48px;
    gap: 24px;
  }

  .docs-article {
    gap: 28px;
  }
}
