/* Стили страниц документации Lenso (не библиотеки) */

:root {
  --bg: #fff;
  --soft: #fafafa;
  --soft-2: #f4f4f5;
  --line: #e4e4e7;
  --text: #71717a;
  --text-2: #3f3f46;
  --head: #09090b;
  --faint: #a1a1aa;
  --accent: #155dfc;
  --accent-soft: #eef3ff;
  --radius: 15px;
  --radius-sm: 10px;
  --header-h: 64px;
  --side-w: 280px;
  --otp-w: 232px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  margin: 0;
  font: 500 16px/1.8 var(--font);
  letter-spacing: -0.01em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

/* ---------- Шапка ---------- */
.hd {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--line);
}
.hd__in { height: 100%; padding: 0 24px; display: flex; align-items: center; gap: 16px; }
.hd__menu { display: none; width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--head); cursor: pointer; align-items: center; justify-content: center; }
.hd__menu svg { width: 22px; height: 22px; }
.hd__logo { font-size: 24px; font-weight: 700; letter-spacing: -0.04em; color: var(--head); }
.hd__logo span { color: var(--accent); }
.hd__logo:hover { text-decoration: none; }
.hd__sep { width: 1px; height: 22px; background: var(--line); }
.hd__ver { font-size: 14px; font-weight: 600; color: var(--head); }
.hd__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.hd__search {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px 0 14px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--soft-2); color: var(--head);
  font: 600 14px var(--font); letter-spacing: -0.01em; cursor: pointer;
}
.hd__search:hover { background: var(--line); }
.hd__search svg { width: 18px; height: 18px; }
.hd__search kbd { border: 0; background: #fff; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  font: 600 14px var(--font); letter-spacing: -0.01em;
  transition: background-color .15s;
}
.btn-primary:hover { background: #0f4fd9; text-decoration: none; }
.btn-primary svg { width: 18px; height: 18px; }

/* ---------- Каркас: сайдбар | контент | на этой странице ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--otp-w); min-height: calc(100vh - var(--header-h)); }
.side {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 16px 40px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  scrollbar-width: thin;
}
.content { min-width: 0; padding: 32px 48px 80px; }
.content > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.otp {
  position: sticky; top: var(--header-h); align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 32px 24px 40px 8px;
}

/* ---------- Поиск ---------- */
.search { position: relative; }
.search__box { position: relative; }
.search input {
  width: 100%; height: 48px; padding: 0 44px 0 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--head);
  font: 500 15px var(--font); letter-spacing: -0.01em;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search__icon { position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--faint); pointer-events: none; }
.search__results {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 360px; overflow-y: auto;
  padding: 6px; margin: 0; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(9, 9, 11, 0.1);
}
.search__results[hidden] { display: none; }
.search__results a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--head); font-size: 14px; font-weight: 600; line-height: 1.4;
}
.search__results a small { flex: none; font-size: 12px; font-weight: 500; color: var(--faint); }
.search__results a:hover,
.search__results a.is-active { background: var(--soft-2); text-decoration: none; }
.search__empty { padding: 10px; font-size: 14px; color: var(--faint); }

