/* Shared design corrections. Native Gutenberg values override these defaults. */
:root, .rx-figma-page, .rx-figma-canvas, .editor-styles-wrapper {
	--rx-figma-ink: var(--wp--preset--color--ink, #000);
	--rx-figma-paper: var(--wp--preset--color--paper, #fff);
	--rx-figma-blue: var(--wp--preset--color--blue, #0037ff);
	--rx-floating-blue: var(--wp--preset--color--blue, #0037ff);
	--rx-figma-sans: var(--wp--preset--font-family--sans);
	--rx-figma-mono: var(--wp--preset--font-family--mono);
	--rx-figma-body: var(--wp--preset--font-size--body);
	--rx-figma-body-lg: var(--wp--preset--font-size--lead);
	--rx-figma-h3: var(--wp--preset--font-size--heading);
	--rx-figma-small: var(--wp--preset--font-size--small);
}

/* One Cover contract for all photographic heroes, in the editor and front end.
 * Modern Image Formats wraps public images in <picture>; the editor does not.
 * Do not set object-position: Gutenberg's native focal point stays authoritative.
 * Target only the background, never images or logos inside the editable content.
 */
.wp-block-cover:is(.rx-figma-hero, .rx-refresh-hero) { isolation: isolate; }
.wp-block-cover:is(.rx-figma-hero, .rx-refresh-hero) > :is(.wp-block-cover__image-background, .wp-block-cover__video-background),
.wp-block-cover:is(.rx-figma-hero, .rx-refresh-hero) > picture > .wp-block-cover__image-background {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	object-fit: cover;
	z-index: 0;
}
.wp-block-cover:is(.rx-figma-hero, .rx-refresh-hero) > .wp-block-cover__background { z-index: 1; }
.wp-block-cover:is(.rx-figma-hero, .rx-refresh-hero) > .wp-block-cover__inner-container { z-index: 2; }
.wp-block-cover:is(.rx-figma-hero, .rx-refresh-hero)::after { display: none; }

/* One disclosure indicator for core Details, CPT FAQ and legacy accordions.
 * Native open/expanded state and keyboard behaviour remain unchanged. */
:is(.wp-site-blocks, .editor-styles-wrapper) details > summary {
	position: relative;
	list-style: none;
	padding-inline-start: 2.25rem;
}
:is(.wp-site-blocks, .editor-styles-wrapper) details > summary::marker { content: ''; }
:is(.wp-site-blocks, .editor-styles-wrapper) details > summary::-webkit-details-marker { display: none; }
:is(.wp-site-blocks, .editor-styles-wrapper) details > summary::before {
	content: '+' / '';
	position: absolute;
	inset-inline-start: 0;
	margin: 0;
	width: 1.25rem;
	text-align: center;
	font-family: var(--wp--preset--font-family--sans);
	font-weight: 400;
}
:is(.wp-site-blocks, .editor-styles-wrapper) details[open] > summary::before { content: '−' / ''; }
:is(.wp-site-blocks, .editor-styles-wrapper) .wp-block-accordion-heading__toggle { gap: 1rem; }
:is(.wp-site-blocks, .editor-styles-wrapper) .wp-block-accordion-heading__toggle-icon { display: none; }
:is(.wp-site-blocks, .editor-styles-wrapper) .wp-block-accordion-heading__toggle::before { content: '+' / ''; flex: 0 0 1.25rem; }
:is(.wp-site-blocks, .editor-styles-wrapper) .wp-block-accordion-heading__toggle[aria-expanded="true"]::before { content: '−' / ''; }

/* Reusable core Group styles: change columns, gaps and colours in Gutenberg. */
:where(.is-style-rexpol-editorial-grid) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--wp--preset--spacing--40); align-items: start; }
:where(.is-style-rexpol-card-grid) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--wp--preset--spacing--30); }
:where(.is-style-rexpol-quiet-card) { padding: var(--wp--preset--spacing--30); border-radius: 6px; }
:where(.is-style-rexpol-quiet-card:not(.has-background)) { background: var(--wp--preset--color--surface); }
:where(.is-style-rexpol-editorial-grid, .is-style-rexpol-card-grid) > * { min-width: 0; }

