/*
 * Токены оформления сайта API: один источник для консоли (Tailwind читает их из tailwind.config.js)
 * и для статической части (лендинг, документация — site/static/site.css). Значения — RGB-тройки, чтобы
 * работали прозрачности (bg-accent-strong/10). Тёмная тема — класс .dark на <html>.
 */
:root {
  --app: 248 249 251;
  --surface: 255 255 255;
  --surface-2: 245 246 248;
  --line: 224 228 234;
  --line-2: 232 235 240;
  --ink: 17 24 39;
  --n-50: 249 250 251;
  --n-100: 243 244 246;
  --n-200: 229 231 235;
  --n-300: 209 213 219;
  --n-400: 156 163 175;
  --n-500: 107 114 128;
  --n-600: 75 85 99;
  --n-700: 55 65 81;
  --n-800: 31 41 55;
  --n-900: 17 24 39;
  --acc-soft: 238 242 255;
  --acc-soft-2: 224 231 255;
  --acc-line: 199 210 254;
  --acc-ink: 55 48 163;
  --acc-strong: 79 70 229;
  --acc-strong-2: 67 56 202;
  --code-bg: 243 244 246;
  color-scheme: light;
}

.dark {
  --app: 11 13 18;
  --surface: 20 23 30;
  --surface-2: 27 31 40;
  --line: 44 50 62;
  --line-2: 37 42 53;
  --ink: 236 239 244;
  --n-50: 24 28 36;
  --n-100: 33 38 49;
  --n-200: 44 50 62;
  --n-300: 64 71 85;
  --n-400: 115 123 138;
  --n-500: 148 156 170;
  --n-600: 176 183 196;
  --n-700: 203 209 220;
  --n-800: 225 229 237;
  --n-900: 241 243 247;
  --acc-soft: 28 30 62;
  --acc-soft-2: 36 38 78;
  --acc-line: 64 68 140;
  --acc-ink: 199 210 254;
  --acc-strong: 99 102 241;
  --acc-strong-2: 79 70 229;
  --code-bg: 27 31 40;
  color-scheme: dark;
}

