/**
 * cmsMinds global CSS: base, primitives and section scaffolding.
 *
 * Tokens come from theme.json (--wp--preset--*); --cm-* aliases keep block CSS
 * short. Block styles live in blocks/<name>/style.css. Values match the design.
 */

:root {
	--cm-blue: var(--wp--preset--color--blue);
	--cm-blue-dark: var(--wp--preset--color--blue-dark);
	--cm-cyan: var(--wp--preset--color--cyan);
	--cm-cyan-soft: var(--wp--preset--color--cyan-soft);
	--cm-coral: var(--wp--preset--color--coral);
	--cm-ink: var(--wp--preset--color--ink);
	--cm-charcoal: var(--wp--preset--color--charcoal);
	--cm-charcoal-2: var(--wp--preset--color--charcoal-2);
	--cm-charcoal-3: var(--wp--preset--color--charcoal-3);
	--cm-charcoal-4: var(--wp--preset--color--charcoal-4);
	--cm-body: var(--wp--preset--color--body);
	--cm-muted: var(--wp--preset--color--muted);
	--cm-muted-2: var(--wp--preset--color--muted-2);
	--cm-muted-3: var(--wp--preset--color--muted-3);
	--cm-on-dark-muted: var(--wp--preset--color--on-dark-muted);
	--cm-on-dark-soft: var(--wp--preset--color--on-dark-soft);
	--cm-line: var(--wp--preset--color--line);
	--cm-line-2: var(--wp--preset--color--line-2);
	--cm-surface: var(--wp--preset--color--surface);
	--cm-white: var(--wp--preset--color--white);
	--cm-blue-tint: var(--wp--preset--color--blue-tint);
	--cm-blue-tint-soft: var(--wp--preset--color--blue-tint-soft);

	--cm-font-display: var(--wp--preset--font-family--display);
	--cm-font-body: var(--wp--preset--font-family--body);
	--cm-font-mono: var(--wp--preset--font-family--mono);

	--cm-section-y: clamp(56px, 8vw, 120px);
	--cm-section-y-band: clamp(56px, 7vw, 104px); /* Compact text bands (Industry "What we solve", Homepage "By the numbers"). */
	--cm-section-y-compact: clamp(56px, 6vw, 88px); /* Strips without a full header (results, recognitions, blog grid top). */
	--cm-gutter: clamp(20px, 4vw, 48px);
	--cm-container: 1280px;

	/* Brand corner: only the bottom-right is rounded. */
	--cm-radius-card: 0 0 24px 0;
	--cm-radius-card-lg: 0 0 28px 0;
	--cm-radius-tile: 0 0 clamp(36px, 4vw, 56px) 0;
	--cm-radius-panel: 0 0 clamp(40px, 5vw, 72px) 0;

	--cm-shadow-blue: 0 10px 24px -10px rgba(0, 85, 165, 0.6);

	--cm-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1); /* power3.out */
	--cm-ease-in: cubic-bezier(0.55, 0.085, 0.68, 0.53); /* power2.in */
	--cm-ease-back: cubic-bezier(0.34, 1.9, 0.5, 1); /* ~back.out(3) */
}

/* ---- Base ---- */
html {
	scroll-behavior: smooth;
	scroll-padding-top: 96px; /* In-page links land below the sticky header. */
}

body {
	-webkit-font-smoothing: antialiased;
	text-wrap: pretty;
}

summary {
	cursor: pointer;
}

summary::-webkit-details-marker {
	display: none;
}

::selection {
	background: var(--cm-cyan);
	color: var(--cm-charcoal);
}

:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
	outline: 3px solid var(--cm-cyan);
	outline-offset: 3px;
}

