/* ═══════════════════════════════════════════════════════════
   Хаб и страницы разделов — assets/site.css
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: dark;
  --bg:       #0a0a0a;
  --s1:       #111111;
  --s2:       #181818;
  --border:   #242424;
  --border2:  #303030;
  --text:     #efefef;
  --muted:    #6a6a6a;
  --muted2:   #949494;
  --amber:    #c8973e;
  --amber-hi: #e0aa52;
  --gutter:   40px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar { border-bottom: 1px solid var(--border); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 48px; }
.crumb { font-size: 12.5px; color: var(--muted2); text-decoration: none; transition: color .12s; }
.crumb:hover { color: var(--text); }
.topbar .brand { font-weight: 700; font-size: 13px; letter-spacing: -.1px; text-decoration: none; }
.topbar .brand em { font-style: normal; color: var(--amber); }
.topbar .spacer { flex: 1; }
.topbar .gh { font-size: 12px; color: var(--muted); text-decoration: none; }
.topbar .gh:hover { color: var(--text); }

/* ── Hero ────────────────────────────────────────────────── */
.hero { padding: 56px 0 36px; }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(30px, 4.6vw, 48px); font-weight: 800; letter-spacing: -1.5px;
  line-height: 1.08; margin-bottom: 16px; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--amber); }
.hero p { font-size: 14.5px; line-height: 1.65; color: var(--muted2); max-width: 560px; }
.stats { display: flex; gap: 22px; margin-top: 22px; font-size: 12.5px; color: var(--muted); }
.stats b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Hub: section cards ──────────────────────────────────── */
.sections { display: grid; gap: 14px; padding-bottom: 72px; }
.section-card {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 24px;
  background: var(--s1); border: 1px solid var(--border); border-radius: 10px;
  padding: 24px 26px; text-decoration: none; transition: border-color .15s, background .15s;
}
.section-card:hover { background: var(--s2); border-color: var(--border2); }
.section-card h2 { font-size: 21px; font-weight: 700; letter-spacing: -.4px; }
.section-card .go { color: var(--amber); font-size: 13px; font-weight: 600; align-self: start; white-space: nowrap; text-decoration: none; }
.section-card p { grid-column: 1 / -1; font-size: 13.5px; line-height: 1.6; color: var(--muted2); max-width: 640px; }
.section-card .meta { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.topic-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.topic-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted2); text-decoration: none;
  border: 1px solid var(--border2); border-radius: 999px; padding: 4px 11px 4px 9px;
  transition: color .12s, border-color .12s;
}
.topic-chip:hover { color: var(--text); border-color: var(--muted); }
.topic-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--amber)); }
.topic-chip span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Section page: toolbar ───────────────────────────────── */
.toolbar {
  position: sticky; top: 0; z-index: 5;
  background: rgba(10,10,10,.92); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.toolbar .wrap { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
.search {
  width: 100%; background: var(--s1); border: 1px solid var(--border2); border-radius: 6px;
  color: var(--text); font: inherit; font-size: 13.5px; padding: 9px 12px; outline: none;
  transition: border-color .15s;
}
.search:focus { border-color: var(--amber); }
.search::placeholder { color: var(--muted); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; }
.toc::-webkit-scrollbar { display: none; }
.toc .topic-chip { flex-shrink: 0; }
.toc .topic-chip.dim { opacity: .35; }

/* ── Section page: topic groups ──────────────────────────── */
.topics { padding: 8px 0 72px; }
.topic { padding-top: 34px; scroll-margin-top: 140px; }
.topic[hidden] { display: none; }
.topic-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.topic-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.topic-head h2 i { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--amber)); }
.topic-head .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-desc { font-size: 13px; color: var(--muted2); line-height: 1.55; margin-bottom: 14px; max-width: 680px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; }
.card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 84px; background: var(--s1); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px 12px; text-decoration: none; position: relative;
  transition: border-color .15s, background .15s;
}
.card::before {
  content: ''; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 2px;
  border-radius: 2px; background: var(--c, var(--amber)); opacity: 0; transition: opacity .15s;
}
.card[hidden] { display: none; }
.card:hover { background: var(--s2); border-color: var(--border2); }
.card:hover::before { opacity: 1; }
.card-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.card-title.code { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cplx { font-size: 11px; font-family: var(--mono); color: var(--muted); }
.card .arrow { font-size: 12px; color: var(--muted); transition: color .15s, transform .15s; }
.card:hover .arrow { color: var(--amber); transform: translateX(2px); }

.empty { padding: 48px 0; color: var(--muted); font-size: 13.5px; }
.empty[hidden] { display: none; }

footer { border-top: 1px solid var(--border); padding: 22px 0; font-size: 12px; color: var(--muted); }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: var(--muted2); text-decoration: none; }
footer a:hover { color: var(--text); }
kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted2);
  border: 1px solid var(--border2); border-radius: 3px; padding: 0 5px;
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .hero { padding: 36px 0 26px; }
  .section-card { padding: 20px 18px; grid-template-columns: 1fr; }
  .section-card .go { display: none; }
  .grid { grid-template-columns: 1fr; }
  .toc { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
}
