/*
 * Theme-level styling only. Everything that can be expressed as a token belongs
 * in theme.json; this file is for the handful of rules the block-styles engine
 * cannot express.
 *
 * Never hardcode a colour or spacing value here. Use the preset custom properties.
 */

/* --- Classic shell ------------------------------------------------------
   header.php, footer.php and the <main> wrapper reproduce what the block
   templates used to express through generated layout classes. The measures
   below are the ones the block templates set: 1280 for the outer frame, and
   theme.json's 1240/760 for everything inside the content.

   `.entry-content` carries `is-layout-constrained` so that WordPress's own
   global layout rules keep sizing the blocks inside it exactly as before. */

.adaptive-main > .entry-content,
.adaptive-main > .adaptive-breadcrumbs__inner {
	max-width: 1280px;
	margin-inline: auto;
}

body.adaptive-tpl-flush .adaptive-main {
	padding-block: 0;
}

body.adaptive-tpl-page .adaptive-main {
	padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--70);
}

body.adaptive-tpl-listing .adaptive-main {
	padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--70);
}

body.adaptive-tpl-roomy .adaptive-main {
	padding-block: var(--wp--preset--spacing--70) var(--wp--preset--spacing--80);
}

/* --- Header shell ------------------------------------------------------- */

.adaptive-header {
	padding-block: var(--wp--preset--spacing--20);
	padding-inline: var(--wp--style--root--padding-right, 1.25rem);
}

.adaptive-header__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: nowrap;
	max-width: 1280px;
	margin-inline: auto;
}

.adaptive-header__logo {
	display: flex;
	align-items: center;
}

.adaptive-header__logo img,
.adaptive-header .custom-logo {
	width: auto;
	max-width: 200px;
	max-height: 40px;
	object-fit: contain;
}

.adaptive-header__sitename {
	font-weight: 700;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.adaptive-nav {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: clamp(1rem, 2.2vw, 2.25rem);
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--sm);
}

.adaptive-nav li {
	margin: 0;
}

.adaptive-header__cta a {
	white-space: nowrap;
}

/* The toggle only exists below the breakpoint. */
.adaptive-header__toggle {
	display: none;
	/* Fixed size: without this the flex row shrinks it to nothing and the bar
	   overflows the viewport on small screens. */
	flex: 0 0 auto;
	position: relative;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--wp--custom--radius--sm);
	background: transparent;
	cursor: pointer;
}

.adaptive-header__toggle-bars,
.adaptive-header__toggle-bars::before,
.adaptive-header__toggle-bars::after {
	position: absolute;
	left: 50%;
	width: 20px;
	height: 2px;
	background: var(--wp--preset--color--contrast);
	transform: translateX(-50%);
}

.adaptive-header__toggle-bars {
	top: 50%;
	translate: 0 -50%;
}

.adaptive-header__toggle-bars::before,
.adaptive-header__toggle-bars::after {
	content: "";
}

.adaptive-header__toggle-bars::before {
	top: -6px;
}

.adaptive-header__toggle-bars::after {
	top: 6px;
}

/* --- Footer shell ------------------------------------------------------- */

.adaptive-footer {
	padding-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40);
	padding-inline: var(--wp--style--root--padding-right, 1.25rem);
}

.adaptive-footer__inner {
	max-width: 1240px;
	margin-inline: auto;
}

.adaptive-footer__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
}

.adaptive-footer__social {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0;
	list-style: none;
}

.adaptive-footer__social a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: var(--wp--preset--color--on-ink);
}

.adaptive-footer__social a:hover {
	background: rgba(255, 255, 255, 0.16);
}

.adaptive-footer__columns {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50);
	margin-top: var(--wp--preset--spacing--50);
}

.adaptive-footer__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
}

/* --- Breadcrumbs -------------------------------------------------------- */

.adaptive-breadcrumbs {
	margin-bottom: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--muted);
}

.adaptive-breadcrumbs a {
	color: var(--wp--preset--color--muted);
}

.adaptive-breadcrumbs a:hover {
	color: var(--wp--preset--color--accent);
}

/* --- Post lists --------------------------------------------------------- */

.adaptive-postlist {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: var(--wp--preset--spacing--50);
}

.adaptive-postcard img {
	width: 100%;
	height: auto;
	border-radius: var(--wp--custom--radius--md);
}

.adaptive-postcard__title {
	margin: var(--wp--preset--spacing--20) 0 var(--wp--preset--spacing--10);
}

.adaptive-postcard__title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.adaptive-entry-image img {
	width: 100%;
	height: auto;
	border-radius: var(--wp--custom--radius--lg);
}