/* Inline links in running text need more than colour to stand out (WCAG 1.4.1). */
/* Prose only: blocks style their own links (linked cards must not underline). */
:where(.cm-prose :where(p, li), .cm-faq__answer :where(p, li), .entry-content > :where(p, ul, ol)) a:not(.cm-btn, .cm-ulink) {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

:where(img, video) {
	max-width: 100%;
	height: auto;
}

/* ---- Pause button for moving content (cmsminds_pause_button) ---- */
.cm-pause {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
	border-radius: 50%;
	background: none;
	color: inherit;
	cursor: pointer;
}

.cm-pause:hover {
	border-color: currentColor;
}

.cm-pause[aria-pressed="true"] .cm-pause__pause,
.cm-pause:not([aria-pressed="true"]) .cm-pause__play {
	display: none;
}

/* ---- Core breadcrumbs (blog, posts and default pages) ---- */
.wp-block-breadcrumbs {
	font-size: clamp(14px, 1.09375vw, 16px); /* Design 14px at 1280; grows on larger screens. */
}

.wp-block-breadcrumbs ol {
	gap: 10px;
}

/* Separators are the small brand mark (.cm-mark--sm); core's inline "/" is cleared by content. */
.wp-block-breadcrumbs li:not(:last-child)::after {
	content: "";
	width: 0.43em;
	height: 0.86em;
	margin: 0 0.15em 0 0.86em;
	background: linear-gradient(90deg, var(--cm-blue) 0 0.15em, transparent 0.15em 0.29em, var(--cm-cyan) 0.29em);
	opacity: 1;
	transform: skewX(-20deg);
}

.wp-block-breadcrumbs a {
	color: inherit;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.cm-pause {
		display: none;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
	}
}

.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* ---- Scroll reveal (motion.js adds .cm-reveal below the fold, .is-in on entry) ---- */
.cm-reveal {
	opacity: 0;
	transition: opacity 0.7s ease-out;
}

/* Text, lists and portraits also rise a little; boxes only fade. */
.cm-reveal--rise {
	transform: translate3d(0, 16px, 0);
	transition:
		opacity 0.7s ease-out,
		transform 0.7s var(--cm-ease-out);
}

.cm-reveal.is-in {
	opacity: 1;
	transform: none;
}

@media print {
	.cm-reveal {
		opacity: 1;
		transform: none;
	}
}

/* ---- CTA tiles (motion.js adds .cm-tiles; entrance wave, then turns while hovered) ---- */
.cm-tiles > span {
	opacity: 0;
	transform: scale(0.6) rotate(var(--r, 0deg));
	transition:
		opacity 0.5s ease-out,
		transform 0.8s var(--cm-ease-out);
	transition-delay: var(--d, 0ms);
}

.cm-tiles.is-in > span {
	opacity: 1;
	transform: rotate(var(--r, 0deg));
}

/* ---- Page transitions: a short crossfade between pages (the header is identical, so it reads as still) ---- */
@media (prefers-reduced-motion: no-preference) {
	@view-transition {
		navigation: auto;
	}

	::view-transition-old(root),
	::view-transition-new(root) {
		animation-duration: 0.25s;
		animation-timing-function: var(--cm-ease-out);
	}
}

/* ---- Sections ---- */
.cm-section {
	position: relative;
	overflow: hidden;
	padding: var(--cm-section-y) var(--cm-gutter);
	background: var(--cm-white);
	color: var(--cm-ink);
}

.cm-section--surface {
	background: var(--cm-surface);
}

.cm-section--dark {
	background: var(--cm-charcoal);
	color: var(--cm-white);
}

.cm-container {
	position: relative;
	max-width: var(--cm-container);
	margin: 0 auto;
}

/* Coral semicircle join: a quarter at the bottom of a section ("Join" block
   style) meets a mirrored quarter atop the next. The page's last block always
   joins the footer. */
.is-style-join-right::after,
.is-style-join-right + .cm-section::before,
.is-style-join-left::after,
.is-style-join-left + .cm-section::before,
main > .wp-block-post-content > :last-child::after,
main > :last-child:not(.wp-block-post-content)::after,
.cm-footer::before {
	content: "";
	position: absolute;
	z-index: 1;
	width: clamp(51px, 6.4vw, 96px);
	height: clamp(51px, 6.4vw, 96px);
	background: var(--cm-coral);
	pointer-events: none;
}

.is-style-join-right::after,
main > .wp-block-post-content > :last-child::after,
main > :last-child:not(.wp-block-post-content)::after {
	right: 0;
	bottom: 0;
	border-radius: 100% 0 0 0;
}

main > .wp-block-post-content > :last-child,
main > :last-child:not(.wp-block-post-content) {
	position: relative;
}

.is-style-join-right + .cm-section::before,
.cm-footer::before {
	right: 0;
	top: 0;
	border-radius: 0 0 0 100%;
}

.is-style-join-left::after {
	left: 0;
	bottom: 0;
	border-radius: 0 100% 0 0;
}

.is-style-join-left + .cm-section::before {
	left: 0;
	top: 0;
	border-radius: 0 0 100% 0;
}

/* ---- Typography ---- */
.cm-h1,
.cm-h1-home,
.cm-h2,
.cm-h3,
.cm-h3-lg {
	margin: 0;
	font-family: var(--cm-font-display);
	color: inherit;
}

.cm-h1-home {
	font-size: clamp(44px, 6.2vw, 92px);
	font-weight: 700;
	line-height: 0.95;
	letter-spacing: -0.05em;
	text-wrap: balance;
}

.cm-h1 {
	font-size: clamp(44px, 6vw, 84px);
	font-weight: 700;
	line-height: 0.96;
	letter-spacing: -0.045em;
}

.cm-h2 {
	font-size: clamp(34px, 4.4vw, 60px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.04em;
	max-width: 18ch;
}

.cm-h3-lg {
	font-size: clamp(24px, 2.4vw, 30px);
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.cm-h3 {
	font-size: clamp(18px, 1.7vw, 21px);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.015em;
}

.cm-lead {
	margin: 0;
	font-size: 18px;
	line-height: 1.6;
	color: var(--cm-body);
	max-width: 52ch;
}

.cm-section--dark .cm-lead,
.cm-on-dark .cm-lead {
	color: var(--cm-on-dark-muted);
}

.cm-mono {
	font-family: var(--cm-font-mono);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* ---- Eyebrow: two skewed bars + label ---- */
.cm-eyebrow {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-family: var(--cm-font-body);
	font-size: 14px;
	font-weight: 500;
	line-height: normal;
	color: var(--cm-muted);
}

.cm-section--dark .cm-eyebrow,
.cm-on-dark .cm-eyebrow {
	color: var(--cm-on-dark-muted);
}

.cm-mark {
	display: inline-flex;
	flex: none;
	gap: 3px;
}

.cm-mark::before,
.cm-mark::after {
	content: "";
	width: 3px;
	height: 14px;
	background: var(--cm-blue);
	transform: skewX(-20deg);
}

.cm-mark::after {
	background: var(--cm-cyan);
}

/* Breadcrumb size, in em to follow the text (design at 14px: 2px bars, 2px apart, 12px tall). */
.cm-mark--sm {
	gap: 0.15em;
	margin: 0 0.15em;
}

.cm-mark--sm::before,
.cm-mark--sm::after {
	width: 0.15em;
	height: 0.86em;
}

/* ---- Section header: eyebrow + H2 on one side, lead on the other ---- */
.cm-head {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
	gap: 20px clamp(32px, 5vw, 80px);
	align-items: end;
	margin-bottom: clamp(40px, 5vw, 64px);
}

.cm-head .cm-eyebrow {
	margin-bottom: 18px;
}

.cm-head > *,
.cm-head .cm-roll * {
	min-width: 0;
	white-space: normal;
}

/* ---- Buttons ---- */
.cm-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 15px 24px;
	border: 0;
	border-radius: 0 0 18px 0;
	background: var(--cm-blue);
	color: var(--cm-white);
	font-family: var(--cm-font-body);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s, box-shadow 0.2s;
}

.cm-btn:hover,
.cm-btn:focus-visible {
	background: var(--cm-blue-dark);
	color: var(--cm-white);
	box-shadow: var(--cm-shadow-blue);
}

.cm-btn--lg {
	padding: 16px 26px;
}

.cm-btn--cyan {
	background: var(--cm-cyan);
	color: var(--cm-charcoal);
}

.cm-btn--cyan:hover,
.cm-btn--cyan:focus-visible {
	background: var(--cm-cyan-soft);
	color: var(--cm-charcoal);
	box-shadow: none;
}

/* Outline buttons: 1px less padding than solid ones (design). */
.cm-btn--outline-light,
.cm-btn--outline-dark {
	padding: 14px 23px;
}

.cm-btn--outline-light {
	background: transparent;
	color: var(--cm-white);
	box-shadow: inset 0 0 0 1.5px var(--cm-white);
}

.cm-btn--outline-light:hover,
.cm-btn--outline-light:focus-visible {
	background: rgba(255, 255, 255, 0.08);
	color: var(--cm-white);
	box-shadow: inset 0 0 0 1.5px var(--cm-white);
}

.cm-btn--outline-dark {
	background: transparent;
	color: var(--cm-ink);
	box-shadow: inset 0 0 0 1px var(--cm-ink);
}

.cm-btn--outline-dark:hover,
.cm-btn--outline-dark:focus-visible {
	background: var(--cm-ink);
	color: var(--cm-white);
	box-shadow: inset 0 0 0 1px var(--cm-ink);
}

/* Header CTA: fixed 48px height, brand corner. */
.cm-btn--header {
	gap: 8px;
	height: 48px;
	box-sizing: border-box;
	padding: 0 clamp(14px, 1.6vw, 20px);
	border-radius: 6px 6px 20px 6px;
	font-size: 15px;
}

/* Small chip (footer social links). */
.cm-btn--chip {
	gap: 6px;
	padding: 8px 12px;
	border-radius: 0 0 10px 0;
	background: var(--cm-charcoal-2);
	font-size: 13px;
}

.cm-btn--chip:hover,
.cm-btn--chip:focus-visible {
	background: var(--cm-charcoal-4);
	box-shadow: none;
}

.cm-btn__icon {
	flex: 0 0 auto;
	display: block;
	width: 18px;
	height: 18px;
}

.cm-btn--header .cm-btn__icon {
	width: 16px;
	height: 16px;
}

/* ---- Underline link ---- */
.cm-ulink {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 3px;
	color: var(--cm-ink);
	font-family: var(--cm-font-body);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	text-decoration: none;
}

.cm-ulink:hover,
.cm-ulink:focus-visible {
	color: var(--cm-ink);
}

.cm-ulink--light,
.cm-ulink--light:hover,
.cm-ulink--light:focus-visible {
	color: var(--cm-white);
}

.cm-ulink--blue,
.cm-ulink--blue:hover,
.cm-ulink--blue:focus-visible {
	color: var(--cm-blue);
}

.cm-ulink__bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: var(--cm-cyan);
	pointer-events: none;
	transform-origin: right center;
}

.cm-ulink__icon {
	width: 16px;
	height: 16px;
	flex: none;
	transition: transform 0.4s var(--cm-ease-back);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.cm-ulink:hover .cm-ulink__icon,
	.cm-ulink:focus-visible .cm-ulink__icon {
		transform: translateX(4px);
	}

	.cm-ulink:hover .cm-ulink__bar,
	.cm-ulink:focus-visible .cm-ulink__bar {
		animation: cm-uline-sweep 0.62s both;
	}
}

/* Bar shrinks away to the right, then grows back in from the left. */
@keyframes cm-uline-sweep {
	0% {
		transform: scaleX(1);
		transform-origin: right center;
		animation-timing-function: var(--cm-ease-in);
	}

	35% {
		transform: scaleX(0);
		transform-origin: right center;
	}

	35.01% {
		transform: scaleX(0);
		transform-origin: left center;
		animation-timing-function: var(--cm-ease-out);
	}

	100% {
		transform: scaleX(1);
		transform-origin: left center;
	}
}

/* ---- Roll label: two stacked copies; motion.js splits them into characters ---- */
.cm-roll {
	position: relative;
	display: block;
	overflow: hidden;
	line-height: 1.25;
}

.cm-roll__a,
.cm-roll__b {
	display: block;
	white-space: nowrap;
}

.cm-roll__b {
	position: absolute;
	left: 0;
	top: 100%;
}

.cm-roll .cm-char {
	display: inline-block;
	transition: transform 0.4s var(--cm-ease-out);
	transition-delay: calc(var(--i, 0) * 15ms);
	white-space: pre;
}

/* motion.js adds .is-rolled on hover/keyboard focus (never under reduced motion). */
.is-rolled .cm-roll__a .cm-char {
	transform: translateY(-110%);
}

.is-rolled .cm-roll__b .cm-char {
	transform: translateY(-100%);
}

/* ---- Quarter-circle pattern (decorative) ---- */
.cm-qc {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 8px;
	width: 100%;
	max-width: 340px;
}

.cm-qc > span {
	aspect-ratio: 1 / 1;
	background: var(--cm-blue);
}

.cm-qc .is-cyan {
	background: var(--cm-cyan);
}

.cm-qc .is-coral {
	background: var(--cm-coral);
}

.cm-qc .is-white {
	background: var(--cm-white);
}

.cm-qc .is-line {
	background: var(--cm-line);
}

.cm-qc .is-charcoal-2 {
	background: var(--cm-charcoal-2);
}

.cm-q-tl {
	border-radius: 100% 0 0 0;
}

.cm-q-tr {
	border-radius: 0 100% 0 0;
}

.cm-q-br {
	border-radius: 0 0 100% 0;
}

.cm-q-bl {
	border-radius: 0 0 0 100%;
}

/* ---- Breadcrumb ---- */
.cm-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: clamp(14px, 1.09375vw, 16px);
	font-weight: 500;
}

.cm-breadcrumb li {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.cm-breadcrumb a {
	color: inherit;
}

.cm-breadcrumb [aria-current="page"] {
	font-weight: 600;
}

/* Block library page (private): a strip naming the block below it. */
.cm-library-label {
	margin: 0;
	padding: 10px var(--cm-gutter);
	border-block: 1px solid var(--cm-line-2);
	background: var(--cm-blue-tint-soft);
	color: var(--cm-body);
	font-family: var(--cm-font-mono);
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* Editor: site blocks span the canvas, as on the page (not the 760px text width). */
.block-editor-block-list__layout.is-root-container > [data-type^="cmsminds/"] {
	max-width: none;
}

/* Editor-only hint shown by empty blocks. */
.cmsminds-placeholder {
	padding: 24px;
	border: 1px dashed var(--cm-muted);
	color: var(--cm-muted);
	font-size: 14px;
}
