/*
 * Документация PRocket.
 *
 * Отдельный сайт: ни одного импорта из public/, поэтому каталог целиком
 * выкладывается на GitHub Pages, Vercel или любой CDN без мини-аппа.
 */

:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --bg-code: #0d1017;
  --panel: #151925;
  --border: #232838;
  --border-soft: #1b1f2c;
  --text: #e6e9f0;
  --text-dim: #9aa3b8;
  --text-faint: #6b7488;
  --accent: #6c5ce7;
  --accent-soft: #8b7bf0;
  --accent-bg: rgba(108, 92, 231, 0.12);
  --green: #2ecc8f;
  --amber: #f5a623;
  --red: #ff5c5c;
  --blue: #4aa3f0;
  --radius: 10px;
  --sidebar-w: 268px;
  --toc-w: 200px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-code: #f6f7f9;
  --panel: #ffffff;
  --border: #e2e5ec;
  --border-soft: #edeff3;
  --text: #1a1d26;
  --text-dim: #5a6274;
  --text-faint: #8b93a5;
  --accent: #5b4bd6;
  --accent-soft: #6c5ce7;
  --accent-bg: rgba(91, 75, 214, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

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

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

/* ---------- шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b06ce7);
  color: #fff;
  font-size: 15px;
}

.brand-tag {
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.topbar-spacer { flex: 1; }

.search-box { position: relative; width: min(320px, 34vw); }

.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box input::placeholder { color: var(--text-faint); }

.search-key {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: none;
}
.search-results.open { display: block; }

.search-hit {
  display: block;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 13px;
}
.search-hit:last-child { border-bottom: none; }
.search-hit:hover { background: var(--accent-bg); text-decoration: none; }
.search-hit span { display: block; color: var(--text-faint); font-size: 11.5px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

.menu-btn { display: none; }

/* ---------- каркас ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 40px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- боковое меню ---------- */

.sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 26px 0 60px;
  scrollbar-width: thin;
}

.nav-group { margin-bottom: 22px; }

.nav-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.nav-link {
  display: block;
  padding: 5px 10px;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  border-radius: 0 6px 6px 0;
}
.nav-link:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav-link.active {
  color: var(--accent-soft);
  border-left-color: var(--accent);
  background: var(--accent-bg);
  font-weight: 600;
}

/* ---------- содержимое ---------- */

.content { min-width: 0; padding: 30px 0 120px; }

.section { scroll-margin-top: 80px; padding-bottom: 8px; }
.section + .section { margin-top: 56px; }

.hero { padding: 20px 0 8px; }

.hero h1 {
  margin: 0 0 12px;
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.hero-lead { margin: 0 0 22px; font-size: 17px; color: var(--text-dim); max-width: 62ch; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-soft); }

h2 {
  margin: 0 0 14px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  margin: 30px 0 10px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h4 { margin: 22px 0 8px; font-size: 15px; font-weight: 650; }

p { margin: 0 0 14px; color: var(--text-dim); }
.content li { color: var(--text-dim); margin-bottom: 5px; }

strong { color: var(--text); font-weight: 650; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1.5px 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  color: var(--accent-soft);
}

/* ---------- таблицы ---------- */

.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  padding: 9px 13px;
  text-align: left;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-weight: 650;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  white-space: nowrap;
}

td { padding: 9px 13px; border-bottom: 1px solid var(--border-soft); color: var(--text-dim); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td code { white-space: nowrap; }

.req { color: var(--red); font-weight: 700; }
.opt { color: var(--text-faint); }

/* ---------- блоки кода ---------- */

.code-block { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-code); }

.code-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.code-tabs::-webkit-scrollbar { display: none; }

.code-tab {
  padding: 8px 11px;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.code-tab:hover { color: var(--text); }
.code-tab.active { color: var(--accent-soft); border-bottom-color: var(--accent); }

.code-copy {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.code-copy:hover { color: var(--text); border-color: var(--accent); }
.code-copy.done { color: var(--green); border-color: var(--green); }

.code-pane { display: none; }
.code-pane.active { display: block; }

pre {
  margin: 0;
  padding: 15px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
  color: var(--text);
  tab-size: 2;
}
pre code { padding: 0; background: none; border: none; color: inherit; font-size: inherit; }

/* подсветка */
.t-key { color: #c792ea; }
.t-str { color: #7ed492; }
.t-num { color: #f5a623; }
.t-com { color: var(--text-faint); font-style: italic; }
.t-fn  { color: #61b0f7; }
.t-var { color: #e6e9f0; }
.t-prop { color: #4aa3f0; }

/* ---------- врезки ---------- */

.note {
  display: flex;
  gap: 11px;
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  background: var(--bg-soft);
  font-size: 14px;
}
.note-warn { border-left-color: var(--amber); }
.note-danger { border-left-color: var(--red); }
.note-ok { border-left-color: var(--green); }
.note-icon { flex-shrink: 0; font-size: 15px; line-height: 1.5; }
.note p { margin: 0 0 6px; }
.note p:last-child { margin: 0; }
.note strong { display: block; margin-bottom: 3px; color: var(--text); }

/* ---------- эндпоинт ---------- */

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13.5px;
  overflow-x: auto;
}

.method {
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--green);
  color: #04170f;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.endpoint-path { color: var(--text); font-weight: 600; white-space: nowrap; }

.endpoint-alias { margin-left: auto; color: var(--text-faint); font-size: 12px; white-space: nowrap; flex-shrink: 0; }

/* ---------- карточки ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0 0 20px; }

.card {
  padding: 15px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
}
a.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card-icon { font-size: 20px; margin-bottom: 7px; }
.card h4 { margin: 0 0 5px; font-size: 14.5px; color: var(--text); }
.card p { margin: 0; font-size: 13px; color: var(--text-dim); }

/* ---------- оглавление справа ---------- */

.toc {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 30px 0 60px;
  font-size: 12.5px;
}

.toc-title {
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.toc a {
  display: block;
  padding: 3px 0 3px 11px;
  border-left: 2px solid var(--border);
  color: var(--text-faint);
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent-soft); border-left-color: var(--accent); }

/* ---------- подвал ---------- */

.footer {
  margin-top: 70px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.footer-spacer { flex: 1; }

/* ---------- адаптив ---------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px; gap: 0; }
  .menu-btn { display: grid; }
  .search-box { width: auto; flex: 1; }
  .search-key { display: none; }

  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 280px;
    padding: 20px 16px 60px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 40;
    height: auto;
  }
  .sidebar.open { transform: translateX(0); }

  .hero h1 { font-size: 30px; }
  h2 { font-size: 22px; }
  .content { padding: 22px 0 80px; }
}

@media print {
  .topbar, .sidebar, .toc { display: none; }
  .layout { grid-template-columns: 1fr; }
}
