/**
 * BHP Table of Contents — widget styles.
 * Defaults replicate the Elementor TOC design used on the site
 * (white box, #FFC43D border, Playfair Display title, Alegreya Sans items).
 * Every value can be overridden from the widget's Style tab.
 */

.bhp-toc {
	background: var(--bhp-toc-box-bg, #ffffff);
	border-style: solid;
	border-color: var(--bhp-toc-box-border-color, #ffc43d);
	border-width: var(--bhp-toc-box-border-width, 3px 1px 1px 1px);
	border-radius: var(--bhp-toc-box-radius, 26px);
	overflow: hidden;
}

/* ---------------------------------------------------------------- Header */
.bhp-toc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 20px;
	border-bottom: 1px solid var(--bhp-toc-sep-color, transparent);
}

.bhp-toc__title {
	margin: 0;
	color: var(--bhp-toc-title-color, #3a506b);
	font-family: "Playfair Display", serif;
	font-size: 18px;
	font-weight: 600;
	line-height: 1em;
	letter-spacing: 0.5px;
}

.bhp-toc__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin: 0;
	padding: 2px;
	background: none;
	border: 0;
	cursor: pointer;
	color: var(--bhp-toc-toggle-color, #ffc43d);
	line-height: 1;
}

.bhp-toc__toggle svg {
	width: 18px;
	height: 18px;
	transition: transform 0.3s ease;
}

.bhp-toc--collapsed .bhp-toc__toggle svg {
	transform: rotate(180deg);
}

.bhp-toc__toggle:hover,
.bhp-toc__toggle:focus {
	background: none;
	border: 0;
	color: var(--bhp-toc-toggle-color, #ffc43d);
}

.bhp-toc__toggle:focus-visible {
	outline: 2px solid var(--bhp-toc-toggle-color, #ffc43d);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ------------------------------------------------------------------ Body */
.bhp-toc__body {
	padding: 20px;
	overflow: hidden;
	transition: max-height 0.35s ease, padding 0.35s ease;
}

.bhp-toc--collapsed .bhp-toc__body {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

/* ------------------------------------------------------------------ List */
.bhp-toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Nested list (hierarchical view) */
.bhp-toc__list .bhp-toc__list {
	padding-left: var(--bhp-toc-indent, 16px);
	margin-top: var(--bhp-toc-gap, 8px);
}

.bhp-toc--markers-bullets .bhp-toc__list {
	list-style: disc;
	padding-left: 20px;
}

.bhp-toc--markers-numbers .bhp-toc__list {
	list-style: decimal;
	padding-left: 20px;
}

.bhp-toc__item {
	margin: 0 0 var(--bhp-toc-gap, 8px);
}

.bhp-toc__item:last-child {
	margin-bottom: 0;
}

.bhp-toc__item::marker {
	color: var(--bhp-toc-marker-color, #3a506b);
}

/* Items are BUTTONS, not links — no href, no #hash, no URL change ever. */
.bhp-toc__link {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	-webkit-appearance: none;
	appearance: none;
	text-align: start;
	cursor: pointer;
	color: var(--bhp-toc-item-color, #3a506b);
	font-family: "Alegreya Sans", sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.45em;
	text-decoration: none;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.bhp-toc--ellipsis .bhp-toc__link {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bhp-toc__link:hover,
.bhp-toc__link:focus {
	background: none;
	border: 0;
	color: var(--bhp-toc-item-hover-color, #ffc43d);
	text-decoration: var(--bhp-toc-hover-decoration, underline);
}

.bhp-toc__link:focus-visible {
	outline: 2px solid var(--bhp-toc-item-hover-color, #ffc43d);
	outline-offset: 2px;
}

/* Active section highlight (scroll spy) */
.bhp-toc__link--active,
.bhp-toc__link--active:hover,
.bhp-toc__link--active:focus {
	color: var(--bhp-toc-item-active-color, #3a506b);
	padding: var(--bhp-toc-active-padding, 10px 14px);
	border-left: 3px solid var(--bhp-toc-active-accent, #ffc43d);
	border-radius: var(--bhp-toc-active-radius, 10px);
	background: var(--bhp-toc-active-bg, rgba(255, 196, 61, 0.125));
}

/* Hidden when the page has no matching headings (frontend only) */
.bhp-toc--empty {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.bhp-toc__body,
	.bhp-toc__toggle svg,
	.bhp-toc__link {
		transition: none;
	}
}