@media (max-width: 781px) {

	.adaptive-header__bar {
		flex-wrap: wrap;
		gap: var(--wp--preset--spacing--20);
	}

	/* The logo is the only part that may give ground; the toggle and the call
	   to action keep their size. */
	.adaptive-header__logo {
		flex: 1 1 auto;
		min-width: 0;
	}

	/* Order the bar explicitly so the toggle always ends the first row rather
	   than being pushed onto a line of its own. */
	.adaptive-header__logo {
		order: 1;
	}

	.adaptive-header__cta {
		flex: 0 0 auto;
		order: 2;
	}

	.adaptive-header__cta a {
		padding-inline: 1rem;
		font-size: var(--wp--preset--font-size--xs);
	}

	.adaptive-header__toggle {
		display: block;
		order: 3;
	}

	.adaptive-header__nav {
		order: 4;
		flex-basis: 100%;
		display: none;
	}

	.adaptive-header__nav.is-open {
		display: block;
		padding-top: var(--wp--preset--spacing--30);
	}

	.adaptive-header__nav.is-open .adaptive-nav {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--wp--preset--spacing--20);
	}

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

/* Dark sections: flip link and heading colours without touching every block. */
.has-ink-background-color,
.has-ink-soft-background-color {
	color: var(--wp--preset--color--on-ink);
}
.has-ink-background-color :where(h1, h2, h3, h4, h5, h6),
.has-ink-soft-background-color :where(h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--on-ink);
}
.has-ink-background-color :where(p),
.has-ink-soft-background-color :where(p) {
	color: var(--wp--preset--color--on-ink-muted);
}

/* Respect the user's motion preference across every animated block. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Visible focus, everywhere. The design has none; accessibility requires it. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
	border-radius: var(--wp--custom--radius--sm);
}

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

/* Small uppercase label above a section heading. Used in core compositions
   (Media & Text, groups) where a custom block would be overkill. */
