/* Документация «Прямой Диалог» — общий стиль раздела /docs/.
   Токены и шрифты те же, что на лендинге (index.html): страницы должны читаться
   как продолжение сайта, а не как чужой документ.
   Раскладка: дерево разделов слева, текст по центру, «На этой странице» справа.
   Страницы собирает build-docs.js — руками их не правят, правят источники. */

@font-face {
	font-family: "SamsungOne-700C";
	src: url("/fonts/SamsungOne/SamsungOne-700C.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Manrope";
	src: url("/fonts/Manrope.ttf") format("truetype");
	font-style: normal;
	font-display: swap;
}

:root {
	--font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-heading: "SamsungOne-700C", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--blue: rgb(34, 76, 156);
	--blue-2: rgb(46, 98, 190);
	--blue-bg: rgba(34, 76, 156, 0.06);
	--red: #d7484a;
	--text: #1f2733;
	--muted: #5b6673;
	--border: #e3e8ef;
	--surface: #f7f9fc;
	--warn: #b4561f;
	--warn-bg: #fbeee5;
	--ok: #16794f;
	--radius: 14px;
	--top-h: 57px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + 20px); }
body {
	font-family: var(--font-body);
	color: var(--text);
	background: #fff;
	line-height: 1.6;
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
}

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

/* ── Шапка ── */
.top {
	position: sticky;
	top: 0;
	z-index: 30;
	background: rgba(255, 255, 255, .92);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--border);
}
.top-in {
	max-width: 1320px;
	margin: 0 auto;
	padding: 12px 24px;
	display: flex;
	align-items: center;
	gap: 16px;
}
.brand {
	display: flex;
	align-items: center;
	gap: 9px;
	font-family: var(--font-heading);
	font-size: 17px;
	color: var(--text);
	white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; display: block; }
.brand-docs { color: var(--muted); font-family: var(--font-body); font-weight: 500; }
.top-spacer { flex: 1; }
.top a.back { color: var(--muted); font-size: 14.5px; white-space: nowrap; }
.top .panel-link {
	border: 1px solid var(--border);
	border-radius: 9px;
	padding: 5px 12px;
	font-size: 14.5px;
	white-space: nowrap;
}

/* Бургер — только на узких экранах, показывает дерево разделов. */
.navtoggle {
	display: none;
	border: 1px solid var(--border);
	border-radius: 9px;
	background: #fff;
	color: var(--text);
	font: inherit;
	font-size: 14.5px;
	padding: 5px 11px;
	cursor: pointer;
	align-items: center;
	gap: 7px;
}
.navtoggle b { display: inline-flex; flex-direction: column; gap: 3px; }
.navtoggle b i { width: 15px; height: 2px; background: var(--text); border-radius: 2px; }

