/**
 * Luminous Page Tree
 * Front-end styles.
 */

.lpt-tree {
	--lpt-text: #16181d;
	--lpt-link: #16181d;
	--lpt-link-hover: #0b4a8a;
	--lpt-current: #0b4a8a;
	--lpt-current-bg: rgba(11, 74, 138, 0.09);
	--lpt-marker: #55606f;
	--lpt-guide: rgba(0, 0, 0, 0.18);
	--lpt-hover-bg: rgba(0, 0, 0, 0.04);
	--lpt-focus: #0b4a8a;
	--lpt-accent: #0b4a8a;
	--lpt-head-bg: rgba(11, 74, 138, 0.07);
	--lpt-indent: 0.85em;
	--lpt-gap: 0.55em;
	--lpt-radius: 5px;

	color: var(--lpt-text);
	font-size: 1em;
	line-height: 1.45;
}

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

.lpt-tree .lpt-list::before,
.lpt-tree .lpt-item::before {
	content: none;
}

.lpt-tree .lpt-children {
	margin: 0 0 0 var(--lpt-indent);
	padding-left: var(--lpt-indent);
	border-left: 1px solid var(--lpt-guide);
}

.lpt-tree .lpt-item {
	margin: 0;
	padding: 0;
}

.lpt-tree .lpt-row {
	display: flex;
	align-items: flex-start;
	gap: 0.15em;
}

.lpt-tree .lpt-link {
	flex: 1 1 auto;
	display: flex;
	align-items: flex-start;
	gap: var(--lpt-gap);
	min-width: 0;
	padding: 0.28em 0.4em;
	border-radius: var(--lpt-radius);
	color: var(--lpt-link);
	text-decoration: none;
	box-shadow: none;
}

.lpt-tree .lpt-link:hover,
.lpt-tree .lpt-link:focus {
	color: var(--lpt-link-hover);
	background: var(--lpt-hover-bg);
	text-decoration: underline;
}

.lpt-tree .lpt-link:focus-visible,
.lpt-tree .lpt-toggle:focus-visible {
	outline: 2px solid var(--lpt-focus);
	outline-offset: 1px;
}

.lpt-tree .lpt-label {
	min-width: 0;
	overflow-wrap: break-word;
}

/* Current page. */

.lpt-tree .lpt-current > .lpt-row > .lpt-link {
	color: var(--lpt-current);
	background: var(--lpt-current-bg);
	font-weight: 600;
}

.lpt-tree .lpt-ancestor > .lpt-row > .lpt-link {
	font-weight: 600;
}

.lpt-tree .lpt-item-root > .lpt-row > .lpt-link {
	font-weight: 700;
	font-size: 1.02em;
	text-decoration: none;
}

.lpt-tree .lpt-item-root > .lpt-row > .lpt-link:hover,
.lpt-tree .lpt-item-root > .lpt-row > .lpt-link:focus {
	text-decoration: none;
}

/* The starting page heads the list rather than sitting in it, so it takes no marker. */

.lpt-tree:not(.lpt-root-item) .lpt-item-root > .lpt-row > .lpt-link::before {
	display: none;
}

/* Markers. */

.lpt-tree .lpt-link::before {
	content: "";
	flex: 0 0 auto;
	display: block;
	width: 0.42em;
	height: 0.42em;
	margin-top: 0.52em;
	border-radius: 50%;
	background: var(--lpt-marker);
}

.lpt-tree.lpt-marker-none .lpt-link::before {
	display: none;
}

.lpt-tree.lpt-marker-ring .lpt-link::before {
	background: transparent;
	border: 2px solid var(--lpt-marker);
	box-sizing: border-box;
	width: 0.5em;
	height: 0.5em;
	margin-top: 0.48em;
}

.lpt-tree.lpt-marker-square .lpt-link::before {
	border-radius: 1px;
}

.lpt-tree.lpt-marker-diamond .lpt-link::before {
	border-radius: 1px;
	transform: rotate(45deg);
}

.lpt-tree.lpt-marker-dash .lpt-link::before {
	width: 0.6em;
	height: 2px;
	border-radius: 2px;
	margin-top: 0.68em;
}

.lpt-tree.lpt-marker-bar .lpt-link::before {
	width: 3px;
	height: 1em;
	border-radius: 2px;
	margin-top: 0.25em;
}

.lpt-tree.lpt-marker-chevron .lpt-link::before {
	width: 0;
	height: 0;
	background: none;
	border-radius: 0;
	border-top: 0.3em solid transparent;
	border-bottom: 0.3em solid transparent;
	border-left: 0.38em solid var(--lpt-marker);
	margin-top: 0.5em;
}

