/* =========================================================
   VANTRO Knowledge Base — docs.vantro.ru
   Same design tokens as the main site.
   ========================================================= */
:root {
  --font-sans: 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-brand: 'Orbitron', 'Manrope', sans-serif;

  --blue: #4f6bff;
  --blue-soft: #6d8bff;
  --violet: #8b5cf6;
  --violet-soft: #a78bfa;
  --grad: linear-gradient(120deg, #4f6bff 0%, #6f5cff 48%, #8b5cf6 100%);

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

:root,
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #06070d;
  --surface: rgba(255, 255, 255, .038);
  --surface-2: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .085);
  --border-strong: rgba(255, 255, 255, .17);
  --text: #f2f4ff;
  --text-2: #b3b8d1;
  --text-3: #7f84a2;
  --link: #a9b8ff;
  --link-strong: #c4ceff;
  --header-bg: rgba(8, 9, 17, .78);
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f6fc;
  --surface: rgba(255, 255, 255, .78);
  --surface-2: rgba(14, 16, 32, .05);
  --border: rgba(14, 16, 32, .1);
  --border-strong: rgba(14, 16, 32, .2);
  --text: #10132a;
  --text-2: #4a4f6b;
  --text-3: #767b96;
  --link: #3d55d8;
  --link-strong: #2a3fb0;
  --header-bg: rgba(245, 246, 252, .82);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 12% -8%, rgba(79, 107, 255, .18), transparent 70%),
    radial-gradient(45% 40% at 92% 0%, rgba(139, 92, 246, .14), transparent 70%);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(60% 45% at 12% -8%, rgba(79, 107, 255, .12), transparent 70%),
    radial-gradient(45% 40% at 92% 0%, rgba(139, 92, 246, .1), transparent 70%);
}

a { color: var(--link); }
a:hover { color: var(--link-strong); }

:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.skip-link:focus { top: 14px; }

.shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.top__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex: 0 0 auto;
}

.brand img { display: block; height: 20px; width: auto; }
.brand:hover img { opacity: .85; }

