/*
 * Case study section bar.
 * Sticks below the banner image, scrolls to a section on click and highlights
 * the section currently on screen. Loaded only on single case-study posts.
 */

/* style.css sets overflow-x:hidden on body, which turns it into its own scroll
   box and kills position:sticky. clip does the same job without that side effect. */
body.single-case-study { overflow-x: clip; }

/* The bar is a direct child of the article so the whole article is its
   containing block — that is the distance it can stay stuck for. The article
   must not clip or create a new scroll context. */
article.case-study.has-cs-tabs { overflow: visible; }

/* ===== Sticky bar ===== */
.cs-tabs__bar {
	position: sticky;
	top: 0;
	z-index: 900;
	width: 100vw;
	margin: 40px calc(50% - 50vw) 0;
	background: #0f0f0f;
	color: #fff;
}
.cs-tabs__inner {
	max-width: 1240px;
	margin: 0 auto;
	padding: 12px 15px;
	display: flex;
	align-items: center;
	justify-content: center;
}
/* Auto margins centre the row but collapse when the tabs overflow, so a
   narrow screen scrolls from the first tab instead of clipping it. */
.cs-tabs__list {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0 auto;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	scroll-behavior: smooth;
}
.cs-tabs__list::-webkit-scrollbar { display: none; }

/* ===== Tabs ===== */
.cs-tab {
	color: #fff;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	text-decoration: none;
	padding: 12px 22px;
	border-radius: 10px;
	cursor: pointer;
	transition: background-color 0.25s ease, color 0.25s ease;
}
.cs-tab:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.cs-tab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cs-tab.is-active { background: #EB1716; color: #fff; }

/* ===== Section headings inside the content =====
   Kept exactly as authored, just offset so the sticky bar never covers them
   when a tab scrolls the page. JS keeps --cs-scroll-offset in sync with the
   header + bar height. */
.entry-content .cs-section-title {
	scroll-margin-top: var(--cs-scroll-offset, 140px);
	padding-top: 20px;
}
/* The first one already has the bar right above it, so it only needs the gap. */
.cs-tabs__bar + .entry-content { padding-top: 35px; }
.cs-tabs__bar + .entry-content > .cs-section-title:first-child { padding-top: 0; }

/* ===== Responsive ===== */
@media (max-width: 1080px) {
	.cs-tab { font-size: 15px; padding: 10px 16px; }
}

@media (max-width: 768px) {
	.cs-tabs__bar { margin-top: 24px; }
	.cs-tabs__inner { padding: 8px 15px; }
	.cs-tabs__list { gap: 4px; }
	.cs-tab { font-size: 14px; padding: 8px 14px; }
}
