/*
 * Kopius Case Studies – front-end styles.
 * Scoped under .kcs; design tokens are custom properties so the look can be
 * tuned (or aligned to a future brand refresh) without touching rules.
 * The few !important flags exist only to beat the Valence theme's global
 * !important rules (heading sizes/margins, font-family on every element,
 * pink `li a`/`p a` links, label colour). Keep them scoped under .kcs.
 */

.kcs {
	--kcs-plum-900: #24101c;
	--kcs-plum-800: #2c1322;
	--kcs-plum-700: #37172a;
	--kcs-navy: #0a0b20; /* Kopius Navy (brand): dark tags, hero base */
	--kcs-ink: #2a1622;
	--kcs-muted: #6b5a64;
	--kcs-subtle: #7a6470;
	--kcs-line: #e4dfe2;
	--kcs-line-soft: #efeaec;
	--kcs-field: #cfc5ca;
	--kcs-bg: #f4f2f3;
	--kcs-surface: #fff;
	--kcs-accent: #d6156f;
	--kcs-accent-strong: #b00f5b;
	--kcs-coral: #ff6a3d;
	--kcs-coral-text-safe: #d9462b; /* gradient start where white text sits on it (WCAG AA) */
	--kcs-tag-bg: #f4eaef;
	--kcs-tag-ink: #8e2159;
	--kcs-hero-text: #e3e5ef;
	--kcs-hero-muted: #c9ccdb;
	--kcs-gradient: linear-gradient(90deg, var(--kcs-coral), var(--kcs-accent));
	--kcs-gradient-text: linear-gradient(90deg, var(--kcs-coral-text-safe), var(--kcs-accent));
	--kcs-radius: 12px;
	--kcs-radius-sm: 6px;
	--kcs-shadow-hover: 0 18px 44px rgb(36 16 28 / 14%);
	--kcs-gutter: clamp(16px, 4vw, 40px);
	--kcs-max: 1360px;
	--kcs-header-offset: 96px; /* the theme's header is position:fixed and overlaps the top of the page */
	--kcs-font-accent: "Literata", Georgia, serif;

	/* Type scale + tracking, aligned with the rest of kopiustech.com:
	   headings and big figures use -0.03em (the theme's -1.35px @ 45px),
	   uppercase labels use 1px, body copy uses normal tracking. */
	--kcs-fs-xs: 0.8125rem; /* 13px – uppercase labels, tags */
	--kcs-fs-sm: 0.9375rem; /* 15px – meta, small links */
	--kcs-fs-base: 1.0625rem; /* 17px – body copy, inputs */
	--kcs-fs-md: 1.25rem; /* 20px – lead, card titles */
	--kcs-fs-lg: clamp(1.5rem, 1.25rem + 0.8vw, 1.875rem); /* 24–30px */
	--kcs-fs-xl: clamp(2rem, 1.4rem + 1.6vw, 2.8125rem); /* 32–45px – H2 */
	--kcs-fs-2xl: clamp(2.5rem, 1.5rem + 3vw, 4.25rem); /* 40–68px – H1 */
	--kcs-track-tight: -0.03em;
	--kcs-track-caps: 1px;

	box-sizing: border-box;
	color: var(--kcs-ink);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.kcs *,
.kcs *::before,
.kcs *::after {
	box-sizing: inherit;
}

.kcs :where(h1, h2, h3, p, ul, ol, dl, dd, figure) {
	margin: 0;
	padding: 0;
}

.kcs :where(ul, ol) {
	list-style: none;
}

.kcs li {
	margin: 0;
	padding: 0; /* theme adds vertical padding to every li */
}

.kcs em {
	font-family: var(--kcs-font-accent) !important;
	font-style: italic;
	font-weight: 400;
}

.kcs img {
	display: block;
	max-width: 100%;
	height: auto;
}

.kcs a:focus-visible,
.kcs button:focus-visible,
.kcs select:focus-visible,
.kcs input:focus-visible {
	outline: 2px solid var(--kcs-accent);
	outline-offset: 2px;
}

.kcs-container {
	width: 100%;
	max-width: calc(var(--kcs-max) + 2 * var(--kcs-gutter));
	margin-inline: auto;
	padding-inline: var(--kcs-gutter);
}

/* Asterisk logomark built from three bars (decorative). */
.kcs-mark,
.kcs-mark::before,
.kcs-mark::after {
	position: absolute;
	width: var(--kcs-mark-w, 26px);
	height: var(--kcs-mark-size, 420px);
	border-radius: 999px;
	background: #fff;
}

.kcs-mark {
	pointer-events: none;
	opacity: var(--kcs-mark-opacity, 0.07);
}

.kcs-mark::before,
.kcs-mark::after {
	content: "";
	inset: 0;
	opacity: 1;
}

.kcs-mark::before {
	transform: rotate(60deg);
}

.kcs-mark::after {
	transform: rotate(-60deg);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.kcs-hero {
	position: relative;
	isolation: isolate; /* keeps the image + overlay layers inside the hero */
	overflow: hidden;
	background: var(--kcs-navy);
	color: #fff;
}

/* Full-bleed photo behind the whole hero (title, metrics and trust bar). */
.kcs .kcs-hero__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	object-position: 70% 40%;
}

/* Navy scrim: dense on the left where the text sits, lighter on the right so the
   arrows stay visible; darker at the bottom behind the metrics and logos. */
.kcs-hero__overlay {
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(0deg, rgb(10 11 32 / 88%) 0%, rgb(10 11 32 / 0%) 50%),
		linear-gradient(90deg, rgb(10 11 32 / 94%) 0%, rgb(10 11 32 / 80%) 38%, rgb(10 11 32 / 35%) 72%, rgb(10 11 32 / 15%) 100%);
	pointer-events: none;
}

.kcs-hero__main {
	position: relative;
	padding-top: calc(var(--kcs-header-offset) + clamp(24px, 3vw, 40px));
}

.kcs-hero__main > .kcs-container {
	position: relative;
}

.kcs-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	font-size: var(--kcs-fs-sm);
	color: var(--kcs-hero-muted);
}

