/*
 * Sommaire Woozy TOC. L'accent se règle par --woozy-toc-accent (sinon la couleur primaire du thème, sinon
 * un gris ardoise) ; fond et texte viennent du thème. Les teintes douces passent par color-mix(), avec une
 * valeur de repli juste avant pour les navigateurs qui ne le connaissent pas.
 */
.woozy-toc,
.woozy-toc-inline {
	--woozy-toc-accent-color: var(--woozy-toc-accent, var(--wp--preset--color--primary, #475569));
}

/* Les intertitres ciblés s'arrêtent sous un en-tête collant. :where() garde la règle facile à surcharger. */
:where(h2, h3)[id] {
	scroll-margin-top: var(--woozy-toc-offset, 96px);
}
.woozy-toc-focus:focus:not(:focus-visible) {
	outline: none;
}

/* Panneau. Sa position horizontale est posée par toc.js, à côté de la colonne de texte. */
.woozy-toc {
	--woozy-toc-width: 260px;
	position: fixed;
	z-index: 90;
	top: var(--woozy-toc-top, 120px);
	left: 16px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	width: var(--woozy-toc-width);
	max-height: calc(100vh - 160px);
	border: 1px solid rgba(0, 0, 0, .1);
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 10px;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, inherit);
	box-shadow: 0 6px 24px rgba(0, 0, 0, .08);
	font-size: 14px;
	line-height: 1.4;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.woozy-toc--right {
	left: auto;
	right: 16px;
}
.woozy-toc.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity .2s ease, transform .2s ease;
}
.woozy-toc *,
.woozy-toc *::before,
.woozy-toc *::after {
	box-sizing: border-box;
}

.woozy-toc__head {
	flex: none;
}
/* Les boutons du thème ne doivent pas déteindre sur ceux du panneau. */
.woozy-toc__toggle,
.woozy-toc__collapse {
	appearance: none;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	cursor: pointer;
}
.woozy-toc__toggle {
	width: 100%;
	padding: 12px 16px;
	font-weight: 700;
	text-align: left;
}
.woozy-toc__title {
	flex: 1 1 auto;
}
.woozy-toc__fab-count {
	display: none;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	opacity: .8;
}
.woozy-toc__fab-count::before {
	content: "· ";
}
.woozy-toc__chevron {
	flex: none;
	transition: transform .2s ease;
}
.woozy-toc__toggle[aria-expanded="true"] .woozy-toc__chevron,
.woozy-toc__collapse .woozy-toc__chevron {
	transform: rotate(180deg);
}
.woozy-toc__toggle:focus-visible,
.woozy-toc__collapse:focus-visible,
.woozy-toc__item a:focus-visible {
	outline: 2px solid var(--woozy-toc-accent-color);
	outline-offset: 2px;
}

/* Corps : la piste de progression à gauche, la liste à droite, « Réduire » dessous. */
.woozy-toc__body {
	display: grid;
	flex: 1 1 auto;
	grid-template-columns: 12px minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr) auto;
	column-gap: 8px;
	min-height: 0;
	padding: 0 12px 8px 14px;
}
.woozy-toc.is-collapsed .woozy-toc__body {
	display: none;
}
.woozy-toc__track {
	position: relative;
	grid-column: 1;
	grid-row: 1;
	justify-self: center;
	width: 2px;
	margin: 8px 0;
	border-radius: 2px;
	background: rgba(0, 0, 0, .1);
	background: color-mix(in srgb, currentColor 12%, transparent);
}
.woozy-toc__progress {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 0;
	border-radius: 2px;
	background: var(--woozy-toc-accent-color);
	transition: height .15s linear;
}
.woozy-toc__dot {
	position: absolute;
	top: -4px;
	left: 50%;
	width: 8px;
	height: 8px;
	margin-left: -4px;
	border-radius: 50%;
	background: var(--woozy-toc-accent-color);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--woozy-toc-accent-color) 25%, transparent);
	transition: top .15s linear;
}
/* Positionnée, pour que toc.js lise la position des entrées par rapport à elle. */
.woozy-toc__list {
	position: relative;
	grid-column: 2;
	grid-row: 1;
	min-height: 0;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
}
.woozy-toc__item {
	margin: 0;
	padding: 0;
}
.woozy-toc__item::before,
.woozy-toc__item::marker {
	content: none;
}
.woozy-toc__item a {
	display: block;
	padding: 5px 8px;
	border-radius: 6px;
	color: inherit;
	text-decoration: none;
	opacity: .75;
}
.woozy-toc__item a:hover {
	opacity: 1;
	background: rgba(0, 0, 0, .04);
	background: color-mix(in srgb, currentColor 6%, transparent);
}
.woozy-toc__item--sub a {
	padding-left: 20px;
	font-size: 13px;
}
.woozy-toc__item.is-active a {
	opacity: 1;
	color: var(--woozy-toc-accent-color);
	font-weight: 600;
	background: rgba(0, 0, 0, .04);
	background: color-mix(in srgb, var(--woozy-toc-accent-color) 10%, transparent);
}
.woozy-toc__collapse {
	grid-column: 1 / -1;
	grid-row: 2;
	justify-self: start;
	margin-top: 6px;
	padding: 6px 8px;
	font-size: 13px;
	opacity: .7;
}
.woozy-toc__collapse:hover {
	opacity: 1;
}
.woozy-toc__counter {
	flex: none;
	padding: 8px 16px;
	border-top: 1px solid rgba(0, 0, 0, .1);
	border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	opacity: .7;
}

/*
 * Écran étroit : un bouton flottant « Sommaire · 3/10 » qui ouvre la liste en tiroir. Il se tient au-dessus
 * de la barre collante des offres (woozy-product-offers), dont la hauteur arrive par --woozy-sticky-bar-height.
 */
.woozy-toc.is-compact {
	top: auto;
	right: auto;
	bottom: calc(16px + var(--woozy-sticky-bar-height, 0px));
	width: auto;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px - var(--woozy-sticky-bar-height, 0px));
	border-radius: 999px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.woozy-toc--left.is-compact {
	left: 16px;
}
.woozy-toc--right.is-compact {
	left: auto;
	right: 16px;
}
.woozy-toc.is-compact .woozy-toc__body,
.woozy-toc.is-compact .woozy-toc__counter {
	display: none;
}
.woozy-toc.is-compact .woozy-toc__toggle {
	padding: 10px 16px;
}
.woozy-toc.is-compact .woozy-toc__fab-count {
	display: inline;
}
.woozy-toc.is-compact.is-open {
	left: 16px;
	right: 16px;
	width: auto;
	max-height: min(70vh, calc(100vh - 32px - var(--woozy-sticky-bar-height, 0px)));
	border-radius: 12px;
}
.woozy-toc.is-compact.is-open .woozy-toc__body {
	display: grid;
}

/* Sommaire replié en tête d'article. */
.woozy-toc-inline {
	margin: 0 0 1.5em;
	padding: 12px 16px;
	border: 1px solid rgba(0, 0, 0, .1);
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 8px;
}
.woozy-toc-inline__summary {
	cursor: pointer;
	font-weight: 700;
}
.woozy-toc-inline__list {
	margin: 10px 0 0;
	padding-left: 1.2em;
}
.woozy-toc-inline__item--sub {
	margin-left: 1.2em;
}
.woozy-toc-inline a {
	color: var(--woozy-toc-accent-color);
}

@media (prefers-reduced-motion: reduce) {
	.woozy-toc,
	.woozy-toc.is-visible,
	.woozy-toc * {
		transition: none;
	}
}
@media print {
	.woozy-toc {
		display: none;
	}
}