/* Header is the same three-part composition on every template. */
.wp-site-blocks > header .rx-header { min-height: 5.25rem; }
.wp-site-blocks > header .rx-primary-nav > .rx-menu a { font-size: .875rem; min-height: 2.75rem; display: inline-flex; align-items: center; }
.wp-site-blocks > header .rx-primary-nav > .rx-menu { gap: clamp(.5rem, 1vw, 1.125rem); }
html.has-rexpol-menu-open .wp-site-blocks > header .rx-header,
.rx-mega-menu { background: var(--wp--preset--color--blue); }
.rx-mega-menu__rows a { font-size: clamp(1.5rem, 2.084vw, 2.25rem); line-height: 1.36; letter-spacing: -.025em; }
.rx-mega-menu__inner { padding-top: clamp(8rem, 9.78vw, 10.5625rem); }
.rx-mega-menu__navigation { padding-top: clamp(2rem, 3.935vw, 4.25rem); }
.rx-mega-menu__close { top: 5.25rem; }
.rx-site-header-shell.has-text-color .rx-header { color: inherit; }
.rx-site-header-shell.has-background .rx-header { background: inherit; }
.rx-site-header-shell[class*="-font-family"] :is(.rx-header, .rx-menu a) { font-family: inherit; }
.rx-site-header-shell[class*="-font-size"] .rx-menu a { font-size: inherit; }
.rx-site-header-shell .rx-primary-nav { font-family: inherit; font-size: inherit; }
.rx-site-header-shell[style*="font-"] :is(.rx-header, .rx-primary-nav, .rx-menu a) { font-size: inherit; font-family: inherit; font-weight: inherit; font-style: inherit; letter-spacing: inherit; }
.rx-site-header-shell[class*="-font-size"] .rx-header { font-size: inherit; }
body:has(main .rx-refresh-hero) .wp-site-blocks > header .custom-logo-link img,
body:has(main .rx-figma-hero:first-child) .wp-site-blocks > header .custom-logo-link img,
html.has-rexpol-menu-open .wp-site-blocks > header .custom-logo-link img { filter: brightness(0) invert(1); }
/* SSR previews do not have the public template's <header> ancestor. */
.editor-styles-wrapper .rx-site-header-shell .rx-header { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: var(--rx-figma-gap); min-height: 5.25rem; }
.editor-styles-wrapper .rx-site-header-shell .rx-header > :is(.custom-logo-link, .rx-brand) { grid-column: 1; justify-self: start; }
.editor-styles-wrapper .rx-site-header-shell .rx-primary-nav { grid-column: 3 / -1; width: 100%; }
.editor-styles-wrapper .rx-site-header-shell .rx-primary-nav > .rx-menu { width: 100%; gap: clamp(.5rem, 1vw, 1.125rem); align-items: center; }
.editor-styles-wrapper .rx-site-header-shell .rx-primary-nav > .rx-menu a { font-size: .875rem; }
.editor-styles-wrapper .rx-site-header-shell .rx-primary-nav > .rx-menu > li:nth-last-child(2) { margin-left: auto; }

/* Original exported Figma chevrons, shared with the editor preview. */
.rx-carousel-controls .rx-carousel-control { display: inline-grid; place-items: center; font-size: 0; width: 2.75rem; height: 2.75rem; }
.rx-carousel-controls .rx-carousel-control::before { content: ''; width: 2.125rem; height: 2.125rem; background-color: currentColor; mask: url('../icons/carousel-chevron-left.svg') center / contain no-repeat; }
.rx-carousel-controls .rx-carousel-control:last-child::before { mask-image: url('../icons/carousel-chevron-right.svg'); transform: rotate(180deg); }
.rx-product-v2__table:focus-visible { outline: 2px solid var(--wp--preset--color--blue); outline-offset: 4px; }

