/**
 * Sticky left/right rails for blog + case-study detail pages.
 * Left: TOC. Right: compact contact form. Rails stay in view while the article scrolls.
 */

body.blog-detail-page,
body.case-study-detail-page {
	overflow: visible !important;
}

body.blog-detail-page .site-main,
body.case-study-detail-page .site-main {
	overflow: visible !important;
}

.bi-article-shell {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
	max-width: 1480px;
	margin: 0 auto;
	padding: 0 1.15rem 2.5rem;
	position: relative;
	z-index: 1;
	overflow: visible;
	align-items: start;
}

.bi-rail--left {
	display: none;
}

.bi-rail--right {
	display: block;
}

.bi-article-shell .page-content .container,
.bi-article-shell .csd-section-inner,
.bi-article-shell .csd-tech-stack-wrap {
	max-width: 100%;
}

.bi-article-shell .bi-blog-wrap {
	max-width: none;
	margin: 0;
	padding: 0 0 1.5rem;
}

.bi-mobile-jump,
.bi-mobile-cta {
	display: none;
}

.bi-rail-card {
	padding: 0.95rem 1rem;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.1);
	backdrop-filter: blur(16px);
	margin-bottom: 0.85rem;
}

.bi-rail-label {
	display: block;
	margin: 0 0 0.55rem;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(233, 213, 255, 0.7);
}

.bi-rail-cta h3 {
	margin: 0 0 0.4rem;
	font-size: 1.05rem;
	font-weight: 800;
	color: #fff;
}

.bi-rail-cta p {
	margin: 0 0 0.7rem;
	font-size: 0.8rem;
	line-height: 1.45;
	color: rgba(255, 255, 255, 0.68);
}

.bi-rail-meta {
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.6);
	margin: 0.35rem 0 0;
}

.bi-rail-meta a {
	color: #67e8f9;
	text-decoration: none;
	font-weight: 700;
}

.bi-rail-form .bi-rail-hp {
	position: absolute;
	left: -9999px;
	height: 0;
	opacity: 0;
}

.bi-rail-form-field {
	display: flex;
	flex-direction: column;
	gap: 0.28rem;
	margin-bottom: 0.65rem;
}

.bi-rail-form-field label {
	font-size: 0.72rem;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.72);
}

.bi-rail-form-field input,
.bi-rail-form-field select,
.bi-rail-form-field textarea {
	width: 100%;
	box-sizing: border-box;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: rgba(8, 12, 28, 0.72);
	color: #fff;
	font-size: 0.85rem;
	padding: 0.5rem 0.65rem;
}

.bi-rail-form-field textarea {
	min-height: 88px;
	resize: vertical;
}

