/* Work card — the tinted project card (Home grid, Work page, "next case study").
   The tint comes from --accent (the project's "dba_accent" field). The whole card is the link.
   Sizes are in cqi: 1% of the width of the board the card sits on. */

.dba-work-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 35.5cqi;
	padding: 1.9cqi 1.8cqi 1.7cqi;
	--card-tint: color-mix(in srgb, var(--accent, var(--dba-tint-blue)) calc(100% * var(--dba-tint-k)), var(--dba-surface));
	background: var(--card-tint);
	border: 1px solid color-mix(in srgb, var(--card-tint), var(--dba-ink) 7%);
	border-radius: 1.4cqi;
	overflow: hidden;
}

.dba-work-card .dba-work-card__kicker {
	max-width: 80%;
	font-size: max(0.8125rem, 0.95cqi);
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.3;
	text-transform: uppercase;
}

.dba-work-card .dba-work-card__title {
	margin-top: 0.7cqi;
	font-size: max(1.5rem, 2.55cqi);
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.dba-work-card .dba-work-card__title a {
	color: inherit;
	text-decoration: none;
}

.dba-work-card .dba-work-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.dba-work-card .dba-work-card__tagline {
	margin-top: 0.5cqi;
	color: var(--dba-ink-soft);
	font-size: max(0.875rem, 1.2cqi);
	line-height: 1.4;
}

.dba-work-card .dba-work-card__tagline p {
	margin: 0;
}

.dba-work-card::after {
	content: "";
	position: absolute;
	top: 1.6cqi;
	right: 1.6cqi;
	width: 2.9cqi;
	height: 2.9cqi;
	background: var(--dba-arrow-tile) center / 40% no-repeat, var(--dba-surface);
	border: 1px solid var(--dba-line);
	border-radius: 0.7cqi;
	pointer-events: none;
	transition: transform var(--dba-dur-s) var(--dba-ease);
}

.dba-work-card:hover::after {
	transform: translate(0.2cqi, -0.2cqi);
}

.dba-work-card .dba-work-card__media {
	display: flex;
	flex: 1;
	align-items: flex-end;
	justify-content: center;
	margin-top: 2cqi;
}

.dba-work-card .dba-work-card__media img {
	width: auto;
	max-width: 88%;
	height: auto;
	max-height: 20.5cqi;
	object-fit: contain;
}

/* Hover / keyboard focus: the card lifts, the mockup rises toward you, the arrow tile fills with the project colour.
   Mouse and trackpad only (touch screens have no hover), and not with "reduce motion". */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.dba-work-card {
		transition: transform 0.35s var(--dba-ease), box-shadow 0.35s var(--dba-ease), border-color 0.35s var(--dba-ease);
	}

	.dba-work-card .dba-work-card__media img {
		transition: transform 0.5s var(--dba-ease);
		transform-origin: 50% 100%;
	}

	.dba-work-card::after {
		transition: transform 0.35s var(--dba-ease), background-color 0.35s var(--dba-ease), border-color 0.35s var(--dba-ease);
	}

	.dba-work-card:hover,
	.dba-work-card:focus-within {
		transform: translateY(-0.4cqi);
		border-color: color-mix(in srgb, var(--card-tint), var(--dba-ink) 18%);
		box-shadow: 0 1.6cqi 3.4cqi -1.4cqi rgb(0 0 0 / 0.22);
	}

	.dba-work-card:hover .dba-work-card__media img,
	.dba-work-card:focus-within .dba-work-card__media img {
		transform: translateY(-0.9cqi) scale(1.035);
	}

	.dba-work-card:hover .dba-work-card__title a,
	.dba-work-card:focus-within .dba-work-card__title a {
		text-decoration: underline;
		text-decoration-thickness: 1px;
		text-underline-offset: 0.18em;
	}

	.dba-work-card:hover::after,
	.dba-work-card:focus-within::after {
		border-color: var(--dba-ink);
		transform: translate(0.3cqi, -0.3cqi);
	}
}

/* Dark theme: keep the project's hue but make it a dark tint (browsers without relative colours keep the soft mix above) */
@supports (color: oklch(from red l c h)) {
	:root[data-theme="dark"] .dba-work-card {
		--card-tint: oklch(from var(--accent, var(--dba-tint-blue)) 0.235 min(0.02, calc(c * 1.2)) h);
	}
}

/* Narrow canvas: sizes in rem instead of board proportions */
@container (max-width: 60rem) {
	.dba-work-card {
		min-height: 0;
		padding: 1.25rem;
		border-radius: 1rem;
	}

	.dba-work-card .dba-work-card__kicker {
		font-size: 0.8125rem;
	}

	.dba-work-card .dba-work-card__title {
		margin-top: 0.5rem;
		font-size: 1.75rem;
	}

	.dba-work-card .dba-work-card__tagline {
		margin-top: 0.4rem;
		font-size: 0.9375rem;
	}

	.dba-work-card::after {
		top: 1rem;
		right: 1rem;
		width: 2.25rem;
		height: 2.25rem;
		border-radius: 0.6rem;
	}

	.dba-work-card .dba-work-card__media {
		margin-top: 1.25rem;
	}

	.dba-work-card .dba-work-card__media img {
		max-width: 100%;
		max-height: 22rem;
	}
}
