/*
 * Theme-level corrections. Loaded after the approved static stylesheets, which
 * stay untouched.
 */

/*
 * Full screen menu: on laptop and phone heights the link columns are taller than
 * the window, and the mouse wheel moved the page behind the menu. The links now
 * scroll inside the menu; the layout is unchanged where everything fits.
 */
html:has(body.menu-open) {
	overflow: hidden;
}

.menu {
	grid-template-rows: minmax(0, 1fr);
}

.menu .mr {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--lt);
}

.menu .mr > .mlinks {
	flex: 0 1 auto;
	min-height: 50%;
	align-content: flex-start;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding-bottom: 32px;
	/* Links fade out before they reach the header buttons. */
	-webkit-mask-image: linear-gradient(180deg, transparent 0 62px, #000 78px);
	mask-image: linear-gradient(180deg, transparent 0 62px, #000 78px);
}

.menu .mr > .mimg {
	flex: 1 1 0;
	min-height: 0;
}

/*
 * Menu columns in rows of three (tablet and up), so "Industries" sits beside
 * "Mobile Apps" and "Marketing" instead of dropping to a third row.
 */
@media (min-width: 701px) {
	.menu .mr > .mlinks {
		display: grid;
		grid-template-columns: repeat(3, auto);
		justify-content: start;
		align-content: start;
		column-gap: clamp(16px, 2.2vw, 56px);
		row-gap: 44px;
		padding-left: clamp(24px, 3.2vw, 64px);
		padding-right: 20px;
	}
}

@media (min-width: 701px) {
	.menu .mlinks a {
		white-space: nowrap;
	}
}

/* Narrow laptops: the menu takes half the window, so the links are slightly smaller. */
@media (min-width: 1001px) and (max-width: 1300px) {
	.menu .mr > .mlinks {
		column-gap: 14px;
		padding-left: 24px;
		padding-right: 12px;
	}
	.menu .mlinks a {
		font-size: clamp(12px, 1.1vw, 14px);
	}
}

/* Shopify page: partner announcement as a compact highlighted band above the resources. */
.midcta.cp-partner {
	background: var(--lt);
	padding-top: 64px;
	padding-bottom: 64px;
}

.cp-partner .cp-partner-label {
	display: block;
	margin-bottom: 10px;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: .4px;
	text-transform: uppercase;
}

@media (max-width: 700px) {
	.midcta.cp-partner {
		padding-top: 40px;
		padding-bottom: 40px;
	}
}

/* Touch screens: at least 48px of tappable area on the small header controls, without changing their look. */
@media (pointer: coarse) {
	header.nav .burger,
	header.nav .theme,
	header.nav .navcta {
		position: relative;
	}
	header.nav .burger::after,
	header.nav .theme::after,
	header.nav .navcta::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: max(100%, 48px);
		height: max(100%, 48px);
		transform: translate(-50%, -50%);
	}
}

/* Coding Pixel logo on the right of the partner band, in the band's text colour. */
.cp-partner .cp-partner-logo {
	flex: 0 1 380px;
	min-width: 0;
}

.cp-partner .cp-partner-logo svg,
.cp-partner .cp-partner-logo img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 110px;
	object-fit: contain;
	object-position: right center;
	margin-left: auto;
}

.cp-partner .cp-partner-logo svg {
	max-width: 380px;
}

.cp-partner .cp-partner-logo svg path {
	fill: currentColor !important;
}

@media (max-width: 700px) {
	.cp-partner .cp-partner-logo {
		flex: none;
		width: 100%;
		max-width: 220px;
	}

	.cp-partner .cp-partner-logo svg,
	.cp-partner .cp-partner-logo img {
		margin-left: 0;
		object-position: left center;
	}
}

/* =====================================================================
 * Responsive corrections: only the places that overlapped or overflowed.
 * ===================================================================== */

/*
 * Case study, success story and article headers: with a long title or a short
 * window the text block ran up over the breadcrumbs and the header. The hero now
 * grows with its content; where everything fits it looks as before.
 */
.sec.case-hero {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: auto;
	min-height: max(680px, 92vh);
}

.sec.case-hero.post-hero {
	min-height: max(620px, 86vh);
}