.kcs-breadcrumbs li + li::before {
	content: "›";
	margin-right: 10px;
	opacity: 0.5;
}

.kcs .kcs-breadcrumbs a {
	color: var(--kcs-hero-muted) !important;
	text-decoration: none !important;
}

.kcs .kcs-breadcrumbs a:hover {
	color: #fff !important;
}

.kcs-breadcrumbs [aria-current] {
	color: #fff;
}

.kcs-hero__title {
	max-width: 980px;
	padding-top: 26px; /* theme forces h1 { margin: 0 !important } */
	color: #fff;
	font-size: var(--kcs-fs-2xl) !important;
	font-weight: 400;
	line-height: 1.1 !important;
	letter-spacing: var(--kcs-track-tight);
	text-wrap: balance;
}

.kcs-hero__lead {
	max-width: 780px;
	margin-top: 22px;
	color: var(--kcs-hero-text);
	font-size: var(--kcs-fs-md);
	line-height: 1.6;
	text-wrap: pretty;
}

.kcs-metrics {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
	margin-top: clamp(28px, 4vw, 44px);
	padding: 26px 0 30px;
	border-top: 1px solid rgb(255 255 255 / 16%);
}

.kcs-metrics__item {
	display: flex;
	flex-direction: column-reverse; /* value visually above its label; dt stays first in the DOM */
	gap: 8px;
}

.kcs-metrics__value {
	color: #fff;
	font-size: clamp(2.25rem, 1.75rem + 1.6vw, 3rem);
	letter-spacing: var(--kcs-track-tight);
	line-height: 1.05;
}

.kcs-metrics__label {
	color: var(--kcs-hero-muted);
	font-size: var(--kcs-fs-xs);
	letter-spacing: var(--kcs-track-caps);
	text-transform: uppercase;
}

.kcs-trust {
	padding: 26px 0;
	border-top: 1px solid rgb(255 255 255 / 12%);
	background: rgb(10 11 32 / 55%);
}

.kcs-trust__title {
	color: var(--kcs-hero-muted);
	font-size: var(--kcs-fs-base);
}

.kcs-logos {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 14px 28px;
	align-items: center;
	margin-top: 16px;
}

.kcs-logos__item {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 44px;
}

.kcs-logos__img {
	width: auto !important;
	max-height: 36px;
	object-fit: contain;
}

.kcs-trust--mono .kcs-logos__img {
	filter: brightness(0) invert(1);
	opacity: 0.72;
	transition: opacity 0.2s ease;
}

