/* Документация интеграционного API ЦЛП. Только светлая тема, цвета — токены. */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --muted-surface: #f1f3f5;
  --text: #212529;
  --dimmed: #6b6f76;
  --border: #e3e5e8;
  --primary: #7048e8;
  --primary-light: #f0ebff;
  --get: #0c8599;
  --post: #1c7ed6;
  --put: #e8590c;
  --delete: #e03131;
  --success-bg: #e6fcf5;
  --success: #087f5b;
  --error-bg: #fff5f5;
  --error: #c92a2a;
  --warning-bg: #fff4e6;
  --warning: #d9480f;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

a {
  color: var(--primary);
}
code {
  font-family: var(--mono);
  font-size: 12.5px;
}
.muted {
  color: var(--dimmed);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
.content {
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-width: 0;
}

@media (min-width: 1200px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: start;
  }
}

/* Шапка */
.hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--primary-light) 0%, transparent 60%), var(--surface);
}
.hero__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 680px;
}
.hero__title {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}
.hero__lead {
  margin: 0;
  color: var(--dimmed);
  font-size: 15px;
}
.eyebrow {
  width: fit-content;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.button {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.button:hover {
  filter: brightness(1.1);
}

/* Разделы */
.section,
.scenario {
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-margin-top: 16px;
}
.section__title {
  margin: 0;
  font-size: 20px;
}
.section__lead,
.section__lead p {
  margin: 0;
  color: var(--dimmed);
  max-width: 760px;
}
.card {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.subtitle {
  margin: 0;
  color: var(--dimmed);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.env {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 520px;
}
.env__name {
  font-weight: 600;
}
.env__url {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-button {
  border: none;
  background: none;
  color: var(--dimmed);
  cursor: pointer;
  font-size: 16px;
}
.icon-button:hover {
  color: var(--primary);
}
.link {
  width: fit-content;
  text-decoration: none;
  font-weight: 500;
}

/* Общий порядок: вертикальный список шагов в одной карточке.
   Строка = рельса с номером | название | методы; высота строки — по содержимому.
   Рельса — сплошная вертикальная линия через центры номеров; горизонтальные разделители
   начинаются правее рельсы и её не пересекают. */
.flow {
  margin: 0;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  list-style: none;
}
/* Без column-gap: отступы — margin/padding ячеек, чтобы разделитель шёл одной линией */
.flow__step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
}
.flow__rail {
  grid-row: 1 / span 2;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
/* Половинки линии: вверх к предыдущему номеру и вниз к следующему */
.flow__rail::before,
.flow__rail::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  background: var(--border);
}
.flow__rail::before {
  top: 0;
  bottom: 50%;
}
.flow__rail::after {
  top: 50%;
  bottom: 0;
}
.flow__step:first-child .flow__rail::before,
.flow__step:last-child .flow__rail::after {
  display: none;
}
.flow__number {
  position: relative;
  z-index: 1;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  /* Кольцо цвета фона отделяет номер от линии */
  box-shadow: 0 0 0 4px var(--surface);
}
.flow__label {
  margin-left: 14px;
  padding-top: 14px;
  font-weight: 600;
}
.flow__endpoints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 14px;
  padding: 6px 0 14px;
}
.flow__step + .flow__step .flow__label {
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) {
  .flow__step {
    grid-template-columns: 26px 214px minmax(0, 1fr);
  }
  .flow__endpoints {
    margin-left: 0;
  }
  .flow__rail {
    grid-row: 1;
  }
  .flow__label,
  .flow__endpoints {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px 0;
  }
  .flow__endpoints {
    gap: 6px;
  }
  .flow__step + .flow__step .flow__endpoints {
    border-top: 1px solid var(--border);
  }
}
/* Метод в одну строку: бейдж + полный путь, перенос только по «/» */
.flow__endpoint {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.flow__endpoint code {
  font-size: 12.5px;
  overflow-wrap: break-word;
}
.flow__endpoint .method {
  font-size: 11px;
}

/* Сценарии */
.scenario {
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.scenario__header {
  display: flex;
  gap: 16px;
}
.scenario__index {
  color: var(--primary);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.scenario__title {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}
.scenario__summary {
  margin: 4px 0 0;
  max-width: 760px;
  color: var(--dimmed);
}

/* Шаги: нумерованный список из Markdown с линией между пунктами */
.steps ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding: 0 0 18px 42px;
  color: var(--dimmed);
  counter-increment: step;
}
.steps li:last-child {
  padding-bottom: 0;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 0;
  left: 14px;
  width: 1px;
  background: var(--border);
}
.steps li strong {
  display: block;
  color: var(--text);
}

.callout {
  padding: 12px 16px;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: var(--primary-light);
}
.callout p {
  margin: 2px 0 0;
}

/* Методы сценария */
.operations {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 992px) {
  .operations {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.operation-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  height: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
a.operation-link:hover {
  border-color: var(--primary);
}
.operation-link__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: break-word;
}
.operation-link__text code {
  font-weight: 600;
}
.operation-link__title {
  color: var(--dimmed);
  font-size: 13px;
}
.operation-link__missing {
  color: var(--warning);
  font-size: 13px;
}

.method {
  flex: none;
  min-width: 56px;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.method--get {
  background: var(--get);
}
.method--post {
  background: var(--post);
}
.method--put,
.method--patch {
  background: var(--put);
}
.method--delete {
  background: var(--delete);
}

/* Справочник методов */
.methods__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.pill {
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--muted-surface);
  color: var(--dimmed);
  font-size: 12px;
}
.pill--warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.tag {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  scroll-margin-top: 16px;
}
.tag__title {
  margin: 0;
  font-size: 16px;
}
.tag p {
  margin: 0;
}

.operation {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  scroll-margin-top: 16px;
}
.operation:target {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
/* Шапка метода одинакова в свёрнутом и раскрытом виде — при переключении ничего не прыгает:
   стрелка | метод | путь целиком (переносится только по «/»), под путём — заголовок метода */
.operation__head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--muted-surface);
  cursor: pointer;
  user-select: none;
}
.operation__head::before {
  content: "▸";
  color: var(--dimmed);
  font-size: 12px;
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}
.operation__head:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.operation__path {
  font-weight: 600;
  overflow-wrap: break-word;
}
.operation__summary {
  grid-column: 3 / -1;
  color: var(--dimmed);
  font-size: 13px;
}
.operation__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 16px 16px;
}
.operation__description {
  margin: 0;
  color: var(--dimmed);
  white-space: pre-line;
}
.operation.is-collapsed .operation__head {
  border-bottom-color: transparent;
}
.operation.is-collapsed .operation__head::before {
  transform: none;
}
.operation.is-collapsed .operation__body {
  display: none;
}

.block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}
.block__title {
  font-size: 13px;
  font-weight: 600;
}
.type {
  color: var(--primary);
  font-size: 12px;
}
.flag {
  margin-left: 6px;
  color: var(--dimmed);
  font-size: 11px;
}
.flag--required {
  color: var(--error);
}
.flag--warning {
  color: var(--warning);
}

.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.params td {
  padding: 7px 10px 7px 0;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.params td:first-child {
  width: 36%;
}

/* Под именем параметра — место (query/path) и обязательность, всегда отдельной строкой */
.param__meta {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  color: var(--dimmed);
  font-size: 11px;
}

.fields {
  margin: 0;
  padding: 0;
  list-style: none;
}
.fields .fields {
  margin: 2px 0 4px 6px;
  padding-left: 14px;
  border-left: 1px dashed var(--border);
}
.fields > li {
  border-top: 1px solid var(--border);
}
.fields .fields > li {
  border-top: none;
}
.field {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 7px 0;
  font-size: 13px;
}
.field__name {
  font-weight: 600;
}
.field__description {
  flex-basis: 100%;
  color: var(--dimmed);
}
.field__enum {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 4px;
}
.field__enum code {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--muted-surface);
  font-size: 11.5px;
}

details > summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
.fields details > summary::before {
  content: "▸";
  color: var(--dimmed);
  font-size: 11px;
  transition: transform 0.15s ease;
}
.fields details[open] > summary::before {
  transform: rotate(90deg);
}

.responses {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.response + .response {
  border-top: 1px solid var(--border);
}
.response__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.response__fields {
  padding: 0 12px 6px;
}
.status {
  min-width: 38px;
  padding: 0 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.status--success {
  background: var(--success-bg);
  color: var(--success);
}
.status--error {
  background: var(--error-bg);
  color: var(--error);
}

/* Справочник значений из Markdown-таблиц */
.reference h3 {
  margin: 8px 0 0;
  font-size: 15px;
}
.reference table {
  width: 100%;
  max-width: 640px;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.reference th,
.reference td {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  text-align: left;
}
.reference th {
  color: var(--dimmed);
  font-size: 12px;
  font-weight: 600;
}
.reference td code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--muted-surface);
  font-weight: 600;
}

/* Оглавление */
.toc {
  display: none;
}
@media (min-width: 1200px) {
  .toc {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
  }
}
.toc__title {
  color: var(--dimmed);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc a {
  display: block;
  padding: 4px 0;
  color: inherit;
  text-decoration: none;
}
.toc a:hover {
  color: var(--primary);
}
.toc__nested {
  padding-left: 12px !important;
  font-size: 13px;
}
