/* JoomexToc — override the variables below in your template CSS to restyle. */
:root {
	--joomextoc-accent: #0a7cff;
	--joomextoc-text: #1f2937;
	--joomextoc-muted: #9aa5b8;
	--joomextoc-bg: #fff;
	--joomextoc-border: #e5e7eb;
	--joomextoc-radius: 18px;
	--joomextoc-fab-bottom: 96px;
	--joomextoc-z: 1050;
}

.joomextoc-target {
	scroll-margin-top: var(--joomextoc-offset, 16px);
}

/* ---------- Inline box ---------- */
.joomextoc {
	box-sizing: border-box;
	margin: 0 0 1.75rem;
	padding: 1.25rem 1.5rem;
	background: var(--joomextoc-bg);
	color: var(--joomextoc-text);
	border: 1px solid var(--joomextoc-border);
	border-radius: var(--joomextoc-radius);
	box-shadow: 0 2px 12px rgba(15, 23, 42, .05);
	line-height: 1.7;
}

.joomextoc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: .75rem;
}

.joomextoc__title {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	font-weight: 700;
	font-size: 1.1em;
}

.joomextoc__icon {
	color: var(--joomextoc-muted);
	flex: none;
}

.joomextoc__count {
	color: var(--joomextoc-muted);
	font-size: .95em;
	white-space: nowrap;
}

.joomextoc__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.joomextoc__item {
	margin: 0;
	padding: 0;
}

.joomextoc__item--d1 { padding-inline-start: 1.25rem; }
.joomextoc__item--d2 { padding-inline-start: 2.5rem; }
.joomextoc__item--d3 { padding-inline-start: 3.75rem; }

.joomextoc__link {
	display: flex;
	align-items: baseline;
	gap: .75rem;
	padding: .55rem .25rem;
	color: inherit;
	text-decoration: none;
	font-weight: 600;
	transition: color .15s;
}

.joomextoc__link::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #cfd6e4;
	transform: translateY(-1px);
	transition: background .15s;
}

.joomextoc__item--d1 .joomextoc__link,
.joomextoc__item--d2 .joomextoc__link,
.joomextoc__item--d3 .joomextoc__link {
	font-weight: 400;
}

.joomextoc__link:hover,
.joomextoc__link:focus-visible {
	color: var(--joomextoc-accent);
}

.joomextoc__link.is-active {
	color: var(--joomextoc-accent);
}

.joomextoc__link.is-active::before {
	background: var(--joomextoc-accent);
}

