/* Systical — Work Grid (sticky category rail + project cards) */

.sys-wk {
	--wk-accent: #9afd0d;
	--wk-max: 1400px;
	--wk-rail: 330px;
	--wk-gap: 24px;
	--wk-sticky: 130px;
	--wk-radius: 20px;
	--wk-ratio-sm: 4 / 3;
	--wk-ratio-lg: 21 / 9;
	--wk-panel: #101010;
	--wk-tab-bg: #1c1c1c;
	--wk-tab-color: #fff;
	--wk-tab-active-bg: #fff;
	--wk-tab-active-color: #070707;
	--wk-badge-size: 132px;
	--wk-badge-bg: #9afd0d;
	--wk-badge-fg: #0b0b0b;
	--wk-badge-speed: 260ms;
	--wk-ease: cubic-bezier(0.22, 1, 0.36, 1);
	padding: 40px 40px 110px;
	background-color: #070707;
}

.sys-wk__inner {
	display: grid;
	grid-template-columns: var(--wk-rail) minmax(0, 1fr);
	/* start, not stretch — a stretched column has no free space to move
	   through, which silently kills position: sticky on the rail */
	align-items: start;
	gap: var(--wk-gap);
	max-width: var(--wk-max);
	margin: 0 auto;
}

/* Rail hidden (single-service pages): the projects take the whole width. */
.sys-wk--norail .sys-wk__inner {
	grid-template-columns: minmax(0, 1fr);
}

/* ---------- rail ---------- */

.sys-wk__side {
	position: sticky;
	top: var(--wk-sticky);
}

.sys-wk__panel {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 20px;
	border-radius: var(--wk-radius);
	background-color: var(--wk-panel);
}

.sys-wk__tab {
	padding: 11px 18px;
	border: 0;
	border-radius: 999px;
	background-color: var(--wk-tab-bg);
	color: var(--wk-tab-color);
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 14.5px;
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition:
		background-color 200ms ease,
		color 200ms ease;
}

/* Restated because Hello Elementor's reset paints `button:hover` pink and the
   base rule leaves the hover background unset. */
.sys-wk__tab:hover,
.sys-wk__tab:focus-visible {
	background-color: #2a2a2a;
	color: var(--wk-tab-color);
}

.sys-wk__tab.is-active,
.sys-wk__tab.is-active:hover {
	background-color: var(--wk-tab-active-bg);
	color: var(--wk-tab-active-color);
	font-weight: 600;
}

.sys-wk__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 16px;
	padding: 20px 24px;
	border-radius: var(--wk-radius);
	background-color: var(--wk-accent);
	color: #070707;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	transition: background-color 220ms ease;
}

/* The colour has to be restated: the background flips to white here, and
   without it the label falls through to the theme's own link hover. */
.sys-wk__btn:hover,
.sys-wk__btn:focus-visible {
	background-color: #fff;
	color: #070707;
}

/* ---------- cards ---------- */

.sys-wk__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wk-gap);
}

/* Two small cards, then one across the full width — the class is written by
   PHP so the interval stays a control rather than a hard-coded nth-child. */
.sys-wk__card.is-wide {
	grid-column: 1 / -1;
}

.sys-wk__card {
	/* Anchor targets land under the floating header without this. */
	scroll-margin-top: calc(var(--wk-sticky) + 20px);
}

.sys-wk__link {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var(--wk-ratio-sm);
	border-radius: var(--wk-radius);
	background-color: #111;
	color: inherit;
	text-decoration: none;
	isolation: isolate;
}

.sys-wk__card.is-wide .sys-wk__link {
	aspect-ratio: var(--wk-ratio-lg);
}

.sys-wk__media {
	position: absolute;
	inset: 0;
}

/* Two classes deep: Elementor's `.elementor img { height: auto }` is (0,1,1)
   and would otherwise collapse the fill. */
.sys-wk .sys-wk__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 700ms var(--wk-ease);
}

.sys-wk__img--empty {
	background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
}

.sys-wk__link:hover .sys-wk__img,
.sys-wk__link:focus-visible .sys-wk__img {
	transform: scale(1.04);
}

/* Scrim, so the copy stays readable over whatever the artwork happens to be. */
.sys-wk__body::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.9) 0%,
		rgba(0, 0, 0, 0.62) 34%,
		rgba(0, 0, 0, 0.12) 66%,
		rgba(0, 0, 0, 0) 100%
	);
}

.sys-wk__body {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 22px 24px 24px;
	isolation: isolate;
}

.sys-wk__stack {
	display: flex;
	gap: 6px;
	margin-bottom: 12px;
}

