/* =========================================================
   single.css — single post layout.
   Hero (triangle SVG anchor) + sticky sidebar (share/TOC/cta)
   + article body with editorial typography.
   ========================================================= */

/* ---------- Reading progress bar (top of viewport) ---------- */
.reading-progress {
	position: fixed;
	top: 0; left: 0; right: 0;
	height: 3px;
	background: transparent;
	z-index: 101;
	pointer-events: none;
}
.reading-progress__bar {
	display: block;
	height: 100%;
	width: var(--progress, 0%);
	background: linear-gradient(90deg, var(--sonix-blue) 0%, var(--sonix-light-blue) 100%);
	transition: width .08s linear;
}

/* ---------- Back-to-top button ---------- */
.back-to-top {
	position: fixed;
	right: var(--space-4);
	bottom: var(--space-5);
	width: 44px; height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--sonix-blue);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 20px rgba(15,23,42,.2);
	opacity: 0;
	transform: translateY(20px);
	transition: opacity .2s ease, transform .2s ease, background .15s ease;
	z-index: 50;
	pointer-events: none;
}
.back-to-top.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}
.back-to-top:hover { background: var(--sonix-dark-blue); }
@media (max-width: 560px) {
	.back-to-top { right: var(--space-3); bottom: var(--space-4); width: 40px; height: 40px; }
}

/* ---------- Wide-table wrapper (added by toc.js) ---------- */
.entry-content__table-wrap {
	overflow-x: auto;
	margin-bottom: var(--space-4);
	border: 1px solid var(--surface-border);
	border-radius: var(--radius-card);
	background: #fff;
	scrollbar-width: thin;
}
.entry-content__table-wrap > table {
	margin: 0;
	border: 0;
	min-width: 480px;
}

/* ---------- Hero ---------- */
.post-hero {
	position: relative;
	overflow: hidden;
	min-height: 360px;
	background: var(--surface-muted);
	color: #fff;
}
.post-hero__art {
	position: absolute; inset: 0;
	background-image: var(--hero-bg);
	background-size: cover;
	background-position: center;
	opacity: 1;
}
.post-hero__scrim {
	position: absolute; inset: 0;
	background:
		linear-gradient(135deg, rgba(15,23,42,.65) 0%, rgba(15,23,42,.10) 60%),
		linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,.45) 100%);
}
.post-hero__inner {
	position: relative;
	z-index: 1;
	max-width: var(--site-max);
	margin: 0 auto;
	padding: var(--space-8) var(--space-4) var(--space-6);
}
.post-hero .breadcrumbs { color: rgba(255,255,255,.8); margin-bottom: var(--space-4); }
.post-hero .breadcrumbs__link,
.post-hero .breadcrumbs__current { color: rgba(255,255,255,.85); }
.post-hero .breadcrumbs__link:hover { color: #fff; text-decoration: underline; }

.post-hero__chip {
	display: inline-block;
	background: var(--hero-accent, var(--sonix-blue));
	color: #fff;
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	padding: .3rem .7rem;
	border-radius: var(--radius-pill);
	text-decoration: none;
	margin-bottom: var(--space-3);
}
.post-hero__chip:hover { background: #fff; color: var(--text-strong); }

.post-hero__title {
	font-family: var(--font-prose);
	font-size: clamp(1.75rem, 4.5vw, 2.75rem);
	line-height: 1.15;
	margin: 0 0 var(--space-4);
	color: #fff;
	text-shadow: 0 2px 24px rgba(15,23,42,.35);
	max-width: 22ch;
}
.post-hero__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	font-size: .92rem;
	color: rgba(255,255,255,.88);
}
.post-hero__meta a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.post-hero__author { display: inline-flex; align-items: center; gap: .4rem; }
.post-hero__avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; }

@media (max-width: 600px) {
	.post-hero { min-height: 280px; }
	.post-hero__inner { padding: var(--space-6) var(--space-4); }
}

/* ---------- Two-column body wrap ---------- */
.single-wrap {
	background: var(--surface-page);
}
.single-wrap__inner {
	max-width: var(--site-max);
	margin: 0 auto;
	padding: var(--space-6) var(--space-4) var(--space-7);
	display: grid;
	gap: var(--space-6);
	grid-template-columns: 1fr;
}

@media (min-width: 900px) {
	.single-wrap__inner {
		grid-template-columns: var(--toc-width) minmax(0, 1fr);
		gap: var(--space-6);
	}
}
@media (min-width: 1100px) {
	.single-wrap__inner {
		grid-template-columns: 300px minmax(0, 1fr);
		gap: var(--space-7);
	}
}

.single-main { min-width: 0; }
.single-main > * { max-width: var(--content-max); margin-inline: auto; }

/* ---------- Sidebar ----------
 *
 * Layout intent: share rail pinned at top, TOC scrolls in the middle,
 * sticky-CTA pinned at bottom. The whole column is a sticky flex
 * container; only the TOC nav inside it owns the scroll.
 */
