/* Документация SkyShop — стили в духе шаблона skyshop (стандартная тема) */
:root {
  --black: #1a1a1a;
  --white: #fff;
  --bg: #ffffff;
  --surface: #f2f2f2;
  --surface-2: #f8f8f7;
  --line: #e6e6e3;
  --text: #1a1a1a;
  --text-2: #595957;
  --muted: #858585;
  --brand: #6675f5;
  --brand-ink: #3f4ed8;
  --brand-soft: #eef0fe;
  --red: #e12d06;
  --red-soft: #fdf0ec;
  --green: #23a41f;
  --green-soft: #ecf7eb;
  --yellow-soft: #fdf8db;
  --yellow-ink: #8a7400;
  --pill-bg: var(--black);
  --pill-text: #fff;

  --radius-sm: 5px;
  --radius: 10px;
  --radius-md: 15px;
  --radius-lg: 20px;

  --font: "Nunito Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --header-h: 72px;
  --container: 1350px;
  --shadow: 0 10px 30px rgba(20, 1, 6, .08);
  color-scheme: light;
}

/* Ночная тема — по системе или вручную */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --black: #f2f2f2;
    --bg: #141414;
    --surface: #1f1f1f;
    --surface-2: #191919;
    --line: #2d2d2c;
    --text: #f2f2f2;
    --text-2: #c6c6c3;
    --muted: #93938f;
    --brand: #8f99ff;
    --brand-ink: #aab2ff;
    --brand-soft: #23264a;
    --red-soft: #3a1d15;
    --green-soft: #17301a;
    --yellow-soft: #33300f;
    --yellow-ink: #e8d35a;
    --pill-bg: #f2f2f2;
    --pill-text: #141414;
    --shadow: 0 10px 30px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --black: #f2f2f2;
  --bg: #141414;
  --surface: #1f1f1f;
  --surface-2: #191919;
  --line: #2d2d2c;
  --text: #f2f2f2;
  --text-2: #c6c6c3;
  --muted: #93938f;
  --brand: #8f99ff;
  --brand-ink: #aab2ff;
  --brand-soft: #23264a;
  --red-soft: #3a1d15;
  --green-soft: #17301a;
  --yellow-soft: #33300f;
  --yellow-ink: #e8d35a;
  --pill-bg: #f2f2f2;
  --pill-text: #141414;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--container); margin: 0 auto; height: 100%;
  padding: 0 24px; display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand__logo { height: 34px; width: auto; }
.brand__mark { display: none; width: 36px; height: 36px; }
:root[data-theme="dark"] .brand__logo { filter: invert(1) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand__logo { filter: invert(1) hue-rotate(180deg); } }
.brand__label {
  font-weight: 600; font-size: 15px; color: var(--text-2);
  padding-left: 14px; border-left: 1px solid var(--line); line-height: 1.2;
}
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search__input {
  width: 100%; height: 44px; border: 1px solid transparent; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; padding: 0 44px 0 16px; outline: none;
  transition: border-color .15s, background .15s;
}
.search__input::placeholder { color: var(--muted); }
.search__input:focus { border-color: var(--text); background: var(--bg); }
.search__icon { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--pill-bg); color: var(--pill-text); pointer-events: none; }
.search__icon svg { width: 16px; height: 16px; }
.search__results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow); padding: 6px; max-height: 60vh; overflow: auto; display: none;
}
.search__results.is-open { display: block; }
.search__item { display: block; padding: 10px 12px; border-radius: var(--radius); color: var(--text); }
.search__item:hover, .search__item.is-active { background: var(--surface); text-decoration: none; }
.search__item b { font-weight: 700; }
.search__item small { display: block; color: var(--muted); font-size: 13px; }
.search__empty { padding: 14px; color: var(--muted); font-size: 14px; }
mark { background: var(--yellow-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

.icon-btn {
  width: 44px; height: 44px; border-radius: var(--radius); border: 0; flex-shrink: 0;
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--line); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }

/* ---------- Раскладка ---------- */
.layout {
  max-width: var(--container); margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 48px;
}
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 28px 4px 40px 0;
  scrollbar-width: thin;
}
.nav__group { margin-bottom: 22px; }
.nav__title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px 8px; }
.nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius); color: var(--text-2); font-weight: 600; font-size: 15px; line-height: 1.35;
}
.nav__link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav__link.is-active { background: var(--pill-bg); color: var(--pill-text); }
.nav__link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }

