/**
 * Case study page (single dvt_case_study): a calmer reading layout with a jump bar,
 * numbered build cards, a result callout, a picture gallery and previous / next
 * project cards. Loaded last on case study pages only (0.17.6).
 */

body[class*="single-dvt_case_study"] {
	--cs-accent: var(--wp--preset--color--accent, #3b5bdb);
	--cs-accent-2: #8b7cf6;
	--cs-ink: var(--wp--preset--color--ink, #0e1426);
	--cs-muted: var(--wp--preset--color--muted, #475066);
	--cs-line: var(--wp--preset--color--line, #e3e7ef);
	--cs-card: linear-gradient(180deg, #fff 0%, #f8f9ff 100%);
	--cs-shadow: 0 1px 2px rgb(14 20 38 / 4%), 0 18px 36px -28px rgb(14 20 38 / 30%);
	--cs-hdr: 77px;
}

/* Reading progress (browsers that support scroll-driven animation; others simply do not show it). */

@supports (animation-timeline: scroll()) {

	body[class*="single-dvt_case_study"]::before {
		position: fixed;
		inset: 0 0 auto;
		z-index: 60;
		height: 3px;
		background: linear-gradient(90deg, var(--cs-accent), var(--cs-accent-2));
		content: "";
		transform: scaleX(0);
		transform-origin: 0 50%;
		animation: dvt-case-progress linear both;
		animation-timeline: scroll(root);
	}

	@keyframes dvt-case-progress {

		to {
			transform: scaleX(1);
		}
	}
}

body[class*="single-dvt_case_study"] section[id] {
	scroll-margin-top: calc(var(--cs-hdr) + 64px);
}

/* Hero */

body[class*="single-dvt_case_study"] .dvt-hero {
	background:
		radial-gradient(60% 80% at 85% 0%, rgb(59 91 219 / 9%) 0%, transparent 70%),
		radial-gradient(50% 60% at 0% 100%, rgb(139 124 246 / 8%) 0%, transparent 70%);
}

body[class*="single-dvt_case_study"] .dvt-case--kicker {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	padding: 6px 14px;
	border: 1px solid #d9e0ff;
	border-radius: 999px;
	background: #eef1ff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--cs-accent);
}

body[class*="single-dvt_case_study"] .dvt-case--title {
	letter-spacing: -0.03em;
	text-wrap: balance;
}

body[class*="single-dvt_case_study"] .dvt-case--actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 28px;
}

.dvt-case__btn {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 0 22px;
	border: 1px solid var(--cs-line, #e3e7ef);
	border-radius: 999px;
	background: #fff;
	font-size: 15px;
	font-weight: 600;
	color: var(--cs-ink, #0e1426);
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dvt-case__btn:hover,
.dvt-case__btn:focus-visible {
	transform: translateY(-2px);
	border-color: #bcc8ff;
	box-shadow: 0 14px 26px -16px rgb(59 91 219 / 50%);
}

.dvt-case__btn--primary {
	border-color: transparent;
	background: linear-gradient(135deg, var(--cs-accent, #3b5bdb), var(--cs-accent-2, #8b7cf6));
	color: #fff;
	box-shadow: 0 14px 26px -14px rgb(59 91 219 / 65%);
}

body[class*="single-dvt_case_study"] .dvt-case--facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 12px;
	margin-top: 8px;
}

body[class*="single-dvt_case_study"] .dvt-case__fact {
	padding: 16px 18px;
	border: 1px solid var(--cs-line);
	border-radius: 16px;
	background: var(--cs-card);
	box-shadow: var(--cs-shadow);
}

body[class*="single-dvt_case_study"] .dvt-case__fact-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cs-accent);
}

body[class*="single-dvt_case_study"] .dvt-case__fact-value {
	margin-top: 4px;
	font-size: 15px;
	line-height: 1.45;
	color: var(--cs-ink);
}

body[class*="single-dvt_case_study"] .dvt-cases__frame {
	border-radius: 14px;
	box-shadow: 0 34px 60px -34px rgb(14 20 38 / 45%);
}

/* Jump bar */

.dvt-case--toc {
	position: sticky;
	top: var(--cs-hdr, 77px);
	z-index: 15;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px clamp(16px, 4vw, 48px);
	overflow-x: auto;
	border-block: 1px solid var(--cs-line, #e3e7ef);
	background: rgb(255 255 255 / 88%);
	backdrop-filter: blur(14px);
	scrollbar-width: none;
}

.dvt-case--toc::-webkit-scrollbar {
	display: none;
}

.dvt-case__toc-label {
	margin-right: 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--cs-muted, #475066);
}

.dvt-case--toc a {
	padding: 8px 16px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	color: var(--cs-ink, #0e1426);
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}

.dvt-case--toc a:hover,
.dvt-case--toc a:focus-visible {
	background: #eef1ff;
	color: var(--cs-accent, #3b5bdb);
}

/* The result: a callout */

body[class*="single-dvt_case_study"] #result .dvt-case--result > p {
	padding: 22px 26px;
	border: 1px solid #d9e0ff;
	border-left: 4px solid var(--cs-accent);
	border-radius: 16px;
	background: linear-gradient(180deg, #f6f8ff 0%, #fff 100%);
	font-size: clamp(17px, 1.5vw, 20px);
	line-height: 1.65;
	color: var(--cs-ink);
}

/* The brief: a lead paragraph */

body[class*="single-dvt_case_study"] #problem .dvt-case--problem p:first-child {
	font-size: clamp(18px, 1.6vw, 21px);
	line-height: 1.65;
	color: var(--cs-ink);
}

/* What we built: two cards across, wide cards for lists and the technology */

body[class*="single-dvt_case_study"] #fix .dvt-case--steps {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
	padding: 0;
	margin: 0;
	list-style: none;
}

body[class*="single-dvt_case_study"] .dvt-case__step {
	gap: 14px;
	padding: 30px 30px 28px;
	border: 1px solid var(--cs-line);
	border-radius: 22px;
	background: var(--cs-card);
	box-shadow: var(--cs-shadow);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

body[class*="single-dvt_case_study"] .dvt-case__step:hover {
	transform: translateY(-3px);
	border-color: #bcc8ff;
	box-shadow: 0 30px 56px -32px rgb(59 91 219 / 40%);
}

body[class*="single-dvt_case_study"] .dvt-case__step--wide {
	grid-column: 1 / -1;
}

body[class*="single-dvt_case_study"] .dvt-case__step-count {
	justify-content: flex-start;
	align-items: center;
	gap: 10px;
}

body[class*="single-dvt_case_study"] .dvt-case__step-count span + span {
	display: inline-grid;
	place-items: center;
	min-width: 38px;
	height: 28px;
	padding: 0 12px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--cs-accent), var(--cs-accent-2));
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: #fff;
}

body[class*="single-dvt_case_study"] .dvt-case__step-count span:first-child {
	display: none;
}

body[class*="single-dvt_case_study"] .dvt-case__step-title {
	font-size: clamp(20px, 1.8vw, 24px);
	line-height: 1.2;
	letter-spacing: -0.02em;
}

body[class*="single-dvt_case_study"] .dvt-case__step-text {
	font-size: 16px;
	line-height: 1.7;
	color: var(--cs-muted);
}

body[class*="single-dvt_case_study"] .dvt-case__step--wide .dvt-case__step-list {
	columns: 2;
	column-gap: 48px;
	margin: 0;
}

body[class*="single-dvt_case_study"] .dvt-case__step--wide .dvt-case__step-list li {
	break-inside: avoid;
	margin: 0 0 12px;
	line-height: 1.6;
}

/* Pictures */

body[class*="single-dvt_case_study"] .dvt-case__figure {
	transition: transform 0.3s ease;
}

body[class*="single-dvt_case_study"] .dvt-case__figure:hover {
	transform: translateY(-3px);
}

body[class*="single-dvt_case_study"] .dvt-case__figure figcaption {
	margin-top: 12px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--cs-muted);
}

/* Previous and next project */

.dvt-case--adjacent {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
	max-width: 1440px;
	margin: 0 auto;
	padding: clamp(32px, 5vw, 64px) clamp(20px, 4.5vw, 65px) 0;
}

.dvt-case__adj {
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 16px;
	border: 1px solid var(--cs-line, #e3e7ef);
	border-radius: 20px;
	background: linear-gradient(180deg, #fff 0%, #f8f9ff 100%);
	box-shadow: 0 1px 2px rgb(14 20 38 / 4%), 0 18px 36px -28px rgb(14 20 38 / 30%);
	color: inherit;
	text-decoration: none;
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.dvt-case__adj:hover,
.dvt-case__adj:focus-visible {
	transform: translateY(-3px);
	border-color: #bcc8ff;
	box-shadow: 0 30px 56px -32px rgb(59 91 219 / 40%);
}

.dvt-case__adj--next {
	flex-direction: row-reverse;
	text-align: right;
}

.dvt-case__adj-pic {
	flex: none;
	width: 112px;
	height: 80px;
	overflow: hidden;
	border-radius: 12px;
	background: #eef1ff;
}

.dvt-case__adj-pic img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

.dvt-case__adj-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.dvt-case__adj-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cs-accent, #3b5bdb);
}

.dvt-case__adj-title {
	font-family: var(--wp--preset--font-family--display, sans-serif);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.015em;
	color: var(--cs-ink, #0e1426);
}

.dvt-case__adj-meta {
	font-size: 13px;
	color: var(--cs-muted, #475066);
}

@media (max-width: 860px) {

	body[class*="single-dvt_case_study"] #fix .dvt-case--steps {
		grid-template-columns: 1fr;
	}

	body[class*="single-dvt_case_study"] .dvt-case__step--wide .dvt-case__step-list {
		columns: 1;
	}

	.dvt-case--adjacent {
		grid-template-columns: 1fr;
	}

	.dvt-case__adj--next {
		flex-direction: row;
		text-align: left;
	}

	body[class*="single-dvt_case_study"] .dvt-case__step {
		padding: 24px 22px;
	}
}

@media (max-width: 640px) {

	body[class*="single-dvt_case_study"] {
		--cs-hdr: 64px;
	}

	body[class*="single-dvt_case_study"] .dvt-case--actions .dvt-case__btn {
		flex: 1 1 100%;
		justify-content: center;
	}

	.dvt-case__adj-pic {
		width: 88px;
		height: 64px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.dvt-case__btn,
	body[class*="single-dvt_case_study"] .dvt-case__step,
	body[class*="single-dvt_case_study"] .dvt-case__figure,
	.dvt-case__adj {
		transition: none;
	}

	.dvt-case__btn:hover,
	body[class*="single-dvt_case_study"] .dvt-case__step:hover,
	body[class*="single-dvt_case_study"] .dvt-case__figure:hover,
	.dvt-case__adj:hover {
		transform: none;
	}
}
