/**
 * Reusable "case" layout: hero-body grid + sticky table-of-contents sidebar.
 *
 * Sidebar links marked with [data-scrollspy-link] get the `is-active` class
 * from assets/js/toc-scrollspy.js. Shared across post types (portfolio, blog).
 */

.case-body.max-width {
	max-width: 1440px;
	padding-right: 40px;
	padding-left: 40px;
}

.case-body {
	display: grid;
	grid-template-columns: 316px minmax(0, 1fr);
	gap: 40px;
	padding-top: 40px;
	padding-bottom: 80px;
}

.toc-sidebar {
	position: relative;
}

.toc-sidebar__sticky {
	position: sticky;
	top: 110px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.toc-sidebar__nav {
	display: flex;
	flex-direction: column;
	gap: 10px;
	border-radius: 5px;
	padding: 10px;
	background: rgba(0, 0, 0, 0.3);
	box-shadow: none;
}

.toc-sidebar__cta {
	--glass-radius: 5px;
	--glass-background: rgba(242, 206, 181, 0.05);
	--glass-background-active: rgba(242, 206, 181, 0.15);
	width: 100%;
	min-height: 40px;
	padding: 0 20px;
	text-decoration: none;
}

.toc-sidebar__cta .glass-button__content {
	width: 100%;
	justify-content: center;
	min-height: 40px;
	padding: 0;
	color: #e7e7e7;
	font-weight: 400;
	font-size: 14px;
	line-height: normal;
	text-transform: uppercase;
}

.toc-sidebar__title {
	width: 100%;
	margin: 0;
	padding: 6px 10px;
	color: #f2ceb5;
	font-weight: 300;
	font-size: 20px;
	line-height: normal;
	text-transform: uppercase;
}

.toc-sidebar__link {
	display: flex;
	width: 100%;
	min-height: 51px;
	align-items: center;
	border-radius: 10px;
	padding: 16px 14px;
	color: rgba(231, 231, 231, 0.7);
	font-size: 14px;
	font-weight: 300;
	line-height: normal;
	text-decoration: none;
	transition: color .2s ease, background .2s ease;
}

.toc-sidebar__link:hover,
.toc-sidebar__link.is-active {
	color: #e7e7e7;
	background: #1e1e1e;
}

.case-body__content {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 10px;
}

.case-body__content > * {
	min-width: 0;
}

@media (min-width: 1024px) and (max-width: 1180px) {
	.case-body {
		grid-template-columns: 280px minmax(0, 1fr);
		gap: 28px;
	}
}

/* Mobile table-of-contents: hidden on desktop, shown ≤1023px. */
.toc-mobile {
	display: none;
}

@media (max-width: 1023px) {
	.case-body {
		display: block;
	}

	.toc-sidebar {
		display: none;
	}

	.toc-mobile {
		display: block;
	}

	/* Floating bar — appears once the case body is scrolled under the header. */
	.toc-mobile__bar {
		position: fixed;
		top: 60px;
		right: 20px;
		left: 20px;
		z-index: 940;
		display: flex;
		align-items: center;
		justify-content: space-between;
		opacity: 0;
		transform: translateY(-10px);
		pointer-events: none;
		transition: opacity .25s ease, transform .25s ease;
	}

	.toc-mobile__bar.is-visible {
		opacity: 1;
		transform: translateY(0);
		pointer-events: auto;
	}

	/* Glass-button pill: "В начало" (scroll-to-top). */
	.toc-mobile__top.glass-button {
		--glass-radius: 41px;
		--glass-background: rgba(30, 30, 30, 0.3);
		--glass-background-active: rgba(30, 30, 30, 0.5);
		min-height: 40px;
		padding: 0 20px;
		color: #e7e7e7;
	}

	.toc-mobile__top .glass-button__content {
		gap: 8px;
		color: #e7e7e7;
		font-size: 12px;
		font-weight: 300;
		line-height: normal;
	}

	/* Glass icon-button: opens the "Содержание" drawer. */
	.toc-mobile__toggle.glass-button {
		--glass-size: 40px;
		--glass-radius: 26px;
		--glass-background: rgba(242, 206, 181, 0.05);
		--glass-background-active: rgba(242, 206, 181, 0.15);
		padding: 0;
		color: #e7e7e7;
	}

	.toc-mobile__toggle .glass-button__content {
		color: #e7e7e7;
	}

	.toc-mobile__icon {
		display: block;
		flex: 0 0 auto;
	}

	/* Bottom-sheet drawer. */
	.toc-drawer {
		position: fixed;
		inset: 0;
		z-index: 998;
		display: flex;
		align-items: flex-end;
	}

	.toc-drawer[hidden] {
		display: none;
	}

	.toc-drawer__overlay {
		position: absolute;
		inset: 0;
		background: rgba(30, 30, 30, 0.4);
		backdrop-filter: blur(1.5px);
		-webkit-backdrop-filter: blur(1.5px);
		opacity: 0;
		transition: opacity .25s ease;
	}

	.toc-drawer.is-open .toc-drawer__overlay {
		opacity: 1;
	}

	.toc-drawer__sheet {
		position: relative;
		display: flex;
		width: 100%;
		max-height: calc(100dvh - 80px);
		flex-direction: column;
		gap: 40px;
		padding: 20px 20px 60px;
		border-radius: 20px 20px 0 0;
		background: #1e1e1e;
		transform: translateY(100%);
		transition: transform .3s cubic-bezier(.22, 1, .36, 1);
	}

	.toc-drawer.is-open .toc-drawer__sheet {
		transform: translateY(0);
	}

	.toc-drawer__sheet:focus {
		outline: none;
	}

	.toc-drawer__head {
		display: flex;
		min-height: 0;
		flex-direction: column;
		gap: 20px;
	}

	.toc-drawer__bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 20px;
	}

	.toc-drawer__title {
		margin: 0;
		color: #f2ceb5;
		font-size: 20px;
		font-weight: 300;
		line-height: normal;
		text-transform: uppercase;
	}

	.toc-drawer__close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 32px;
		width: 32px;
		height: 32px;
		padding: 0;
		border: 0;
		color: #e7e7e7;
		background: transparent;
		cursor: pointer;
	}

	.toc-drawer__nav {
		display: flex;
		min-height: 0;
		flex-direction: column;
		gap: 30px;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding-right: 12px;
	}

	.toc-drawer__nav::-webkit-scrollbar {
		width: 4px;
	}

	.toc-drawer__nav::-webkit-scrollbar-thumb {
		border-radius: 4px;
		background: rgba(231, 231, 231, 0.4);
	}

	.toc-drawer__nav {
		scrollbar-width: thin;
		scrollbar-color: rgba(231, 231, 231, 0.4) transparent;
	}

	.toc-drawer__link {
		display: flex;
		align-items: center;
		gap: 20px;
		color: #e7e7e7;
		font-size: 14px;
		font-weight: 300;
		line-height: normal;
		text-decoration: none;
		opacity: 0.7;
		transition: opacity .2s ease;
	}

	.toc-drawer__link.is-active {
		opacity: 1;
	}

	.toc-drawer__bullet {
		flex: 0 0 8px;
		width: 8px;
		height: 8px;
		border-radius: 50%;
		background: #e7e7e7;
		transition: background .2s ease;
	}

	.toc-drawer__link.is-active .toc-drawer__bullet {
		background: #f2ceb5;
	}

	.toc-drawer__cta {
		--glass-radius: 5px;
		--glass-background: rgba(242, 206, 181, 0.05);
		--glass-background-active: rgba(242, 206, 181, 0.15);
		flex: 0 0 auto;
		width: 100%;
		min-height: 40px;
		padding: 0 20px;
		text-decoration: none;
	}

	.toc-drawer__cta .glass-button__content {
		width: 100%;
		min-height: 40px;
		justify-content: center;
		padding: 0;
		color: #e7e7e7;
		font-weight: 400;
		font-size: 14px;
		line-height: normal;
		text-transform: uppercase;
	}

	body.toc-drawer-open {
		overflow: hidden;
	}
}
