/* Mục lục nổi cuộn theo — TD-023/024. Chỉ hiện khi đủ H2 (JS). */
.eds-toc-float {
	--toc-blue: #0054a7;
	--toc-orange: #e55c28;
	--toc-bg: #fff;
	position: fixed;
	left: 14px;
	top: auto;
	bottom: 96px; /* thấp bên trái, tránh Zalo/hotline góc phải */
	z-index: 90;
	width: auto;
	max-width: min(300px, calc(100vw - 24px));
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.18s ease, visibility 0.18s ease;
}

.eds-toc-float.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.eds-toc-float__summary {
	list-style: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	user-select: none;
}

.eds-toc-float__summary::-webkit-details-marker {
	display: none;
}

.eds-toc-float__btn {
	position: relative;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	width: auto;
	height: auto;
	padding: 6px 8px 5px;
	box-sizing: border-box;
	border: 1.5px solid var(--toc-orange);
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(11, 36, 71, 0.12);
}

.eds-toc-float__caption {
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.01em;
	color: var(--toc-blue);
	white-space: nowrap;
}

.eds-toc-float__num {
	position: absolute;
	top: -6px;
	right: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--toc-orange);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	box-sizing: border-box;
	border: 1.5px solid #fff;
}

.eds-toc-float__summary:focus-visible .eds-toc-float__btn {
	outline: 3px solid var(--toc-orange);
	outline-offset: 2px;
}

.eds-toc-float__icon {
	display: block;
	flex: 0 0 auto;
}

.eds-toc-float[open] {
	width: min(300px, calc(100vw - 24px));
	display: flex;
	flex-direction: column-reverse; /* panel mở lên trên vì nút ở đáy */
}

.eds-toc-float[open] > .eds-toc-float__summary {
	width: 100%;
}

.eds-toc-float[open] .eds-toc-float__btn {
	width: 100%;
	flex-direction: row;
	justify-content: flex-start;
	gap: 8px;
	padding: 8px 10px;
	border-radius: 0 0 10px 10px;
	border-top: 0;
	border-bottom: 1.5px solid var(--toc-orange);
}

.eds-toc-float[open] .eds-toc-float__caption {
	font-size: 13px;
}

.eds-toc-float[open] .eds-toc-float__num {
	position: static;
	margin-left: auto;
	border-color: #fff;
}

.eds-toc-float__panel {
	background: var(--toc-bg);
	border: 1.5px solid var(--toc-blue);
	border-bottom: 0;
	border-radius: 10px 10px 0 0;
	box-shadow: 0 -8px 24px rgba(11, 36, 71, 0.14);
	max-height: 60vh;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

.eds-toc-float__head {
	padding: 10px 12px 0;
	font-size: 12px;
	font-weight: 600;
	color: #64748b;
}

.eds-toc-float__list {
	list-style: decimal;
	margin: 4px 0 12px;
	padding: 0 12px 8px 2rem;
}

.eds-toc-float__list li {
	margin: 0 0 7px;
	font-size: 13px;
	line-height: 1.4;
	color: #64748b;
}

.eds-toc-float__link {
	color: #334155;
	text-decoration: none;
	font-weight: 500;
}

.eds-toc-float__link:hover,
.eds-toc-float__link:focus {
	color: var(--toc-orange);
	text-decoration: underline;
}

/* Heading không bị header che khi nhảy mục */
.entry-content h2,
.page-wrapper h2,
.eds-band h2,
.eds-toeic-v3-main h2,
.eds-general-v3-main h2 {
	scroll-margin-top: 108px;
}

@media (max-width: 1100px) {
	.eds-toc-float {
		left: 10px;
		bottom: 96px;
	}

	.eds-toc-float[open] {
		width: min(300px, calc(100vw - 20px));
	}

	.eds-toc-float__panel {
		max-height: 50vh;
	}
}

@media (max-width: 549px) {
	.eds-toc-float {
		left: 10px;
		right: 10px;
		bottom: calc(64px + env(safe-area-inset-bottom, 0px)); /* trên thanh Zalo/hotline */
		z-index: 998;
		max-width: none;
	}

	.eds-toc-float:not([open]) {
		right: auto;
		width: auto;
	}

	.eds-toc-float[open] {
		width: auto;
	}

	.eds-toc-float__panel {
		max-height: min(48vh, 340px);
		width: 100%;
		box-sizing: border-box;
	}
}
