:root {
  --bg: #fff9ec;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #5b6270;
  --line: #eadfc6;
  --accent: #2f6fe4;
  --accent-ink: #ffffff;
  --yellow: #f7c32e;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1c1f27;
    --text: #e9ebf0;
    --muted: #9aa1b0;
    --line: #2b2f3a;
    --accent: #6c9bff;
    --accent-ink: #0d1220;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-underline-offset: 3px; }

/* шапка */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 18px; }
.brand img { border-radius: 12px; }
nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 999px; font-size: 15px; }
nav a:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
nav a.btn { background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-left: 4px; }
nav a.btn:hover { filter: brightness(1.08); }

/* документ */
.doc { padding-top: 36px; padding-bottom: 48px; }
.doc h1 { font-size: clamp(28px, 5vw, 38px); line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
.doc h1 + p { color: var(--muted); }
.doc h2 {
  font-size: 22px; line-height: 1.3; margin: 40px 0 12px; padding-top: 4px;
  scroll-margin-top: 84px;
}
.doc h2::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--yellow); margin-bottom: 10px; }
.doc p, .doc li { margin: 0 0 12px; }
.doc ul { padding-left: 22px; }
.doc li > ul { margin-top: 8px; }
.doc strong { font-weight: 650; }

/* содержание */
#markdown-toc {
  list-style: none; margin: 24px 0 8px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  columns: 2 220px; column-gap: 28px;
}
#markdown-toc li { margin: 0 0 6px; break-inside: avoid; }
#markdown-toc a { text-decoration: none; font-size: 15px; }
#markdown-toc a:hover { text-decoration: underline; }

/* главная: карточки */
.lead { font-size: 19px; color: var(--muted); margin-bottom: 28px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 8px 0 24px; }
.card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .08); }
.card h2 { margin: 0 0 6px; font-size: 20px; }
.card h2::before { display: none; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

/* подвал */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
.site-footer p { margin: 0 0 6px; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .doc { padding-top: 24px; }
  nav a { padding: 7px 10px; }
}
@media print {
  .site-header, .site-footer nav, #markdown-toc { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .doc h2::before { display: none; }
}
