/**
 * AAB accessibility fixes (WCAG 2.2 AA) – Critical items
 * Loaded after style.css. Every rule is scoped to body.a11y-preview, which
 * functions.php only adds for logged-in users until AAB_A11Y_LIVE is true.
 *
 * C5 – 2.4.7 Focus Visible
 * Two-tone ring: 2px white inner halo + 3px AAB black (#0e161b) outer ring.
 * Contrast of the stronger ring against each brand background:
 *   white/dust/grey-light 16–18:1 (black) · red #FF0114 4.6:1 (black) and 4.0:1 (white)
 *   red-cta #EA332A 4.4:1 / 4.2:1 · black/navy/grey-dark/blue 9–18:1 (white)
 *   green/lime/pink/pale-blue 12–16:1 (black)
 * The two rings are 18:1 against each other, so the ring reads on any background.
 */

.a11y-preview :focus-visible {
	outline: 3px solid var(--black, #0e161b) !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 2px var(--white, #fff) !important;
}

/* Keep focused elements clear of the fixed header (#header_main ~92px, +admin bar when logged in) */
html:has(body.a11y-preview) {
	scroll-padding-top: var(--a11y-header-offset, 120px);
	scroll-padding-bottom: var(--a11y-bottom-offset, 0px);
}

/* Feedback: on a solid dark or light background, a single ring with a clear
   gap (set by initFocusGap in js/a11y.js). White on dark, black on light. */
.a11y-preview [data-a11y-ring="dark-bg"]:focus-visible {
	outline: 3px solid var(--white, #fff) !important;
	outline-offset: 3px !important;
	box-shadow: none !important;
}
.a11y-preview [data-a11y-ring="light-bg"]:focus-visible {
	outline: 3px solid var(--black, #0e161b) !important;
	outline-offset: 3px !important;
	box-shadow: none !important;
}

/* Feedback: reduced motion – no smooth scrolling or long transitions */
@media (prefers-reduced-motion: reduce) {
	html:has(body.a11y-preview) { scroll-behavior: auto !important; }
	.a11y-preview *, .a11y-preview *::before, .a11y-preview *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* Screen-reader-only text (used by js/a11y.js) */
.a11y-preview .a11y-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/**
 * C2 – 2.1.1 Keyboard: desktop mega menu disclosure buttons
 * Invisible (and take no space) until focused, so mouse users see no change.
 * Absolutely positioned with no top/left, so it sits where it would in the
 * flow, just after the link, without pushing the other menu items along.
 */
.a11y-preview .a11y-menu-toggle {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
	background: transparent;
	cursor: pointer;
}
/* Shown while focused, or while its panel is open and focus is inside it */
.a11y-preview .a11y-menu-toggle:focus,
.a11y-preview li:focus-within > .a11y-menu-toggle[aria-expanded="true"] {
	width: 22px;
	height: 22px;
	margin: -2px 0 0 4px;
	clip: auto;
	overflow: visible;
	border-radius: 2px;
	background: var(--green, #00ff87);
}
.a11y-preview .a11y-menu-toggle:focus::after,
.a11y-preview li:focus-within > .a11y-menu-toggle[aria-expanded="true"]::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 7px;
	height: 7px;
	border-right: 2px solid var(--black, #0e161b);
	border-bottom: 2px solid var(--black, #0e161b);
	transform: translate(-50%, -70%) rotate(45deg);
}
.a11y-preview .a11y-menu-toggle[aria-expanded="true"]::after {
	transform: translate(-50%, -30%) rotate(-135deg) !important;
}

/**
 * C2 / C6 – Buttons injected inside accordion headings (.faq_question,
 * .people_qualities_toggle). Reset so the heading looks exactly as before.
 */
.a11y-preview .a11y-faq-btn {
	all: unset;
	display: block;
	width: 100%;
	box-sizing: border-box;
	cursor: pointer;
}

/**
 * C3 – 2.2.2 Pause, Stop, Hide: carousel Pause/Play button (js/a11y.js)
 * Styled like the theme's own buttons (.hero-text-ctas__btn-outline /
 * .homepage-hero-slider__cta): square, AlternateGot, uppercase, 32px high.
 * Black with a white 2px border so it reads on dark and light sections
 * (white on #0e161b = 18:1). Hover inverts, like the hero CTA.
 * Heroes: bottom-right corner (the top is under the fixed header).
 * Other sliders: --inline, right-aligned above the slides.
 * Needs client sign-off (visible change).
 */
.a11y-preview .a11y-carousel-pause {
	position: absolute;
	bottom: 16px;
	right: 16px;
	z-index: 20;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 32px;
	padding: 0 14px;
	border: 2px solid var(--white, #fff);
	border-radius: 0;
	background: var(--black, #0e161b);
	color: var(--white, #fff);
	font-family: var(--alternategot, sans-serif);
	font-size: 18px;
	font-weight: 400;
	line-height: 1;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.a11y-preview .a11y-carousel-pause:hover {
	background: var(--white, #fff);
	color: var(--black, #0e161b);
}
.a11y-preview .a11y-carousel-pause__icon {
	position: relative;
	width: 10px;
	height: 12px;
	border-left: 3px solid currentColor;
	border-right: 3px solid currentColor;
	box-sizing: border-box;
}
.a11y-preview .a11y-carousel-pause.is-paused .a11y-carousel-pause__icon {
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 0 6px 10px;
	border-color: transparent transparent transparent currentColor;
}
.a11y-preview .a11y-carousel-pause--inline {
	position: static;
	display: flex;
	width: max-content;
	margin: 0 0 12px auto;
}

/* C1 – while a menu is open, sit above the HubSpot bottom banner (z-index 9999) */
.a11y-preview #header_main.a11y-menu-raised {
	z-index: 10000;
}

/**
 * C2/C6 – FAQ accordions: make the injected button fill the whole green
 * heading bar, so the focus outline wraps the full bar rather than sitting
 * inside its padding. Padding moves from the h2/h3 to the button.
 */
.a11y-preview .faq_question {
	padding: 0 !important;
}
.a11y-preview .faq_question > .a11y-faq-btn {
	padding: 17px 22px 13px 28px;
}

/* C2 – aabwealth.uk: WordPress dropdown opened by its disclosure button */
.a11y-preview .header_base nav > ul > li.a11y-open > .sub-menu {
	visibility: visible;
	opacity: 1;
	z-index: 2;
	/* no 0.5s fade when opened by keyboard: links must be focusable straight away */
	transition: none;
}

/* Contact form: the "Select your interests" box sat on top of the open menu
   and the HubSpot banner (theme gives the wrapper z-index 10000). The option
   list is appended to <body> with its own z-index, so the wrapper doesn't need it. */
.a11y-preview .hs-multiselect-wrapper {
	z-index: 1 !important;
}
