/* WordPress-only pieces of the redesign chrome that the mockup design system (assets/css/ds/) has no rule for.
 * Built from DS tokens only. Loaded after ds/components.css. */

/* Skip link: hidden until focused, then shown above the sticky nav. */
.eframe-skip-link {
	position: absolute;
	left: var(--space-4);
	top: -100px;
	z-index: 200;
	padding: var(--space-2) var(--space-4);
	background: var(--color-canvas-void);
	color: var(--color-text-heading);
	border: 1px solid var(--color-border-hairline);
	border-radius: var(--radius-control);
}

.eframe-skip-link:focus {
	top: var(--space-4);
}

/* Contact form honeypot (inc/contact-form.php rejects a filled one): off-screen, out of the tab order, hidden from AT. */
.eframe-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Form-level errors (security check, rate limit, mail failure); field errors use .field-error. */
.form-status.is-error {
	color: var(--color-signal-alarm-red);
}

/* The old main.css styles WordPress's post navigation (.nav-links, the class the_posts_pagination() prints) with a top
 * margin, 12px text and space-between, and the header list shares that class. Drop with main.css (launch plan Phase 2).
 * The reverse also holds: the DS hides .nav-links on phones, so archive templates use the mockup pagination markup. */
.site-nav .nav-links {
	grid-column: auto;
	margin-top: 0;
	justify-content: normal;
	font-size: inherit;
}

/* The DS drops section hairlines with `body > section`; WordPress pages wrap their sections in <main>. */
.eframe-main > section {
	border-top: 0 !important;
	border-bottom: 0 !important;
}

/* Old main.css sets letter-spacing on every heading; prose h3/h4 and case cells have none in the DS. Drop with main.css. */
.prose h3,
.prose h4,
.case-cell-title {
	letter-spacing: normal;
}

/* ==========================================================================
 * Insights search + category filter without reload (assets/js/insights-ajax.js). One block: keep it together.
 * ========================================================================== */
.chip {
	/* A flex chip drops the space after <span class="nowrap">E-commerce</span> ("E-commerceOperations"). Inline-block keeps
	 * the text inline; line-height and zero block padding keep the 34px height of the DS chip. */
	display: inline-block;
	padding-block: 0;
	line-height: calc(var(--control-small-height) - 2px);
	vertical-align: middle;
}

.insights-results-meta {
	margin: 0 0 var(--space-6);
	color: var(--color-text-muted, inherit);
	font-size: var(--text-sm, 0.875rem);
}

[data-insights-results] {
	transition: opacity 150ms ease;
}

[data-insights-results].is-loading {
	opacity: 0.5;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	[data-insights-results] {
		transition: none;
	}
}
/* ===== end Insights search + category filter ===== */

/* Same old rule on .pagination (space-between, 12px); the DS pagination (template-parts/archive/pagination.php) sets
 * neither. Drop with main.css. */
ul.pagination {
	grid-column: auto;
	justify-content: normal;
	font-size: inherit;
}

/* ==========================================================================
 * SITE FOOTER (sitemap footer) — template-parts/footer/site-footer.php, links from inc/footer-config.php.
 * One block: brand column + Services / Company / Contact link columns, then a bottom bar. Mobile first (stacked).
 * Replaces the old one-line `.footer-wrap` rules. DS tokens only.
 * ========================================================================== */
.site-footer .footer-sitemap {
	display: grid;
	grid-template-columns: 1fr;
	align-items: start;
	gap: var(--space-10);
}

.footer-col--brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-4);
}

.footer-tagline {
	margin: 0;
	font-size: var(--type-body-size);
	color: var(--color-text-lead);
}

