/* Сгенерировано build.py — правки вносить в build.py, не сюда. */
:root {
  --bg: #0b1020;
  --panel: #121a2d;
  --panel-2: #182339;
  --line: rgba(148, 163, 184, 0.2);
  --line-soft: rgba(148, 163, 184, 0.12);
  --text: #e5edf9;
  --muted: #9fb0ca;
  --accent: #6ee7b7;
  --accent-2: #7dd3fc;
  --warning: #fbbf24;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.45);
  --measure: 74ch;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(110, 231, 183, 0.14), transparent 30%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

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

.container { max-width: 1200px; margin: 0 auto; padding: 48px 20px 80px; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand { font-size: clamp(1.4rem, 2vw, 2rem); font-weight: 700; letter-spacing: 0.02em; }
.brand a { color: inherit; }
.meta { color: var(--muted); font-size: 0.95rem; }

.badge {
  display: inline-block;
  padding: 6px 10px;
  background: rgba(110, 231, 183, 0.12);
  color: var(--accent);
  border: 1px solid rgba(110, 231, 183, 0.25);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Главная ───────────────────────────────────────────────────────────── */

.hero {
  padding: 28px 30px;
  border: 1px solid var(--line);
  background: rgba(18, 26, 45, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero h1 { margin: 0 0 10px; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.1; }
.hero p { margin: 0; color: var(--muted); max-width: 920px; }

.quick-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

.quick-links a {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.04);
  color: var(--text);
}

.quick-links a:hover { border-color: rgba(125, 211, 252, 0.5); text-decoration: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(24, 35, 57, 0.9), rgba(18, 26, 45, 0.9));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover { border-color: rgba(125, 211, 252, 0.35); transform: translateY(-2px); }
.card-header { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); background: rgba(148, 163, 184, 0.04); }
.card-header h2 { margin: 12px 0 0; font-size: 1.18rem; line-height: 1.35; }
.card-body { padding: 18px; color: var(--muted); display: flex; flex-direction: column; flex: 1; }
.card-body p { margin: 0 0 16px; }
.card-stats { margin: 0 0 16px; font-size: 0.82rem; color: var(--muted); opacity: 0.75; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }

.links a {
  display: inline-block;
  background: rgba(125, 211, 252, 0.08);
  border: 1px solid rgba(125, 211, 252, 0.25);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.92rem;
}

.links a:hover { background: rgba(125, 211, 252, 0.16); text-decoration: none; }

.section-title {
  margin: 46px 0 16px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }

.doc-list li {
  border: 1px solid var(--line);
  background: rgba(18, 26, 45, 0.75);
  padding: 14px 16px;
  border-radius: 12px;
}

.doc-list a { font-weight: 600; }
.doc-list small { display: block; color: var(--muted); margin-top: 4px; }

.site-footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ── Страница документа ────────────────────────────────────────────────── */

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: transparent; z-index: 40; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.1s linear; }

.doc-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: rgba(11, 16, 32, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.doc-bar .back { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.doc-bar .back:hover { color: var(--accent-2); }
.doc-bar .crumb { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-bar .spacer { flex: 1; }

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 20px 90px;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 46px;
  align-items: start;
}

.toc { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; }
.toc > summary { display: none; }
.toc-title { font-size: 0.74rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; font-weight: 700; }
.toc-nav { border-left: 1px solid var(--line); }
.toc-nav a {
  display: block;
  padding: 5px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}
.toc-nav a:hover { color: var(--text); text-decoration: none; }
.toc-nav a.lvl-3 { padding-left: 26px; font-size: 0.83rem; opacity: 0.85; }
.toc-nav a.active { color: var(--accent); border-left-color: var(--accent); background: rgba(110, 231, 183, 0.06); }

.toc-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line-soft); display: grid; gap: 7px; }
.toc-foot span { font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.toc-foot a { font-size: 0.85rem; color: var(--muted); }
.toc-foot a:hover { color: var(--accent-2); }

.doc {
  max-width: var(--measure);
  font-size: 1.02rem;
  line-height: 1.75;
}

.doc h1 {
  margin: 0 0 26px;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.doc h2 {
  margin: 54px 0 16px;
  padding-top: 6px;
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  border-top: 1px solid var(--line-soft);
  padding-top: 26px;
}

.doc h3 { margin: 36px 0 12px; font-size: 1.15rem; line-height: 1.4; color: var(--accent-2); }
.doc h4 { margin: 28px 0 10px; font-size: 1.02rem; color: var(--muted); }

.doc h1 + p { color: var(--muted); }

.doc p { margin: 0 0 20px; }
.doc strong { color: #fff; font-weight: 650; }
.doc em { color: var(--text); }

.doc a.ext::after { content: "↗"; font-size: 0.72em; vertical-align: super; margin-left: 2px; opacity: 0.65; }

.doc code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  background: rgba(148, 163, 184, 0.13);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.1em 0.38em;
}

.doc pre {
  background: rgba(9, 13, 26, 0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
}
.doc pre code { background: none; border: 0; padding: 0; font-size: 0.86rem; }

.doc ul, .doc ol { margin: 0 0 20px; padding-left: 22px; }
.doc li { margin-bottom: 9px; }
.doc li::marker { color: var(--accent); }
.doc ol li::marker { color: var(--accent-2); font-weight: 600; }

.doc blockquote {
  margin: 0 0 20px;
  padding: 2px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(110, 231, 183, 0.05);
  color: var(--muted);
  border-radius: 0 10px 10px 0;
}

.doc hr { border: 0; border-top: 1px solid var(--line-soft); margin: 34px 0; }

.doc .alias { display: block; height: 0; overflow: hidden; }

.doc .anchor {
  margin-left: 10px;
  color: var(--line);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor { opacity: 1; }
.doc .anchor:hover { color: var(--accent); text-decoration: none; }

.table-wrap {
  margin: 0 0 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 26, 45, 0.6);
  box-shadow: var(--shadow);
}

.doc table { width: 100%; border-collapse: collapse; font-size: 0.93rem; line-height: 1.6; min-width: 480px; }

.doc thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 13px 16px;
  background: rgba(24, 35, 57, 0.98);
  border-bottom: 1px solid var(--line);
  color: var(--accent-2);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.doc tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:nth-child(even) { background: rgba(148, 163, 184, 0.035); }
.doc tbody tr:hover { background: rgba(125, 211, 252, 0.06); }
.doc tbody td:first-child { color: var(--text); font-weight: 500; }

.doc-footer {
  margin-top: 60px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.doc-footer .pager { display: flex; flex-wrap: wrap; gap: 10px; }
.doc-footer .pager a {
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.04);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 0.88rem;
}
.doc-footer .pager a:hover { border-color: rgba(125, 211, 252, 0.45); text-decoration: none; }

/* ── Адаптив ───────────────────────────────────────────────────────────── */

@media (min-width: 901px) {
  .toc[open] > .toc-body, .toc > .toc-body { display: block !important; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 22px; }
  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(18, 26, 45, 0.8);
    padding: 12px 14px;
  }
  .toc > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
  }
  .toc > summary::-webkit-details-marker { display: none; }
  .toc > summary::after { content: "▾"; margin-left: auto; transition: transform 0.15s ease; }
  .toc[open] > summary::after { transform: rotate(180deg); }
  .toc-title { display: none; }
  .toc-body { padding-top: 12px; }
  .doc { font-size: 1rem; }
  .doc h2 { margin-top: 40px; padding-top: 20px; }
  .container { padding: 32px 16px 64px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .hero { padding: 22px 18px; }
}

@media print {
  .doc-bar, .progress, .toc, .doc-footer, .anchor { display: none !important; }
  body { background: #fff; color: #111; }
  .layout { display: block; padding: 0; }
  .doc { max-width: none; }
  .doc a { color: #06c; }
  .doc strong { color: #000; }
  .table-wrap { box-shadow: none; }
}