.sec.case-hero > .left {
	position: relative;
	inset: auto;
	margin: 150px 40px 60px;
}

@media (max-width: 1000px) {
	.sec.case-hero > .left {
		margin: 150px 24px 50px;
	}
}

/* Wide comparison tables and long web addresses inside articles. */
.prose p,
.prose li {
	overflow-wrap: break-word;
}

/* Small phones. */
@media (max-width: 360px) {
	.sec.case-hero h1 {
		font-size: 44px;
		letter-spacing: -1.2px;
		overflow-wrap: break-word;
	}

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

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

	.svc-hero h1 {
		font-size: 38px;
	}

	main h2.h {
		font-size: 35px;
	}

	/* Office clocks on the About page. */
	.ab-top {
		flex-wrap: wrap;
		gap: 20px;
		padding: 0 24px;
	}

	.ab-top .clocks {
		flex-wrap: wrap;
		gap: 18px 24px;
	}

	body footer {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Home, very small phones: the row of work controls wraps so the button stays on screen. */
@media (max-width: 360px) {
	.wkrow-ctl {
		flex-wrap: wrap;
		row-gap: 12px;
	}
}

/* Headings kept for screen readers and search engines only (heading order). */
h2.sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/*
 * Careers page: the article text styles are made for light panels. In the dark
 * "interview process" panel the text follows the panel's own colour (both themes).
 */
.sec .prose.cp-dark,
.sec .prose.cp-dark :is(h3, h4, p, li, a) {
	color: inherit;
}

.sec .prose.cp-dark p {
	opacity: .78;
}

/* Careers page: the text starts on the same line as its heading. */
.cp-careers .prose {
	margin-left: 0;
	padding-left: 0;
	padding-right: 0;
}

/* Success stories: the heading of the dark "Your project next" card was dark on dark. */
.wk.wkcta b {
	color: #fff;
}

/*
 * Article subheadings moved from H4 to H3 for a correct heading order keep the
 * spacing they had as H4.
 */
.prose h3.h4x {
	line-height: inherit;
	scroll-margin-top: 0;
}

/*
 * Article body content from the editor: links, pictures, picture beside text,
 * galleries and the in-article call to action line.
 */
.prose a:not(.btn) {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	overflow-wrap: anywhere;
}

.prose img {
	max-width: 100%;
	height: auto;
}

.prose .cp-fig {
	margin: 26px 0 30px;
}

.prose .cp-fig img {
	display: block;
	margin: 0 auto;
}

.prose figcaption,
.prose .cp-caption {
	font-size: 13px;
	line-height: 1.5;
	opacity: .7;
	margin-top: 8px;
}

.prose .cp-mt {
	display: grid;
	grid-template-columns: var(--cp-media, 50%) minmax(0, 1fr);
	gap: 28px;
	align-items: start;
	margin: 18px 0 26px;
}

.prose .cp-mt.cp-r {
	grid-template-columns: minmax(0, 1fr) var(--cp-media, 50%);
}

.prose .cp-mt-media {
	margin: 0;
}

.prose .cp-mt-media img {
	display: block;
	width: 100%;
}

.prose .cp-mt-text {
	min-width: 0;
}

.prose .cp-mt-text > :first-child {
	margin-top: 0;
}

.prose .cp-mt-text > :last-child {
	margin-bottom: 0;
}

.prose .cp-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin: 26px 0 30px;
}

.prose .cp-gallery figure {
	margin: 0;
}

.prose p.cp-talk {
	margin: 32px 0;
	padding: 22px 26px;
	background: #060606;
	color: #fff;
	border-left: 3px solid #22e3d9;
	font-size: 17px;
	line-height: 1.6;
}

.prose p.cp-talk a {
	color: #22e3d9;
}

html.light .prose p.cp-talk {
	background: #f4f4f4;
	color: #0d0d0d;
}

html.light .prose p.cp-talk a {
	color: #0a8a83;
}

@media (max-width: 700px) {
	.prose .cp-mt,
	.prose .cp-mt.cp-r {
		grid-template-columns: minmax(0, 1fr);
		gap: 18px;
	}

	.prose .cp-mt-media {
		order: -1;
	}

	.prose .cp-mt-media img {
		width: auto;
		margin: 0 auto;
	}
}
