/**
 * Table of Contents by Netstry - Frontend Styles
 * Strictly scoped to .ns-toc to avoid theme/builder conflicts.
 */

.ns-toc {
	--ns-toc-bg: #f8fafc;
	--ns-toc-border: #e2e8f0;
	--ns-toc-title: #0f172a;
	--ns-toc-link: #334155;
	--ns-toc-link-hover: #0284c7;
	--ns-toc-active: #0284c7;
	--ns-toc-radius: 8px;

	box-sizing: border-box;
	background-color: var(--ns-toc-bg);
	border: 1px solid var(--ns-toc-border);
	border-radius: var(--ns-toc-radius);
	padding: 16px 20px;
	margin: 0 0 24px;
	font-size: 15px;
	line-height: 1.55;
	max-width: 100%;
}

.ns-toc[hidden] {
	display: none !important;
}

.ns-toc *,
.ns-toc *::before,
.ns-toc *::after {
	box-sizing: border-box;
}

/* Theme presets */
.ns-toc--theme-minimal {
	--ns-toc-bg: transparent;
	--ns-toc-border: transparent;
	padding: 0;
}

.ns-toc--theme-dark {
	--ns-toc-bg: #0f172a;
	--ns-toc-border: #1e293b;
	--ns-toc-title: #f8fafc;
	--ns-toc-link: #cbd5e1;
	--ns-toc-link-hover: #38bdf8;
	--ns-toc-active: #38bdf8;
}

/* Float alignments */
.ns-toc--float-left {
	float: left;
	margin: 0 24px 18px 0;
}

.ns-toc--float-right {
	float: right;
	margin: 0 0 18px 24px;
}

@media (max-width: 640px) {
	.ns-toc--float-left,
	.ns-toc--float-right {
		float: none;
		width: 100% !important;
		margin: 0 0 20px;
	}
}

/* Header */
.ns-toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.ns-toc--collapsed .ns-toc-header {
	margin-bottom: 0;
}

.ns-toc-title {
	margin: 0;
	padding: 0;
	font-size: 1.05em;
	font-weight: 700;
	color: var(--ns-toc-title);
	line-height: 1.3;
}

.ns-toc-toggle {
	appearance: none;
	background: transparent;
	border: 1px solid var(--ns-toc-border);
	border-radius: 4px;
	color: var(--ns-toc-link);
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	padding: 5px 10px;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.ns-toc-toggle:hover,
.ns-toc-toggle:focus-visible {
	color: var(--ns-toc-link-hover);
	border-color: var(--ns-toc-link-hover);
	outline: none;
}

/* Body & List */
.ns-toc--collapsed .ns-toc-body {
	display: none;
}

.ns-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ns-toc-sublist {
	padding-left: 18px;
	margin-top: 4px;
}

.ns-toc-item {
	margin: 4px 0;
	padding: 0;
}

.ns-toc-link {
	display: inline-block;
	color: var(--ns-toc-link);
	text-decoration: none;
	transition: color 0.15s ease;
	word-break: break-word;
}

.ns-toc-link:hover,
.ns-toc-link:focus-visible {
	color: var(--ns-toc-link-hover);
	text-decoration: underline;
	outline: none;
}

.ns-toc-link.ns-toc-active {
	color: var(--ns-toc-active);
	font-weight: 600;
}

.ns-toc-num {
	opacity: 0.78;
	font-variant-numeric: tabular-nums;
	margin-right: 2px;
}