/* ── Поиск ── */
.search { position: relative; width: min(320px, 34vw); }
.search input {
	width: 100%;
	font: inherit;
	font-size: 14.5px;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 9px;
	padding: 6px 34px 6px 32px;
	outline: none;
}
.search input:focus { border-color: var(--blue); background: #fff; }
.search input::placeholder { color: var(--muted); }
.search .ico {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 14px;
	height: 14px;
	opacity: .5;
	pointer-events: none;
}
.search .hint {
	position: absolute;
	right: 9px;
	top: 50%;
	transform: translateY(-50%);
	border: 1px solid var(--border);
	border-radius: 5px;
	background: #fff;
	color: var(--muted);
	font-size: 11.5px;
	line-height: 1.5;
	padding: 0 5px;
	pointer-events: none;
}
.search input:focus ~ .hint { display: none; }
.results {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	width: min(520px, 90vw);
	max-height: min(62vh, 520px);
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
	padding: 6px;
	display: none;
	z-index: 40;
}
.results.open { display: block; }
.results a {
	display: block;
	padding: 8px 10px;
	border-radius: 9px;
	color: var(--text);
}
.results a:hover,
.results a.cur { background: var(--surface); text-decoration: none; }
.results a b { display: block; font-size: 15px; }
.results a span { color: var(--muted); font-size: 13.5px; }
.results a em { font-style: normal; background: #fdf3c8; border-radius: 3px; }
.results .where { color: var(--blue); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.results .empty { padding: 12px 10px; color: var(--muted); font-size: 14.5px; }

/* ── Раскладка ── */
.layout {
	max-width: 1320px;
	margin: 0 auto;
	padding: 28px 24px 80px;
	display: grid;
	grid-template-columns: 248px minmax(0, 1fr) 212px;
	gap: 40px;
	align-items: start;
}

/* Дерево разделов. Текущий раздел развёрнут, остальные — одной строкой. */
.side {
	position: sticky;
	top: calc(var(--top-h) + 20px);
	max-height: calc(100vh - var(--top-h) - 40px);
	overflow-y: auto;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px 16px;
	font-size: 14.5px;
}
.side h4 {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted);
	font-weight: 700;
	margin: 14px 0 6px;
}
.side h4:first-child { margin-top: 0; }
.side a { display: block; padding: 4px 0; color: var(--text); }
.side a:hover { color: var(--blue); text-decoration: none; }
.side a.cur { color: var(--blue); font-weight: 700; }
.side a.ext::after { content: " ↗"; color: var(--muted); font-size: 12px; }
.side .sub { margin: 2px 0 6px; padding-left: 10px; border-left: 2px solid var(--border); }
.side .sub a { font-size: 14px; padding: 3px 0; color: var(--muted); }
.side .sub a:hover { color: var(--blue); }
.side .sub a.cur { color: var(--blue); }
.side .sec { font-weight: 700; }

/* «На этой странице» */
.toc-col {
	position: sticky;
	top: calc(var(--top-h) + 20px);
	max-height: calc(100vh - var(--top-h) - 40px);
	overflow-y: auto;
	font-size: 14px;
	border-left: 1px solid var(--border);
	padding-left: 16px;
}
.toc-col h4 {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--muted);
	font-weight: 700;
	margin-bottom: 8px;
}
.toc-col a { display: block; padding: 3px 0; color: var(--muted); line-height: 1.4; }
.toc-col a:hover { color: var(--blue); text-decoration: none; }
.toc-col a.cur { color: var(--blue); font-weight: 700; }
.toc-col a.lvl3 { padding-left: 12px; font-size: 13.5px; }

/* ── Текст ── */
.crumbs { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

.doc h1 {
	font-family: var(--font-heading);
	font-size: 32px;
	line-height: 1.2;
	margin-bottom: 10px;
}
.doc h2 {
	font-family: var(--font-heading);
	font-size: 23px;
	margin: 2em 0 .5em;
	padding-bottom: .25em;
	border-bottom: 1px solid var(--border);
}
.doc h3 { font-size: 18px; margin: 1.6em 0 .4em; }
.doc h4 { font-size: 16px; margin: 1.3em 0 .3em; }
.doc p { margin: .7em 0; }
.doc .lead { font-size: 18px; color: var(--muted); margin-bottom: 1.4em; }
.doc ul, .doc ol { margin: .7em 0; padding-left: 1.3em; }
.doc li { margin: .35em 0; }
.doc hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.doc code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 5px;
	padding: 1px 5px;
	font-size: 14px;
}
.doc pre {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 14px 16px;
	overflow-x: auto;
	margin: 1em 0;
	font-size: 14px;
	line-height: 1.5;
}
.doc pre code { background: none; border: 0; padding: 0; font-size: 14px; }
.doc table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 15px; }
.doc th, .doc td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { background: var(--surface); font-weight: 700; }
/* Широкая таблица не должна раздвигать страницу — прокручивается сама. */
.doc .table-wrap { overflow-x: auto; margin: 1em 0; }
.doc .table-wrap table { margin: 0; }

