/* ============================================================
   Clarity — документация
   ============================================================ */

.docs-shell { display: flex; min-height: 100vh; }

/* ================= Боковое меню ================= */
.docs-nav {
  position: sticky; top: 0; z-index: 40;
  width: 268px; flex: none; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.docs-nav::after {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, var(--accent-line) 30%, var(--accent-line) 70%, transparent);
  opacity: .5; pointer-events: none;
}

.docs-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 var(--s5);
  border-bottom: 1px solid var(--border);
}
.docs-brand .brand-mark {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent) 38%, transparent),
              inset 0 1px 0 rgba(255,255,255,.25);
}
.docs-brand .nm {
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
  letter-spacing: -.015em;
}
.docs-brand .sub { font-size: 12px; color: var(--text-3); margin-left: 1px; }

.docs-links { flex: 1; overflow-y: auto; padding: var(--s4) var(--s3) var(--s6); }
.docs-links .group {
  padding: var(--s5) 10px 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
}
.docs-links .group:first-child { padding-top: 0; }

.docs-links a {
  position: relative; display: block;
  padding: 7px 10px; margin-bottom: 1px;
  font-size: 13.5px; color: var(--text-2);
  border-radius: var(--r-sm); text-decoration: none;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.docs-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.docs-links a.active {
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600;
}
.docs-links a.active::before {
  content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--accent);
}
.docs-links a .muted { font-size: 12px; color: var(--text-3); }
.docs-links a.active .muted { color: inherit; opacity: .7; }

.docs-foot { padding: var(--s3); border-top: 1px solid var(--border); display: flex; gap: 6px; }
.docs-foot .btn { flex: 1; }

/* ================= Контент ================= */
.docs-main { flex: 1; min-width: 0; }
.docs-top {
  position: sticky; top: 0; z-index: 30;
  display: none; align-items: center; gap: var(--s3);
  height: var(--topbar-h); padding: 0 var(--s4);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.docs-body { padding: var(--s8) var(--s7) var(--s10); }
.docs-inner { max-width: 760px; margin: 0 auto; }

.doc-section { display: none; animation: docIn var(--dur-3) var(--ease-out); }
.doc-section.active { display: block; }
@keyframes docIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Хлебные крошки */
.crumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  font-size: 12px; color: var(--text-3); margin-bottom: var(--s4);
}
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--accent-text); text-decoration: none; }
.crumb .sep { color: var(--border-str); }

/* Заголовки */
.doc-section h1 {
  font-family: var(--font-display); font-size: 32px; font-weight: 500;
  letter-spacing: -.025em; line-height: 1.15;
  margin-bottom: var(--s5);
}
.doc-section h2 {
  font-family: var(--font-display); font-size: 21px; font-weight: 500;
  letter-spacing: -.02em;
  margin: var(--s8) 0 var(--s3);
  padding-top: var(--s6);
  border-top: 1px solid var(--border);
}
.doc-section h2:first-of-type { border-top: 0; padding-top: 0; margin-top: var(--s7); }
.doc-section h3 {
  font-size: 15px; font-weight: 600; letter-spacing: -.005em;
  margin: var(--s6) 0 var(--s3);
}

/* Текст */
.doc-section p { font-size: 14.5px; line-height: 1.7; color: var(--text-2); margin: var(--s3) 0; }
.doc-section p strong, .doc-section strong { color: var(--text); font-weight: 600; }
.doc-section ul, .doc-section ol { margin: var(--s3) 0; padding-left: 22px; }
.doc-section li { font-size: 14.5px; line-height: 1.7; color: var(--text-2); margin-bottom: 5px; }
.doc-section a { color: var(--accent-text); }

.hl { color: var(--accent-text); font-weight: 500; }
.doc-section .muted { color: var(--text-2); }
.doc-section .dim { color: var(--text-3); }

/* Таблица команд */
.cmd-table {
  display: grid; grid-template-columns: minmax(160px, auto) 1fr;
  margin: var(--s5) 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1), var(--sh-in);
  overflow: hidden;
}
.cmd-table .cmd,
.cmd-table .desc {
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  font-size: 13.5px; line-height: 1.55;
}
.cmd-table > .cmd:first-child,
.cmd-table > .cmd:first-child + .desc { border-top: 0; }

.cmd-table .cmd {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: var(--accent-text);
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  word-break: break-word;
}
.cmd-table .desc { color: var(--text-2); }
.cmd-table .alias {
  display: inline-block; margin-left: 5px;
  font-size: 11.5px; color: var(--text-3); font-weight: 400;
}

@media (max-width: 620px) {
  .cmd-table { grid-template-columns: 1fr; }
  .cmd-table .cmd { border-right: 0; }
  .cmd-table .desc { border-top: 0; padding-top: 0; }
}

/* Код */
.codeblock, .doc-section pre {
  margin: var(--s4) 0; padding: 14px 16px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.doc-section code, .mod {
  font-family: var(--font-mono); font-size: .9em;
  padding: 2px 6px; border-radius: var(--r-xs);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2);
}

/* Врезка */
.note {
  display: flex; gap: 12px;
  margin: var(--s5) 0; padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  font-size: 13.5px; line-height: 1.6; color: var(--text-2);
}
.note svg { flex: none; color: var(--accent-text); margin-top: 2px; }
.note strong { color: var(--text); }

/* ================= Язык ================= */
body[data-lang="ru"] .tr-en, body[data-lang="ru"] .tr-en-block { display: none; }
body[data-lang="en"] .tr-ru, body[data-lang="en"] .tr-ru-block { display: none; }
.tr-en, .tr-ru { display: inline; }
.tr-en-block, .tr-ru-block { display: block; }

/* ================= Мобильные ================= */
.docs-scrim {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(25,25,23,.42); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-3) var(--ease), visibility var(--dur-3);
}
.docs-scrim.show { opacity: 1; visibility: visible; }

@media (max-width: 900px) {
  .docs-nav {
    position: fixed; top: 0; left: 0; z-index: 41;
    transform: translateX(-100%);
    transition: transform var(--dur-3) var(--ease-out);
    box-shadow: var(--sh-3);
  }
  .docs-nav.open { transform: none; }
  .docs-top { display: flex; }
  .docs-body { padding: var(--s6) var(--s4) var(--s10); }
  .doc-section h1 { font-size: 26px; }
  .doc-section h2 { font-size: 19px; }
}
@media (min-width: 901px) { .docs-scrim { display: none; } }
