/**
 * MicroLearn — native table of contents.
 * Loaded on single posts that actually contain enough headings.
 */

html {
	scroll-behavior: smooth;
}

body.single-post .entry-content :is(h2, h3)[id] {
	scroll-margin-top: 96px;
}

body.ml-modern .entry-content .ml-toc {
	margin: 8px 0 34px;
	border: 1px solid var(--ms-line);
	border-radius: var(--ms-radius);
	background: var(--ms-bg-2);
	box-shadow: var(--ms-shadow-sm);
	overflow: hidden;
}

body.ml-modern .entry-content .ml-toc__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 13px 16px;
	background: var(--ms-bg);
	color: var(--ms-ink);
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.6;
	cursor: pointer;
	list-style: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

body.ml-modern .entry-content .ml-toc__head::-webkit-details-marker { display: none; }
body.ml-modern .entry-content .ml-toc__head::marker { content: ""; }

body.ml-modern .entry-content .ml-toc[open] .ml-toc__head {
	border-bottom: 1px solid var(--ms-line);
}

body.ml-modern .entry-content .ml-toc__head:hover { color: var(--ms-green-ink); }
body.ml-modern .entry-content .ml-toc__head:focus-visible {
	outline: 2px solid var(--ms-green);
	outline-offset: -2px;
	border-radius: var(--ms-radius) var(--ms-radius) 0 0;
}

body.ml-modern .entry-content .ml-toc__icon {
	position: relative;
	flex: 0 0 auto;
	width: 16px;
	height: 12px;
	border-block-start: 2px solid var(--ms-green);
	border-block-end: 2px solid var(--ms-green);
}

body.ml-modern .entry-content .ml-toc__icon::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	top: 50%;
	height: 2px;
	margin-top: -1px;
	background: var(--ms-green);
}

body.ml-modern .entry-content .ml-toc__count {
	padding: 2px 9px;
	border-radius: var(--ms-radius-full);
	background: var(--ms-green-soft);
	color: var(--ms-green-ink);
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.7;
}

body.ml-modern .entry-content .ml-toc__chev {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	margin-inline-start: auto;
	color: var(--ms-muted);
	transition: transform .18s ease;
}

body.ml-modern .entry-content .ml-toc__chev::before {
	content: "\25BE";
	font-size: 13px;
	line-height: 1;
}

body.ml-modern .entry-content .ml-toc[open] .ml-toc__chev {
	transform: rotate(180deg);
}

body.ml-modern .entry-content .ml-toc__list,
body.ml-modern .entry-content .ml-toc__sub {
	margin: 0;
	padding: 0;
	list-style: none;
}

body.ml-modern .entry-content .ml-toc__list {
	padding: 10px 16px 14px;
}

body.ml-modern .entry-content .ml-toc__item {
	margin: 0;
	padding: 0;
}

body.ml-modern .entry-content .ml-toc__item + .ml-toc__item {
	margin-top: 2px;
}

/* Hierarchy is shown with a marker and an indented rail instead of
   1.2-style decimal numbers. */
body.ml-modern .entry-content .ml-toc__item > .ml-toc__link::before {
	content: "";
	flex: 0 0 auto;
	align-self: flex-start;
	width: 7px;
	height: 7px;
	margin-top: .72em;
	border-radius: 50%;
	background: var(--ms-green);
}

body.ml-modern .entry-content .ml-toc__sub {
	margin: 2px 0 6px;
	margin-inline-start: 3px;
	padding-inline-start: 14px;
	border-inline-start: 2px solid var(--ms-line);
}

body.ml-modern .entry-content .ml-toc__link {
	display: flex;
	align-items: baseline;
	gap: 10px;
	padding: 7px 4px;
	border-radius: var(--ms-radius-sm);
	color: var(--ms-ink) !important;
	font-size: 14.5px;
	font-weight: 700;
	line-height: 1.9;
	text-decoration: none !important;
	transition: color .15s ease, background-color .15s ease;
}

body.ml-modern .entry-content .ml-toc__link:hover,
body.ml-modern .entry-content .ml-toc__link:focus-visible {
	color: var(--ms-green-ink) !important;
	background: var(--ms-green-soft);
	text-decoration: none !important;
}

body.ml-modern .entry-content .ml-toc__link:focus-visible {
	outline: 2px solid var(--ms-green);
	outline-offset: -2px;
}

body.ml-modern .entry-content .ml-toc__sub .ml-toc__link::before {
	content: "";
	flex: 0 0 auto;
	align-self: flex-start;
	box-sizing: border-box;
	width: 6px;
	height: 6px;
	margin-top: .78em;
	border: 1.5px solid rgba(34, 197, 94, .55);
	border-radius: 50%;
	background: transparent;
}

body.ml-modern .entry-content .ml-toc__text {
	flex: 1 1 auto;
	min-width: 0;
}

body.ml-modern .entry-content .ml-toc__sub .ml-toc__link {
	padding-block: 5px;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--ms-body) !important;
}

body.ml-modern .entry-content .ml-toc__sub .ml-toc__link:hover,
body.ml-modern .entry-content .ml-toc__sub .ml-toc__link:focus-visible {
	color: var(--ms-green-ink) !important;
}

/* "Show N more" under the first sections. */
body.ml-modern .entry-content .ml-toc__more {
	margin: 0;
	padding: 0 16px 14px;
	border: 0;
}

body.ml-modern .entry-content .ml-toc__more > .ml-toc__list {
	padding: 0 0 2px;
}

body.ml-modern .entry-content .ml-toc__more-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 4px;
	list-style: none;
	cursor: pointer;
	color: var(--ms-green-ink);
	font-size: 13px;
	font-weight: 700;
}

body.ml-modern .entry-content .ml-toc__more-btn::-webkit-details-marker { display: none; }

body.ml-modern .entry-content .ml-toc__more-btn::after {
	content: "\25BE";
	font-size: 11px;
}

/* Once expanded, the button would sit above the list it opened; hide it. */
body.ml-modern .entry-content .ml-toc__more[open] > .ml-toc__more-btn { display: none; }

/* Phones: the box only adds scrolling before the article starts. */
@media (max-width: 767px) {
	body.ml-modern .entry-content .ml-toc {
		display: none;
	}
}

@media print {
	.ml-toc { display: none !important; }
}