.bi-rail-form-field input:focus,
.bi-rail-form-field select:focus,
.bi-rail-form-field textarea:focus {
	outline: none;
	border-color: rgba(167, 139, 250, 0.7);
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.bi-rail-form-submit {
	width: 100%;
	border: 0;
	border-radius: 999px;
	padding: 0.6rem 0.85rem;
	background: linear-gradient(135deg, #7c3aed, #4f46e5);
	color: #fff;
	font-size: 0.82rem;
	font-weight: 800;
	cursor: pointer;
}

.bi-rail-form-submit:disabled {
	opacity: 0.65;
	cursor: wait;
}

.bi-rail-form-status {
	min-height: 1.1em;
	margin: 0 0 0.5rem;
	font-size: 0.75rem;
	font-weight: 700;
	color: #67e8f9;
}

@media (max-width: 1023px) {
	.bi-mobile-jump {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		margin: 0 0 1rem;
	}
	.bi-mobile-jump a,
	.bi-mobile-jump summary {
		display: inline-flex;
		align-items: center;
		gap: 0.35rem;
		padding: 0.4rem 0.75rem;
		border-radius: 999px;
		border: 1px solid rgba(255, 255, 255, 0.14);
		background: rgba(255, 255, 255, 0.06);
		color: #e9d5ff;
		font-size: 0.78rem;
		font-weight: 700;
		text-decoration: none;
		cursor: pointer;
		list-style: none;
	}
	.bi-mobile-jump details {
		position: relative;
	}
	.bi-mobile-jump details ol {
		position: absolute;
		z-index: 20;
		margin: 0.4rem 0 0;
		padding: 0.65rem 0.85rem;
		list-style: none;
		min-width: 220px;
		border-radius: 14px;
		background: #0f1224;
		border: 1px solid rgba(255, 255, 255, 0.12);
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
	}
	.bi-mobile-jump details a {
		display: block;
		border: 0;
		background: none;
		padding: 0.35rem 0;
		border-radius: 0;
		color: rgba(255, 255, 255, 0.82);
		font-weight: 600;
	}
	.bi-mobile-cta {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
		position: sticky;
		bottom: 0.85rem;
		z-index: 30;
		margin: 0 0.75rem 4.5rem;
		padding: 0.7rem 0.85rem;
		border-radius: 16px;
		background: rgba(12, 16, 36, 0.92);
		border: 1px solid rgba(167, 139, 250, 0.35);
		backdrop-filter: blur(16px);
	}
	.bi-mobile-cta p {
		margin: 0;
		font-size: 0.8rem;
		font-weight: 700;
		color: #fff;
	}
	.bi-mobile-cta a {
		flex-shrink: 0;
		padding: 0.45rem 0.8rem;
		border-radius: 999px;
		background: linear-gradient(135deg, #7c3aed, #4f46e5);
		color: #fff;
		font-size: 0.78rem;
		font-weight: 800;
		text-decoration: none;
	}
}

@media (min-width: 1024px) {
	.bi-article-shell {
		grid-template-columns: 200px minmax(0, 1fr) 320px;
		padding: 0 1.25rem 3rem 4.75rem;
		gap: 1.35rem;
	}

	.bi-rail--left,
	.bi-rail--right {
		display: block;
		position: sticky;
		top: 88px;
		max-height: calc(100vh - 108px);
		overflow-x: hidden;
		overflow-y: auto;
		align-self: start;
		scrollbar-width: thin;
	}

	.bi-rail-progress {
		height: 4px;
		border-radius: 99px;
		background: rgba(255, 255, 255, 0.1);
		margin-bottom: 0.75rem;
		overflow: hidden;
	}
	.bi-rail-progress span {
		display: block;
		height: 100%;
		width: 0%;
		border-radius: inherit;
		background: linear-gradient(90deg, #7c3aed, #22d3ee);
	}

	.bi-rail-toc {
		list-style: none;
		margin: 0;
		padding: 0;
	}
	.bi-rail-toc a {
		display: block;
		padding: 0.32rem 0.4rem 0.32rem 0.55rem;
		margin-left: -0.4rem;
		border-left: 2px solid transparent;
		color: rgba(255, 255, 255, 0.62);
		text-decoration: none;
		font-size: 0.8rem;
		font-weight: 650;
		line-height: 1.35;
	}
	.bi-rail-toc a:hover,
	.bi-rail-toc a.is-active {
		color: #fff;
		border-left-color: #a78bfa;
	}

	.bi-rail-share {
		display: flex;
		flex-wrap: wrap;
		gap: 0.4rem;
	}
	.bi-rail-share button,
	.bi-rail-share a {
		appearance: none;
		border: 1px solid rgba(255, 255, 255, 0.14);
		background: rgba(255, 255, 255, 0.04);
		color: rgba(255, 255, 255, 0.82);
		border-radius: 999px;
		padding: 0.28rem 0.65rem;
		font-size: 0.72rem;
		font-weight: 700;
		cursor: pointer;
		text-decoration: none;
	}

	.bi-article-shell .bi-blog-toc {
		display: none;
	}
}