.kcs-trust--mono .kcs-logos__item:hover .kcs-logos__img {
	opacity: 1;
}

/* ==========================================================================
   Sections (shared)
   ========================================================================== */

.kcs-section {
	background: var(--kcs-bg);
	padding-top: clamp(48px, 6vw, 64px);
}

.kcs-explorer {
	padding-bottom: clamp(48px, 6vw, 72px);
}

.kcs-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px 24px;
}

.kcs-h2 {
	color: var(--kcs-ink);
	font-size: var(--kcs-fs-xl) !important;
	font-weight: 400;
	line-height: 1.15 !important;
	letter-spacing: var(--kcs-track-tight);
}

.kcs-section__intro {
	margin-top: 10px;
	color: var(--kcs-muted);
	font-size: var(--kcs-fs-base);
}

.kcs-section__note {
	color: var(--kcs-muted);
	font-size: var(--kcs-fs-sm);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.kcs-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border: 1px solid var(--kcs-line);
	border-radius: var(--kcs-radius);
	background: var(--kcs-surface);
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.kcs-card:hover,
.kcs-card:focus-within {
	border-color: var(--kcs-accent);
	box-shadow: var(--kcs-shadow-hover);
}

.kcs-card__media {
	position: relative;
	aspect-ratio: 2.8 / 1;
	overflow: hidden;
	background: linear-gradient(135deg, #cfc6cb, #b8aab2);
}

.kcs-card__img {
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.kcs-card:hover .kcs-card__img {
	transform: scale(1.03);
}

.kcs-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 14px;
	padding: 22px 24px 24px;
}

.kcs-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.kcs-tag {
	padding: 5px 10px;
	border-radius: 4px;
	font-size: 0.75rem;
	letter-spacing: var(--kcs-track-caps);
	line-height: 1.4;
	text-transform: uppercase;
}

.kcs-tag--dark {
	background: var(--kcs-navy);
	color: #fff;
}

.kcs-tag--light {
	background: var(--kcs-tag-bg);
	color: var(--kcs-tag-ink);
}

.kcs-card__title {
	font-size: var(--kcs-fs-md) !important;
	font-weight: 400;
	line-height: 1.3 !important;
	letter-spacing: var(--kcs-track-tight);
}

.kcs .kcs-card__link {
	color: var(--kcs-ink) !important;
	text-decoration: none !important;
}

/* Stretched link: the whole card is the click target. */
.kcs-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.kcs-card__link:focus-visible {
	outline: none;
}

.kcs-card:has(.kcs-card__link:focus-visible) {
	outline: 2px solid var(--kcs-accent);
	outline-offset: 2px;
}

.kcs-card__excerpt {
	color: var(--kcs-muted);
	font-size: var(--kcs-fs-sm);
	line-height: 1.6;
}

.kcs-impact {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-top: auto;
	padding-top: 14px;
	border-top: 1px solid var(--kcs-line-soft);
}

.kcs-impact__value {
	flex: none;
	color: var(--kcs-accent);
	font-size: 1.75rem;
	letter-spacing: var(--kcs-track-tight);
	line-height: 1;
}

.kcs-impact__label {
	color: var(--kcs-muted);
	font-size: var(--kcs-fs-xs);
	line-height: 1.4;
}

.kcs-card__cta {
	color: var(--kcs-accent);
	font-size: var(--kcs-fs-sm);
}

/* The metric row (or, without one, the CTA) sits at the bottom of the card. */
.kcs-card__cta {
	margin-top: auto;
}

.kcs-impact ~ .kcs-card__cta {
	margin-top: 0;
}

.kcs-arrow {
	display: inline-block;
	transition: transform 0.2s ease;
}

.kcs-card:hover .kcs-arrow,
.kcs-btn:hover .kcs-arrow {
	transform: translateX(3px);
}

/* Large featured card */
.kcs-card--featured-lg .kcs-card__media {
	aspect-ratio: 16 / 9;
	max-height: 300px;
}

.kcs-card--featured-lg .kcs-card__body {
	gap: 16px;
	padding: 30px 32px 32px;
}

.kcs-card--featured-lg .kcs-tag {
	padding: 6px 11px;
}

.kcs-card--featured-lg .kcs-card__title {
	font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.125rem) !important;
	line-height: 1.2 !important;
}

.kcs-card--featured-lg .kcs-impact {
	padding-top: 16px;
}

.kcs-card--featured-lg .kcs-impact__value {
	font-size: 2.75rem;
}

.kcs-card--featured-lg .kcs-impact__label {
	font-size: var(--kcs-fs-sm);
}

.kcs-card--featured-lg .kcs-card__excerpt {
	font-size: var(--kcs-fs-base);
}

.kcs-card--featured-lg .kcs-card__cta {
	font-size: var(--kcs-fs-base);
}

/* Small featured cards: image left, content right */
.kcs-card--featured-sm {
	display: grid;
	grid-template-columns: minmax(160px, 210px) 1fr;
}

.kcs-card--featured-sm .kcs-card__media {
	aspect-ratio: auto;
	height: 100%;
	min-height: 180px;
}

.kcs-card--featured-sm .kcs-card__body {
	gap: 12px;
	padding: 24px 26px;
}

.kcs-card--featured-sm .kcs-card__title {
	font-size: clamp(1.25rem, 1.1rem + 0.4vw, 1.5rem) !important;
	line-height: 1.25 !important;
}

.kcs-card--featured-sm .kcs-impact {
	padding-top: 0;
	border-top: 0;
}

/* ==========================================================================
   Featured layout
   ========================================================================== */

.kcs-featured__layout {
	display: grid;
	grid-template-columns: 1.35fr 1fr;
	gap: 20px;
	margin-top: 28px;
}

.kcs-featured__layout--single {
	grid-template-columns: 1fr;
}

.kcs-featured__side {
	display: grid;
	grid-auto-rows: 1fr;
	gap: 20px;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.kcs-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px;
	margin-top: 20px;
	padding: 18px 20px;
	border: 1px solid var(--kcs-line);
	border-radius: var(--kcs-radius);
	background: var(--kcs-surface);
}

.kcs-filters__label {
	align-self: center;
	color: var(--kcs-subtle);
	font-size: var(--kcs-fs-xs);
	letter-spacing: var(--kcs-track-caps);
	text-transform: uppercase;
}

.kcs-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.kcs-field--select {
	flex: 0 1 260px;
}

.kcs-field--search {
	flex: 1 1 220px;
}

.kcs .kcs-field__label {
	color: var(--kcs-subtle) !important; /* theme: html body label { color … !important } */
	font-size: 0.75rem;
	letter-spacing: var(--kcs-track-caps);
	text-transform: uppercase;
}

.kcs-field--search .kcs-field__label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.kcs .kcs-field select,
.kcs .kcs-field input {
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid var(--kcs-field);
	border-radius: var(--kcs-radius-sm);
	background-color: #fff;
	box-shadow: none;
	color: var(--kcs-ink);
	font-size: var(--kcs-fs-base);
	line-height: 46px;
	transition: border-color 0.15s ease;
}

.kcs .kcs-field select {
	padding-right: 36px;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b5a64' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.kcs .kcs-field input {
	padding-left: 42px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%237a6470' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: 16px center;
}

.kcs .kcs-field select:hover,
.kcs .kcs-field input:hover {
	border-color: var(--kcs-navy);
}

.kcs-filters__meta {
	display: flex;
	align-items: center;
	gap: 16px;
	height: 48px;
	margin-left: auto;
	font-size: var(--kcs-fs-sm);
}

.kcs-filters__count {
	color: var(--kcs-muted);
	white-space: nowrap;
}

.kcs .kcs-filters__clear,
.kcs .kcs-empty a {
	color: var(--kcs-accent-strong) !important;
	text-decoration: none !important;
	white-space: nowrap;
}

.kcs .kcs-filters__clear:hover,
.kcs .kcs-empty a:hover {
	text-decoration: underline !important;
}

.kcs-filters__apply {
	height: 48px;
	padding: 0 20px;
	border: 0;
	border-radius: 999px;
	background: var(--kcs-plum-900);
	color: #fff;
	font: inherit;
	cursor: pointer;
}

/* With JS, filters apply instantly: hide the Apply button. */
.kcs-js .kcs-filters__apply {
	display: none;
}

/* ==========================================================================
   Grid, CTA, load more
   ========================================================================== */

.kcs-results {
	margin-top: 24px;
	transition: opacity 0.2s ease;
}

.kcs-results[aria-busy="true"] {
	opacity: 0.45;
	pointer-events: none;
}

.kcs-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

.kcs-cols-4 .kcs-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kcs-grid:empty {
	display: none;
}

.kcs-grid + .kcs-empty,
.kcs-empty + .kcs-cta,
.kcs-grid + .kcs-cta,
.kcs-cta + .kcs-grid {
	margin-top: 28px;
}

.kcs-empty {
	padding: 40px 20px;
	border: 1px dashed var(--kcs-field);
	border-radius: var(--kcs-radius);
	color: var(--kcs-muted);
	text-align: center;
}

.kcs-cta {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px 30px;
	overflow: hidden;
	padding: clamp(28px, 3.5vw, 40px) clamp(24px, 3.5vw, 44px);
	border-radius: var(--kcs-radius);
	background: var(--kcs-gradient-text);
	color: #fff;
}

.kcs-cta__mark {
	--kcs-mark-size: 260px;
	--kcs-mark-w: 18px;
	--kcs-mark-opacity: 0.08;

	right: 18%;
	top: -40px;
}

.kcs-cta__copy {
	position: relative;
	flex: 1 1 420px;
}

.kcs-cta__title {
	color: #fff;
	font-size: var(--kcs-fs-lg);
	line-height: 1.25;
	letter-spacing: var(--kcs-track-tight);
}

.kcs-cta__text {
	margin-top: 10px;
	color: #fff;
	font-size: var(--kcs-fs-base);
}

.kcs-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 15px 30px;
	border-radius: 999px;
	font-size: 1rem; /* site buttons are 16px */
	line-height: 1.2;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.kcs .kcs-btn--light {
	background: #fff;
	color: var(--kcs-plum-900) !important;
}

.kcs .kcs-btn--light:hover {
	background: var(--kcs-plum-900);
	color: #fff !important;
}

.kcs .kcs-btn--outline {
	border: 1px solid var(--kcs-plum-900);
	background: transparent;
	color: var(--kcs-plum-900) !important;
}

.kcs .kcs-btn--outline:hover {
	background: var(--kcs-plum-900);
	color: #fff !important;
}

.kcs-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	margin-top: 34px;
}