.single-sidebar { min-width: 0; }
.single-sidebar__sticky {
	position: sticky;
	top: calc(var(--header-h) + var(--space-3));
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	max-height: calc(100vh - var(--header-h) - var(--space-5));
}
/* Only the TOC scrolls — share + sticky-cta stay visible. */
.single-sidebar__sticky > .post-toc {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--surface-border) transparent;
}
.single-sidebar__sticky > .post-share,
.single-sidebar__sticky > .sticky-cta {
	flex: 0 0 auto;
}

@media (max-width: 899px) {
	.single-sidebar { display: none; }
}

/* ---------- TOC (desktop sidebar) ---------- */
.post-toc {
	background: var(--surface-card);
	border-radius: var(--radius-card);
	padding: var(--space-4);
	border: 1px solid var(--surface-border);
}
.post-toc__label {
	margin: 0 0 var(--space-3);
	font-size: .8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--text-quiet);
}
.post-toc__list { padding-left: 0; list-style: none; }
.post-toc__item { position: relative; padding-left: 1.25rem; } /* 1.25rem = chevron well */
.post-toc__item--h2 + .post-toc__item--h2 { margin-top: var(--space-1); }

.post-toc__link {
	display: block;
	font-size: .92rem;
	color: var(--text-default);
	text-decoration: none;
	padding: .35rem 0 .35rem var(--space-2);
	border-left: 2px solid transparent;
	margin-left: -2px;
	line-height: 1.4;
	transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.post-toc__link:hover {
	color: var(--sonix-blue);
	background: rgba(30,136,229,.06);
}
.post-toc__link.is-active {
	color: var(--sonix-blue);
	border-left-color: var(--sonix-blue);
	font-weight: 700;
}
.post-toc__item--h2.has-active-child > .post-toc__link {
	color: var(--text-strong);
	font-weight: 600;
}

.post-toc__item--h3 { padding-left: 2.25rem; }
.post-toc__item--h3 .post-toc__link { font-size: .85rem; color: var(--text-muted); }
.post-toc__item--h3 .post-toc__link.is-active { color: var(--sonix-blue); font-weight: 600; }

.post-toc__toggle {
	position: absolute;
	left: 0;
	top: .35rem;
	width: 1.25rem; height: 1.25rem;
	border: 0;
	background: transparent;
	display: inline-flex;
	align-items: center; justify-content: center;
	padding: 0;
	border-radius: 4px;
	cursor: pointer;
}
.post-toc__toggle:hover { background: rgba(15,23,42,.06); }
.post-toc__toggle-icon {
	width: .55rem;
	height: .55rem;
	display: inline-block;
	border-right: 2px solid var(--text-muted);
	border-bottom: 2px solid var(--text-muted);
	transform: rotate(-45deg);
	transition: transform .15s ease;
	margin-left: -.15rem;
}
.post-toc__toggle[aria-expanded="true"] .post-toc__toggle-icon { transform: rotate(45deg); }
.post-toc__sublist { padding-left: 0; list-style: none; margin-top: .15rem; }

/* ---------- TOC (mobile <details>) ---------- */
.single-toc-mobile {
	background: var(--surface-card);
	border: 1px solid var(--surface-border);
	border-radius: var(--radius-card);
	padding: var(--space-3) var(--space-4);
	margin-bottom: var(--space-5);
}
.single-toc-mobile > summary {
	cursor: pointer;
	font-weight: 700;
	color: var(--text-strong);
	list-style: none;
}
.single-toc-mobile > summary::after { content: " ▾"; color: var(--text-quiet); }
.single-toc-mobile[open] > summary::after { content: " ▴"; }
.single-toc-mobile .post-toc { background: transparent; border: 0; padding: var(--space-3) 0 0; }

@media (min-width: 900px) {
	.single-toc-mobile { display: none; }
}

/* ---------- Share rail ---------- */
.post-share {
	background: var(--surface-card);
	border: 1px solid var(--surface-border);
	border-radius: var(--radius-card);
	padding: var(--space-3) var(--space-4);
}
.post-share__label {
	margin: 0 0 var(--space-2);
	font-size: .8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--text-quiet);
}
.post-share__list {
	display: flex;
	gap: var(--space-1);
	flex-wrap: wrap;
}
.post-share__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px; height: 34px;
	border-radius: 50%;
	color: var(--text-muted);
	background: #fff;
	border: 1px solid var(--surface-border);
	text-decoration: none;
	transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
	position: relative;
	padding: 0;
}
.post-share__btn:hover {
	background: var(--sonix-blue);
	color: #fff;
	border-color: var(--sonix-blue);
	transform: translateY(-1px);
}
.post-share__copy-toast {
	position: absolute;
	top: -28px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--text-strong);
	color: #fff;
	font-size: .75rem;
	padding: .25rem .5rem;
	border-radius: 4px;
	white-space: nowrap;
	pointer-events: none;
}