.footer-heading {
	margin: 0 0 var(--space-4);
	font-family: var(--font-mono);
	font-size: var(--type-kicker-size);
	font-weight: var(--weight-medium);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.footer-list {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Footer links, including the cookie-preferences button and the bottom-bar links, share one look and a 44px tap target. */
.site-footer .footer-list a,
.site-footer .footer-legal a,
.site-footer .eframe-cookie-settings {
	display: inline-block; /* not flex: inc/nowrap.php wraps words in spans whose spaces a flex container would drop */
	padding: var(--space-3) 0; /* 44px+ tap target */
	border: 0;
	background: transparent;
	font-family: var(--font-sans);
	font-size: var(--type-small-size);
	line-height: 20px;
	color: var(--color-text-lead);
	text-decoration: none;
	cursor: pointer;
}

/* `.site-footer a` (ds/components.css) greys links; keep the primary button's own dark-on-white text. */
.site-footer .footer-cta,
.site-footer .footer-cta:hover {
	color: #000000;
}

.site-footer .footer-list a:hover,
.site-footer .footer-legal a:hover,
.site-footer .eframe-cookie-settings:hover {
	color: var(--color-text-heading);
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-color: var(--color-text-muted);
}

.site-footer .footer-bar {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2);
	margin-top: var(--space-10);
	padding-top: var(--space-4);
	border-top: 1px solid var(--color-border-hairline);
}

.footer-legal {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 var(--space-6);
}

@media (min-width: 768px) {
	.site-footer .footer-sitemap {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.footer-col--brand {
		grid-column: 1 / -1;
	}

	.site-footer .footer-bar {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}

@media (min-width: 1100px) {
	.site-footer .footer-sitemap {
		grid-template-columns: 1.2fr 1.4fr 1.4fr 1fr 1.2fr;
		gap: var(--space-12);
	}

	.footer-col--brand {
		grid-column: auto;
	}
}
/* END SITE FOOTER */

/* Work page glue (mockup work.html's page <style>): one-column hero, wider lead, grid right under its heading. */
.post-type-archive-case_study .hero-grid {
	grid-template-columns: minmax(0, 1fr);
}

.post-type-archive-case_study .hero-content {
	max-width: 960px;
}

.post-type-archive-case_study .work-section .section-header {
	margin-bottom: 0;
}

/* Old main.css colours every link; the next-project image link has no colour in the DS. Drop with main.css. */
.case-next-media {
	color: revert;
}

/* ==========================================================================
 * HEADER: Services dropdown (template-parts/header/site-header.php, assets/js/main.js). Keep this block together.
 * ========================================================================== */
.site-nav .nav-item--has-menu {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--space-1);
}
.site-nav .nav-submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-control);
	background: transparent;
	color: var(--color-text-lead);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: color 0.15s ease;
}
.site-nav .nav-submenu-toggle:hover,
.site-nav .nav-item--has-menu.is-open .nav-submenu-toggle {
	color: var(--color-text-heading);
}
/* Label toggle (Solutions has no page of its own): looks like a nav link with the chevron after it. */
.site-nav .nav-submenu-toggle--label {
	width: auto;
	gap: var(--space-3);
	font-family: inherit;
	font-size: var(--type-body-size);
	font-weight: var(--weight-medium);
	line-height: var(--type-body-lh);
}
.site-nav .nav-submenu-toggle--label:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-color: var(--color-text-muted);
}
.site-nav .nav-submenu-toggle svg {
	transition: transform 0.15s ease;
}
.site-nav .nav-item--has-menu.is-open .nav-submenu-toggle svg {
	transform: rotate(180deg);
}
.site-nav .nav-submenu-toggle:focus-visible,
.site-nav .nav-submenu a:focus-visible {
	outline: 2px solid var(--color-text-heading);
	outline-offset: 2px;
}
.site-nav .nav-submenu {
	display: none;
	list-style: none;
	margin: 0;
	padding: var(--space-2);
}
.site-nav .nav-item--has-menu.is-open .nav-submenu {
	display: block;
}
.site-nav .nav-submenu a {
	display: block;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-control);
	white-space: nowrap;
}
.site-nav .nav-submenu a:hover,
.site-nav .nav-submenu a[aria-current="page"] {
	background: var(--color-canvas-chip-hover);
	color: var(--color-text-heading);
	text-decoration: none;
}
@media (min-width: 961px) {
	.site-nav .nav-submenu {
		position: absolute;
		top: 100%;
		left: calc(var(--space-3) * -1);
		z-index: 70;
		min-width: 280px;
		margin-top: var(--space-4);
		background: var(--color-canvas-void);
		border: 1px solid var(--color-border-hairline);
		border-radius: var(--radius-nested);
		box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
	}
	/* invisible bridge so the pointer can cross the gap from the link to the panel without closing it */
	.site-nav .nav-submenu::before {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		top: calc(var(--space-4) * -1);
		height: var(--space-4);
	}
}
@media (max-width: 960px) {
	.site-nav .nav-item--has-menu {
		flex-wrap: wrap;
		justify-content: space-between;
	}
	.site-nav .nav-submenu-toggle {
		width: 44px;
		height: 44px;
	}
	.site-nav .nav-submenu-toggle--label {
		flex: 1;
		width: auto;
		justify-content: space-between;
		padding: 0;
		text-align: left;
		font-size: var(--type-body-size);
	}
	.site-nav .nav-submenu {
		flex-basis: 100%;
		padding: var(--space-1) 0 var(--space-2) var(--space-4);
		border-left: 1px solid var(--color-border-hairline);
	}
	.site-nav .nav-submenu a {
		white-space: normal;
	}
}
/* END HEADER: Services dropdown */

/* Open mobile menu: with the header sticky again, a menu taller than the screen (both groups open, short phones, landscape)
 * scrolls inside itself instead of running off the bottom. The panel starts at the top of the viewport plus the header's
 * top padding (--space-5, ds/components.css .site-nav) plus .nav-wrap, its containing block, so 100% = .nav-wrap's height. */
@media (max-width: 960px) {
	.site-nav .nav-links {
		max-height: calc(100vh - 100% - var(--space-5));
		max-height: calc(100dvh - 100% - var(--space-5));
		overflow-y: auto;
		overscroll-behavior: contain;
	}
}

/* Open mobile menu above the cookie banner: the banner (main.css, fixed, z-index 9999) sat over the lower menu rows on short
 * phones (iPhone 13 Safari, 390x664), so a tap on Solutions hit the banner. main.js adds body.nav-open while the menu is open;
 * the header then outranks the banner. Closed menu: the header is back at z-index 100 and the banner is untouched (its consent
 * state is never changed here). */
@media (max-width: 960px) {
	body.nav-open .site-nav {
		z-index: 10000;
	}
}

/* In-page anchors clear the sticky header. The header sticks at every width since #91, so a target scrolled to top: 0 sat
 * under it (home #process, #contact, ...). One mechanism: scroll-margin-top on the targets, not scroll-padding on html,
 * because scroll-padding ADDS to a target's own scroll-margin (the contents-linked .case-chapter and .article-body h2 already
 * have one, tuned for the page's own sticky contents bar) and would double the offset. :where() has zero specificity, so every
 * existing scroll-margin-top rule still wins and only targets without one (section[id], #contact, ...) get this default.
 * Same formula as main.css's .eframe-entry-content h2: --header-height (80px, 72px under 768px) + 24px. */
:where([id]) {
	scroll-margin-top: calc(var(--header-height) + var(--space-6));
}
