/* Krishna TOC for YOOtheme — v2.1.1
 * Deliberately thin. Layout, type and colour come from UIkit / your
 * YOOtheme style set; this file only adds what UIkit has no class for.
 */

/* Keep anchored headings clear of a sticky navbar. */
.ktoc-heading {
	scroll-margin-top: calc(var(--ktoc-offset, 100px) + 16px);
}

.ktoc[data-ktoc-hidden] {
	display: none;
}

/* Only relevant when a placement opts in with sticky="true". UIkit switches
   the element to position:fixed, which can otherwise let a later section —
   a featured image, a full-width block — paint over the top of it. */
.ktoc.uk-sticky-fixed {
	z-index: 970;
}

/* Sub-levels stay open — this is a contents list, not an accordion. */
.ktoc-nav .ktoc-sub {
	display: block;
}

.ktoc-nav .ktoc-branch > a {
	display: none;
}

/* Title, and the phone toggle that shares its styling. */
.ktoc-title {
	display: block;
	width: 100%;
}

button.ktoc-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	text-align: left;
	cursor: default;
	-webkit-appearance: none;
	appearance: none;
}

.ktoc-chevron {
	display: none;
	flex: 0 0 auto;
	transition: transform .2s ease;
}

.ktoc-collapsed .ktoc-chevron {
	transform: rotate(-90deg);
}

.ktoc-collapsed .ktoc-nav {
	display: none;
}

@media (max-width: 639px) {
	button.ktoc-title {
		cursor: pointer;
	}
	.ktoc-chevron {
		display: inline-flex;
	}
}

/* Numbered variant. */
.ktoc--numbered .ktoc-nav {
	counter-reset: ktoc;
}

.ktoc--numbered .ktoc-nav > .ktoc-item > a::before {
	counter-increment: ktoc;
	content: counter(ktoc) ". ";
	opacity: .6;
}

.ktoc--numbered .ktoc-sub {
	counter-reset: ktocsub;
}

.ktoc--numbered .ktoc-sub > .ktoc-item > a::before {
	counter-increment: ktocsub;
	content: counter(ktocsub) ". ";
	opacity: .6;
}

/* Colour overrides.
   Each rule only exists when the matching shortcode attribute was set, so an
   untouched TOC inherits your YOOtheme style set completely. Because setting
   one is an explicit instruction to override the theme — including inverse
   cards like uk-card-primary — these win outright. */

.ktoc-c-link.ktoc .ktoc-nav.uk-nav > li > a,
.ktoc-c-link.ktoc .ktoc-nav.uk-nav .ktoc-sub > li > a {
	color: var(--ktoc-link) !important;
}

.ktoc-c-hover.ktoc .ktoc-nav.uk-nav > li > a:hover,
.ktoc-c-hover.ktoc .ktoc-nav.uk-nav > li > a:focus,
.ktoc-c-hover.ktoc .ktoc-nav.uk-nav .ktoc-sub > li > a:hover,
.ktoc-c-hover.ktoc .ktoc-nav.uk-nav .ktoc-sub > li > a:focus {
	color: var(--ktoc-hover) !important;
}

.ktoc-c-active.ktoc .ktoc-nav.uk-nav > li.uk-active > a,
.ktoc-c-active.ktoc .ktoc-nav.uk-nav .ktoc-sub > li.uk-active > a {
	color: var(--ktoc-active) !important;
}

.ktoc-c-title.ktoc .ktoc-title {
	color: var(--ktoc-title) !important;
}

.ktoc-c-bg.ktoc {
	background-color: var(--ktoc-bg) !important;
}

.ktoc-c-border.ktoc {
	border: 1px solid var(--ktoc-border) !important;
}

/* Long headings should wrap rather than overflow a narrow sidebar. */
.ktoc-nav a {
	overflow-wrap: break-word;
	word-break: break-word;
}

@media print {
	.ktoc {
		display: none;
	}
}
