
/**
 * Coaderhub Table of Contents
 * Frontend styles.
 */

.coaderhub-toc,
.coaderhub-toc * {
	box-sizing: border-box;
}

/* =========================================
   MAIN TOC
========================================= */

.coaderhub-toc {
	display: block;
	position: relative;
	width: 280px;
	max-width: 100%;
	margin-top: var(--coaderhub-toc-margin-top, 0);
	margin-right: var(--coaderhub-toc-margin-right, 24px);
	margin-bottom: var(--coaderhub-toc-margin-bottom, 28px);
	margin-left: var(--coaderhub-toc-margin-left, 0);
	padding: 0;
	border: 1px solid #e1e5ea;
	border-radius: 8px;
	background: #ffffff;
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
	overflow: hidden;
	font-size: 15px;
	line-height: 1.5;
}

.coaderhub-toc--full {
	width: 100%;
	max-width: 100%;
}

.coaderhub-toc--compact {
	width: 280px;
	max-width: 100%;
}

.coaderhub-toc--sidebar {
	width: 100%;
	max-width: 100%;
	margin: 0;
}

/* =========================================
   HEADER
========================================= */

.coaderhub-toc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 18px 14px;
	background: #ffffff;
	border-bottom: 1px solid #f0f1f3;
}

.coaderhub-toc__heading {
	min-width: 0;
}

.coaderhub-toc__title {
	display: block;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	color: #111827;
	letter-spacing: -0.2px;
}

.coaderhub-toc__count {
	display: block;
	margin-top: 3px;
	font-size: 12px;
	line-height: 1.4;
	color: #6b7280;
}

/* =========================================
   TOGGLE
========================================= */

.coaderhub-toc__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	gap: 5px;
	min-height: 32px;
	padding: 5px 9px;
	border: 1px solid #dfe3e8;
	border-radius: 7px;
	background: #ffffff;
	color: #6b7280;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
}

.coaderhub-toc__toggle:hover {
	background: #f8fafc;
	color: #374151;
}

.coaderhub-toc__toggle-icon {
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(225deg);
	transition: transform 0.2s ease;
}

.coaderhub-toc__toggle[aria-expanded="false"]
.coaderhub-toc__toggle-icon {
	transform: rotate(45deg);
}

/* =========================================
   SCROLLABLE BODY
========================================= */

.coaderhub-toc__body {
	height: 350px;
	max-height: 350px;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #cbd1d9 transparent;
}

.coaderhub-toc__body::-webkit-scrollbar {
	width: 5px;
}

.coaderhub-toc__body::-webkit-scrollbar-track {
	background: transparent;
}

.coaderhub-toc__body::-webkit-scrollbar-thumb {
	background: #cbd1d9;
	border-radius: 20px;
}

.coaderhub-toc__body::-webkit-scrollbar-thumb:hover {
	background: #aeb6c1;
}

/* =========================================
   LIST
========================================= */

.coaderhub-toc__list {
	margin: 0;
	padding: 8px 0 16px;
	list-style: none;
	counter-reset: toc-item;
}

.coaderhub-toc__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-increment: toc-item;
}

/* =========================================
   LINKS
========================================= */

.coaderhub-toc__link {
	position: relative;
	display: block;
	margin: 0;
	padding: 6px 12px 6px 42px;
	color: #526176;
	text-decoration: none;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	border: 0;
	border-left: 0;
	border-radius: 0;
	background: transparent;
	transition:
		background-color 0.15s ease,
		color 0.15s ease,
		font-weight 0.15s ease;
}

/* =========================================
   BULLET
========================================= */

.coaderhub-toc__link::before {
	content: "";
	position: absolute;
	left: 17px;
	top: 50%;
	width: 15px;
	height: 15px;
	border: 1.5px solid #718096;
	border-radius: 50%;
	background: #ffffff;
	transform: translateY(-50%);
	z-index: 2;
}

.coaderhub-toc__link::after {
	display: none;
}

/* =========================================
   INDENTATION
========================================= */

.coaderhub-toc__item--indent-1 {
	padding-left: 28px;
}

.coaderhub-toc__item--indent-2 {
	padding-left: 56px;
}

.coaderhub-toc__item--indent-3 {
	padding-left: 84px;
}

.coaderhub-toc__item--indent-4 {
	padding-left: 112px;
}

/* =========================================
   CHILD LINK PADDING
========================================= */

.coaderhub-toc__item--indent-1 > .coaderhub-toc__link,
.coaderhub-toc__item--indent-2 > .coaderhub-toc__link,
.coaderhub-toc__item--indent-3 > .coaderhub-toc__link,
.coaderhub-toc__item--indent-4 > .coaderhub-toc__link {
	padding-left: 30px;
}

/* =========================================
   CHILD BULLETS
========================================= */