/* ---------- Навигация в сайдбаре ---------- */
.side .search { margin-bottom: 20px; }
.side__label { margin: 0 0 6px 10px; font-size: 13px; font-weight: 600; color: var(--faint); }
.nav-group { margin-bottom: 2px; }
.nav-group__head { display: flex; align-items: center; border-radius: var(--radius-sm); }
.nav-group__head > a {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--head); font-size: 15px; font-weight: 600; line-height: 1.4;
}
.nav-group__head > a svg { width: 18px; height: 18px; flex: none; }
.nav-group__head > a:hover { background: var(--soft-2); text-decoration: none; }
.nav-group.is-current > .nav-group__head > a { background: var(--soft-2); }
.nav-group__toggle {
  flex: none; width: 32px; height: 32px; margin-left: 2px;
  border: 0; border-radius: 8px; background: none; color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.nav-group__toggle:hover { background: var(--soft-2); color: var(--head); }
.nav-group__toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.nav-group.is-open .nav-group__toggle svg { transform: rotate(180deg); }
.nav-sub { list-style: none; margin: 4px 0 10px 20px; padding: 0 0 0 0; border-left: 1px solid var(--line); display: none; }
.nav-group.is-open .nav-sub { display: block; }
.nav-sub a {
  position: relative; display: block;
  padding: 5px 12px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-2); font-size: 14px; font-weight: 500; line-height: 1.45;
}
.nav-sub a:hover { color: var(--head); text-decoration: none; }
.nav-sub a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* ---------- На этой странице ---------- */
.otp__title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--head); }
.otp__title svg { width: 16px; height: 16px; }
.otp ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.otp a {
  display: block; margin-left: -1px; padding: 4px 0 4px 14px;
  border-left: 2px solid transparent;
  color: var(--head); font-size: 14px; font-weight: 600; line-height: 1.45;
}
.otp a:hover { color: var(--accent); text-decoration: none; }
.otp a.is-active { color: var(--accent); border-left-color: var(--accent); }

/* ---------- Заголовок страницы ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.crumbs a { color: var(--text-2); }
.crumbs svg { width: 14px; height: 14px; color: var(--faint); }
h1 { margin: 0 0 14px; font-size: 32px; line-height: 1.25; font-weight: 600; letter-spacing: -0.03em; color: var(--head); }
.meta { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--soft-2); color: var(--head); font-size: 13px; font-weight: 600; }
p.lead { margin-top: 0; margin-bottom: 40px; font-size: 17px; color: var(--text); }

/* ---------- Главная: hero и карточки ---------- */
.hero {
  position: relative;
  padding: 64px 56px 52px; margin-bottom: 48px;
  border: 1px solid var(--line); border-radius: 20px;
  background:
    radial-gradient(60% 90% at 100% 60%, rgba(124, 154, 255, 0.35) 0%, rgba(124, 154, 255, 0) 70%),
    radial-gradient(40% 60% at 85% 0%, rgba(205, 216, 255, 0.6) 0%, rgba(205, 216, 255, 0) 70%),
    var(--soft);
}
.hero h1 { font-size: 40px; margin-bottom: 8px; }
.hero > p { margin: 0 0 28px; max-width: 520px; }
.hero .search { max-width: 460px; }
.hero__popular { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 22px; font-size: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--head);
  font-size: 13px; font-weight: 600;
}
.chip:hover { border-color: var(--head); text-decoration: none; }
.chip svg { width: 14px; height: 14px; }