/* Ссылка-якорь у заголовка: появляется при наведении, как в GitHub. */
.doc .anchor {
	color: var(--border);
	font-weight: 400;
	margin-left: .35em;
	opacity: 0;
	transition: opacity .12s;
}
.doc h2:hover .anchor,
.doc h3:hover .anchor,
.doc .anchor:focus { opacity: 1; }
.doc .anchor:hover { color: var(--blue); text-decoration: none; }

.note {
	border-left: 4px solid var(--blue);
	background: var(--blue-bg);
	border-radius: 0 10px 10px 0;
	padding: 12px 16px;
	margin: 1.2em 0;
}
.note.warn { border-color: var(--warn); background: var(--warn-bg); }
.note p:first-child { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }
.note strong { font-weight: 700; }

/* ── Карточки разделов ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 1.4em 0; }
.card {
	display: block;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px 18px;
	color: var(--text);
	transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--blue); text-decoration: none; transform: translateY(-2px); }
.card b { display: block; font-size: 16.5px; margin-bottom: 4px; }
.card span { color: var(--muted); font-size: 14.5px; }

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps > li {
	counter-increment: step;
	position: relative;
	padding-left: 42px;
	margin: 1.2em 0;
}
.steps > li::before {
	content: counter(step);
	position: absolute;
	left: 0;
	top: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--blue);
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.steps > li > b { display: block; font-size: 16.5px; margin-bottom: 2px; }

/* Главы руководства списком на его первой странице. */
.chapters { list-style: none; padding-left: 0; margin: 1.2em 0; }
.chapters li { margin: 0; border-bottom: 1px solid var(--border); }
.chapters li:first-child { border-top: 1px solid var(--border); }
.chapters a { display: flex; gap: 12px; align-items: baseline; padding: 11px 4px; color: var(--text); }
.chapters a:hover { text-decoration: none; color: var(--blue); background: var(--surface); }
.chapters .n { color: var(--muted); font-size: 13.5px; min-width: 20px; }

/* ── Назад / Дальше ── */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 3em 0 0; }
.pager a {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px 16px;
	color: var(--text);
}
.pager a:hover { border-color: var(--blue); text-decoration: none; }
.pager span { display: block; color: var(--muted); font-size: 13px; }
.pager b { font-weight: 700; font-size: 15.5px; }
.pager .next { text-align: right; grid-column: 2; }

.foot {
	border-top: 1px solid var(--border);
	margin-top: 60px;
	padding: 24px;
	text-align: center;
	color: var(--muted);
	font-size: 14px;
}
.foot a { color: var(--muted); }

/* ── Узкие экраны ── */
@media (max-width: 1140px) {
	.layout { grid-template-columns: 236px minmax(0, 1fr); gap: 32px; }
	.toc-col { display: none; }
}
@media (max-width: 880px) {
	/* minmax(0, 1fr), а не 1fr: у трека 1fr минимум auto, поэтому колонка раздувается под
	   самый широкий неразрывный кусок (строка вставки, блок кода) и утаскивает за собой всю
	   страницу — появляется горизонтальная прокрутка, из-за которой Яндекс не признаёт сайт
	   оптимизированным для мобильных. Нулевой минимум оставляет прокрутку внутри .doc pre. */
	.layout { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 18px 18px 60px; }
	.side {
		display: none;
		position: static;
		max-height: none;
	}
	body.nav-open .side { display: block; }
	.navtoggle { display: inline-flex; }
	.top-in { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
	.brand-docs { display: none; }
	.search { order: 3; width: 100%; }
	.top a.back { display: none; }
	.doc h1 { font-size: 26px; }
	.doc h2 { font-size: 20px; }
	.pager { grid-template-columns: 1fr; }
	.pager .next { grid-column: 1; }
}

@media print {
	.top, .side, .toc-col, .pager, .foot { display: none; }
	.layout { display: block; padding: 0; }
	.doc pre, .doc table, .note { break-inside: avoid; }
}
