/* =========================================================================
 * single.css — single post layout, article typography, sticky TOC
 * ========================================================================= */

.lb-article-wrap {
	padding-block: var(--lb-s-5);
}

.lb-article {
	min-width: 0; /* allow content to shrink inside grid */
}

/* -------- Post header -------- */

.lb-post-header { margin-bottom: var(--lb-s-4); }

.lb-post-header__featured {
	margin: 0 0 var(--lb-s-4);
	border-radius: var(--lb-radius-lg);
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: var(--lb-subtle);
}
.lb-post-header__featured img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lb-post-header__title {
	font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
	font-weight: 700;
	margin: 0 0 var(--lb-s-2);
	letter-spacing: -0.015em;
	line-height: 1.15;
}

.lb-post-header__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	color: var(--lb-muted);
	font-size: 0.92rem;
}
.lb-post-header__meta .lb-badge { font-size: 0.72rem; }

/* -------- Article body -------- */

.lb-article__body {
	font-size: 1.05rem;
	line-height: 1.75;
	color: var(--lb-text);
}
.lb-article__body > * + * { margin-top: 1em; }
.lb-article__body h2,
.lb-article__body h3 {
	position: relative;
}
.lb-article__body h2 {
	margin-top: 2em;
	font-size: 1.625rem;
	scroll-margin-top: 100px;
}
.lb-article__body h3 {
	margin-top: 1.7em;
	font-size: 1.25rem;
	scroll-margin-top: 100px;
}

/* -------- Heading permalink anchor (#) -------- */

.lb-heading-anchor {
	position: absolute;
	left: -1.1em;
	top: 0;
	display: inline-flex;
	align-items: center;
	height: 1em;
	padding: 0 0.2em;
	margin-top: 0.15em;          /* nudge to optical center of the heading */
	font-weight: 400;
	color: var(--lb-muted);
	text-decoration: none !important;
	opacity: 0;
	transition: opacity var(--lb-dur) var(--lb-ease), color var(--lb-dur) var(--lb-ease);
}
.lb-article__body h2:hover .lb-heading-anchor,
.lb-article__body h3:hover .lb-heading-anchor,
.lb-heading-anchor:focus,
.lb-heading-anchor:focus-visible {
	opacity: 1;
}
.lb-heading-anchor:hover { color: var(--lb-primary); }

/* On narrower screens there's no left gutter — render inline after the title. */
@media (max-width: 1024px) {
	.lb-heading-anchor {
		position: static;
		margin-left: 0.35em;
		padding: 0;
	}
}
.lb-article__body img,
.lb-article__body figure {
	border-radius: var(--lb-radius);
}
.lb-article__body ul,
.lb-article__body ol {
	padding-left: 1.4em;
}
.lb-article__body li + li { margin-top: 0.4em; }
.lb-article__body a { text-decoration: underline; text-underline-offset: 3px; }

/* -------- TOC sidebar -------- */

.lb-toc-wrapper {
	position: sticky;
	top: 24px;
	align-self: start;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
}

.lb-toc {
	background: var(--lb-subtle);
	border: 1px solid var(--lb-border);
	border-radius: var(--lb-radius-lg);
	padding: var(--lb-s-3);
	font-size: 0.92rem;
}

.lb-toc__title {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--lb-muted);
	margin: 0 0 var(--lb-s-2);
}

.lb-toc ol,
.lb-toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.lb-toc li {
	position: relative;
	padding-left: 0.75rem;
	margin: 0.2rem 0;
	border-left: 2px solid transparent;
	transition: border-color var(--lb-dur) var(--lb-ease);
}
.lb-toc li.is-active { border-left-color: var(--lb-primary); }

.lb-toc a {
	display: block;
	padding: 0.35rem 0.4rem;
	color: var(--lb-muted);
	border-radius: var(--lb-radius-sm);
	line-height: 1.4;
}
.lb-toc a:hover { color: var(--lb-primary); background: rgba(31, 182, 245, 0.08); }
.lb-toc li.is-active > a { color: var(--lb-primary-dark); font-weight: 600; }

.lb-toc ol ol,
.lb-toc ul ul {
	margin-left: 0.75rem;
	margin-top: 0.1rem;
	padding-left: 0;
	border-left: 1px solid var(--lb-border);
}

/* -------- Mobile TOC (collapsed dropdown) -------- */

.lb-toc-toggle {
	display: none;
	width: 100%;
	margin-bottom: var(--lb-s-3);
	padding: 0.7rem 1rem;
	font-weight: 600;
	background: var(--lb-subtle);
	border: 1px solid var(--lb-border);
	border-radius: var(--lb-radius);
	cursor: pointer;
	text-align: left;
}
.lb-toc-toggle::before { content: '📑 '; }

@media (max-width: 1024px) {
	.lb-toc-wrapper {
		position: static;
		max-height: none;
	}
	.lb-toc-toggle { display: block; }
	.lb-toc {
		display: none;
	}
	.lb-toc.is-open { display: block; }
}

/* -------- After-content / comments -------- */

.lb-after-content {
	margin-top: var(--lb-s-5);
	padding-top: var(--lb-s-4);
	border-top: 1px solid var(--lb-border);
}

.comments-area {
	margin-top: var(--lb-s-5);
	padding-top: var(--lb-s-4);
	border-top: 1px solid var(--lb-border);
}
.comments-area .comments-title {
	font-size: 1.5rem;
	margin-bottom: var(--lb-s-3);
}
.comments-area .comment-list {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--lb-s-4);
}
.comments-area .comment-list li {
	padding: var(--lb-s-2) 0;
	border-bottom: 1px solid var(--lb-border);
}
