/* ===== Design tokens (те же, что Developer Portal — визуальная согласованность двух порталов) ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --bg-elevated: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #59636e;
  --accent: #0969da;
  --accent-bg: #ddf4ff;
  --code-bg: #f6f8fa;
  --shadow: 0 4px 16px rgba(0,0,0,.08);
  --radius: 8px;
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --green: #1a7f37; --green-bg: #dafbe1;
  --amber: #9a6700; --amber-bg: #fff8c5;
  --gray-bg: #eaeef2;
}
:root[data-theme="dark"] {
  --bg: #0d1117; --bg-alt: #161b22; --bg-elevated: #161b22; --border: #30363d;
  --text: #e6edf3; --text-muted: #9198a1; --accent: #4493f8; --accent-bg: #0c2d6b;
  --code-bg: #161b22; --shadow: 0 4px 16px rgba(0,0,0,.4);
  --green: #3fb950; --green-bg: #0d3320; --amber: #d29922; --amber-bg: #3d2e05; --gray-bg: #21262d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --bg-alt: #161b22; --bg-elevated: #161b22; --border: #30363d;
    --text: #e6edf3; --text-muted: #9198a1; --accent: #4493f8; --accent-bg: #0c2d6b;
    --code-bg: #161b22; --shadow: 0 4px 16px rgba(0,0,0,.4);
    --green: #3fb950; --green-bg: #0d3320; --amber: #d29922; --amber-bg: #3d2e05; --gray-bg: #21262d;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* ===== Topbar ===== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border); z-index: 100;
}
.topbar__logo { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.topbar__logo span { color: var(--text-muted); font-weight: 400; }
.icon-btn {
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  font-size: 18px; padding: 6px 10px; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--bg-alt); border-color: var(--border); }
#menu-toggle { display: none; }

.search-box { position: relative; flex: 1; max-width: 480px; margin: 0 auto; }
.search-box input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text); font-size: 14px;
}
.search-box input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 60vh; overflow-y: auto;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 200;
}
.search-result { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-alt); text-decoration: none; }
.search-result__title { font-weight: 600; font-size: 14px; }
.search-result__snippet { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-empty { padding: 14px; color: var(--text-muted); font-size: 14px; }

/* ===== Layout ===== */
.layout { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  overflow-y: auto; border-right: 1px solid var(--border); background: var(--bg-alt); padding: 16px 8px;
}
.main-col { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { max-width: 860px; padding: 8px 40px 60px; flex: 1; }

.breadcrumb { padding: 14px 40px 0; font-size: 13px; color: var(--text-muted); max-width: 860px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb__sep { margin: 0 6px; opacity: .6; }

.site-footer {
  border-top: 1px solid var(--border); padding: 20px 40px 32px; max-width: 860px;
  font-size: 13px; color: var(--text-muted);
}
.site-footer div:first-child { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.site-footer__muted { max-width: 640px; }

.source-bar {
  font-size: 12px; color: var(--text-muted); background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px; margin: 10px 0 18px; display: inline-block;
}
.source-bar a { color: var(--text-muted); text-decoration: underline; }
.source-bar a:hover { color: var(--accent); }
.source-bar__date { opacity: .8; }

/* ===== Nav ===== */
.nav-link { display: block; padding: 8px 12px; border-radius: 6px; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.nav-link:hover { background: var(--bg-elevated); text-decoration: none; }
.nav-link--active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

/* ===== Content typography ===== */
.content h1 { font-size: 28px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content h2 { font-size: 20px; margin: 32px 0 12px; }
.content h3 { font-size: 16px; margin: 22px 0 8px; }
.content p { margin: 12px 0; }
.content ul, .content ol { padding-left: 24px; }
.content li { margin: 4px 0; }
.content blockquote {
  margin: 12px 0; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--bg-alt); color: var(--text-muted);
}
.content hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.content code { background: var(--code-bg); padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.md-code {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.5; margin: 12px 0;
}
.md-code code { background: none; padding: 0; }
.md-table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
th { background: var(--bg-alt); font-weight: 600; }
.loading, .empty-state { color: var(--text-muted); padding: 24px 0; text-align: center; }
.error-state h1 { border: none; }

/* ===== Status badges (жизненный цикл статьи, USER_GUIDE_ARCHITECTURE.md §6) ===== */
.status-badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
  vertical-align: middle;
}
.status-draft { background: var(--gray-bg); color: var(--text-muted); }
.status-review { background: var(--accent-bg); color: var(--accent); }
.status-approved { background: var(--accent-bg); color: var(--accent); }
.status-published { background: var(--green-bg); color: var(--green); }
.status-stale { background: var(--amber-bg); color: var(--amber); }
.status-stub { background: var(--gray-bg); color: var(--text-muted); }

.stale-notice {
  background: var(--amber-bg); color: var(--amber); border-radius: var(--radius);
  padding: 10px 14px; font-size: 14px; margin: 12px 0;
}

/* ===== Auto-facts блок (автоматическая часть, §1/§3) ===== */
.auto-facts {
  background: var(--bg-alt); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 14px 18px; margin: 16px 0 8px;
}
.auto-facts__title { font-weight: 700; margin-bottom: 8px; }
.auto-facts__row { margin: 6px 0; font-size: 14px; }
.auto-facts__row ul { margin: 4px 0; padding-left: 20px; }
.auto-facts__warn { color: var(--text-muted); font-size: 13px; }
.auto-facts__note { color: var(--text-muted); font-size: 13px; font-style: italic; }

/* ===== Заглушка «готовится» (§4) ===== */
.stub-notice {
  background: var(--bg-alt); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 18px 22px; margin-top: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  #menu-toggle { display: inline-block; }
  .sidebar {
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
    width: 240px; z-index: 90;
  }
  .sidebar.sidebar--open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .content { padding: 8px 20px 40px; }
  .breadcrumb, .site-footer { padding-left: 20px; padding-right: 20px; }
  .topbar__logo span { display: none; }
  .search-box { max-width: none; }
}
