/* Ozon Delivery API — документация. Тема: светлая/тёмная, акцент — синий Ozon. */

:root {
  --accent: #005bff;
  --accent-hover: #0050e0;
  --accent-soft: rgba(0, 91, 255, 0.08);
  --accent-border: rgba(0, 91, 255, 0.28);

  --bg: #ffffff;
  --bg-alt: #f6f8fb;
  --bg-code: #f4f6fa;
  --bg-header: rgba(255, 255, 255, 0.86);
  --text: #14171f;
  --text-dim: #5b6474;
  --text-faint: #8a93a3;
  --border: #e4e8ef;
  --border-strong: #ccd3de;
  --shadow: 0 6px 24px rgba(16, 24, 40, 0.09);

  --warn-bg: #fff7e6;
  --warn-border: #f0b429;
  --ok: #12855f;

  --sidebar-w: 292px;
  --header-h: 58px;
  --content-max: 880px;

  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #4d8dff;
    --accent-hover: #6ea1ff;
    --accent-soft: rgba(77, 141, 255, 0.12);
    --accent-border: rgba(77, 141, 255, 0.35);
    --bg: #0f1319;
    --bg-alt: #161b23;
    --bg-code: #161b23;
    --bg-header: rgba(15, 19, 25, 0.86);
    --text: #e6e9ef;
    --text-dim: #a2abbb;
    --text-faint: #737d8f;
    --border: #242b36;
    --border-strong: #333c4a;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    --warn-bg: #2a2313;
    --warn-border: #b3861f;
    --ok: #4bbd92;
  }
}

:root[data-theme="dark"] {
  --accent: #4d8dff;
  --accent-hover: #6ea1ff;
  --accent-soft: rgba(77, 141, 255, 0.12);
  --accent-border: rgba(77, 141, 255, 0.35);
  --bg: #0f1319;
  --bg-alt: #161b23;
  --bg-code: #161b23;
  --bg-header: rgba(15, 19, 25, 0.86);
  --text: #e6e9ef;
  --text-dim: #a2abbb;
  --text-faint: #737d8f;
  --border: #242b36;
  --border-strong: #333c4a;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --warn-bg: #2a2313;
  --warn-border: #b3861f;
  --ok: #4bbd92;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Шапка ---------- */
.hdr {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: var(--bg-header); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.hdr__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); flex-shrink: 0; }
.hdr__brand:hover { text-decoration: none; }
.hdr__brand img { width: 26px; height: 26px; border-radius: 7px; display: block; }
.hdr__brand span { white-space: nowrap; }
.hdr__brand b { color: var(--accent); font-weight: 600; }
.hdr__spacer { flex: 1; }

.burger {
  display: none; width: 38px; height: 38px; border: 1px solid var(--border);
  background: transparent; border-radius: 9px; cursor: pointer; color: var(--text);
  align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn {
  width: 38px; height: 38px; border: 1px solid var(--border); background: transparent;
  border-radius: 9px; cursor: pointer; color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-border); }

/* ---------- Поиск ---------- */
.search { position: relative; width: min(420px, 46vw); }
.search input {
  width: 100%; height: 38px; padding: 0 34px 0 36px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-alt); color: var(--text); font: inherit; font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.search__icon { position: absolute; left: 11px; top: 10px; color: var(--text-faint); pointer-events: none; }
.search__key {
  position: absolute; right: 9px; top: 9px; font-size: 11px; color: var(--text-faint);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; font-family: var(--mono);
}
.search__results {
  position: absolute; top: 46px; left: 0; right: 0; max-height: 62vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: none;
}
.search__results.open { display: block; }
.search__item { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.search__item:hover, .search__item.active { background: var(--accent-soft); text-decoration: none; }
.search__item b { display: block; font-size: 14px; font-weight: 600; }
.search__item small { color: var(--text-faint); font-size: 12px; }
.search__empty { padding: 14px; color: var(--text-faint); font-size: 14px; text-align: center; }

/* ---------- Каркас ---------- */
.layout { display: flex; padding-top: var(--header-h); }

.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 22px 14px 60px; border-right: 1px solid var(--border);
  background: var(--bg); z-index: 40;
}
.sidebar__group { font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin: 20px 12px 8px; }
.sidebar__group:first-child { margin-top: 0; }
.sidebar a.nav {
  display: block; padding: 7px 12px; border-radius: 9px; color: var(--text-dim);
  font-size: 14.5px; line-height: 1.4;
}
.sidebar a.nav:hover { background: var(--bg-alt); color: var(--text); text-decoration: none; }
.sidebar a.nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .subnav { margin: 2px 0 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.sidebar .subnav a {
  display: block; padding: 4px 10px; font-size: 13.5px; color: var(--text-faint);
  border-radius: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .subnav a:hover { color: var(--text); background: var(--bg-alt); text-decoration: none; }
.sidebar .subnav a.here { color: var(--accent); background: var(--accent-soft); }

.scrim { display: none; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(6,10,16,.45); z-index: 39; }
.scrim.open { display: block; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); padding: 34px 40px 90px; }
.content { max-width: var(--content-max); margin: 0 auto; }

/* ---------- Типографика контента ---------- */
.md h1 { font-size: 34px; line-height: 1.2; margin: 0 0 22px; letter-spacing: -.02em; }
.md h2 {
  font-size: 24px; margin: 46px 0 14px; padding-top: 8px; letter-spacing: -.01em;
  border-top: 1px solid var(--border);
}
.md h2:first-of-type { border-top: none; padding-top: 0; }
.md h3 { font-size: 19px; margin: 34px 0 10px; }
.md h4 { font-size: 16px; margin: 24px 0 8px; color: var(--text-dim); }
.md h2 .anchor, .md h3 .anchor {
  opacity: 0; margin-left: 8px; font-size: .7em; color: var(--text-faint); text-decoration: none;
}
.md h2:hover .anchor, .md h3:hover .anchor { opacity: 1; }

.md p { margin: 0 0 15px; }
.md ul, .md ol { margin: 0 0 15px; padding-left: 24px; }
.md li { margin: 5px 0; }
.md li > ul, .md li > ol { margin: 5px 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.md img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
.md a img { display: block; }

.md blockquote {
  margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--text);
}
.md blockquote p:last-child { margin-bottom: 0; }

.md aside.warning, .md .warning {
  margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--warn-border);
  background: var(--warn-bg); border-radius: 0 10px 10px 0;
}