.coaderhub-toc__item--indent-1 > .coaderhub-toc__link::before {
	left: 15px;
	width: 14px;
	height: 14px;
}

.coaderhub-toc__item--indent-2 > .coaderhub-toc__link::before {
	left: 43px;
	width: 14px;
	height: 14px;
}

.coaderhub-toc__item--indent-3 > .coaderhub-toc__link::before {
	left: 71px;
	width: 14px;
	height: 14px;
}

.coaderhub-toc__item--indent-4 > .coaderhub-toc__link::before {
	left: 99px;
	width: 14px;
	height: 14px;
}

/* =========================================
   VERTICAL HIERARCHY LINES
========================================= */

.coaderhub-toc__item--indent-1::before,
.coaderhub-toc__item--indent-2::before,
.coaderhub-toc__item--indent-3::before,
.coaderhub-toc__item--indent-4::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 1px;
	background: #d9dee6;
	z-index: 0;
}

.coaderhub-toc__item--indent-1::before {
	left: 28px;
}

.coaderhub-toc__item--indent-2::before {
	left: 56px;
}

.coaderhub-toc__item--indent-3::before {
	left: 84px;
}

.coaderhub-toc__item--indent-4::before {
	left: 112px;
}

/* =========================================
   HOVER
========================================= */

.coaderhub-toc__link:hover {
	background: #fafafa;
	color: #111827;
}

/* =========================================
   ACTIVE ITEM
========================================= */

.coaderhub-toc__link.is-active {
	background: #fff0eb;
	color: #f15a29;
	font-weight: 600;
}

.coaderhub-toc__link.is-active::before {
	left: 16px;
	width: 18px;
	height: 18px;
	border: 0;
	background: #f15a29;
}

.coaderhub-toc__link.is-active::after {
	display: flex;
	content: counter(toc-item);
	position: absolute;
	left: 16px;
	top: 50%;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	color: #ffffff;
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	background: transparent;
	transform: translateY(-50%);
	z-index: 3;
}

/* =========================================
   LAYOUT
========================================= */

.coaderhub-toc-layout {
	display: grid !important;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: 40px;
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	align-items: start;
	box-sizing: border-box;
}

.coaderhub-toc-layout--right {
	grid-template-columns: minmax(0, 1fr) 280px;
}

.coaderhub-toc-layout__sidebar {
	display: block;
	width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0;
}

.coaderhub-toc-layout__content {
	display: block;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	margin: 0;
	padding: 0;
}

.coaderhub-toc-layout__content > * {
	max-width: 100%;
}

.coaderhub-toc-layout__sidebar .coaderhub-toc {
	width: 100%;
	max-width: 100%;
	margin: 0;
}

/* =========================================
   STICKY
========================================= */

.coaderhub-toc--sticky {
	position: sticky;
	top: 24px;
}

.coaderhub-toc-layout__sidebar .coaderhub-toc--sticky {
	position: sticky;
	top: 24px;
}

/* =========================================
   COLLAPSED
========================================= */

.coaderhub-toc__body[hidden] {
	display: none !important;
}

/* =========================================
   TABLET
========================================= */