.brand__tag {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.top__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.top__link {
  padding: 7px 11px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease, background-color .2s ease;
}

.top__link:hover { color: var(--text); background: var(--surface); }

.top__link--accent {
  border: 1px solid rgba(139, 92, 246, .4);
  color: var(--violet-soft);
}

.top__link--accent:hover { color: #fff; background: rgba(139, 92, 246, .18); }

[data-theme="light"] .top__link--accent { color: #6d3fd4; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn .icon { width: 16px; height: 16px; }

.theme-toggle__icon--sun { display: none; }
[data-theme="light"] .theme-toggle__icon--sun { display: block; }
[data-theme="light"] .theme-toggle__icon--moon { display: none; }

/* ---------- Layout ---------- */
.docs {
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 46px;
  padding: 34px 0 84px;
  align-items: start;
}

.side {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  padding-right: 6px;
}

.side__group + .side__group { margin-top: 24px; }

.side__title {
  margin: 0 0 10px;
  padding: 0 10px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.side__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color .18s ease, background-color .18s ease;
}

.side__link:hover { color: var(--text); background: var(--surface); }

.side__link.is-active {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: inset 2px 0 0 var(--blue);
}

.side__link--api { color: var(--violet-soft); }
[data-theme="light"] .side__link--api { color: #6d3fd4; }

.side__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  flex: 0 0 auto;
}

/* ---------- Content ---------- */
.content { max-width: 780px; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  color: var(--text-3);
  font-size: 11.5px;
}

.crumbs a { color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs span { opacity: .55; }

h1 {
  margin: 0;
  font-size: clamp(26px, 3.1vw, 38px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.lead {
  max-width: 640px;
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 14.5px;
}

h2 {
  margin: 36px 0 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.01em;
}

h3 {
  margin: 24px 0 8px;
  font-size: 15px;
  font-weight: 800;
}

.content p { color: var(--text-2); font-size: 14px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.tag--api { border-color: rgba(139, 92, 246, .45); color: var(--violet-soft); }
[data-theme="light"] .tag--api { color: #6d3fd4; }

.tag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Empty state ---------- */
.empty {
  margin-top: 26px;
  padding: 28px 26px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(150deg, rgba(79, 107, 255, .08), rgba(139, 92, 246, .05) 60%, transparent);
}

.empty__icon {
  width: 30px;
  height: 30px;
  color: var(--blue-soft);
  stroke-width: 1.6;
}

.empty__title {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.empty__text {
  max-width: 540px;
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.topics {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 20px;
  list-style: disc outside;
  color: var(--text-3);
  font-size: 13.5px;
}

.topics li::marker { color: var(--border-strong); }

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 32px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
}

.note .icon { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; color: var(--link); }

/* ---------- Hub ---------- */
.hub { padding: 52px 0 84px; }

.hub__hero { max-width: 720px; }

.hub__hero h1 { font-size: clamp(30px, 4.2vw, 48px); }

.hub__hero .lead { font-size: 15px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform .22s ease, border-color .22s ease, background-color .22s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: inherit;
}

.card__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 2px;
  border-radius: 11px;
  background: rgba(79, 107, 255, .16);
  color: var(--blue-soft);
}

.card__icon .icon { width: 18px; height: 18px; stroke-width: 1.8; }

.card__title {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.card__desc {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.62;
}

.card__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.card--api {
  grid-column: 1 / -1;
  border-color: rgba(139, 92, 246, .42);
  background: linear-gradient(120deg, rgba(79, 107, 255, .14), rgba(139, 92, 246, .13) 70%, transparent);
}

.card--stub {
  cursor: default;
  background: var(--surface);
}

.card--stub:hover {
  transform: none;
  border-color: var(--border);
  background: var(--surface);
}

.card--api .card__icon { background: rgba(139, 92, 246, .22); color: var(--violet-soft); }
[data-theme="light"] .card--api .card__icon { color: #6d3fd4; }

.card--api .card__desc { max-width: 620px; }

.hub__section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 44px 0 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hub__section-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--border);
  padding: 24px 0 42px;
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  color: var(--text-3);
  font-size: 11.5px;
}

.foot__links { display: flex; flex-wrap: wrap; gap: 16px; }
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--text); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-top: 24px;
  }

  .side {
    position: static;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
  }

  .side > nav {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .side::-webkit-scrollbar { height: 4px; }
  .side::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

  .side__group { display: contents; }

  .side__title { display: none; }

  .side__dot { display: none; }

  .side__link {
    flex: 0 0 auto;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
  }

  .side__link.is-active { box-shadow: none; border-color: var(--blue); background: var(--surface-2); }

  .content { max-width: none; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }

  .top__link:not(.top__link--accent) { display: none; }
  .top__inner { gap: 10px; height: 58px; }

  .hub { padding: 34px 0 64px; }
  .cards { grid-template-columns: 1fr; margin-top: 26px; }

  .empty { padding: 22px 18px; }

  .foot__inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}

/* ---------- Extra tokens ---------- */
:root,
[data-theme="dark"] { --code-bg: #0a0c17; }

[data-theme="light"] { --code-bg: #ffffff; }

/* ---------- Search: top bar ---------- */
.top__search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color .2s ease, background-color .2s ease;
}

.top__search:focus-within { border-color: var(--blue); background: var(--surface-2); }
.top__search .icon { width: 14px; height: 14px; color: var(--text-3); flex: 0 0 auto; }

.top__search input {
  width: 126px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

.top__search input::placeholder { color: var(--text-3); }

/* ---------- Search: hub ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  height: 46px;
  margin-top: 26px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .2s ease, background-color .2s ease;
}

.search:focus-within { border-color: var(--blue); background: var(--surface-2); }
.search .icon { width: 17px; height: 17px; color: var(--text-3); flex: 0 0 auto; }

.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.search input::placeholder { color: var(--text-3); }

.search__empty {
  margin-top: 20px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ---------- Table of contents ---------- */
.toc {
  margin: 28px 0 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.toc__title {
  margin: 0;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.toc ol {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding-left: 18px;
  list-style: decimal outside;
}

.toc li { color: var(--text-2); font-size: 13px; line-height: 1.5; }
.toc li::marker { color: var(--text-3); }
.toc li.toc__sub { margin-left: 14px; font-size: 12.5px; }

.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }

/* ---------- Code blocks ---------- */
.code {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  overflow: hidden;
}

.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}

.code code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre;
}

.tok-com { color: #6d7392; font-style: italic; }
.tok-str { color: #7ee0b8; }
.tok-key { color: #a9b8ff; }
.tok-num { color: #ffb86b; }
.tok-bool { color: #c4a2ff; }
.tok-flag { color: #8fd3ff; }
.tok-var { color: #ffd479; }
.tok-cmd { color: #b39dff; font-weight: 700; }

[data-theme="light"] .tok-com { color: #8a90a8; }
[data-theme="light"] .tok-str { color: #0f7a52; }
[data-theme="light"] .tok-key { color: #2c46c7; }
[data-theme="light"] .tok-num { color: #a1541a; }
[data-theme="light"] .tok-bool { color: #6d3fd4; }
[data-theme="light"] .tok-flag { color: #14608f; }
[data-theme="light"] .tok-var { color: #8a5a00; }
[data-theme="light"] .tok-cmd { color: #4b2fb0; }

/* ---------- Utility ---------- */
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .top__search { display: none; }
}
/* ---------- 404 ---------- */
.nf { max-width: 660px; padding: 56px 0 80px; }

.nf__code {
  margin: 14px 0 0;
  font-family: var(--font-brand);
  font-size: clamp(80px, 13vw, 132px);
  font-weight: 800;
  line-height: .9;
  letter-spacing: .01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nf h1 { margin: 8px 0 0; }
.nf .lead { margin-top: 10px; }

.nf__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.btn-lite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease, opacity .2s ease;
}

.btn-lite:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }

.btn-lite--primary {
  border-color: transparent;
  background: var(--grad);
  color: #fff;
}

.btn-lite--primary:hover { color: #fff; opacity: .92; }

.nf .search { max-width: 440px; }

@media (max-width: 640px) {
  .nf { padding: 34px 0 60px; }
  .nf__actions .btn-lite { flex: 1 1 auto; justify-content: center; }
}
/* ---------- 404 page: keep footer at the bottom ---------- */
body.is-nf {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.is-nf main.shell { flex: 1 0 auto; }