:root{
  --bg:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --card:#f9fafb;
  --accent:#2563eb;
  --max:1120px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.7;
}

/* Ссылки — заметные (синие) */
a{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover{opacity:.9}

/* Контейнер: отступы + safe-area */
.container{
  max-width:var(--max);
  margin:0 auto;
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
}

/* Верхняя панель */
.topbar{
  position:sticky; top:0; z-index:20;
  background:#fff;
  border-bottom:1px solid var(--border);
}
.topbar__row{
  display:flex; align-items:center;
  padding:14px 0;
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight:800;
  text-decoration:none;
  color:var(--text);
}
.brand:hover{opacity:.95}
.brand__dot{
  width:12px; height:12px; border-radius:50%;
  background: var(--accent);
  display:inline-block;
}
.brand__text{
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  max-width:70vw;
}

/* Hero */
.hero{
  padding:26px 0 14px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg, #f8fafc, #ffffff);
}
h1{
  margin:0;
  font-size: clamp(26px, 4vw, 42px);
  line-height:1.15;
}

/* Layout */
.layout{
  display:grid;
  grid-template-columns: 1fr 320px;
  gap:18px;
  padding:18px 0 26px;
}

/* Article typography */
.article{min-width:0}
.article h2{margin:18px 0 8px; font-size:22px}
.article h3{margin:14px 0 6px; font-size:18px}
.article h4{margin:12px 0 6px; font-size:15px}
.article p{margin:0 0 10px}
.article ul, .article ol{margin:0 0 12px; padding-left:20px}
.article li{margin:6px 0}

/* “Синее разделение” между блоками сервисов */
.service{
  margin: 14px 0;
  padding: 14px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: #fff;
}
.service h3{margin-top:0}

/* Sidebar */
.sidebar{
  position:sticky;
  top:74px;
  align-self:start;
}
.widget{
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:12px;
  margin-bottom:12px;
}
.widget__title{font-weight:800; margin-bottom:8px}

/* TOC */
.toc a{
  display:block;
  padding:6px 8px;
  border-radius:10px;
  color:var(--muted);
  font-size:14px;
  text-decoration:none;
}
.toc a:hover{background:var(--card); color:var(--text)}
.toc a.active{
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  color:var(--text);
}
.toc a.depth-3{padding-left:16px; font-size:13px}

/* Мобильное оглавление */
.toc--mobile{display:none}
.toc__toggle{
  width:100%;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  font-weight:800;
  text-align:left;
  cursor:pointer;
}
.toc__body{margin-top:10px}

/* Responsive: на мобилке справа ничего нет, оглавление только сверху */
@media (max-width: 980px){
  .layout{grid-template-columns:1fr}
  .sidebar{display:none;}
  .toc--mobile{display:block; margin-bottom:12px}
  .toc--desktop{display:none}

  /* чуть меньше отступы на мобилке */
  .container{
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}