/* ---------- Floating button ---------- */
.joomextoc-end {
	height: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.joomextoc-fab {
	position: fixed;
	right: 6px;
	bottom: var(--joomextoc-fab-bottom);
	z-index: calc(var(--joomextoc-z) + 3);
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: 64px;
	height: 68px;
	margin: 0;
	padding: 0 4px;
	font: inherit;
	font-size: 12px;
	line-height: 1.3;
	color: var(--joomextoc-text);
	background: var(--joomextoc-bg);
	border: 0;
	border-radius: 14px;
	box-shadow: 0 4px 18px rgba(15, 23, 42, .18);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: scale(.9);
	transition: opacity .2s, transform .2s, visibility .2s;
	-webkit-tap-highlight-color: transparent;
}

.joomextoc-fab--plain {
	border: 2px solid var(--joomextoc-accent);
}

.joomextoc-fab.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.joomextoc-fab__icon {
	display: block;
	flex: none;
}

.joomextoc-fab__label {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Reading-progress ring drawn around the button. */
.joomextoc-fab__ring {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	overflow: visible;
}

.joomextoc-fab__track,
.joomextoc-fab__bar {
	fill: none;
	stroke-width: 3;
}

.joomextoc-fab__track {
	stroke: var(--joomextoc-border);
}

.joomextoc-fab__bar {
	stroke: var(--joomextoc-accent);
	stroke-linecap: round;
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
	transition: stroke-dashoffset .12s linear;
}

.joomextoc-fab:focus-visible {
	outline: 2px solid var(--joomextoc-accent);
	outline-offset: 3px;
}

/* ---------- Popup ---------- */
.joomextoc-backdrop {
	position: fixed;
	inset: 0;
	z-index: calc(var(--joomextoc-z) + 1);
	background: rgba(15, 23, 42, .45);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s, visibility .2s;
}

.joomextoc-popup {
	position: fixed;
	right: 12px;
	bottom: calc(var(--joomextoc-fab-bottom) + 72px);
	z-index: calc(var(--joomextoc-z) + 2);
	box-sizing: border-box;
	width: min(420px, calc(100vw - 24px));
	max-height: calc(100vh - var(--joomextoc-fab-bottom) - 96px);
	max-height: calc(100dvh - var(--joomextoc-fab-bottom) - 96px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: .75rem 1rem;
	background: var(--joomextoc-bg);
	color: var(--joomextoc-text);
	border-radius: var(--joomextoc-radius);
	box-shadow: 0 12px 40px rgba(15, 23, 42, .3);
	line-height: 1.7;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) scale(.98);
	transform-origin: bottom right;
	transition: opacity .2s, transform .2s, visibility .2s;
}

.joomextoc-popup .joomextoc__list {
	margin: 0;
}

.joomextoc-open .joomextoc-backdrop,
.joomextoc-open .joomextoc-popup {
	opacity: 1;
	visibility: visible;
}

.joomextoc-open .joomextoc-popup {
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.joomextoc-fab__bar,
	.joomextoc-fab,
	.joomextoc-backdrop,
	.joomextoc-popup {
		transition: none;
	}
}

@media print {
	.joomextoc-fab,
	.joomextoc-backdrop,
	.joomextoc-popup {
		display: none !important;
	}
}

/* Link back to the start of the article (first item in the list). */
.joomextoc__link--top::before {
	background: transparent;
	box-shadow: inset 0 0 0 2px #cfd6e4;
}

.joomextoc__link--top:hover::before,
.joomextoc__link--top:focus-visible::before {
	box-shadow: inset 0 0 0 2px var(--joomextoc-accent);
}

/* ---------- Isolation from template styles ----------
   Templates often style every link / list / nav inside the article area (colored buttons, floats, narrow
   boxes). These selectors are intentionally specific so the table of contents looks the same everywhere. */
html body nav.joomextoc {
	display: block;
	float: none;
	clear: both;
	flex: 0 0 100%;
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	margin: 0 0 1.75rem;
	padding: 1.25rem 1.5rem;
	background: var(--joomextoc-bg);
	color: var(--joomextoc-text);
	border: 1px solid var(--joomextoc-border);
	border-radius: var(--joomextoc-radius);
	text-align: start;
	font-size: 1rem;
	line-height: 1.7;
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list {
	display: block;
	float: none;
	width: auto;
	margin: 0;
	padding: 0;
	list-style: none;
	background: none;
	border: 0;
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item {
	display: block;
	float: none;
	width: auto;
	margin: 0;
	padding-block: 0;
	padding-inline-end: 0;
	list-style: none;
	background: none;
	border: 0;
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d0 { padding-inline-start: 0; }
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d1 { padding-inline-start: 1.25rem; }
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d2 { padding-inline-start: 2.5rem; }
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d3 { padding-inline-start: 3.75rem; }
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d4 { padding-inline-start: 5rem; }
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d5 { padding-inline-start: 6.25rem; }

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link {
	display: flex !important;
	align-items: baseline;
	gap: .75rem;
	float: none;
	width: auto;
	margin: 0;
	padding: .55rem .25rem;
	background: none !important;
	box-shadow: none !important;
	border: 0 !important;
	border-radius: 0;
	color: var(--joomextoc-text) !important;
	text-decoration: none !important;
	font-size: inherit;
	font-weight: 600;
	line-height: inherit;
	text-align: start;
	text-transform: none;
	letter-spacing: normal;
	white-space: normal;
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d1 a.joomextoc__link,
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d2 a.joomextoc__link,
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d3 a.joomextoc__link,
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d4 a.joomextoc__link,
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item--d5 a.joomextoc__link {
	font-weight: 400;
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link:hover,
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link:focus-visible,
html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link.is-active {
	color: var(--joomextoc-accent) !important;
	background: none !important;
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	margin: 0;
	border-radius: 50%;
	background: #cfd6e4;
	transform: translateY(-1px);
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link.is-active::before {
	background: var(--joomextoc-accent);
}

html body :is(nav.joomextoc, div.joomextoc-popup) ul.joomextoc__list li.joomextoc__item a.joomextoc__link--top::before {
	background: transparent;
	box-shadow: inset 0 0 0 2px #cfd6e4;
}

html body nav.joomextoc .joomextoc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin: 0 0 .75rem;
	padding: 0;
	background: none;
	border: 0;
}

html body button.joomextoc-fab {
	min-width: 0;
	text-transform: none;
	letter-spacing: normal;
}

/* The "start of article" item exists for the popup only: hide it in the list inside the article, even before the script runs. */
html body nav.joomextoc ul.joomextoc__list li.joomextoc__item.joomextoc__item--top {
	display: none;
}