.kcs-more[hidden],
.kcs-btn[hidden],
.kcs-empty[hidden] {
	display: none;
}

.kcs-more__status {
	color: var(--kcs-muted);
	font-size: var(--kcs-fs-sm);
}

.kcs-progress {
	width: 260px;
	height: 3px;
	overflow: hidden;
	border-radius: 2px;
	background: var(--kcs-line);
}

.kcs-progress__bar {
	display: block;
	height: 100%;
	background: var(--kcs-gradient);
	transition: width 0.3s ease;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
	.kcs-cols-4 .kcs-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 1023px) {
	.kcs-featured__layout {
		grid-template-columns: 1fr;
	}

	.kcs-featured__side {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-rows: auto;
	}

	.kcs-card--featured-sm {
		display: flex;
	}

	.kcs-card--featured-sm .kcs-card__media {
		height: auto;
		min-height: 0;
		aspect-ratio: 2.8 / 1;
	}

	.kcs-grid,
	.kcs-cols-4 .kcs-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kcs-metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.kcs-filters__label {
		flex-basis: 100%;
	}

	.kcs-filters__meta {
		flex-basis: 100%;
		justify-content: space-between;
		height: auto;
		margin-left: 0;
	}
}

@media (max-width: 639px) {
	.kcs-featured__side,
	.kcs-grid,
	.kcs-cols-4 .kcs-grid {
		grid-template-columns: 1fr;
	}

	.kcs-field--select,
	.kcs-field--search {
		flex: 1 1 100%;
	}

	/* Small screens: text spans the full width, so darken the whole photo evenly. */
	.kcs-hero__overlay {
		background: linear-gradient(0deg, rgb(10 11 32 / 92%) 0%, rgb(10 11 32 / 72%) 100%);
	}

	.kcs .kcs-hero__bg {
		object-position: 75% 30%;
	}

	.kcs-btn {
		white-space: normal;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kcs *,
	.kcs *::before,
	.kcs *::after {
		transition: none !important;
	}
}