.md code {
  font-family: var(--mono); font-size: .875em; padding: .15em .38em;
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 6px;
  word-break: break-word;
}
.md pre {
  margin: 0 0 18px; padding: 16px 18px; overflow-x: auto;
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 12px;
  font-size: 13.5px; line-height: 1.6;
}
.md pre code { padding: 0; border: none; background: none; font-size: inherit; }

.codeblock { position: relative; }
.codeblock__copy {
  position: absolute; top: 10px; right: 10px; padding: 4px 9px; font-size: 12px;
  border: 1px solid var(--border-strong); border-radius: 7px; background: var(--bg);
  color: var(--text-dim); cursor: pointer; opacity: 0; transition: opacity .15s;
}
.codeblock:hover .codeblock__copy { opacity: 1; }
.codeblock__copy:hover { color: var(--accent); border-color: var(--accent-border); }
.codeblock__copy.done { color: var(--ok); border-color: var(--ok); }

/* подсветка */
.tok-key { color: #0a66c2; } .tok-str { color: #0a7d4b; } .tok-num { color: #b3541e; }
.tok-bool { color: #8a2be2; } .tok-cmt { color: var(--text-faint); font-style: italic; }
.tok-flag { color: #b3541e; } .tok-cmd { color: #0a66c2; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tok-key { color: #7ab4ff; }
  :root:not([data-theme="light"]) .tok-str { color: #7ddba5; }
  :root:not([data-theme="light"]) .tok-num { color: #ffb27a; }
  :root:not([data-theme="light"]) .tok-bool { color: #d3a4ff; }
  :root:not([data-theme="light"]) .tok-flag { color: #ffb27a; }
  :root:not([data-theme="light"]) .tok-cmd { color: #7ab4ff; }
}
:root[data-theme="dark"] .tok-key { color: #7ab4ff; }
:root[data-theme="dark"] .tok-str { color: #7ddba5; }
:root[data-theme="dark"] .tok-num { color: #ffb27a; }
:root[data-theme="dark"] .tok-bool { color: #d3a4ff; }
:root[data-theme="dark"] .tok-flag { color: #ffb27a; }
:root[data-theme="dark"] .tok-cmd { color: #7ab4ff; }

/* таблицы */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: 12px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.md th { background: var(--bg-alt); font-weight: 600; white-space: nowrap; }
.md tbody tr:last-child td { border-bottom: none; }
.md td code { white-space: nowrap; }
.md td:last-child code { white-space: normal; }

/* ---------- Правое оглавление ---------- */
.toc { position: fixed; top: calc(var(--header-h) + 34px); right: 26px; width: 236px;
  max-height: calc(100vh - var(--header-h) - 70px); overflow-y: auto; display: none; }
.toc__title { font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin-bottom: 10px; }
.toc a { display: block; padding: 4px 10px; font-size: 13.5px; color: var(--text-faint);
  border-left: 2px solid var(--border); line-height: 1.45; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
.toc a.lvl3 { padding-left: 20px; }

/* ---------- Главная ---------- */
.hero { padding: 8px 0 6px; }
.hero h1 { font-size: 40px; line-height: 1.12; margin: 0 0 14px; letter-spacing: -.025em; }
.hero p.lead { font-size: 18px; color: var(--text-dim); margin: 0 0 24px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.badge { font-size: 13px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-alt); color: var(--text-dim); }
.badge code { font-family: var(--mono); font-size: 12.5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px; margin: 24px 0 34px; }
.card { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text); transition: border-color .15s, transform .15s; }
.card:hover { text-decoration: none; border-color: var(--accent-border); transform: translateY(-2px); }
.card b { display: block; font-size: 15.5px; margin-bottom: 5px; }
.card span { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; display: block; }

/* ---------- Подвал ---------- */
.footer { margin-top: 60px; padding-top: 22px; border-top: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-faint); }
.footer a { color: var(--text-dim); }
.footer p { margin: 0 0 6px; }

/* ---------- Адаптив ---------- */
@media (min-width: 1440px) { .toc { display: block; } .main { padding-right: 300px; } }
@media (max-width: 1023px) {
  .burger { display: inline-flex; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 26px 20px 70px; }
  .search { width: auto; flex: 1; }
  .search__key { display: none; }
  .hdr__brand span { display: none; }
}
@media (max-width: 560px) {
  .md h1, .hero h1 { font-size: 27px; }
  .md h2 { font-size: 21px; }
  .main { padding: 20px 14px 60px; }
  .md pre { padding: 13px 14px; font-size: 12.5px; }
}