/* Статическая часть сайта API: лендинг и документация. Цвета — токены из theme.css (общие с консолью). */
*, *::before, *::after { box-sizing: border-box; }
html { background: rgb(var(--app)); scroll-behavior: smooth; }
body {
  margin: 0; color: rgb(var(--ink)); background: rgb(var(--app));
  font: 16px/1.65 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased;
}
a { color: rgb(var(--acc-ink)); text-underline-offset: 2px; }
a:hover { color: rgb(var(--acc-strong)); }
:focus-visible { outline: 2px solid rgb(var(--acc-strong)); outline-offset: 2px; border-radius: 4px; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Шапка */
.top { position: sticky; top: 0; z-index: 10; background: rgb(var(--surface) / .92); backdrop-filter: blur(8px); border-bottom: 1px solid rgb(var(--line)); }
.top .wrap { display: flex; align-items: center; gap: 14px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: rgb(var(--ink)); text-decoration: none; margin-right: auto; }
.brand .mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; font-size: 11px; font-weight: 700; background: linear-gradient(135deg, rgb(var(--acc-strong)), rgb(var(--acc-strong-2))); }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a { padding: 7px 11px; border-radius: 9px; font-size: 14px; color: rgb(var(--n-600)); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current] { background: rgb(var(--n-100)); color: rgb(var(--ink)); }
.lang { display: flex; border: 1px solid rgb(var(--line)); border-radius: 8px; overflow: hidden; font-size: 12px; font-weight: 600; }
.lang a { padding: 6px 9px; color: rgb(var(--n-600)); text-decoration: none; }
.lang a[aria-current] { background: rgb(var(--acc-soft)); color: rgb(var(--acc-ink)); }
.icon-btn { border: 0; background: none; padding: 7px; border-radius: 8px; color: rgb(var(--n-600)); cursor: pointer; line-height: 0; }
.icon-btn:hover { background: rgb(var(--n-100)); color: rgb(var(--ink)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid transparent; }
.btn.primary { color: #fff; background: linear-gradient(90deg, rgb(var(--acc-strong)), rgb(var(--acc-strong-2))); }
.btn.primary:hover { color: #fff; filter: brightness(1.08); }
.btn.ghost { color: rgb(var(--ink)); background: rgb(var(--surface)); border-color: rgb(var(--line)); }
.btn.ghost:hover { color: rgb(var(--ink)); background: rgb(var(--n-50)); }
@media (max-width: 720px) { .top nav .hide-sm { display: none; } }
@media (max-width: 520px) {
  .top .wrap { gap: 8px; padding: 0 12px; }
  .top nav .hide-xs { display: none; }
  .top nav a { padding: 7px 8px; }
}

/* Лендинг */
.hero { padding: 64px 0 40px; display: grid; gap: 36px; grid-template-columns: 1.05fr .95fr; align-items: center; }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.12; margin: 0 0 16px; letter-spacing: -.02em; }
.hero p.lead { font-size: 18px; color: rgb(var(--n-600)); margin: 0 0 26px; max-width: 34em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero > * { min-width: 0; } /* иначе длинная строка примера кода растягивает колонку шире экрана телефона */
.eyebrow { display: inline-block; margin-bottom: 14px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgb(var(--acc-soft)); color: rgb(var(--acc-ink)); border: 1px solid rgb(var(--acc-line)); }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 40px; } }
section.block { padding: 40px 0; }
section.block h2 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
section.block > .wrap > p.sub { color: rgb(var(--n-600)); margin: 0 0 24px; max-width: 40em; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 16px; padding: 18px 18px 16px; }
.card h3 { font-size: 16px; margin: 0 0 6px; }
.card p { margin: 0; font-size: 14.5px; color: rgb(var(--n-600)); }
.steps { counter-reset: s; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 16px; padding: 18px; font-size: 15px; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; margin-bottom: 10px; border-radius: 50%; font-weight: 700; font-size: 14px; background: rgb(var(--acc-soft)); color: rgb(var(--acc-ink)); }
.groups { width: 100%; border-collapse: collapse; background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 14px; overflow: hidden; font-size: 15px; }
.groups td, .groups th { padding: 11px 14px; text-align: left; border-bottom: 1px solid rgb(var(--line)); vertical-align: top; }
.groups tr:last-child td { border-bottom: 0; }
.groups code { font-weight: 600; }
details.faq { background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 14px; padding: 4px 16px; margin-bottom: 10px; }
details.faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style-position: outside; }
details.faq p { margin: 0 0 14px; color: rgb(var(--n-600)); }
.cta-band { margin: 24px 0 8px; padding: 30px; border-radius: 20px; text-align: center; background: rgb(var(--acc-soft)); border: 1px solid rgb(var(--acc-line)); }
.cta-band h2 { margin: 0 0 8px; }
.cta-band p { margin: 0 0 18px; color: rgb(var(--n-600)); }

/* Подвал */
footer.foot { margin-top: 48px; border-top: 1px solid rgb(var(--line)); padding: 24px 0 40px; font-size: 14px; color: rgb(var(--n-500)); }
footer.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer.foot a { color: rgb(var(--n-600)); }