/* Home 133:2076. Contents remain core Cover / Group / Query / Post Template. */
:where(.rx-home-hero .rx-home-hero__claim) { font-size: var(--wp--preset--font-size--lead); line-height: 1.12; }
.rx-home-hero .rx-home-hero__actions .wp-block-button__link { font-size: var(--wp--preset--font-size--micro); min-height: 1.875rem; }
.rx-home-hero .rx-home-hero__kicker { margin-bottom: 1.2rem; }
.rx-home-section-head { grid-template-columns: minmax(0, 488fr) minmax(0, 1066fr); }
.rx-home-section-head__copy { max-width: 35.125rem; }
.rx-home-section-head__copy > .rx-figma-kicker { margin-bottom: .75rem; }
.rx-home-track--rexpol-brand .rx-home-section-head__copy { max-width: 30rem; }
.rx-home-track--rexpol-brand .rx-home-section-head { margin-bottom: clamp(5rem, 10.65vw, 11.5rem); }
.rx-home-track__query.rx-figma-carousel { width: calc(100% + var(--rx-figma-gutter)); max-width: none; overflow: visible; }
.rx-home-track__query.rx-figma-carousel .wp-block-post-template { display: flex; gap: var(--rx-figma-gap); padding: 0; background: transparent; scroll-padding-inline: 0; }
.rx-home-track__query.rx-figma-carousel .wp-block-post { flex: 0 0 calc((100% - var(--rx-figma-gutter)) * .30925); margin: 0; }
.rx-home-track__query .rx-carousel-controls { padding-right: var(--rx-figma-gutter); }
.rx-home-track--rexpol-brand .wp-block-post { min-height: 0; background: transparent; }
.rx-home-track--rexpol-brand .rx-figma-card { min-height: clamp(20.5rem, 27.26vw, 29.4375rem); }
.rx-home-track--rexpol-brand .rx-home-brand-card__logo { width: auto; height: 1.45rem; margin: 0; }
.rx-home-track--rexpol-brand .rx-home-brand-card__logo img { width: auto; max-width: 8rem; height: 100%; object-fit: contain; object-position: left; }
.rx-home-brand-card__body { padding-bottom: 2.25rem; }
.rx-home-brand-card__body .wp-block-post-excerpt { line-height: 1.15; }
.rx-home-track__query .wp-block-post-title { text-align: left; }
.rx-home-track__query .rx-home-card__label { text-align: left; }
.rx-home-track--rexpol-solution .wp-block-post-featured-image,
.rx-home-track--post .wp-block-post-featured-image { aspect-ratio: 3.32; }
.rx-home-track--rexpol-solution .wp-block-post-featured-image img,
.rx-home-track--post .wp-block-post-featured-image img { height: 100%; }
.rx-home-events .rx-home-section-head { grid-template-columns: minmax(0, 488fr) minmax(0, 1066fr); }
.rx-home-events__body { grid-template-columns: minmax(0, 930fr) minmax(0, 565fr); }
.rx-home-events .rx-figma-event-row { grid-template-columns: minmax(5rem, 1.05fr) minmax(4.3rem, .85fr) minmax(5.4rem, .95fr) minmax(0, 2.6fr) 1.5rem; gap: .6rem; min-height: clamp(4.5rem, 5.2vw, 5.65rem); }
.rx-home-events .rx-figma-event-row .wp-block-post-title { font-size: inherit; }
.rx-home-events .rx-home-event__title .rx-meta-field strong { font-size: var(--wp--preset--font-size--micro); }
.rx-home-events__body > * { min-width: 0; }
:where(.rx-home-projects__body) { display: grid; grid-template-columns: minmax(0, 488fr) minmax(0, 1066fr); gap: var(--rx-figma-gap); align-items: start; }
.rx-home-projects__body > * { min-width: 0; }
.rx-home-projects__grid.wp-block-post-template { gap: var(--wp--preset--spacing--30); }
.rx-home-project-card { aspect-ratio: 521 / 323; min-height: 0; border-radius: 6px; }
.rx-home-project-card .wp-block-post-featured-image { display: none; }
.rx-home-projects__copy > :first-child { margin-bottom: 2.5rem; }

