/**
 * [ctbt_toc] - table des matières (mockup/editorial.html, bloc "Sur cette page").
 * Voir elementor-globals-map.md. Typographies utilisées :
 * - 61d3dcb : Inter 600, 0.875rem  (titre, bouton replié)
 * - 4bf239c : Inter 400, 0.875rem  (liens)
 * - 6687ff8 : Inter 500, 0.875rem  (lien actif)
 *
 * Deux modes :
 * - déplié (au-dessus du point de rupture) : carte avec titre ;
 * - replié (<= 1024 px avec .ctbt-toc--collapse-1024, < 768 px avec --collapse-768) :
 *   bouton pleine largeur, liste affichée seulement avec .is-open (toc.js).
 *
 * !important sur la typo/couleur des liens, du titre et du bouton : le kit Elementor
 * (.elementor-kit-N a, a:hover) et les styles de widget imposent police, taille (1rem au
 * survol), interligne et couleur - sans ça le texte grossit au survol.
 *
 * Pas de sticky ici : géré dans Elementor (effets de défilement du conteneur).
 */

.ctbt-toc {
	box-sizing: border-box;
	padding: 24px;
	border-radius: 16px;
	background-color: var(--e-global-color-01d5930, #FDFAF2);
	box-shadow: 0 2px 6px rgba(44, 24, 16, 0.08);
}

.ctbt-toc .ctbt-toc__title {
	margin: 0 0 16px !important;
	padding: 0 !important;
	font-family: var(--e-global-typography-61d3dcb-font-family, Inter), sans-serif !important;
	font-size: var(--e-global-typography-61d3dcb-font-size, 0.875rem) !important;
	font-weight: var(--e-global-typography-61d3dcb-font-weight, 600) !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	color: var(--e-global-color-3f56ae9, #2C1810) !important;
}

/* ── Liste et hiérarchie ── */
.ctbt-toc .ctbt-toc__list {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.ctbt-toc .ctbt-toc__list--depth-0 {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ctbt-toc .ctbt-toc__list .ctbt-toc__list {
	margin-top: 2px !important;
	padding-left: 12px !important;
}

.ctbt-toc .ctbt-toc__item {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.ctbt-toc .ctbt-toc__item::before,
.ctbt-toc .ctbt-toc__item::marker {
	content: none;
}

.ctbt-toc .ctbt-toc__link,
.ctbt-toc .ctbt-toc__link:hover,
.ctbt-toc .ctbt-toc__link:focus,
.ctbt-toc .ctbt-toc__link:active,
.ctbt-toc .ctbt-toc__link:visited {
	display: block !important;
	margin: 0 !important;
	padding: 8px 0 8px 12px !important;
	border: 0 !important;
	border-left: 2px solid transparent !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	font-family: var(--e-global-typography-4bf239c-font-family, Inter), sans-serif !important;
	font-size: var(--e-global-typography-4bf239c-font-size, 0.875rem) !important;
	font-weight: var(--e-global-typography-4bf239c-font-weight, 400) !important;
	font-style: normal !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
	color: var(--e-global-color-6cd5322, #7A6A5A) !important;
	transition: color 150ms ease, border-color 150ms ease;
}

/* Sous-niveaux : un peu plus compacts, puis plus petits à partir du 3e niveau. */
.ctbt-toc .ctbt-toc__list--depth-1 .ctbt-toc__link,
.ctbt-toc .ctbt-toc__list--depth-1 .ctbt-toc__link:hover,
.ctbt-toc .ctbt-toc__list--depth-1 .ctbt-toc__link:focus {
	padding-top: 6px !important;
	padding-bottom: 6px !important;
}

.ctbt-toc .ctbt-toc__list--depth-2 .ctbt-toc__link,
.ctbt-toc .ctbt-toc__list--depth-2 .ctbt-toc__link:hover,
.ctbt-toc .ctbt-toc__list--depth-2 .ctbt-toc__link:focus {
	padding-top: 5px !important;
	padding-bottom: 5px !important;
	font-size: 0.8125rem !important;
}

.ctbt-toc .ctbt-toc__link:hover,
.ctbt-toc .ctbt-toc__link:focus-visible,
.ctbt-toc .ctbt-toc__link.is-active,
.ctbt-toc .ctbt-toc__link.is-active:hover,
.ctbt-toc .ctbt-toc__link.is-active:focus {
	border-left-color: var(--e-global-color-4f69e6c, #8B5A2B) !important;
	color: var(--e-global-color-4f69e6c, #8B5A2B) !important;
}

.ctbt-toc .ctbt-toc__link.is-active,
.ctbt-toc .ctbt-toc__link.is-active:hover,
.ctbt-toc .ctbt-toc__link.is-active:focus {
	font-weight: var(--e-global-typography-6687ff8-font-weight, 500) !important;
}

.ctbt-toc .ctbt-toc__link:focus-visible {
	outline: 2px solid var(--e-global-color-4f69e6c, #8B5A2B);
	outline-offset: 2px;
}

/* ── Bouton replié (masqué en mode déplié) ── */
.ctbt-toc .ctbt-toc__toggle {
	display: none !important;
}

.ctbt-toc .ctbt-toc__toggle,
.ctbt-toc .ctbt-toc__toggle:hover,
.ctbt-toc .ctbt-toc__toggle:focus,
.ctbt-toc .ctbt-toc__toggle:active {
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	font-family: var(--e-global-typography-61d3dcb-font-family, Inter), sans-serif !important;
	font-size: var(--e-global-typography-61d3dcb-font-size, 0.875rem) !important;
	font-weight: var(--e-global-typography-61d3dcb-font-weight, 600) !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	text-align: left !important;
	text-transform: none !important;
	text-decoration: none !important;
	color: var(--e-global-color-3f56ae9, #2C1810) !important;
	cursor: pointer;
}

.ctbt-toc .ctbt-toc__toggle:focus-visible {
	outline: 2px solid var(--e-global-color-4f69e6c, #8B5A2B);
	outline-offset: 4px;
}

.ctbt-toc .ctbt-toc__chevron {
	flex-shrink: 0;
	color: var(--e-global-color-4f69e6c, #8B5A2B);
	transition: transform 150ms ease;
}

.ctbt-toc.is-open .ctbt-toc__chevron {
	transform: rotate(180deg);
}

/* ── Mode replié ── */
@media (max-width: 1024px) {
	.ctbt-toc.ctbt-toc--collapse-1024 {
		padding: 16px 20px;
	}

	.ctbt-toc.ctbt-toc--collapse-1024 .ctbt-toc__title {
		display: none;
	}

	.ctbt-toc.ctbt-toc--collapse-1024 .ctbt-toc__toggle {
		display: flex !important;
	}

	.ctbt-toc--collapse-1024 .ctbt-toc__panel {
		display: none;
	}

	.ctbt-toc--collapse-1024.is-open .ctbt-toc__panel {
		display: block;
		margin-top: 12px;
	}
}

@media (max-width: 767px) {
	.ctbt-toc.ctbt-toc--collapse-768 {
		padding: 16px 20px;
	}

	.ctbt-toc.ctbt-toc--collapse-768 .ctbt-toc__title {
		display: none;
	}

	.ctbt-toc.ctbt-toc--collapse-768 .ctbt-toc__toggle {
		display: flex !important;
	}

	.ctbt-toc--collapse-768 .ctbt-toc__panel {
		display: none;
	}

	.ctbt-toc--collapse-768.is-open .ctbt-toc__panel {
		display: block;
		margin-top: 12px;
	}
}

/* Écran tactile : pas de survol "collant" après un appui. */
@media (hover: none) {
	.ctbt-toc .ctbt-toc__link:hover:not(.is-active) {
		border-left-color: transparent !important;
		color: var(--e-global-color-6cd5322, #7A6A5A) !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ctbt-toc .ctbt-toc__link,
	.ctbt-toc .ctbt-toc__chevron {
		transition: none;
	}
}
