/*
 * WCAG helper — keyboard, focus and motion fixes.
 * From the accessibility audit of 2026-10-01 (wcag-audit/wcag-findings.md). Each block names its finding.
 * Loaded on every page by inc/wcag-helper.php, together with assets/js/wcag-helper.js.
 *
 * Breakpoints match assets/css/header.css: the hamburger menu applies up to 1200px wide.
 */

/* ---------------------------------------------------------------------------------------------
 * WCAG-004 · Focus visible on the Lawmatics form fields.
 * form.css already intends a focus state (light-gold border), but a more specific rule overrides it,
 * so nothing changes when a field gets focus. An outline cannot be overridden by those border rules;
 * !important is used because the base field rules set "outline: none" later in the cascade.
 * #FDE8A4 is the brand light gold that form.css already uses for focus.
 * ------------------------------------------------------------------------------------------- */
.matlin-lawmatics-form input:not([type="hidden"]):focus-visible,
.matlin-lawmatics-form select:focus-visible,
.matlin-lawmatics-form textarea:focus-visible {
	outline: 3px solid #FDE8A4 !important;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------------------------
 * WCAG-002 · Desktop dropdowns open with the keyboard too.
 * Same selectors as the existing :hover rule in header.css, with :focus-within. Level-3 flyouts
 * already did this in header.css; level 1 did not.
 * .wcag-dismissed is set by wcag-helper.js when Escape closes a dropdown (WCAG 1.4.13). It hides the
 * whole dropdown at once, level-3 flyouts included: their own closing delay (0.55s in header.css)
 * would otherwise let the next Tab land on a link that is about to disappear.
 * ------------------------------------------------------------------------------------------- */
@media (min-width: 1201px) {
	main-header .header-wrapper nav.main-navbar-menu ul:not(.sub-menu) > .menu-item-has-children:focus-within > ul.sub-menu,
	main-header .navbar-nav > .menu-item-has-children.menu-item:focus-within > ul.sub-menu {
		visibility: visible;
		opacity: 1;
	}
	main-header .header-wrapper nav.main-navbar-menu ul:not(.sub-menu) > .menu-item-has-children.wcag-dismissed ul.sub-menu {
		visibility: hidden !important;
		opacity: 0 !important;
		transition: none !important;
	}
}

/* ---------------------------------------------------------------------------------------------
 * WCAG-001 · Mobile menu: nothing inside a closed menu or a closed submenu can take focus.
 * Today the closed menu is only moved off-screen (transform) and closed submenus only collapsed
 * (max-height: 0), so keyboard focus lands on ~30 invisible links. visibility:hidden removes them
 * from the Tab order; the delay keeps the closing animation visible.
 * Only top-level items open and close on mobile (header-class.js); level-3 lists show expanded inside
 * an open item, so the rules apply to everything under a top-level item. The extra .menu-item keeps
 * these rules above the desktop :hover rule of header.css, which also matches on mobile.
 * ------------------------------------------------------------------------------------------- */
@media screen and (max-width: 1200px) {
	main-header .header-wrapper nav.main-navbar-menu:not(.open) {
		visibility: hidden;
		transition: visibility 0s linear .35s;
	}
	main-header .header-wrapper nav.main-navbar-menu.open {
		visibility: visible;
		transition: visibility 0s linear 0s;
	}
	main-header .header-wrapper nav.main-navbar-menu ul:not(.sub-menu) > .menu-item-has-children.menu-item:not(.open) ul.sub-menu {
		visibility: hidden;
	}
	main-header .header-wrapper nav.main-navbar-menu ul:not(.sub-menu) > .menu-item-has-children.menu-item.open ul.sub-menu {
		visibility: visible;
	}
}

/* ---------------------------------------------------------------------------------------------
 * WCAG-003 / WCAG-007 · Focus ring for elements the helper makes focusable
 * (FAQ question headers, scrollable regions) and for the pause buttons.
 * ------------------------------------------------------------------------------------------- */
.question-head[role="button"]:focus-visible,
[data-wcag-scroll]:focus-visible,
.wcag-pause:focus-visible {
	outline: 3px solid #5581f1;
	outline-offset: 3px;
	border-radius: 4px;
}
.question-head[role="button"] { cursor: pointer; }

/* ---------------------------------------------------------------------------------------------
 * WCAG-005 · Pause button for carousels that advance on their own (inserted by wcag-helper.js).
 * Own colours, so it reads the same on the light and the dark sections it sits in.
 * ------------------------------------------------------------------------------------------- */
.wcag-pause-wrap {
	display: flex;
	justify-content: flex-end;
	margin: 0 0 10px;
}
.wcag-pause {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	padding: 4px 14px;
	border: 1px solid #211747;
	border-radius: 999px;
	background: #ffffff;
	color: #211747;
	font-family: var(--font-body, "Futura PT Medium", sans-serif);
	font-size: 14px;
	line-height: 1;
	letter-spacing: .02em;
	cursor: pointer;
}
.wcag-pause:hover { background: #211747; color: #ffffff; }
.wcag-pause__icon { font-size: 11px; }

/* ---------------------------------------------------------------------------------------------
 * WCAG-014 / WCAG-016 · Testimonial dots: 24×24px touch target, same 9px dot.
 * The active state moves from aria-selected (a tab attribute, invalid on a plain button) to
 * aria-current, set by testimonials-carrousel.js; this repeats the existing active style.
 * No gap between the 24px boxes (the box itself spaces the dots), so 20 dots fit in one line on
 * desktop; on narrow screens they wrap, as landing-page.css already intends below 782px.
 * ------------------------------------------------------------------------------------------- */
.tstm .tstm__dots,
[data-carousel] .tstm__dots {
	flex-wrap: wrap;
	gap: 0;
}
.tstm .tstm__dot,
[data-carousel] .tstm__dot {
	box-sizing: border-box;
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
	padding: 7.5px;
	background-clip: content-box;
	border-width: 0;
	position: relative;
}
.tstm .tstm__dot::after,
[data-carousel] .tstm__dot::after {
	content: "";
	position: absolute;
	inset: 7.5px;
	border-radius: 999px;
	border: 1px solid rgba(31, 27, 58, 0.25);
}
.tstm .tstm__dot[aria-current="true"],
[data-carousel] .tstm__dot[aria-current="true"] {
	background-color: var(--accent);
}
.tstm .tstm__dot[aria-current="true"]::after,
[data-carousel] .tstm__dot[aria-current="true"]::after {
	border-color: var(--accent);
}