.sys-wk__chip {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 6px;
	border-radius: 9px;
	background-color: rgba(255, 255, 255, 0.94);
}

.sys-wk .sys-wk__chip img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sys-wk__title {
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.015em;
	color: #fff;
	transition: color 200ms ease;
}

/* The whole card is the link, so the name responds to a hover anywhere on it
   rather than only over the text itself.

   Four classes deep on purpose: the title's resting colour is an Elementor
   control, and Elementor emits it as
   `.elementor-<page> .elementor-element.elementor-element-<id> .sys-wk__title`
   — (0,3,0), which beats any two-class hover rule. */
.sys-wk .sys-wk__card .sys-wk__link:hover .sys-wk__title,
.sys-wk .sys-wk__card .sys-wk__link:focus-visible .sys-wk__title {
	color: var(--wk-accent);
}

.sys-wk__desc {
	max-width: 62ch;
	margin-top: 8px;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.55;
	color: #cfcfcf;
	/* Clamped so a long excerpt cannot grow past the scrim and sit on the
	   artwork. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---------- hover badge ----------
   Same treatment as the projects mosaic on the home page: a lime disc that
   rides the cursor across the card. */

.sys-wk__badge {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 3;
	/* JS writes --bx/--by as pixel offsets inside the card, so the centring
	   has to come from the badge's own box rather than from left/top. */
	transform: translate3d(calc(var(--bx, 50%) - 50%), calc(var(--by, 50%) - 50%), 0);
	transition: transform 0.13s ease-out;
	pointer-events: none;
}

/* No easing back to a stale position when the pointer leaves and returns. */
.sys-wk__card:not(:hover) .sys-wk__badge {
	transition: none;
}

.sys-wk__badge-in {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: var(--wk-badge-size);
	height: var(--wk-badge-size);
	padding: 10px;
	border-radius: 50%;
	background: var(--wk-badge-bg);
	color: var(--wk-badge-fg);
	text-align: center;
	opacity: 0;
	transform: scale(0.35);
	transition:
		transform var(--wk-badge-speed) cubic-bezier(0.34, 1.42, 0.64, 1),
		opacity calc(var(--wk-badge-speed) * 0.6) ease;
}

.sys-wk__link:hover .sys-wk__badge-in,
.sys-wk__link:focus-visible .sys-wk__badge-in {
	opacity: 1;
	transform: scale(1);
}

.sys-wk__badge-arrow {
	flex: 0 0 auto;
	width: calc(var(--wk-badge-size) * 0.22);
	height: calc(var(--wk-badge-size) * 0.22);
}

.sys-wk__badge-label {
	display: block;
	max-width: 100%;
	font-family: Inter, system-ui, sans-serif;
	font-size: calc(var(--wk-badge-size) * 0.098);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

/* Touch has no hover, so the disc would sit parked in a corner. */
@media (hover: none) {
	.sys-wk__badge {
		display: none;
	}
}

/* ---------- editor empty state ---------- */

.sys-wk--empty {
	padding: 40px;
	color: #929292;
	font-family: Inter, system-ui, sans-serif;
	text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
	.sys-wk {
		--wk-rail: 260px;
	}

	.sys-wk__title {
		font-size: 19px;
	}
}

@media (max-width: 767px) {
	.sys-wk {
		padding: 24px 18px 64px;
	}

	.sys-wk__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	/* The rail becomes a swipeable strip above the cards; sticky would pin a
	   full-width panel over half the screen. */
	.sys-wk__side {
		position: static;
	}

	.sys-wk__panel {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding: 14px;
		scrollbar-width: none;
	}

	.sys-wk__panel::-webkit-scrollbar {
		display: none;
	}

	.sys-wk__tab {
		flex: 0 0 auto;
		font-size: 13.5px;
	}

	.sys-wk__btn {
		margin-top: 12px;
		padding: 16px 20px;
		font-size: 15px;
	}

	.sys-wk__list {
		grid-template-columns: minmax(0, 1fr);
		margin-top: 18px;
	}

	/* One column, so every card is already full width. */
	.sys-wk__card .sys-wk__link,
	.sys-wk__card.is-wide .sys-wk__link {
		aspect-ratio: 4 / 3;
	}

	.sys-wk__body {
		padding: 16px 16px 18px;
	}

	.sys-wk__title {
		font-size: 18px;
	}

	.sys-wk__desc {
		font-size: 13.5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sys-wk .sys-wk__img,
	.sys-wk__badge,
	.sys-wk__badge-in {
		transition: none;
	}
}