@media (max-width: 1000px) {
	.coaderhub-toc-layout,
	.coaderhub-toc-layout--right {
		grid-template-columns: 250px minmax(0, 1fr);
		gap: 28px;
	}

	.coaderhub-toc-layout--right {
		grid-template-columns: minmax(0, 1fr) 250px;
	}

	.coaderhub-toc {
		width: 250px;
	}

	.coaderhub-toc--compact {
		width: 250px;
	}

	.coaderhub-toc__body {
		height: 350px;
		max-height: 350px;
	}
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 767px) {
	.coaderhub-toc-layout,
	.coaderhub-toc-layout--right {
		display: block !important;
		width: 100% !important;
	}

	.coaderhub-toc-layout__sidebar {
		width: 100%;
		margin-bottom: 24px;
	}

	.coaderhub-toc-layout__content {
		width: 100%;
	}

	.coaderhub-toc,
	.coaderhub-toc--compact,
	.coaderhub-toc--full,
	.coaderhub-toc--sidebar {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	.coaderhub-toc__header {
		padding: 16px 18px 13px;
	}

	.coaderhub-toc__title {
		font-size: 19px;
	}

	.coaderhub-toc__body {
		height: 320px;
		max-height: 320px;
	}

	.coaderhub-toc__item--indent-1 {
		padding-left: 22px;
	}

	.coaderhub-toc__item--indent-2 {
		padding-left: 44px;
	}

	.coaderhub-toc__item--indent-3 {
		padding-left: 66px;
	}

	.coaderhub-toc__item--indent-4 {
		padding-left: 88px;
	}

	.coaderhub-toc__item--indent-1::before {
		left: 22px;
	}

	.coaderhub-toc__item--indent-2::before {
		left: 44px;
	}

	.coaderhub-toc__item--indent-3::before {
		left: 66px;
	}

	.coaderhub-toc__item--indent-4::before {
		left: 88px;
	}

	.coaderhub-toc__item--indent-1 > .coaderhub-toc__link::before {
		left: 11px;
	}

	.coaderhub-toc__item--indent-2 > .coaderhub-toc__link::before {
		left: 33px;
	}

	.coaderhub-toc__item--indent-3 > .coaderhub-toc__link::before {
		left: 55px;
	}

	.coaderhub-toc__item--indent-4 > .coaderhub-toc__link::before {
		left: 77px;
	}

	.coaderhub-toc--sticky,
	.coaderhub-toc-layout__sidebar .coaderhub-toc--sticky {
		position: relative;
		top: auto;
	}
}

/* =========================================
   BULLET OVERLAP FIX
========================================= */

.coaderhub-toc__item--indent-1 > .coaderhub-toc__link,
.coaderhub-toc__item--indent-2 > .coaderhub-toc__link,
.coaderhub-toc__item--indent-3 > .coaderhub-toc__link,
.coaderhub-toc__item--indent-4 > .coaderhub-toc__link {
	padding-left: 42px;
}

.coaderhub-toc__item--indent-1 > .coaderhub-toc__link::before,
.coaderhub-toc__item--indent-2 > .coaderhub-toc__link::before,
.coaderhub-toc__item--indent-3 > .coaderhub-toc__link::before,
.coaderhub-toc__item--indent-4 > .coaderhub-toc__link::before {
	left: 15px;
}

@media (max-width: 767px) {
	.coaderhub-toc__item--indent-1 > .coaderhub-toc__link,
	.coaderhub-toc__item--indent-2 > .coaderhub-toc__link,
	.coaderhub-toc__item--indent-3 > .coaderhub-toc__link,
	.coaderhub-toc__item--indent-4 > .coaderhub-toc__link {
		padding-left: 36px;
	}

	.coaderhub-toc__item--indent-1 > .coaderhub-toc__link::before,
	.coaderhub-toc__item--indent-2 > .coaderhub-toc__link::before,
	.coaderhub-toc__item--indent-3 > .coaderhub-toc__link::before,
	.coaderhub-toc__item--indent-4 > .coaderhub-toc__link::before {
		left: 11px;
	}
}

/* =========================================
   ACCESSIBILITY: KEYBOARD FOCUS
========================================= */

.coaderhub-toc .coaderhub-toc__link:focus-visible,
.coaderhub-toc .coaderhub-toc__toggle:focus-visible {
	outline: 3px solid #7c3aed !important;
	outline-offset: -3px;
	position: relative;
	z-index: 10;
	box-shadow: inset 0 0 0 1px #ffffff;
}

.coaderhub-toc .coaderhub-toc__link:focus-visible {
	background-color: #fff0eb !important;
	color: #9a3412 !important;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.coaderhub-toc .coaderhub-toc__toggle:focus-visible {
	background-color: #ffffff !important;
	color: #111827 !important;
}

.coaderhub-toc-layout__content :is(
	h1, h2, h3, h4, h5, h6
):focus {
	outline: 2px solid #7c3aed;
	outline-offset: 4px;
}

/* =========================================
   ACCESSIBILITY: HIGH CONTRAST
========================================= */

@media (forced-colors: active) {
	.coaderhub-toc {
		border: 1px solid CanvasText;
	}

	.coaderhub-toc__title,
	.coaderhub-toc__count,
	.coaderhub-toc__link,
	.coaderhub-toc__toggle {
		color: CanvasText;
	}

	.coaderhub-toc__header,
	.coaderhub-toc__toggle,
	.coaderhub-toc__link {
		background: Canvas;
	}

	.coaderhub-toc__link::before {
		border: 1px solid CanvasText;
		background: Canvas;
	}

	.coaderhub-toc__link.is-active {
		border: 2px solid Highlight;
		color: Highlight;
	}

	.coaderhub-toc .coaderhub-toc__link:focus,
	.coaderhub-toc .coaderhub-toc__toggle:focus {
		outline: 3px solid Highlight !important;
		outline-offset: -3px;
		box-shadow: none;
	}

	.coaderhub-toc__item--indent-1::before,
	.coaderhub-toc__item--indent-2::before,
	.coaderhub-toc__item--indent-3::before,
	.coaderhub-toc__item--indent-4::before {
		background: CanvasText;
	}
}

/* =========================================
   ACCESSIBILITY: REDUCED MOTION
========================================= */

@media (prefers-reduced-motion: reduce) {
	.coaderhub-toc *,
	.coaderhub-toc *::before,
	.coaderhub-toc *::after {
		scroll-behavior: auto !important;
		animation: none !important;
		transition: none !important;
	}
}