/* Блоки кода */
.code { position: relative; margin: 0 0 14px; border: 1px solid rgb(var(--line)); border-radius: 12px; background: rgb(var(--code-bg)); overflow: hidden; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; }
.code pre code, article.doc .code pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
.code .copy { position: absolute; top: 7px; right: 7px; border: 1px solid rgb(var(--line)); background: rgb(var(--surface)); color: rgb(var(--n-600)); border-radius: 8px; font-size: 12px; padding: 4px 9px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.code:hover .copy, .code .copy:focus-visible { opacity: 1; }
@media (hover: none) { .code .copy { opacity: 1; } }
.code .lang-tag { position: absolute; right: 12px; bottom: 6px; font-size: 11px; color: rgb(var(--n-400)); pointer-events: none; }

/* Подсветка (highlight.js): цвета под обе темы */
.hljs-comment, .hljs-quote { color: rgb(var(--n-500)); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: #7c3aed; }
.hljs-string, .hljs-attr, .hljs-regexp { color: #0f766e; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #b45309; }
.hljs-title, .hljs-section, .hljs-name { color: #1d4ed8; }
.hljs-variable, .hljs-params { color: rgb(var(--ink)); }
.dark .hljs-keyword, .dark .hljs-selector-tag, .dark .hljs-literal, .dark .hljs-built_in { color: #c4b5fd; }
.dark .hljs-string, .dark .hljs-attr, .dark .hljs-regexp { color: #5eead4; }
.dark .hljs-number, .dark .hljs-symbol, .dark .hljs-bullet { color: #fcd34d; }
.dark .hljs-title, .dark .hljs-section, .dark .hljs-name { color: #93c5fd; }

/* Документация */
.docs { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; padding-top: 28px; }
.side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; font-size: 14.5px; padding-bottom: 20px; }
.side h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: rgb(var(--n-500)); margin: 0 0 8px; }
.side ul { list-style: none; margin: 0 0 18px; padding: 0; }
.side li a { display: block; padding: 6px 10px; border-radius: 8px; color: rgb(var(--n-700)); text-decoration: none; }
.side li a:hover { background: rgb(var(--n-100)); }
.side li a[aria-current] { background: rgb(var(--acc-soft)); color: rgb(var(--acc-ink)); font-weight: 600; }
.side ul ul { margin: 2px 0 6px 12px; border-left: 1px solid rgb(var(--line)); }
.side ul ul a { font-size: 13.5px; padding: 3px 10px; color: rgb(var(--n-600)); }
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; gap: 12px; }
  .side { position: static; max-height: none; overflow: visible; }
  .side details > summary { cursor: pointer; padding: 10px 14px; border: 1px solid rgb(var(--line)); border-radius: 10px; background: rgb(var(--surface)); font-weight: 600; }
  .side details[open] > summary { margin-bottom: 10px; }
  .side-desktop { display: none; }
}
@media (min-width: 861px) { .side-mobile { display: none; } }
article.doc { min-width: 0; overflow-wrap: anywhere; padding-bottom: 24px; }
article.doc h1 { font-size: 32px; line-height: 1.2; margin: 0 0 14px; letter-spacing: -.015em; }
article.doc h2 { font-size: 22px; margin: 34px 0 10px; padding-top: 6px; }
article.doc h3 { font-size: 17px; margin: 24px 0 8px; }
article.doc p, article.doc li { color: rgb(var(--n-800)); }
article.doc h1 .anchor, article.doc h2 .anchor, article.doc h3 .anchor { margin-left: -1em; padding-right: .35em; text-decoration: none; opacity: 0; color: rgb(var(--n-400)); font-weight: 400; }
article.doc :is(h1, h2, h3):hover .anchor { opacity: 1; }
article.doc code { background: rgb(var(--code-bg)); border-radius: 5px; padding: 1px 6px; font-size: .9em; }
article.doc .table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid rgb(var(--line)); border-radius: 12px; }
article.doc table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
article.doc th, article.doc td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid rgb(var(--line)); }
article.doc th { background: rgb(var(--n-50)); font-weight: 600; white-space: nowrap; }
article.doc tr:last-child td { border-bottom: 0; }
article.doc blockquote { margin: 0 0 14px; padding: 4px 16px; border-left: 3px solid rgb(var(--acc-line)); color: rgb(var(--n-600)); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 18px; border-top: 1px solid rgb(var(--line)); }
.pager a { flex: 1; padding: 12px 14px; border: 1px solid rgb(var(--line)); border-radius: 12px; background: rgb(var(--surface)); text-decoration: none; color: rgb(var(--ink)); }
.pager a:hover { border-color: rgb(var(--acc-line)); }
.pager small { display: block; color: rgb(var(--n-500)); font-size: 12px; }
.pager .next { text-align: right; }
.hub-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 20px 0; padding: 0; list-style: none; }
.hub-list a { display: block; height: 100%; padding: 14px 16px; border: 1px solid rgb(var(--line)); border-radius: 14px; background: rgb(var(--surface)); text-decoration: none; color: rgb(var(--ink)); }
.hub-list a:hover { border-color: rgb(var(--acc-line)); }
.hub-list strong { display: block; margin-bottom: 4px; }
.hub-list span { font-size: 14px; color: rgb(var(--n-600)); }
