/**
 * VisualBlogger - Reading enhancements styling.
 */

/* Reading progress bar */
.vb-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	background: transparent;
	z-index: 9999;
	pointer-events: none;
}
.vb-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient( 90deg, #2ea043, #58a6ff );
	transition: width 0.1s linear;
}

/* Reading time badge */
.vb-reading-time {
	display: inline-block;
	margin: 0.5rem 0 1rem;
	padding: 4px 12px;
	font-size: 13px;
	color: #555;
	background: rgba( 88, 166, 255, 0.1 );
	border-radius: 20px;
}

/* Heading anchors */
.wp-block-post-content :is( h2, h3 ),
.entry-content :is( h2, h3 ) {
	position: relative;
	scroll-margin-top: 80px;
}
.vb-anchor {
	margin-left: 0.4em;
	opacity: 0;
	color: #58a6ff;
	text-decoration: none;
	font-weight: 400;
	transition: opacity 0.15s ease;
}
:is( h2, h3 ):hover .vb-anchor,
.vb-anchor:focus {
	opacity: 1;
}

/* Table of Contents */
.vb-toc {
	margin: 1.5rem 0 2rem;
	padding: 1rem 1.25rem;
	background: #f7f9fc;
	border: 1px solid #e3e8ef;
	border-left: 4px solid #58a6ff;
	border-radius: 8px;
	font-size: 14px;
}
.vb-toc-toggle {
	background: none;
	border: none;
	padding: 0;
	margin: 0 0 0.5rem;
	font-size: 15px;
	font-weight: 700;
	color: #1a1a2e;
	cursor: pointer;
}
.vb-toc-toggle::before {
	content: "▾ ";
}
.vb-toc.is-collapsed .vb-toc-toggle::before {
	content: "▸ ";
}
.vb-toc.is-collapsed .vb-toc-list {
	display: none;
}
.vb-toc-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 65vh;
	overflow-y: auto;
}

/* Floating TOC launcher + panel (reachable from anywhere while scrolling). */
.vb-toc-float {
	position: fixed;
	right: 20px;
	bottom: 84px;
	z-index: 9997;
	opacity: 0;
	visibility: hidden;
	transform: translateY( 8px );
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.vb-toc-float.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY( 0 );
}
.vb-toc-float-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	background: #1a1a2e;
	border: none;
	border-radius: 22px;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.25 );
}
.vb-toc-float-icon {
	font-size: 15px;
	line-height: 1;
}
.vb-toc-float-panel {
	position: absolute;
	right: 0;
	bottom: calc( 100% + 10px );
	width: 290px;
	max-width: calc( 100vw - 40px );
	max-height: 62vh;
	overflow-y: auto;
	padding: 0.85rem 1.1rem;
	background: #fff;
	border: 1px solid #e3e8ef;
	border-radius: 10px;
	box-shadow: 0 8px 30px rgba( 0, 0, 0, 0.18 );
	display: none;
}
.vb-toc-float.is-open .vb-toc-float-panel {
	display: block;
}
.vb-toc-float-head {
	font-weight: 700;
	font-size: 14px;
	margin-bottom: 0.5rem;
}
.vb-toc-float-panel .vb-toc-list {
	max-height: none;
}
.vb-toc-float-panel li {
	margin: 0.3rem 0;
	line-height: 1.4;
}
.vb-toc-float-panel li.vb-toc-h3 {
	padding-left: 1rem;
	font-size: 13px;
}
.vb-toc-float-panel a {
	text-decoration: none;
	color: #3a3a52;
}
.vb-toc-float-panel a:hover,
.vb-toc-float-panel a.is-active {
	color: #58a6ff;
	font-weight: 600;
}

@media ( max-width: 600px ) {
	.vb-toc-float {
		right: 14px;
		bottom: 78px;
	}
	.vb-toc-float-text {
		display: none;
	}
	.vb-toc-float-btn {
		padding: 11px;
		border-radius: 50%;
	}
}
.vb-toc-list li {
	margin: 0.25rem 0;
	line-height: 1.4;
}
.vb-toc-list li.vb-toc-h3 {
	padding-left: 1.25rem;
	font-size: 13px;
}
.vb-toc-list a {
	text-decoration: none;
	color: #3a3a52;
	border-left: 2px solid transparent;
	padding-left: 8px;
	margin-left: -10px;
	display: inline-block;
}
.vb-toc-list a:hover {
	color: #58a6ff;
}
.vb-toc-list a.is-active {
	color: #58a6ff;
	font-weight: 600;
	border-left-color: #58a6ff;
}

/* Back to top */
.vb-to-top {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 44px;
	height: 44px;
	font-size: 20px;
	line-height: 1;
	color: #fff;
	background: #1a1a2e;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY( 10px );
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 9998;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.25 );
}
.vb-to-top.is-visible {
	opacity: 0.85;
	visibility: visible;
	transform: translateY( 0 );
}
.vb-to-top:hover {
	opacity: 1;
}

/* Previous / next post navigation */
.vb-post-nav {
	gap: 1rem;
	margin: 2rem 0;
}
.vb-post-nav .wp-block-post-navigation-link {
	flex: 1 1 45%;
	min-width: 200px;
	padding: 0.85rem 1.1rem;
	border: 1px solid #e3e8ef;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.45;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.vb-post-nav .post-navigation-link-next {
	text-align: right;
}
.vb-post-nav .wp-block-post-navigation-link:hover {
	border-color: #58a6ff;
	box-shadow: 0 2px 10px rgba( 88, 166, 255, 0.15 );
}
.vb-post-nav .wp-block-post-navigation-link a {
	text-decoration: none;
	font-weight: 600;
}

/* Featured image shown at the top of single posts */
.vb-post-featured {
	margin: 0 0 1.5rem;
}
.vb-post-featured img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

/* Series navigation box */
.vb-series {
	margin: 1.5rem 0;
	padding: 1rem 1.25rem;
	background: #eef4ff;
	border: 1px solid #d8e6ff;
	border-radius: 8px;
}
.vb-series-head {
	font-weight: 600;
	margin-bottom: 0.5rem;
}
.vb-series-list {
	margin: 0;
	padding-left: 1.25rem;
}
.vb-series-list li {
	margin: 0.2rem 0;
}
.vb-series-list li.is-current {
	color: #1a1a2e;
}
.vb-series-list a {
	text-decoration: none;
}

/* Related posts */
.vb-related {
	margin: 2.5rem 0 1rem;
	padding-top: 1.25rem;
	border-top: 1px solid #e3e8ef;
}
.vb-related-heading {
	margin-top: 0;
}
.vb-related-grid {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 200px, 1fr ) );
	gap: 1rem;
}
.vb-related-card {
	display: block;
	text-decoration: none;
	color: inherit;
	border: 1px solid #e3e8ef;
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.vb-related-card:hover {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.1 );
	transform: translateY( -2px );
}
.vb-related-thumb img {
	width: 100%;
	height: 130px;
	object-fit: cover;
	display: block;
}
.vb-related-title {
	display: block;
	padding: 0.6rem 0.8rem;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
}

@media ( prefers-reduced-motion: reduce ) {
	.vb-progress-fill,
	.vb-to-top,
	.vb-post-nav .wp-block-post-navigation-link,
	.vb-related-card {
		transition: none;
	}
}