/* Respect explicit native block typography/colour, including legacy blocks. */
.rx-home-section-head [class*="has-"][class*="-font-size"],
.rx-home-brand-card__body [class*="has-"][class*="-font-size"] { line-height: 1.2; }
.rx-footer.has-text-color :where(a, address, p, strong) { color: inherit; }

@media (max-width: 80rem) and (min-width: 50.001rem) {
	.wp-site-blocks > header .rx-header { grid-template-columns: minmax(6.5rem, 1fr) minmax(0, 5fr); }
	.wp-site-blocks > header .rx-primary-nav { grid-column: 2; }
	.wp-site-blocks > header .rx-primary-nav > .rx-menu a { font-size: .8125rem; }
	.rx-home-events__body { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); column-gap: 2rem; }
	.rx-home-events .rx-figma-event-row { font-size: .75rem; }
}
@media (max-width: 50rem) {
	:where(.is-style-rexpol-editorial-grid, .is-style-rexpol-card-grid) { grid-template-columns: 1fr; }
	.rx-home-hero .rx-home-hero__row { grid-template-columns: 1fr; gap: 2rem; }
	.rx-home-hero .rx-home-hero__row > * { grid-column: 1; }
	.rx-home-hero .rx-home-hero__claim { max-width: 24rem !important; }
	.rx-home-hero .rx-home-hero__actions .wp-block-button__link { min-height: 2.75rem; }
	.rx-home-section-head, .rx-home-events .rx-home-section-head { grid-template-columns: 1fr; gap: 1.5rem; }
	.rx-home-section-head__copy, .rx-home-track--rexpol-brand .rx-home-section-head__copy { max-width: none; }
	.rx-home-section-head__copy-columns { gap: 1.5rem; }
	.rx-home-track--rexpol-brand .rx-home-section-head { margin-bottom: 4rem; }
	.rx-home-track__query.rx-figma-carousel .wp-block-post { flex-basis: min(85vw, 24rem); }
	.rx-home-track--rexpol-brand .rx-figma-card { min-height: 24rem; }
	.rx-home-events__body, .rx-home-projects__body { grid-template-columns: 1fr; gap: 2rem; }
	.rx-home-events .rx-figma-event-row { grid-template-columns: 1fr 1fr; padding: 1rem 0; gap: .8rem; }
	.rx-home-events .rx-figma-event-row > * { grid-column: auto; }
	.rx-home-events .rx-home-event__title { grid-column: 1 / -1; }
	.rx-home-events .rx-home-event__link { justify-self: end; }
	.rx-home-projects__grid.wp-block-post-template { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.rx-home-project-card { min-height: 13rem; }
	.rx-mega-menu__rows a { min-height: 2.75rem; }
	.wp-site-blocks > header .rx-primary-nav > .rx-menu a { font-size: 1rem; }
}
@media (max-width: 30rem) {
	.rx-home-projects__grid.wp-block-post-template { grid-template-columns: 1fr; }
	.rx-home-section-head__copy-columns { grid-template-columns: 1fr; }
}

/* Mobile navigation replaces one level at a time; desktop keeps its mega menu. */
.wp-site-blocks > header .rx-header .rx-brand { color: inherit; }
.rx-mobile-menu__toolbar, .rx-mobile-menu__list { display: none; }
@media (max-width: 50rem) {
	html.has-rexpol-primary-open,
	html.has-rexpol-primary-open body { overflow: hidden; }
	.wp-site-blocks > header .rx-site-header-shell .rx-header { flex-wrap: wrap; row-gap: .5rem; }
	.wp-site-blocks > header .rx-header > :is(.rx-brand, .custom-logo-link) { flex-shrink: 0; max-width: 100%; }
	html.has-rexpol-primary-open .wp-site-blocks > header { position: relative; z-index: 80; }
	html.has-rexpol-primary-open .wp-site-blocks > header .rx-site-header-shell .rx-header {
		position: fixed;
		inset: var(--wp-admin--admin-bar--height, 0px) 0 auto;
		z-index: 80;
		width: 100%;
		max-width: none;
		background: var(--wp--preset--color--ink);
		color: var(--wp--preset--color--paper);
		border-color: rgb(255 255 255 / .3);
	}
	html.has-rexpol-primary-open .wp-site-blocks > header .custom-logo-link img { filter: brightness(0) invert(1); }
	.wp-site-blocks > header .rx-primary-menu__toggle { min-width: 4.5rem; min-height: 2.75rem; justify-content: center; font-size: var(--wp--preset--font-size--small); }
	.wp-site-blocks > header .rx-header nav.rx-mobile-menu.is-open {
		position: fixed;
		inset: var(--rx-mobile-header-bottom, 5.25rem) 0 0;
		width: 100%;
		max-width: none;
		max-height: calc(100dvh - var(--rx-mobile-header-bottom, 5.25rem));
		padding: 1rem max(1.25rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
		margin: 0;
		border: 0;
		overflow: auto;
		overscroll-behavior: contain;
		background: var(--wp--preset--color--ink);
		color: var(--wp--preset--color--paper);
	}
	.wp-site-blocks > header .rx-mobile-menu--enhanced > .rx-menu { display: none; }
	.rx-mobile-menu .rx-mobile-menu__toolbar { position: sticky; top: -1rem; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; min-height: 3rem; margin: 0 0 .5rem; padding-block: .5rem; background: var(--wp--preset--color--ink); }
	.rx-mobile-menu .rx-mobile-menu__title { flex: 1 0 8ch; min-width: 0; max-width: 100%; margin: 0; font-size: var(--wp--preset--font-size--small); line-height: 1.4; text-align: end; overflow-wrap: anywhere; }
	.rx-mobile-menu .rx-mobile-menu__back { display: inline-flex; align-items: center; flex-shrink: 0; gap: .5rem; min-height: 2.75rem; padding: .5rem .25rem; border: 0; background: transparent; color: inherit; font: inherit; font-size: var(--wp--preset--font-size--small); cursor: pointer; }
	.rx-mobile-menu .rx-mobile-menu__back[hidden] { display: none; }
	.rx-mobile-menu .rx-mobile-menu__list { display: block; width: 100%; margin: 0; padding: 0; list-style: none; }
	.rx-mobile-menu .rx-mobile-menu__item { display: flex; align-items: stretch; width: 100%; min-width: 0; margin: 0; padding: 0; border-bottom: 1px solid rgb(255 255 255 / .3); }
	.rx-mobile-menu .rx-mobile-menu__link { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; min-height: 3.5rem; padding: .75rem .25rem; margin: 0; border: 0; background: transparent; color: inherit; font-family: inherit; font-size: var(--wp--preset--font-size--lead); font-weight: inherit; line-height: 1.35; letter-spacing: -.02em; text-align: start; text-decoration: none; overflow-wrap: anywhere; cursor: pointer; }
	.rx-mobile-menu .rx-mobile-menu__next { display: inline-grid; place-items: center; align-self: center; flex: 0 0 1.5rem; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; background: transparent; color: inherit; pointer-events: none; }
	.rx-mobile-menu .rx-mobile-menu__back::before,
	.rx-mobile-menu .rx-mobile-menu__next::before { content: ''; display: block; flex: 0 0 1.5rem; width: 1.5rem; height: 1.5rem; background: currentColor; mask: url('../icons/carousel-chevron-left.svg') center / contain no-repeat; }
	.rx-mobile-menu .rx-mobile-menu__next::before { transform: rotate(180deg); }
	.rx-mobile-menu :is(.rx-mobile-menu__link, .rx-mobile-menu__back, .rx-mobile-menu__next):hover { background-color: rgb(255 255 255 / .08); }
	.rx-mobile-menu :is(a, button):focus-visible { outline: 2px solid #fff; outline-offset: -3px; box-shadow: none; }
	.wp-site-blocks > header .rx-mega-menu { display: none; }
	html.has-rexpol-primary-open .rx-floating-menu { visibility: hidden; }
}
