/*!
 * IPV Accessibility - WCAG 2.1 AA remediation styles
 *
 * DESIGN CONTRACT
 * Nothing in this file changes how the site looks to a mouse user.
 * Every rule is scoped to one of:
 *   - :focus-visible  (keyboard / assistive-tech focus only, never mouse clicks)
 *   - .ipv-skip-link  (off-screen until focused)
 *   - .ipv-sr-only    (off-screen always)
 * No colours, fonts, spacing or layout of existing elements are touched.
 */

/* -------------------------------------------------------------------------
 * 1. WCAG 2.4.7 Focus Visible (AA)
 *
 * The Ekko theme and its bundled libraries contain 39 rules that set
 * `outline: none` on :focus, leaving keyboard users with no visible position
 * indicator anywhere on the site. These rules restore one.
 *
 * :focus-visible is used deliberately: the browser only matches it for
 * keyboard and assistive-tech focus, so clicking a button with a mouse looks
 * exactly as it does today. !important is required to win against the
 * theme's own `outline: none !important` declarations.
 *
 * The white box-shadow sits inside the 2px outline offset, guaranteeing the
 * indicator stays visible against the brand orange, green and dark
 * backgrounds as well as against white.
 * --------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
details:focus-visible,
area:focus-visible,
object:focus-visible,
embed:focus-visible,
iframe:focus-visible,
audio[controls]:focus-visible,
video[controls]:focus-visible,
[tabindex]:focus-visible,
[contenteditable="true"]:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="checkbox"]:focus-visible,
[role="radio"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="option"]:focus-visible,
[role="switch"]:focus-visible,
[role="combobox"]:focus-visible,
[role="textbox"]:focus-visible {
	outline: 3px solid #0b5fff !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 2px #ffffff !important;
}

/* Windows High Contrast / forced-colors: let the OS supply the indicator. */
@media (forced-colors: active) {
	a:focus-visible,
	button:focus-visible,
	input:focus-visible,
	select:focus-visible,
	textarea:focus-visible,
	[tabindex]:focus-visible,
	[role="button"]:focus-visible,
	[role="link"]:focus-visible {
		outline: 3px solid Highlight !important;
		outline-offset: 2px !important;
		box-shadow: none !important;
	}
}

/*
 * Programmatic focus targets (the skip-link destination and carousel regions
 * receive tabindex="-1" so they can be focused by script). They must never
 * paint a ring, because the user did not navigate to them by keyboard.
 */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible,
.ipv-focus-target:focus,
.ipv-focus-target:focus-visible {
	outline: none !important;
	box-shadow: none !important;
}

/* -------------------------------------------------------------------------
 * 2. WCAG 2.4.1 Bypass Blocks (A) - skip link
 *
 * Positioned off-screen and only pulled into view while focused, so it is
 * invisible during normal browsing but is the first thing a keyboard or
 * screen-reader user reaches.
 * --------------------------------------------------------------------- */
.ipv-skip-link {
	position: absolute !important;
	left: -10000px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	z-index: 2147483647 !important;
	white-space: nowrap;
}

.ipv-skip-link:focus,
.ipv-skip-link:focus-visible {
	position: fixed !important;
	left: 12px !important;
	top: 12px !important;
	width: auto !important;
	height: auto !important;
	padding: 12px 22px !important;
	overflow: visible !important;
	background: #ffffff !important;
	color: #111111 !important;
	font: 700 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
	text-decoration: underline !important;
	border-radius: 4px !important;
	outline: 3px solid #0b5fff !important;
	outline-offset: 2px !important;
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4) !important;
}

/* -------------------------------------------------------------------------
 * 3. Visually hidden text utility
 *
 * Used for the hidden <h1> on templates that render none, and for accessible
 * names that must not appear on screen. This is the standard clip-path
 * pattern - the text stays in the accessibility tree and is read aloud, but
 * occupies no visual space and cannot affect layout.
 * --------------------------------------------------------------------- */
.ipv-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* -------------------------------------------------------------------------
 * 4. WCAG 2.2 - SC 2.4.11 Focus Not Obscured (Minimum), Level AA
 *
 * The theme's navbar is position:fixed and 152px tall (184px with the admin
 * bar). The document had scroll-padding-top of only 32px, so pressing Tab to
 * reach an element below the fold scrolled it flush against the viewport top -
 * that is, completely underneath the fixed header, where a keyboard user
 * cannot see it at all. That is a direct SC 2.4.11 failure.
 *
 * scroll-padding-top only tells the browser where to STOP when scrolling an
 * element into view. It changes no geometry, no paint, and nothing about how
 * the page looks - it is purely scroll-anchoring behaviour. This is therefore
 * a free fix for an AA criterion.
 *
 * The precise value is measured from the live header by ipv-a11y.js and set on
 * --ipv-header-clearance. The literal below is only a fallback for the brief
 * moment before script runs, or if script fails.
 * --------------------------------------------------------------------- */
html {
	scroll-padding-top: var(--ipv-header-clearance, 170px);
}

/* -------------------------------------------------------------------------
 * 5. WCAG 2.2 - SC 2.5.8 Target Size (Minimum), Level AA
 *
 * ** THIS IS THE ONE INTENTIONAL VISUAL CHANGE IN THIS PLUGIN, AND IT WAS
 *    EXPLICITLY APPROVED. Everything else is pixel-identical. **
 *
 * The carousel pagination dots are 10x10 CSS px sitting on a 20px pitch
 * (10px dot + 5px margin each side). SC 2.5.8 requires either a 24x24 target,
 * or - for undersized targets - that a 24px-diameter circle centred on each
 * target does not intersect the circle of another target. At a 20px pitch
 * those circles overlap, so 24 dots on the home page failed.
 *
 * Raising the horizontal margin from 5px to 7px gives a 24px pitch, which
 * satisfies the spacing exception without changing the dots' size, colour or
 * shape. The rows are centred and have ample room (the 20-dot row grows from
 * 400px to 466px inside an 1180px container), so nothing wraps or reflows.
 *
 * Deliberately NOT enlarging the dots themselves: that would be a far more
 * noticeable design change.
 * --------------------------------------------------------------------- */
.owl-dots .owl-dot,
.sa_owl_theme .owl-dots .owl-dot {
	margin-left: 7px !important;
	margin-right: 7px !important;
}

/* -------------------------------------------------------------------------
 * 6. WCAG 2.3.3 Animation from Interactions (AAA) / 2.2.2 courtesy
 *
 * Honour an explicit operating-system request for reduced motion. Users who
 * have not set that preference see the site exactly as it is today.
 * --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.ipv-reduced-motion *,
	.ipv-reduced-motion *::before,
	.ipv-reduced-motion *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}
