/* Auto Page TOC - front-end styles.
 * Colours come from CSS variables so themes / Elementor can override them:
 *   --apt-accent  --apt-bg  --apt-text  --apt-border
 */

.apt-toc {
	box-sizing: border-box;
	max-width: 100%;
	margin: 1.5em 0;
	padding: 1rem 1.25rem;
	background: var(--apt-bg, #f7f9fc);
	color: var(--apt-text, #1f2937);
	border: 1px solid var(--apt-border, rgba(0, 0, 0, .12));
	border-left: 4px solid var(--apt-accent, #0b63f5);
	border-radius: 6px;
	font-size: .95em;
	line-height: 1.5;
}

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

.apt-toc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.apt-toc__title {
	margin: 0;
	font-size: 1.05em;
	font-weight: 700;
	color: inherit;
}

.apt-toc__toggle {
	display: none; /* shown only once the script is running */
	margin: 0;
	padding: .15em .65em;
	background: transparent;
	color: var(--apt-accent, #0b63f5);
	border: 1px solid currentColor;
	border-radius: 4px;
	font: inherit;
	font-size: .85em;
	line-height: 1.4;
	cursor: pointer;
}

.apt-toc__toggle:hover,
.apt-toc__toggle:focus-visible {
	background: var(--apt-accent, #0b63f5);
	color: #fff;
}

.apt-js .apt-toc__toggle {
	display: inline-flex;
}

.apt-toc__list,
.apt-toc__list ol,
.apt-toc__list ul {
	margin: .6em 0 0;
	padding: 0;
	list-style: none;
}

.apt-toc__list .apt-toc__list {
	margin-top: .3em;
	margin-left: 1.25em;
}

.apt-toc__item {
	margin: .3em 0;
	padding: 0;
}

.apt-toc__link {
	color: inherit;
	text-decoration: none;
}

.apt-toc__link:hover,
.apt-toc__link:focus-visible {
	color: var(--apt-accent, #0b63f5);
	text-decoration: underline;
}

.apt-toc__link.is-active {
	color: var(--apt-accent, #0b63f5);
	font-weight: 600;
}

/* Numbering: 1, 1.1, 1.2, 2 ... via CSS counters (works with any nesting depth). */
.apt-toc--numbered ol {
	counter-reset: apt-counter;
}

.apt-toc--numbered ol > li {
	counter-increment: apt-counter;
}

.apt-toc--numbered ol > li > .apt-toc__link::before {
	content: counters(apt-counter, ".") ". ";
	color: var(--apt-accent, #0b63f5);
	font-weight: 600;
}

/* Bullets when numbering is off. */
.apt-toc:not(.apt-toc--numbered) .apt-toc__list {
	list-style: disc;
	padding-left: 1.2em;
}

.apt-toc:not(.apt-toc--numbered) .apt-toc__list .apt-toc__list {
	margin-left: 0;
}

.apt-toc:not(.apt-toc--numbered) .apt-toc__item::marker {
	color: var(--apt-accent, #0b63f5);
}

/* Collapsed (set by the script, so the list is always visible without JS). */
.apt-toc--collapsed .apt-toc__list {
	display: none;
}

/* Keep the target heading clear of a sticky header after a jump. */
.apt-toc-active :is(h1, h2, h3, h4, h5, h6)[id] {
	scroll-margin-top: var(--apt-offset, 90px);
}

/* Elementor editor preview */
.apt-toc--preview {
	border-style: dashed;
}

.apt-toc__note {
	margin: .8em 0 0;
	font-size: .8em;
	opacity: .7;
}

@media print {
	.apt-toc__toggle {
		display: none !important;
	}

	.apt-toc--collapsed .apt-toc__list {
		display: block;
	}
}
