/* ============================================================
   SINGLE POST (enqueued on single posts only)
   ============================================================ */

/* --- reading progress --- */
.sp-progress {
	position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000;
	pointer-events: none;
}
.sp-progress span {
	display: block; height: 100%; width: 100%;
	background: var(--grad);
	transform-origin: 0 50%; transform: scaleX(0);
	box-shadow: 0 0 12px rgba(124, 58, 237, .55);
}

/* --- hero --- */
.sp-hero { padding: 136px 0 92px; }
.sp-hero--cover { padding-bottom: 190px; }
.sp-hero__inner { position: relative; max-width: 900px; text-align: center; }

.sp-crumbs {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 14px; border-radius: 999px;
	background: rgba(139,165,255,.10); border: 1px solid rgba(139,165,255,.26);
	font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.sp-crumbs a { color: #cfe0ff; transition: color .15s ease; }
.sp-crumbs a:hover { color: #fff; }
.sp-crumbs a:last-child { color: #fff; }
.sp-crumbs svg { width: 14px; height: 14px; color: rgba(207,224,255,.5); }

.sp-hero__title {
	margin: 24px auto 0; max-width: 860px;
	font-family: var(--font-display); font-weight: 800;
	font-size: clamp(32px, 5vw, 56px); line-height: 1.08; letter-spacing: -.035em;
	color: #fff; text-wrap: balance;
}
.sp-hero__dek {
	margin: 22px auto 0; max-width: 680px;
	font-size: 19px; line-height: 1.6; color: rgba(225,232,248,.78);
	text-wrap: pretty;
}

.sp-hero__meta {
	display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
	gap: 10px 16px; margin-top: 34px;
	font-size: 14.5px; font-weight: 500; color: rgba(255,255,255,.7);
}
.sp-hero__sep { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.3); }
.sp-author { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; }
.sp-author__ava {
	display: inline-flex; width: 34px; height: 34px; border-radius: 50%;
	background: #fff; padding: 5px; box-shadow: 0 0 0 3px rgba(139,165,255,.25);
}
.sp-author__ava img { width: 100%; height: 100%; }
.sp-hero__read { display: inline-flex; align-items: center; gap: 6px; }
.sp-hero__read svg { width: 16px; height: 16px; opacity: .8; }

/* --- cover --- */
.sp-cover-wrap { position: relative; z-index: 2; margin-top: -140px; max-width: 1040px; }
.sp-cover {
	margin: 0; border-radius: var(--radius-xl); overflow: hidden;
	aspect-ratio: 16 / 8.4; background: var(--grad-soft);
	border: 1px solid rgba(255,255,255,.6);
	box-shadow: var(--shadow-lg);
}
.sp-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- layout --- */
.sp-layout {
	display: grid; grid-template-columns: 280px minmax(0, 720px);
	justify-content: center; gap: 56px;
	padding-top: 72px; padding-bottom: 40px;
}
.sp-layout--solo { grid-template-columns: minmax(0, 760px); }

.sp-aside__sticky { position: sticky; top: 108px; }

/* contents card: progress ring + numbered track */
.sp-toc {
	position: relative;
	background: #fff; border: 1px solid var(--line); border-radius: 22px;
	box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 24px 48px -28px rgba(44,40,120,.35);
	overflow: hidden;
}
.sp-toc::before {
	content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad);
}
.sp-toc__head {
	display: flex; align-items: center; gap: 12px;
	list-style: none; cursor: default;
	padding: 18px 18px 16px;
	border-bottom: 1px dashed var(--line);
}
.sp-toc__head::-webkit-details-marker { display: none; }

.sp-toc__ring { position: relative; flex: none; width: 42px; height: 42px; }
.sp-toc__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sp-toc__ring circle { fill: none; stroke-width: 3.2; }
.sp-toc__ring-bg { stroke: #eef1f8; }
.sp-toc__ring-fg {
	stroke: url(#spRingGrad); stroke-linecap: round;
	stroke-dasharray: 100; stroke-dashoffset: 100;
	transition: stroke-dashoffset .2s linear;
}
.sp-toc__pct {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	font-family: var(--font-display); font-weight: 700; font-size: 10.5px; color: var(--ink);
	font-variant-numeric: tabular-nums;
}
.sp-toc__title { display: grid; gap: 1px; min-width: 0; flex: 1; }
.sp-toc__k { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); }
.sp-toc__n { font-size: 12.5px; color: var(--muted-2); }
.sp-toc__chev { display: none; flex: none; width: 18px; height: 18px; color: var(--muted-2); }

.sp-toc__list {
	position: relative; display: grid; gap: 2px;
	padding: 12px 10px 14px;
	max-height: calc(100vh - 230px); overflow-y: auto; scrollbar-width: thin;
}
/* the track line behind the numbers */
.sp-toc__list::before {
	content: ""; position: absolute; left: 27px; top: 26px; bottom: 28px;
	width: 2px; border-radius: 2px; background: #eef1f8;
}
.sp-toc__list li { position: relative; }
.sp-toc__list a {
	position: relative; display: flex; align-items: flex-start; gap: 12px;
	padding: 8px 10px 8px 6px; border-radius: 12px;
	font-size: 14px; line-height: 1.4; color: var(--muted);
	transition: color .15s ease, background .15s ease;
}
.sp-toc__list a:hover { color: var(--ink); background: var(--bg-alt); }
.sp-toc__num {
	position: relative; z-index: 1; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	width: 26px; height: 22px; margin-top: -1px; border-radius: 8px;
	background: #fff; border: 1px solid var(--line);
	font: 700 10.5px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--muted-2);
	transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.sp-toc__txt { padding-top: 1px; }

.sp-toc__list a.is-done { color: var(--ink); }
.sp-toc__list a.is-done .sp-toc__num { background: var(--bg-tint); border-color: #d6e2ff; color: var(--blue-deep); }

.sp-toc__list a.is-active { color: var(--ink); font-weight: 600; background: var(--grad-soft); }
.sp-toc__list a.is-active .sp-toc__num {
	background: var(--grad); border-color: transparent; color: #fff;
	box-shadow: 0 6px 14px -6px rgba(79,70,229,.8);
}

/* --- article typography (extends .single-content in style.css) --- */
.sp-content { font-size: 18px; line-height: 1.78; }
.sp-content > p:first-child {
	font-size: 21px; line-height: 1.65; color: var(--ink);
}
.sp-content strong { color: var(--ink); font-weight: 650; }

.sp-content h2 {
	position: relative; scroll-margin-top: 100px;
	font-size: clamp(25px, 2.6vw, 31px); line-height: 1.2;
	margin-top: 2.1em; padding-top: 1.1em;
	border-top: 1px solid var(--line);
}
.sp-content h2::before {
	content: ""; position: absolute; top: -1px; left: 0;
	width: 56px; height: 3px; border-radius: 3px; background: var(--grad);
}
.sp-content h3 { scroll-margin-top: 100px; }

/* bullet lists: gradient dots */
.sp-content ul { list-style: none; padding-left: 0; display: grid; gap: 12px; }
.sp-content li + li { margin-top: 0; }
.sp-content ul > li { position: relative; padding-left: 30px; }
.sp-content ul > li::before {
	content: ""; position: absolute; left: 4px; top: .62em;
	width: 10px; height: 10px; border-radius: 50%;
	background: var(--grad);
	box-shadow: 0 0 0 4px #eef1ff;
}

/* numbered lists: step cards */
.sp-content ol { list-style: none; padding-left: 0; counter-reset: step; display: grid; gap: 12px; }
.sp-content ol > li {
	counter-increment: step; position: relative;
	padding: 16px 20px 16px 66px;
	background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
}
.sp-content ol > li::before {
	content: counter(step);
	position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
	display: inline-flex; align-items: center; justify-content: center;
	width: 32px; height: 32px; border-radius: 10px;
	background: var(--grad); color: #fff;
	font-family: var(--font-display); font-weight: 700; font-size: 15px;
	box-shadow: 0 8px 16px -8px rgba(79,70,229,.8);
}

/* code */
.sp-content pre {
	position: relative; padding: 46px 22px 20px;
	border: 1px solid #1e2940; border-radius: var(--radius);
	background: linear-gradient(180deg, #111a2e 0, #0b111f 38px);
	box-shadow: var(--shadow);
}
.sp-content pre::before {
	content: ""; position: absolute; left: 18px; top: 16px;
	width: 10px; height: 10px; border-radius: 50%;
	background: #ff6b6b; box-shadow: 16px 0 0 #ffc24b, 32px 0 0 #3ddc84;
}
.sp-code-copy {
	position: absolute; right: 12px; top: 9px;
	padding: 4px 11px; border-radius: 8px; border: 1px solid rgba(139,165,255,.28);
	background: rgba(139,165,255,.1); color: #cfe0ff;
	font: 600 12px/1.6 var(--font-body); cursor: pointer;
	transition: background .15s ease;
}
.sp-code-copy:hover { background: rgba(139,165,255,.22); }

/* links */
.sp-content a {
	color: var(--blue-deep); text-decoration: none;
	background-image: linear-gradient(currentColor, currentColor);
	background-size: 100% 1px; background-position: 0 100%; background-repeat: no-repeat;
	transition: color .15s ease, background-size .2s ease;
}
.sp-content a:hover { color: var(--purple); background-size: 100% 2px; }

/* images and figures */
.sp-content figure img,
.sp-content > img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sp-content figcaption { margin-top: 10px; font-size: 14px; color: var(--muted-2); text-align: center; }

/* --- share --- */
.sp-share {
	display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
	margin-top: 56px; padding: 18px 22px;
	border: 1px solid var(--line); border-radius: var(--radius);
	background: var(--bg-alt);
}
.sp-share__label { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.sp-share__row { display: flex; gap: 10px; }
.sp-share__btn {
	position: relative;
	display: inline-flex; align-items: center; justify-content: center;
	width: 42px; height: 42px; border-radius: 12px;
	border: 1px solid var(--line); background: #fff; color: var(--ink);
	cursor: pointer; transition: transform .15s ease, color .15s ease, border-color .15s ease;
}
.sp-share__btn:hover { transform: translateY(-2px); color: var(--blue-deep); border-color: #cfd8ea; }
.sp-share__btn svg { width: 18px; height: 18px; }
.sp-share__done {
	position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
	padding: 4px 9px; border-radius: 7px; background: var(--ink); color: #fff;
	font-size: 12px; font-weight: 600; white-space: nowrap;
	opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.sp-share__copy.is-copied .sp-share__done { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- author --- */
.sp-bio {
	display: flex; gap: 18px; align-items: flex-start;
	margin-top: 18px; padding: 24px;
	border-radius: var(--radius-lg); background: var(--grad-soft);
	border: 1px solid #e3e6fb;
}
.sp-bio__ava {
	flex: none; display: inline-flex; width: 56px; height: 56px; padding: 9px;
	border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm);
}
.sp-bio__ava img { width: 100%; height: 100%; }
.sp-bio__k { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.sp-bio__n { margin-top: 2px; font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.sp-bio__d { margin-top: 6px; font-size: 15px; line-height: 1.6; color: var(--muted); }

/* --- related --- */
.sp-related { padding: 80px 0 96px; margin-top: 56px; background: var(--bg-alt); border-top: 1px solid var(--line); }
.sp-related__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.sp-related__head h2 { font-size: clamp(26px, 3vw, 34px); }
.sp-related__head a { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 15px; color: var(--blue-deep); }
.sp-related__head svg { width: 16px; height: 16px; transition: transform .2s ease; }
.sp-related__head a:hover svg { transform: translateX(3px); }
.sp-related .blog-card__title { font-size: 20px; }

/* --- responsive --- */
@media (max-width: 1080px) {
	.sp-layout { grid-template-columns: minmax(0, 760px); gap: 0; padding-top: 48px; }
	.sp-aside__sticky { position: static; }
	.sp-toc { margin-bottom: 36px; }
	.sp-toc__head { cursor: pointer; border-bottom-color: transparent; }
	.sp-toc[open] .sp-toc__head { border-bottom-color: var(--line); }
	.sp-toc__chev { display: block; transition: transform .2s ease; }
	.sp-toc[open] .sp-toc__chev { transform: rotate(180deg); }
	.sp-toc__list { max-height: none; }
}
@media (max-width: 860px) {
	.sp-hero { padding: 112px 0 70px; }
	.sp-hero--cover { padding-bottom: 130px; }
	.sp-cover-wrap { margin-top: -90px; }
	.sp-cover { border-radius: var(--radius-lg); }
	.sp-hero__dek { font-size: 17.5px; }
}
@media (max-width: 620px) {
	.sp-content { font-size: 17px; }
	.sp-content > p:first-child { font-size: 19px; }
	.sp-content ol > li { padding: 14px 16px 14px 58px; }
	.sp-content ol > li::before { left: 14px; width: 30px; height: 30px; }
	.sp-author + .sp-hero__sep { display: none; }
	.sp-author { width: 100%; justify-content: center; }
	.sp-bio { flex-direction: column; }
	.sp-related__head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
	.sp-progress { display: none; }
}
