/*
 * UTS Sites Table of Contents — front-end styles.
 *
 * Intentionally NO font-family, font-size or link color/hover-color
 * rules here. Every text element uses `inherit`, and every <a> tag
 * is left untouched so the theme's own body font and link/hover
 * colors apply automatically. Only layout, spacing, and subtle
 * depth/structure are controlled by the plugin.
 */

.uts-toc-container {
	--uts-toc-border: rgba(0, 0, 0, 0.10);
	--uts-toc-bg: #fafafa;
	--uts-toc-marker: rgba(0, 0, 0, 0.28);

	font-family: inherit;
	font-size: inherit;
	line-height: 1.65;
	box-sizing: border-box;
	margin: 1.75em 0;
	padding: 1.25em 1.5em 1.4em;
	border: 1px solid var(--uts-toc-border);
	border-radius: 10px;
	background: var(--uts-toc-bg);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	max-width: 100%;
}

.uts-toc-container * {
	box-sizing: border-box;
}

.uts-toc-title {
	font-weight: 700;
	font-size: 1.05em;
	letter-spacing: 0.01em;
	margin: 0 0 0.75em;
	padding-bottom: 0.6em;
	border-bottom: 1px solid var(--uts-toc-border);
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.uts-toc-title::before {
	content: "";
	display: inline-block;
	width: 4px;
	height: 1em;
	border-radius: 2px;
	background: var(--uts-toc-marker);
	flex-shrink: 0;
}

.uts-toc-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: none;
	border: none;
	padding: 0;
	margin: 0 0 0.75em;
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: left;
	padding-bottom: 0.6em;
	border-bottom: 1px solid var(--uts-toc-border);
}

.uts-toc-toggle .uts-toc-title {
	margin: 0;
	border-bottom: none;
	padding-bottom: 0;
	flex: 1;
}

.uts-toc-arrow-wrap {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-left: 12px;
	background: rgba(0, 0, 0, 0.05);
	transition: background 0.2s ease, transform 0.2s ease;
}

.uts-toc-toggle:hover .uts-toc-arrow-wrap {
	background: rgba(0, 0, 0, 0.09);
}

.uts-toc-collapsed .uts-toc-arrow-wrap {
	transform: rotate(180deg);
}

.uts-toc-arrow {
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.6;
}

.uts-toc-body {
	overflow: hidden;
	max-height: 2000px;
	transition: max-height 0.28s ease, opacity 0.2s ease;
	opacity: 1;
}

.uts-toc-collapsed .uts-toc-body {
	max-height: 0;
	opacity: 0;
}

.uts-toc-list {
	margin: 0 !important;
	padding-left: 0;
	list-style: none;
}

.uts-toc-sublist {
	margin: 0.3em 0 0 1.3em;
	padding-left: 1.1em;
	border-left: 2px solid var(--uts-toc-border);
}

.uts-toc-item {
	margin: 0 !important;
	padding: 0.25em 0 0.25em 1.15em !important;
	line-height: 1.4 !important;
	text-indent: -1.15em;
}

.uts-toc-item::before {
	content: "";
	display: inline-block;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--uts-toc-marker);
	margin-right: 0.6em;
	vertical-align: 0.12em;
}

/* Sub-items (h3, h4...) get a visibly smaller, lighter treatment so
   the h2 -> h3 hierarchy is obvious at a glance, not just via indent. */
.uts-toc-sublist .uts-toc-item {
	font-size: 0.93em;
	opacity: 0.82;
}

.uts-toc-sublist .uts-toc-item::before {
	width: 4px;
	height: 4px;
}

.uts-toc-sublist .uts-toc-sublist .uts-toc-item {
	font-size: 0.9em;
	opacity: 0.7;
}

/* Numbered mode swaps the dot markers for native counters. */
.uts-toc-container ol.uts-toc-list {
	counter-reset: uts-toc-counter;
}

.uts-toc-container ol.uts-toc-list > .uts-toc-item {
	counter-increment: uts-toc-counter;
	padding-left: 1.6em !important;
}

.uts-toc-container ol.uts-toc-list > .uts-toc-item::before {
	content: counter(uts-toc-counter) ".";
	display: inline-block;
	background: none;
	width: auto;
	height: auto;
	margin-right: 0.5em;
	vertical-align: baseline;
	font-size: 0.9em;
	font-weight: 600;
	opacity: 0.6;
}

.uts-toc-container ol.uts-toc-sublist {
	counter-reset: uts-toc-counter;
}

/* Links deliberately unstyled for color — theme's own `a` / `a:hover`
   rules apply here exactly as they do anywhere else on the page. */
.uts-toc-container a {
	font: inherit;
	line-height: inherit !important;
	text-decoration: none;
	margin: 0 !important;
	padding: 0 !important;
	color: var(--uts-toc-link, inherit);
}

.uts-toc-container a:hover {
	text-decoration: underline;
}

/* Toggle in Settings → UTS TOC → Behaviour & Style: makes ONLY the
   white background transparent. Border, shadow, radius, and every
   other style stay exactly as-is. */
.uts-toc-container.uts-toc-transparent {
	background: transparent !important;
}

.uts-toc-credit {
	margin-top: 0.9em;
	padding-top: 0.6em;
	border-top: 1px solid var(--uts-toc-border);
	font-size: 0.78em;
	opacity: 0.6;
	text-align: right;
}

@media (max-width: 480px) {
	.uts-toc-container {
		padding: 1em 1.1em 1.2em;
		border-radius: 8px;
	}
}