.content { padding: 36px 0 64px; min-width: 0; }
.toc { position: sticky; top: var(--header-h); align-self: start; padding: 36px 0; max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
.toc__title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc a { display: block; color: var(--text-2); font-size: 14px; line-height: 1.4; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); }
.toc a.lvl-3 { padding-left: 24px; font-size: 13px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.is-active { color: var(--text); border-left-color: var(--brand); font-weight: 600; }

/* ---------- Типографика ---------- */
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); }
h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.15; font-weight: 800; margin: 0 0 14px; letter-spacing: -.01em; }
.lead { font-size: 18px; color: var(--text-2); margin: 0 0 28px; max-width: 760px; }
h2 { font-size: 26px; line-height: 1.25; font-weight: 700; margin: 56px 0 16px; padding-top: 4px; }
h3 { font-size: 19px; line-height: 1.3; font-weight: 700; margin: 34px 0 12px; }
h2 + h3 { margin-top: 18px; }
h2, h3 { position: relative; }
.anchor { position: absolute; left: -22px; top: 0; color: var(--muted); opacity: 0; font-weight: 400; padding-right: 6px; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; text-decoration: none; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 22px; margin: 0 0 16px; }
li { margin: 4px 0; }
li::marker { color: var(--muted); }
strong, b { font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
code, .code {
  font-family: var(--mono); font-size: .86em; background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 2px 6px; overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
/* Блоки кода */
.code-block {
  position: relative; margin: 16px 0 24px; border-radius: var(--radius-md); overflow: hidden;
  background: #17171a; color: #e8e8ea; border: 1px solid #26262b;
}
.code-block__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 16px; background: #1f1f24; border-bottom: 1px solid #2a2a30;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9a9aa6;
}
.code-block__file { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-weight: 400; color: #c9c9d3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-block__copy {
  flex-shrink: 0; border: 0; border-radius: 7px; padding: 5px 10px; cursor: pointer;
  background: #2c2c33; color: #e8e8ea; font: 600 12px var(--font);
}
.code-block__copy:hover { background: #3a3a43; }
.code-block pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.65 var(--mono); tab-size: 4; }
.code-block code { font: inherit; background: none; padding: 0; color: inherit; white-space: pre; border-radius: 0; }
.tok-c { color: #7f8392; font-style: italic; }
.tok-s { color: #a5d6a7; }
.tok-k { color: #b4a7ff; }
.tok-v { color: #ffcc80; }
.tok-n { color: #f6b26b; }
.tok-t { color: #8fc7ff; }

kbd { font: 600 13px var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--bg); }

/* Путь в админке */
.path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 18px; }
.path span { background: var(--surface); border-radius: var(--radius); padding: 5px 12px; font-size: 14px; font-weight: 600; }
.path span:last-child { background: var(--pill-bg); color: var(--pill-text); }
.path i { font-style: normal; color: var(--muted); font-size: 14px; }

/* Метки */
.badge {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: 1px;
  font-size: 12px; font-weight: 700; line-height: 1; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.badge--c { background: var(--brand-soft); color: var(--brand-ink); }
.badge--c::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--def { background: var(--surface); color: var(--text-2); }
.badge--new { background: var(--green-soft); color: var(--green); }

/* Выноски */
.callout {
  display: grid; grid-template-columns: 28px 1fr; gap: 14px; align-items: start;
  background: var(--surface); border-radius: var(--radius-md); padding: 16px 20px; margin: 20px 0;
}
.callout__icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--pill-bg); color: var(--pill-text); font-weight: 800; font-size: 15px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout__title { font-weight: 700; margin-bottom: 4px; }
.callout--tip { background: var(--brand-soft); }
.callout--tip .callout__icon { background: var(--brand); color: #fff; }
.callout--warn { background: var(--yellow-soft); }
.callout--warn .callout__icon { background: var(--yellow-ink); color: var(--bg); }
.callout--danger { background: var(--red-soft); }
.callout--danger .callout__icon { background: var(--red); color: #fff; }

/* Таблицы настроек */
.table-wrap { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--line); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--line); }
th { background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; min-width: 200px; }
td .badge { margin-top: 4px; }
table.opts td:first-child { width: 34%; }
table.opts td:last-child { color: var(--text-2); }
td small { color: var(--muted); }
td ul { margin: 6px 0 0; padding-left: 18px; }

/* Шаги */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 16px 0 24px; }
.steps > li { counter-increment: step; position: relative; padding: 2px 0 14px 48px; margin: 0; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pill-bg); color: var(--pill-text); font-weight: 800; font-size: 15px;
}
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 15.5px; top: 36px; bottom: 2px; width: 1px; background: var(--line); }

/* Карточки разделов */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 20px 0 8px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); min-height: 170px; transition: transform .15s, box-shadow .15s;
}
.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.card__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; margin-bottom: 6px; }
.card__icon svg { width: 22px; height: 22px; }
.card__title { font-weight: 700; font-size: 17px; }
.card__text { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.card--accent { background: var(--pill-bg); color: var(--pill-text); }
.card--accent .card__text { color: color-mix(in srgb, var(--pill-text) 75%, transparent); }
.card--accent .card__icon { background: color-mix(in srgb, var(--pill-text) 12%, transparent); color: var(--pill-text); }

/* Иллюстрации */
.shot { margin: 18px 0 26px; }
.shot img { border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface); }
.shot figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* Типы баннеров */
.types { display: grid; gap: 18px; margin: 20px 0; }
.type { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); }
.type__img { background: var(--surface); border-bottom: 1px solid var(--line); }
.type__img img { width: 100%; }
.type__body { padding: 18px 22px 20px; }
.type__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 6px; }
.type__name { font-weight: 700; font-size: 18px; }
.type__body p { color: var(--text-2); margin-bottom: 8px; }
.type__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--text-2); }
.type__meta b { color: var(--text); }