.intro { margin-bottom: 56px; }
.intro h2 { margin-bottom: 4px; }
.intro > p { margin: 0 0 22px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card {
  position: relative; display: block;
  padding: 24px 22px 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--soft); color: var(--text);
  transition: border-color .15s, background-color .15s;
}
.card:hover { border-color: #c9c9cf; background: #fff; text-decoration: none; }
.card .card__icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 22px; border-radius: 12px; background: #fff; border: 1px solid var(--line); color: var(--head); }
.card .card__icon svg { width: 22px; height: 22px; }
.card__arrow { position: absolute; right: 14px; top: 14px; width: 18px; height: 18px; color: var(--faint); transition: color .15s, transform .15s; }
.card:hover .card__arrow { color: var(--head); transform: translate(2px, -2px); }
.card b { display: block; margin-bottom: 2px; font-size: 17px; font-weight: 600; color: var(--head); letter-spacing: -0.02em; }
.card span { display: block; font-size: 14px; line-height: 1.5; }

/* ---------- Контент ---------- */
section { padding: 0 0 48px; }
h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; font-size: 24px; line-height: 1.3; font-weight: 600; letter-spacing: -0.025em; color: var(--head); }
h3 { margin: 28px 0 10px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; color: var(--head); }
section > p, .muted { color: var(--text); }
section > p { margin: 0 0 18px; }
.muted { font-size: 15px; }
b, strong { color: var(--head); font-weight: 600; }
.step { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--soft-2); font-size: 16px; font-weight: 600; color: var(--head); letter-spacing: 0; }
.part { display: flex; align-items: center; gap: 12px; margin-top: 8px; margin-bottom: 28px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.part::after { content: ""; flex: 1; height: 1px; background: var(--line); }
:not(pre) > code { padding: 2px 6px; border-radius: 6px; background: var(--soft-2); color: var(--head); font: 500 0.86em var(--mono); letter-spacing: 0; }
kbd { display: inline-block; min-width: 20px; padding: 0 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: #fff; color: var(--head); font: 600 12px/20px var(--mono); text-align: center; }
ul.list { margin: 0 0 18px; padding-left: 22px; }
ul.list li { margin: 6px 0; padding-left: 4px; }
ul.list li::marker { color: var(--faint); }

/* ---------- Демо ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.grid a { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.grid a:hover img { transform: scale(1.04); }
.tile { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--head) !important; transition: border-color .15s; }
.tile:hover { border-color: #c9c9cf !important; }
.tile svg { width: 32px; height: 32px; color: var(--accent); }
.badge { position: absolute; left: 8px; top: 8px; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 1.7; background: rgba(9, 9, 11, .7); color: #fff; letter-spacing: 0; }
.badge--warn { background: #dc2626; }
.badge--ok { background: #16a34a; }
.play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.play svg { width: 46px; height: 46px; padding: 11px; border-radius: 50%; color: var(--head); background: rgba(255, 255, 255, .92); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--soft-2); color: var(--head);
  font: 600 14px var(--font); letter-spacing: -0.01em; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.btn:hover { background: var(--line); text-decoration: none; }
.btn.is-on { background: var(--accent); color: #fff; }
a.btn { color: var(--head); }
.excluded-box { border: 1px dashed #dc2626; border-radius: 14px; padding: 12px; }
.label { font-size: 14px; color: var(--text); margin: 20px 0 10px; }
.demo-form { display: grid; gap: 10px; }
.demo-form input, .demo-form textarea { font: 500 15px var(--font); padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--head); }
.demo-form input:focus, .demo-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.demo-form .btn { justify-self: start; }

/* Переключатели в демо плагинов */
.layout-controls { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.layout-controls .row { gap: 6px; }
.layout-controls .theme-bar__label { min-width: 92px; }
.layout-controls .btn { height: 34px; padding: 0 12px; font-size: 13px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.layout-controls .btn.is-on { background: var(--accent); box-shadow: none; }
@media (max-width: 720px) { .layout-controls .theme-bar__label { min-width: 0; width: 100%; } }

/* Панель «Вид окна» на «Обзоре» */
.theme-bar {
  position: sticky; top: calc(var(--header-h) + 12px); z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 0 auto 36px; padding: 8px 8px 8px 16px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: 0 6px 20px rgba(9, 9, 11, .06);
}
.theme-bar__label { font-size: 14px; font-weight: 600; color: var(--head); }
.theme-bar__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.theme-bar .btn { height: 34px; padding: 0 12px; font-size: 13px; }
.theme-bar__sep, #themes .theme-bar__sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.theme-bar__link { margin-left: auto; padding: 0 8px; font-size: 14px; font-weight: 600; }
@media (max-width: 720px) {
  .theme-bar { top: calc(var(--header-h) + 8px); padding: 8px 10px; gap: 6px 10px; }
  .theme-bar__label, .theme-bar__link { display: none; }
}

button.btn-tile { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); font: inherit; cursor: pointer; }

/* ---------- Блоки кода ---------- */
.code { margin-top: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); overflow: hidden; }
.code__head { display: flex; align-items: center; gap: 4px; padding: 8px; overflow-x: auto; scrollbar-width: none; }
.code__head::-webkit-scrollbar { display: none; }
.code__tab { flex: 0 0 auto; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 600 13px var(--font); letter-spacing: -0.01em; white-space: nowrap; cursor: pointer; }
.code__tab:hover { color: var(--head); }
.code__tab[aria-selected="true"] { background: #fff; color: var(--head); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(9, 9, 11, .06); }
.code__copy { position: sticky; right: 0; flex: 0 0 auto; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--soft); color: var(--text); font: 600 13px var(--font); cursor: pointer; box-shadow: -12px 0 12px var(--soft); }
.code__copy:hover { color: var(--head); background: var(--soft-2); }
.code__copy svg { width: 15px; height: 15px; }
.code__copy.is-done { color: #16a34a; }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; background: #fff; border-top: 1px solid var(--line); color: var(--head); font: 500 13.5px/1.7 var(--mono); letter-spacing: 0; tab-size: 2; }
.code pre[hidden] { display: none; }
.code.is-updated { animation: code-flash 0.9s ease; }
@keyframes code-flash { from { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
.tok-c { color: var(--faint); font-style: italic; }
.tok-t { color: #cf222e; }
.tok-a { color: #953800; }
.tok-s { color: #0a3069; }
.tok-k { color: #8250df; }
.tok-n { color: #0550ae; }
.tok-f { color: #6639ba; }
.tok-p { color: #0550ae; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.doc { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
table.doc th { text-align: left; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--head); white-space: nowrap; }
table.doc td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
table.doc tr:last-child td { border-bottom: 0; }
table.doc td:first-child { white-space: nowrap; }
table.doc td code { white-space: nowrap; }

/* ---------- Переход между страницами ---------- */
.pager { display: flex; gap: 16px; margin-top: 16px; padding-top: 32px; border-top: 1px solid var(--line); }
.pager a { flex: 1; display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); transition: border-color .15s, background-color .15s; }
.pager a:hover { border-color: #c9c9cf; background: #fff; text-decoration: none; }
.pager small { display: block; font-size: 13px; color: var(--text); }
.pager b { font-size: 17px; letter-spacing: -0.02em; }
.pager .next { text-align: right; }
.pager .ph { flex: 1; }

/* ---------- Мобильное меню ---------- */
.side-backdrop { display: none; }

@media (max-width: 1280px) {
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .otp { display: none; }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .hd__menu { display: inline-flex; }
  .side {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0;
    width: min(320px, 86vw); height: 100%;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(9, 9, 11, .15);
  }
  body.is-menu-open .side { transform: none; }
  body.is-menu-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(9, 9, 11, .35); }
  body.is-menu-open { overflow: hidden; }
  .content { padding: 28px 24px 64px; }
}
@media (max-width: 720px) {
  .hd__in { padding: 0 16px; gap: 12px; }
  .hd__search span, .hd__search kbd, .btn-primary span, .hd__sep, .hd__ver { display: none; }
  .hd__search { width: 40px; padding: 0; justify-content: center; }
  .btn-primary { width: 40px; padding: 0; justify-content: center; }
  .content { padding: 24px 16px 56px; }
  h1 { font-size: 28px; }
  .hero { padding: 36px 20px 28px; border-radius: 16px; }
  .hero h1 { font-size: 32px; }
  .cards { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { flex-direction: column; }
  .pager .ph { display: none; }
  .code { margin-left: -4px; margin-right: -4px; }
  .code__copy span { display: none; }
}

/* ===== Пример своей темы лайтбокса только на CSS-переменных ===== */
.lenso--warm {
  --lenso-bg: rgba(20, 16, 10, .96);
  --lenso-accent: #f39800;
  --lenso-btn-bg: rgba(243, 152, 0, .14);
  --lenso-btn-bg-hover: rgba(243, 152, 0, .32);
  --lenso-btn-radius: 6px;
  --lenso-radius: 0px;
  --lenso-thumb-radius: 0px;
  --lenso-thumb-opacity: .35;
  --lenso-caption-color: #f3d6a6;
  --lenso-font: Georgia, "Times New Roman", serif;
}
.lenso--warm .lenso__caption { font-style: italic; }