/* ---------- Sticky CTA card ---------- */
.sticky-cta {
	background: linear-gradient(135deg, var(--sonix-blue-deep) 0%, var(--sonix-blue) 100%);
	color: #fff;
	border-radius: var(--radius-card);
	padding: var(--space-4);
	box-shadow: var(--shadow-cta);
}
.sticky-cta__eyebrow {
	margin: 0 0 var(--space-2);
	font-size: .75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	opacity: .85;
}
.sticky-cta__copy {
	margin: 0 0 var(--space-3);
	font-size: .95rem;
	color: rgba(255,255,255,.92);
	line-height: 1.5;
}
.sticky-cta .btn { margin-bottom: var(--space-3); }
.sticky-cta__proof {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin: 0;
	font-size: .8rem;
	color: rgba(255,255,255,.85);
}
.sticky-cta__stars { color: #FFC857; letter-spacing: .05em; }

/* ---------- Article body / entry-content ---------- */
.entry-content {
	font-family: var(--font-prose);
	font-size: 1.125rem;
	line-height: 1.8;
	color: var(--text-default);
}
.entry-content h2,
.entry-content h3,
.entry-content h4 {
	font-family: var(--font-prose);
	color: var(--text-strong);
	scroll-margin-top: calc(var(--header-h) + var(--space-3));
}
.entry-content h2 { font-size: 1.85rem; margin: var(--space-7) 0 var(--space-3); line-height: 1.25; }
.entry-content h3 { font-size: 1.4rem;  margin: var(--space-6) 0 var(--space-3); line-height: 1.3;  }
.entry-content h4 { font-size: 1.15rem; margin: var(--space-5) 0 var(--space-2); }
.entry-content p,
.entry-content ul,
.entry-content ol,
.entry-content blockquote,
.entry-content figure {
	margin: 0 0 var(--space-4);
}
.entry-content ul,
.entry-content ol {
	padding-left: 1.3em;
	list-style: disc;
}
.entry-content ol { list-style: decimal; }
.entry-content li + li { margin-top: .35em; }
.entry-content blockquote {
	border-left: 4px solid var(--sonix-blue);
	padding: var(--space-2) var(--space-4);
	color: var(--text-muted);
	font-style: italic;
	background: var(--surface-card);
	border-radius: 0 var(--radius-card) var(--radius-card) 0;
}
.entry-content a {
	color: var(--sonix-blue);
	border-bottom: 1px solid transparent;
	transition: border-color .15s ease;
}
.entry-content a:hover { border-bottom-color: var(--sonix-blue); text-decoration: none; }
.entry-content img,
.entry-content figure {
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
}
.entry-content code {
	background: var(--surface-card);
	padding: .15em .35em;
	border-radius: 4px;
	font-size: .9em;
}
.entry-content pre {
	background: var(--surface-muted);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-card);
	overflow-x: auto;
	font-size: .9rem;
	line-height: 1.5;
}
.entry-content table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: var(--space-4);
	font-size: .95rem;
}
.entry-content th, .entry-content td {
	padding: var(--space-2) var(--space-3);
	border-bottom: 1px solid var(--surface-border);
	text-align: left;
}
.entry-content th { font-family: var(--font-ui); font-weight: 700; }

.page-links {
	margin-top: var(--space-5);
	font-weight: 700;
	color: var(--text-muted);
}
.page-links a { margin: 0 .25rem; }

/* ---------- Tags ---------- */
.post-tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	margin: var(--space-6) 0;
	font-family: var(--font-ui);
}
.post-tags__label {
	font-size: .8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--text-quiet);
}
.post-tags__tag {
	display: inline-block;
	padding: .25rem .65rem;
	background: var(--surface-card);
	color: var(--text-default);
	border-radius: var(--radius-pill);
	font-size: .85rem;
	text-decoration: none;
}
.post-tags__tag:hover { background: var(--sonix-blue); color: #fff; }

/* ---------- Comments ---------- */
.post-comments {
	margin-top: var(--space-7);
	border-top: 1px solid var(--surface-border);
	padding-top: var(--space-5);
}
.post-comments__title {
	font-family: var(--font-prose);
	font-size: 1.5rem;
	margin-bottom: var(--space-4);
}
.post-comments__list { padding-left: 0; }
.post-comments__list .comment { margin-bottom: var(--space-4); }
.post-comments__list .children { padding-left: var(--space-4); margin-top: var(--space-3); }
.post-comments__reply-title {
	font-family: var(--font-prose);
	font-size: 1.25rem;
	margin: var(--space-5) 0 var(--space-3);
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea { width: 100%; margin-bottom: var(--space-3); }
.comment-form .form-submit input { margin-top: var(--space-2); }