.lpt-tree.lpt-marker-custom .lpt-link::before {
	content: var(--lpt-marker-char, "\2022");
	width: auto;
	height: auto;
	background: none;
	border-radius: 0;
	margin-top: 0;
	color: var(--lpt-marker);
	line-height: 1.45;
}

.lpt-tree .lpt-current > .lpt-row > .lpt-link::before,
.lpt-tree .lpt-link:hover::before {
	--lpt-marker: currentColor;
}

/* Accordion toggle. */

.lpt-tree .lpt-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	min-width: 1.9em;
	height: 1.9em;
	padding: 0 0.3em;
	border: 1px solid transparent;
	margin: 0;
	padding: 0;
	background: none;
	border-radius: var(--lpt-radius);
	color: inherit;
	cursor: pointer;
	line-height: 1;
	-webkit-appearance: none;
	appearance: none;
}

/* Items that open: give the control a visible affordance. */

.lpt-tree .lpt-has-children > .lpt-row > .lpt-toggle {
	border-color: var(--lpt-guide);
	background: var(--lpt-hover-bg);
}

.lpt-tree .lpt-toggle:hover {
	background: var(--lpt-current-bg);
	border-color: var(--lpt-current);
	color: var(--lpt-link-hover);
}

.lpt-tree .lpt-has-children > .lpt-row > .lpt-link {
	font-weight: 500;
}

.lpt-tree .lpt-caret {
	display: block;
	width: 0.42em;
	height: 0.42em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transform-origin: center;
	transition: transform 0.2s ease;
	opacity: 0.8;
}

.lpt-tree .lpt-item.is-open > .lpt-row > .lpt-toggle .lpt-caret {
	transform: rotate(45deg);
}

.lpt-tree .lpt-children.is-animating {
	overflow: hidden;
	transition: height 0.24s ease;
}

.lpt-tree [hidden] {
	display: none;
}

/* Screen reader text. */

.lpt-tree .lpt-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Dark mode. */

@media (prefers-color-scheme: dark) {
	.lpt-tree.lpt-auto-dark {
		--lpt-text: #e6e9ef;
		--lpt-link: #e6e9ef;
		--lpt-link-hover: #8ab7ef;
		--lpt-current: #8ab7ef;
		--lpt-current-bg: rgba(138, 183, 239, 0.14);
		--lpt-marker: #8c96a8;
		--lpt-guide: rgba(255, 255, 255, 0.16);
		--lpt-hover-bg: rgba(255, 255, 255, 0.07);
		--lpt-focus: #8ab7ef;
	--lpt-accent: #8ab7ef;
	--lpt-head-bg: rgba(138, 183, 239, 0.13);
	}
}

.fanrev-dark .lpt-tree,
.lpt-dark .lpt-tree,
.lpt-tree.lpt-dark {
	--lpt-text: #e6e9ef;
	--lpt-link: #e6e9ef;
	--lpt-link-hover: #8ab7ef;
	--lpt-current: #8ab7ef;
	--lpt-current-bg: rgba(138, 183, 239, 0.14);
	--lpt-marker: #8c96a8;
	--lpt-guide: rgba(255, 255, 255, 0.16);
	--lpt-hover-bg: rgba(255, 255, 255, 0.07);
	--lpt-focus: #8ab7ef;
	--lpt-accent: #8ab7ef;
	--lpt-head-bg: rgba(138, 183, 239, 0.13);
}

@media (prefers-reduced-motion: reduce) {
	.lpt-tree .lpt-caret,
	.lpt-tree .lpt-children.is-animating {
		transition: none;
	}
}

/* Theme colour inheritance. */

.lpt-tree.lpt-theme-colors {
	color: inherit;
}

.lpt-tree.lpt-theme-colors .lpt-link {
	color: inherit;
}

.lpt-tree.lpt-theme-colors .lpt-link:hover,
.lpt-tree.lpt-theme-colors .lpt-link:focus,
.lpt-tree.lpt-theme-colors .lpt-current > .lpt-row > .lpt-link {
	color: inherit;
}

/* Groups. */

.lpt-tree .lpt-group > .lpt-group-row {
	margin: 0.1em 0;
}

