/**
 * TOC — content insert + mobile layout.
 */

.site-theme .container > .toc,
.site-theme .t2-toc-block,
.site-theme .toc {
	box-sizing: border-box;
	margin: 11px auto 21px;
	max-width: var(--t2-container-width, 1260px);
	min-width: 0;
	overflow: hidden;
	width: 100%;
}

.site-theme .text_container > .t2-toc-block,
.site-theme .text_container > .toc,
.site-theme .text_container .t2-toc-block {
	margin-inline: 0;
	max-width: 100%;
}

.site-theme .t2-toc-block > .container,
.site-theme .t2-toc-block__container {
	box-sizing: border-box;
	margin-inline: auto;
	max-width: 100%;
	width: 100%;
}

.site-theme .toc .ctoc,
.site-theme .toc .ctoc-body,
.site-theme .toc #ctoc-list-captions {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
	width: 100%;
}

.site-theme #toc_container {
	box-sizing: border-box;
	height: auto;
	max-width: 100%;
	overflow: visible;
	width: 100%;
}

@media only screen and (max-width: 767px) {
	.site-theme #toc_container {
		height: auto;
	}

	.site-theme #toc_container:before {
		content: none;
		display: none;
	}
}

.site-theme #toc_container ul {
	align-items: stretch;
	display: flex;
	flex-flow: row wrap;
	gap: 10px;
	justify-content: center;
	list-style: none;
	margin: 0;
	padding: 0;
}

.site-theme #toc_container ul li {
	background-color: var(--toc-background-color, #1a1a1a);
	border-radius: 8px;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.site-theme #toc_container ul li {
	flex: 0 1 auto;
	width: auto;
}

.site-theme #toc_container.toc--lead-first ul li:first-child {
	background: transparent;
	display: flex;
	flex: 0 0 100%;
	justify-content: center;
	max-width: 100%;
	padding: 0;
	width: 100%;
}

.site-theme #toc_container.toc--lead-first ul li:first-child a {
	background-color: var(--toc-background-color, #1a1a1a);
	border-radius: 8px;
	box-sizing: border-box;
	display: block;
	margin-inline: auto;
	max-width: 100%;
	padding: 8px 20px 9px;
	width: fit-content;
}

.site-theme #toc_container ul li:before {
	content: none;
}

.site-theme #toc_container ul li a {
	box-sizing: border-box;
	color: var(--toc-link-color, #ffffff);
	display: block;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.25;
	max-width: 100%;
	overflow-wrap: anywhere;
	padding: 8px 16px;
	text-align: center;
	text-decoration: none;
	white-space: normal;
	word-break: break-word;
}

.site-theme #toc_container ul li:hover {
	background-color: var(--toc-background-hover-color, #fce043);
}

.site-theme #toc_container.toc--lead-first ul li:first-child:hover {
	background: transparent;
}

.site-theme #toc_container.toc--lead-first ul li:first-child:hover a {
	background-color: var(--toc-background-hover-color, #fce043);
	color: var(--toc-link-hover-color, #000000);
}

.site-theme #toc_container ul li:hover a {
	color: var(--toc-link-hover-color, #000000);
}

@media only screen and (max-width: 767px) {
	.site-theme #toc_container ul {
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 8px;
		justify-content: flex-start;
	}

	.site-theme #toc_container ul li,
	.site-theme #toc_container ul li:first-child,
	.site-theme #toc_container ul li:not(:first-child) {
		background: transparent;
		display: block;
		flex: 0 0 auto;
		max-width: 100%;
		padding: 0;
		width: 100%;
	}

	.site-theme #toc_container ul li a,
	.site-theme #toc_container ul li:first-child a {
		background-color: var(--toc-background-color, #1a1a1a);
		box-sizing: border-box;
		display: block;
		overflow-wrap: anywhere;
		padding: 12px 14px;
		text-align: left;
		white-space: normal;
		width: 100%;
		word-break: break-word;
	}

	.site-theme #toc_container.toc--lead-last ul li:first-child,
	.site-theme #toc_container.toc--lead-last ul li:last-child {
		background: transparent;
		display: block;
		flex: 0 0 auto;
		justify-content: flex-start;
		margin-inline: 0;
		padding: 0;
		text-align: left;
		width: 100%;
	}

	.site-theme #toc_container.toc--lead-last ul li:first-child a,
	.site-theme #toc_container:not(.toc--lead-first) ul li a {
		display: block;
		width: 100%;
	}

	.site-theme #toc_container.toc--lead-last ul li:last-child a,
	.site-theme #toc_container.toc--lead-first ul li:first-child a {
		margin-inline: 0;
		max-width: 100%;
		width: 100%;
	}
}

/* Длинная ссылка в конце списка (ifb-woerthde) — только desktop */
@media only screen and (min-width: 768px) {
	.site-theme #toc_container.toc--lead-last ul {
		flex-flow: wrap-reverse;
	}

	.site-theme #toc_container.toc--lead-last ul li:first-child {
		flex: 0 1 auto;
		margin-inline: 0;
		text-align: left;
		width: auto;
	}

	.site-theme #toc_container.toc--lead-last ul li:last-child {
		background: transparent;
		display: flex;
		flex: 0 0 100%;
		justify-content: center;
		padding: 0;
		width: 100%;
	}

	.site-theme #toc_container.toc--lead-last ul li:last-child a {
		background-color: var(--toc-background-color, #1a1a1a);
		border-radius: 8px;
		box-sizing: border-box;
		display: block;
		margin-inline: auto;
		max-width: 100%;
		padding: 8px 20px 9px;
		width: fit-content;
	}

	.site-theme #toc_container.toc--lead-last ul li:last-child:hover a {
		background-color: var(--toc-background-hover-color, #fce043);
		color: var(--toc-link-hover-color, #000000);
	}
}
