/**
 * Sommaire automatique H2/H3 — Sonate
 */

.sonate-toc {
	box-sizing: border-box;
	position: relative;
	width: 100%;
}

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

.sonate-toc__heading {
	display: block;
	margin: 0;
	font-weight: 600;
}

.sonate-toc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.sonate-toc__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.sonate-toc__toggle-icon {
	position: relative;
	display: inline-block;
	width: 12px;
	height: 12px;
}

.sonate-toc__toggle-icon::before,
.sonate-toc__toggle-icon::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 9px;
	height: 2px;
	background: currentColor;
	transform: translate(-50%, -50%);
	transition: transform 0.2s ease;
}

.sonate-toc__toggle-icon::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.sonate-toc--collapsed .sonate-toc__toggle-icon::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

.sonate-toc__list {
	margin: 0;
	padding-left: 0;
	list-style: none;
	counter-reset: none;
}

.sonate-toc__item {
	display: block;
	line-height: 1.35;
	list-style: none;
}

nav.sonate-toc .sonate-toc__list > .sonate-toc__item:hover {
	text-decoration: underline;
}

.sonate-toc__item:last-child {
	margin-bottom: 0 !important;
}

.sonate-toc__link-wrap {
	display: block;
}

.sonate-toc__link {
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.sonate-toc__link:hover,
.sonate-toc__link:focus-visible {
	outline: none;
}

.sonate-toc--empty .sonate-toc__list {
	display: none;
}

/* Sans H2/H3 : masquer tout le bloc sommaire + la colonne Elementor parente. */
.sonate-toc--empty,
.sonate-toc--initial {
	display: none !important;
}

.elementor-column.sonate-toc-aside-hidden,
.e-con.sonate-toc-aside-hidden,
.aside.sonate-toc-aside-hidden,
.elementor-column:has(.sonate-toc--initial),
.elementor-column:has(.sonate-toc--empty),
.e-con:has(> .elementor-widget-sonate_heading_toc .sonate-toc--initial),
.e-con:has(> .elementor-widget-sonate_heading_toc .sonate-toc--empty),
.e-con:has(> .e-con-inner > .elementor-widget-sonate_heading_toc .sonate-toc--initial),
.e-con:has(> .e-con-inner > .elementor-widget-sonate_heading_toc .sonate-toc--empty) {
	display: none !important;
}

.sonate-toc--empty .sonate-toc__status:not(.screen-reader-text) {
	margin: 0;
	font-style: italic;
	opacity: 0.85;
}

.sonate-toc {
    position: sticky;
    top: 30px; 
    align-self: flex-start;
	border: 1px solid var(--orange);
	padding: 10px;
	border-radius: 14px;
	box-shadow: 0px 0px 10px 0px #fa70254d;
}

@media (max-width: 767px) {
	.sonate-toc {
		position: relative;
		top: auto;
		left: 0;
		right: 0;
		width: 425px;
		max-width: 100%;
	}

	.sonate-toc__toggle {
		display: inline-flex;
		background-color: var(--orange);
		color: var(--white);
	}

	.sonate-toc__toggle:focus {
		background-color: var(--orange);
		color: var(--white);
	}

	.sonate-toc__toggle:hover {
		background-color: var(--orange);
		color: var(--white);
	}
}

/* Accessibilité : texte réservé lecteurs d’écran uniquement si WordPress définit cette classe */