.adaptive-eyebrow {
	margin: 0 0 var(--wp--preset--spacing--10);
	display: inline-block;
	padding: 0.3rem 0.85rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* Three-part header: logo left, navigation centred, call to action right.
   The outer two columns share a basis so the nav sits at the true centre of
   the bar rather than the centre of the space left over. */
.adaptive-header {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.adaptive-header__bar {
	gap: var(--wp--preset--spacing--30);
}

.adaptive-header__bar > .adaptive-header__logo,
.adaptive-header__bar > .adaptive-header__cta {
	flex: 1 0 auto;
}

.adaptive-header__bar > .adaptive-header__cta {
	justify-content: flex-end;
}

.adaptive-header__bar > .adaptive-header__nav {
	flex: 0 1 auto;
}

.adaptive-header__nav a {
	color: var(--wp--preset--color--contrast);
}

.adaptive-header__nav a:hover {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

/* Below the nav's breakpoint the bar becomes logo + CTA + hamburger, so the
   centring basis would only push things apart. */
@media (max-width: 781px) {

	.adaptive-header__bar > .adaptive-header__logo,
	.adaptive-header__bar > .adaptive-header__cta {
		flex: 0 0 auto;
	}
}

/* --- Footer -------------------------------------------------------------
   Logo and socials on one row, link columns beneath, then a divider with the
   copyright left and legal links right. */

.adaptive-footer__top {
	gap: var(--wp--preset--spacing--30);
}

.adaptive-footer__logo {
	margin: 0;
}

.adaptive-footer__logo img {
	display: block;
	width: 188px;
	height: auto;
}

/* Footer link lists are navigation, not prose — no markers, no indent. */
.adaptive-footer__links,
.adaptive-footer__legal {
	margin: 0;
	padding: 0;
	list-style: none;
}

.adaptive-footer__links li {
	margin-bottom: 0.6rem;
}

/* Navigation targets need to clear the 24px minimum (WCAG 2.5.8); the link
   text alone is only ~19px tall. */
.adaptive-footer__links a,
.adaptive-footer__legal a,
.adaptive-header__nav a {
	display: inline-block;
	padding-block: 4px;
}

.adaptive-footer__links a,
.adaptive-footer__legal a,
.adaptive-footer__bottom p {
	color: var(--wp--preset--color--on-ink);
	font-size: var(--wp--preset--font-size--sm);
	text-decoration: none;
}

.adaptive-footer__links a:hover,
.adaptive-footer__legal a:hover {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

.adaptive-footer__cta-label {
	margin: 0 0 var(--wp--preset--spacing--20);
	font-weight: 600;
	color: var(--wp--preset--color--on-ink);
}

.adaptive-footer__bottom {
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	align-items: center;
}

.adaptive-footer__bottom p {
	margin: 0;
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--on-ink-muted);
}

.adaptive-footer__legal {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
}

.adaptive-footer__legal li {
	margin: 0;
}

.adaptive-footer__legal a {
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--on-ink-muted);
}

/* --- Forms on the dark panels ------------------------------------------
   The design shows placeholder-only fields. Labels are hidden visually but
   kept in the accessibility tree, so screen readers still announce them. */

.adaptive-contact__form .wpforms-field-label,
.has-ink-background-color .wpforms-field-label,
.adaptive-contact__form .wpforms-field-sublabel,
.has-ink-background-color .wpforms-field-sublabel {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.adaptive-contact__form .wpforms-field,
.has-ink-background-color .wpforms-field {
	padding: 0 0 var(--wp--preset--spacing--20);
}

/* Validation messages have to stay readable against black. */
.adaptive-contact__form .wpforms-error,
.has-ink-background-color .wpforms-error {
	color: #FFB4B4;
	font-size: var(--wp--preset--font-size--xs);
}

.adaptive-contact__form .wpforms-field-container input::placeholder,
.has-ink-background-color .wpforms-field-container input::placeholder,
.adaptive-contact__form textarea::placeholder,
.has-ink-background-color textarea::placeholder {
	color: #72757C;
	opacity: 1;
}

.adaptive-contact__form .wpforms-submit-container,
.has-ink-background-color .wpforms-submit-container {
	margin-top: var(--wp--preset--spacing--10);
}

/* WPForms' modern markup styles its submit button from an ID-scoped rule, so
   class selectors alone never reach it. Narrowly scoped rather than global. */
.adaptive-contact__form .wpforms-form button[type="submit"].wpforms-submit,
.adaptive-lead .wpforms-form button[type="submit"].wpforms-submit {
	background: var(--wp--preset--color--accent) !important;
	border-radius: var(--wp--custom--radius--pill) !important;
	color: var(--wp--preset--color--on-ink) !important;
}

.adaptive-contact__form .wpforms-form button[type="submit"].wpforms-submit:hover,
.adaptive-lead .wpforms-form button[type="submit"].wpforms-submit:hover {
	background: var(--wp--preset--color--accent-hover) !important;
}

.wpforms-container .wpforms-form button[type="submit"].wpforms-submit,
.adaptive-contact__form .wpforms-form button[type="submit"] {
	padding: 0.75rem 2rem;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--on-ink);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	cursor: pointer;
}

.wpforms-container .wpforms-form button[type="submit"].wpforms-submit:hover,
.adaptive-contact__form .wpforms-form button[type="submit"]:hover {
	background: var(--wp--preset--color--accent-hover);
}

/* --- Lead magnet panel --------------------------------------------------
   The design puts the send button *inside* the message box, bottom right. The
   textarea reserves that space with padding-bottom and the submit container is
   pulled back up over it, so no absolute positioning and the focus order and
   tab sequence stay exactly as WPForms wrote them.

   Every selector carries .wpforms-container: WPForms' own stylesheet is
   enqueued after the theme's, so matching its specificity is not enough. */

.adaptive-lead .wpforms-container {
	margin: var(--wp--preset--spacing--40) 0 0;
	max-width: none;
}

.adaptive-lead .wpforms-container .wpforms-field {
	padding: 0 0 var(--wp--preset--spacing--20);
}

.adaptive-lead .wpforms-container .wpforms-field input[type="email"],
.adaptive-lead .wpforms-container .wpforms-field input[type="text"],
.adaptive-lead .wpforms-container .wpforms-field textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	padding: 0.8rem 1rem;
	border: 1px solid transparent;
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm);
}

.adaptive-lead .wpforms-container .wpforms-field input[type="email"]:focus-visible,
.adaptive-lead .wpforms-container .wpforms-field textarea:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.adaptive-lead .wpforms-container .wpforms-field textarea {
	height: 163px;
	min-height: 163px;
	/* Room for the button that gets pulled up into this box. */
	padding-bottom: 3.5rem;
	resize: vertical;
}

.adaptive-lead .wpforms-container .wpforms-form .wpforms-submit-container {
	/* button height + the gap below it + the field's own bottom padding */
	margin: -66px 12px 0 0;
	text-align: right;
}

.adaptive-lead .wpforms-container .wpforms-form button[type="submit"].wpforms-submit {
	padding: 0.5rem 1.5rem;
	/* The design's blue, as drawn. It sits on the white message box, so the
	   white label is around 3:1 against it — below AA for text. */
	background: var(--wp--preset--color--accent);
}

.adaptive-lead .wpforms-container .wpforms-form button[type="submit"].wpforms-submit:hover {
	background: var(--wp--preset--color--accent-hover);
}

@media (max-width: 781px) {
	.adaptive-lead .wpforms-container .wpforms-field textarea {
		height: 140px;
		min-height: 140px;
	}
}