.lpt-tree .lpt-group-button,
.lpt-tree .lpt-group-heading {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	gap: 0.5em;
	width: 100%;
	min-width: 0;
	height: auto;
	margin: 0;
	padding: 0.32em 0.4em;
	background: none;
	border: 0;
	border-radius: var(--lpt-radius);
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.lpt-tree .lpt-group-heading {
	cursor: default;
}

.lpt-tree .lpt-group-button:hover {
	background: var(--lpt-hover-bg);
	color: var(--lpt-link-hover);
}

.lpt-tree .lpt-group-button .lpt-caret {
	flex: 0 0 auto;
	margin-left: 0.1em;
	margin-right: 0.15em;
}

.lpt-tree .lpt-group-label {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: break-word;
}

.lpt-tree .lpt-group-count {
	flex: 0 0 auto;
	padding: 0.05em 0.5em;
	border-radius: 999px;
	background: var(--lpt-hover-bg);
	border: 1px solid var(--lpt-guide);
	font-size: 0.78em;
	font-weight: 600;
	line-height: 1.6;
	opacity: 0.85;
}

.lpt-tree .lpt-group-current > .lpt-row > .lpt-group-button {
	color: var(--lpt-current);
}

.lpt-tree .lpt-group-list {
	margin-left: 0.6em;
	padding-left: 0.85em;
}

/* Plus / minus toggle style. */

.lpt-tree.lpt-toggle-plus .lpt-caret {
	position: relative;
	width: 0.72em;
	height: 0.72em;
	border: 0;
	transform: none;
	opacity: 1;
}

.lpt-tree.lpt-toggle-plus .lpt-caret::before,
.lpt-tree.lpt-toggle-plus .lpt-caret::after {
	content: "";
	position: absolute;
	background: currentColor;
	border-radius: 1px;
}

.lpt-tree.lpt-toggle-plus .lpt-caret::before {
	left: 0;
	top: 50%;
	width: 100%;
	height: 2px;
	margin-top: -1px;
}

.lpt-tree.lpt-toggle-plus .lpt-caret::after {
	top: 0;
	left: 50%;
	width: 2px;
	height: 100%;
	margin-left: -1px;
	transform: scaleY(1);
	transition: transform 0.2s ease;
}

.lpt-tree.lpt-toggle-plus .lpt-item.is-open > .lpt-row > .lpt-toggle .lpt-caret {
	transform: none;
}

.lpt-tree.lpt-toggle-plus .lpt-item.is-open > .lpt-row > .lpt-toggle .lpt-caret::after {
	transform: scaleY(0);
}

@media (prefers-reduced-motion: reduce) {
	.lpt-tree.lpt-toggle-plus .lpt-caret::after {
		transition: none;
	}
}

/* Items whose children open further pages of their own. */

.lpt-tree .lpt-caret-echo {
	margin-left: -0.26em;
	opacity: 0.45;
}

.lpt-tree .lpt-has-grandchildren > .lpt-row > .lpt-toggle {
	border-color: var(--lpt-marker);
}

.lpt-tree .lpt-has-grandchildren > .lpt-row > .lpt-toggle:hover .lpt-caret-echo {
	opacity: 0.8;
}

/* The doubled chevron does not read as a plus, so the stacked look carries it there. */

.lpt-tree.lpt-toggle-plus .lpt-caret-echo {
	display: none;
}

.lpt-tree.lpt-toggle-plus .lpt-has-grandchildren > .lpt-row > .lpt-toggle {
	box-shadow: 0.22em 0.22em 0 -1px var(--lpt-hover-bg), 0.22em 0.22em 0 0 var(--lpt-guide);
}

.lpt-tree.lpt-toggle-plus .lpt-has-grandchildren > .lpt-row > .lpt-toggle:hover {
	box-shadow: 0.22em 0.22em 0 -1px var(--lpt-current-bg), 0.22em 0.22em 0 0 var(--lpt-current);
}

.lpt-tree .lpt-group.lpt-has-grandchildren > .lpt-row > .lpt-group-button {
	box-shadow: none;
}

/* Top page as a heading. */

.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row {
	align-items: center;
	margin: 0 0 0.45em;
	padding: 0.2em 0.25em 0.2em 0.55em;
	background: var(--lpt-head-bg);
	border-left: 4px solid var(--lpt-accent);
	border-radius: var(--lpt-radius);
}

.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row > .lpt-link {
	padding-left: 0.15em;
	font-size: 1.06em;
	font-weight: 700;
	color: var(--lpt-accent);
}

.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row > .lpt-link:hover,
.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row > .lpt-link:focus,
.lpt-tree.lpt-root-header .lpt-item-root.lpt-current > .lpt-row > .lpt-link {
	background: transparent;
}

.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row > .lpt-link:hover {
	color: var(--lpt-link-hover);
}

.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row > .lpt-toggle {
	color: var(--lpt-accent);
	border-color: transparent;
	background: transparent;
}

.lpt-tree.lpt-root-header .lpt-item-root > .lpt-row > .lpt-toggle:hover {
	background: var(--lpt-hover-bg);
}

/* Top page as plain bold text. */

.lpt-tree.lpt-root-plain .lpt-item-root > .lpt-row > .lpt-link {
	font-size: 1.04em;
	font-weight: 700;
}

.lpt-tree.lpt-root-plain .lpt-item-root.lpt-current > .lpt-row > .lpt-link {
	background: transparent;
}