/* Схема плитки (без скриншота) */
.mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px; }
.mosaic__half { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mosaic__tile { background: color-mix(in srgb, var(--brand) 22%, var(--bg)); border-radius: 12px; min-height: 64px; display: grid; place-items: center; font-weight: 700; color: var(--brand-ink); font-size: 14px; }
.mosaic__tile.wide { grid-column: span 2; }

/* Палитра цветовых схем */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 16px 0 24px; }
.swatch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); font-size: 14px; font-weight: 600; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.swatch small { display: block; font-weight: 400; color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* Схема «откуда что берётся» */
.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 26px; align-items: stretch; }
.flow__step { position: relative; background: var(--surface); border-radius: var(--radius-md); padding: 16px 18px; }
.flow__step b { display: block; font-size: 16px; margin-bottom: 4px; }
.flow__step span { font-size: 14px; color: var(--text-2); line-height: 1.45; display: block; }
.flow__step:not(:last-child)::after {
  content: "→"; position: absolute; right: -13px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; background: var(--pill-bg); color: var(--pill-text);
  display: grid; place-items: center; font-size: 14px; z-index: 1;
}
.flow__step--dark { background: var(--pill-bg); color: var(--pill-text); }
.flow__step--dark span { color: color-mix(in srgb, var(--pill-text) 75%, transparent); }

/* Пагинация страниц */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a {
  display: block; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 18px; color: var(--text);
  transition: border-color .15s;
}
.pager a:hover { border-color: var(--text); text-decoration: none; }
.pager small { display: block; color: var(--muted); font-size: 13px; }
.pager b { font-weight: 700; }
.pager .next { text-align: right; grid-column: 2; }

.footer { border-top: 1px solid var(--line); }
.footer__inner { max-width: var(--container); margin: 0 auto; padding: 22px 24px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; color: var(--muted); font-size: 14px; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; font-size: 14px; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 22px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); gap: 36px; }
  .toc { display: none; }
}
@media (max-width: 960px) {
  :root { --header-h: 64px; }
  .topbar__inner { padding: 0 16px; gap: 10px; }
  .menu-btn { display: grid; }
  .brand__label { display: none; }
  .brand__logo { height: 28px; }
  .layout { display: block; padding: 0 16px; }
  .sidebar {
    position: fixed; z-index: 60; top: var(--header-h); left: 0; bottom: 0; height: auto; width: min(320px, 86vw);
    background: var(--bg); border-right: 1px solid var(--line); padding: 20px 16px 40px;
    transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 55; }
  .content { padding-top: 24px; }
  .anchor { display: none; }
  .flow { grid-template-columns: 1fr; }
  .flow__step:not(:last-child)::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -13px; transform: translateX(-50%); }
}
@media (max-width: 640px) {
  .brand__logo { display: none; }
  .brand__mark { display: block; }
  table.opts thead { display: none; }
  table.opts, table.opts tbody, table.opts tr, table.opts td { display: block; width: auto; }
  table.opts tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.opts tr:last-child { border-bottom: 0; }
  table.opts td { padding: 0; border: 0; }
  table.opts td:first-child { width: auto; min-width: 0; margin-bottom: 4px; }
  .search { max-width: none; }
  .search__input { height: 40px; font-size: 14px; }
  .search__icon { width: 28px; height: 28px; }
  .icon-btn { width: 40px; height: 40px; }
  h2 { font-size: 22px; margin-top: 44px; }
  .lead { font-size: 16px; }
  th, td { padding: 10px 12px; }
  td:first-child { min-width: 150px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .mosaic { grid-template-columns: 1fr; }
}