/* The contact panel's fields, like the lead magnet's, have to out-specify
   WPForms' own ID-scoped rules -- the block stylesheet loses to them, which is
   why the inputs were 43px tall with a 3px radius rather than the design's
   46px and 8px. */

.adaptive-contact__form .wpforms-container .wpforms-field input[type="text"],
.adaptive-contact__form .wpforms-container .wpforms-field input[type="email"],
.adaptive-contact__form .wpforms-container .wpforms-field input[type="tel"],
.adaptive-contact__form .wpforms-container .wpforms-field textarea {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	/* WPForms pins line-height to the font size, so the box height comes from
	   min-height rather than from padding alone. */
	min-height: 46px;
	padding: 0.75rem 1rem;
	border: 1px solid transparent;
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm);
	line-height: 1.4;
}

.adaptive-contact__form .wpforms-container .wpforms-field input:focus-visible,
.adaptive-contact__form .wpforms-container .wpforms-field textarea:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.adaptive-contact__form .wpforms-container .wpforms-field textarea {
	height: 118px;
	resize: vertical;
}

/* WPForms adds its own margins around the form; the panel already supplies
   the rhythm, so they only push the column out of step with the details
   beside it. */
.adaptive-contact__form .wpforms-container.wpforms-container-full {
	margin: 0;
}

.adaptive-contact__form .wpforms-container .wpforms-form .wpforms-submit-container {
	margin-top: 0;
}

/* 32px between rows, as drawn. */
.adaptive-contact__form .wpforms-container .wpforms-field {
	padding: 0 0 var(--wp--preset--spacing--40);
}

.adaptive-contact__form .wpforms-container .wpforms-form button[type="submit"].wpforms-submit {
	min-height: 49px;
	padding: 0 2.6rem;
	line-height: 1.4;
}

/* The contact panel's form is a two-up grid in the design, with the message
   box spanning both columns. The two anti-spam fields WPForms injects are
   absolutely positioned, so they take no grid cell. */

.adaptive-contact__form .wpforms-field-container {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: var(--wp--preset--spacing--20);
}

.adaptive-contact__form .wpforms-field-textarea {
	grid-column: 1 / -1;
}

@media (max-width: 781px) {
	.adaptive-contact__form .wpforms-field-container {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* --- Full-bleed section band ---------------------------------------------
   Two sections on the staff augmentation page sit on a tinted band that runs
   edge to edge. Nothing in the block markup can reach the viewport edges --
   post content is capped well short of them -- so the band escapes its
   containers in CSS and re-centres its own content at the 1240px measure.

   `calc(50% - 50vw)` counts the scrollbar in 50vw, which would otherwise push
   a few pixels of horizontal scroll onto the page; `overflow-x: clip` on the
   root absorbs that without the side effects `hidden` has on sticky
   positioning. */

html {
	overflow-x: clip;
}

.wp-block-group.adaptive-band {
	/* WordPress's constrained-layout rule pins every non-aligned child with
	   `margin-left/right: auto !important`, so escaping it has to answer in
	   kind. Scoped to this one class rather than anything broader. */
	margin-inline: calc(50% - 50vw) !important;
	max-width: none;
	width: auto;
	padding-block: var(--wp--preset--spacing--60);
	padding-inline: var(--wp--preset--spacing--60);
	background: var(--wp--preset--color--band);
}

/* The band supplies its own rhythm, so the first heading inside it should not
   also carry the large top margin it needs when it sits on the page itself. */
.wp-block-group.adaptive-band > :first-child {
	margin-top: 0;
}

.wp-block-group.adaptive-band > :last-child {
	margin-bottom: 0;
}

/* --- Reveal on scroll ---------------------------------------------------
   Only active under .has-reveal, which JavaScript adds in <head> and only when
   the reader has not asked for reduced motion. Without JS nothing is hidden. */

.has-reveal [data-reveal] {
	opacity: 0;
	transform: translateY(18px);
	transition:
		opacity 620ms cubic-bezier(0.22, 0.61, 0.36, 1),
		transform 620ms cubic-bezier(0.22, 0.61, 0.36, 1);
	transition-delay: var(--reveal-delay, 0ms);
	will-change: opacity, transform;
}

.has-reveal [data-reveal].is-revealed {
	opacity: 1;
	transform: none;
	will-change: auto;
}

/* Belt and braces: if the media query flips after load, drop the effect. */
@media (prefers-reduced-motion: reduce) {

	.has-reveal [data-reveal] {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* In-page anchors (the footer's Services link) glide rather than jump. */
@media (prefers-reduced-motion: no-preference) {

	html {
		scroll-behavior: smooth;
	}
}
