/*!
 * CIFAL Accessibility Fixes 1.0.0 | Parameter LLC
 * Scoped overrides for UiCore/Elementor front-end markup on cifalmiami.org.
 */

/* A11Y-01 Visible keyboard focus (WCAG 2.4.7).
   UiCore's generated uicore-global.css ships ":focus{outline:none}", which removes every focus indicator.
   Two-tone ring: dark outline for light backgrounds, white inner ring for dark/photo backgrounds. */
html body :focus-visible {
	outline: 3px solid #0b1b33 !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 2px #fff !important;
}

/* Header links fill the 81px bar: ring the label text instead of the whole bar-height link. */
html body #wrapper-navbar .uicore-menu > li > a:focus-visible:has(> .ui-menu-item-wrapper) {
	outline: none !important;
	box-shadow: none !important;
}

html body #wrapper-navbar .uicore-menu > li > a:focus-visible > .ui-menu-item-wrapper {
	outline: 3px solid #0b1b33;
	outline-offset: 6px;
	border-radius: 2px;
}

/* Logo and dropdown links: ring drawn inside the element so the bar and panel edges cannot clip it. */
html body #wrapper-navbar .uicore-branding a:focus-visible,
html body #wrapper-navbar nav .sub-menu a:focus-visible {
	outline-offset: -6px !important;
	box-shadow: none !important;
}

/* Skip-link target: focus is moved programmatically; no ring around the whole content area. */
html body #content:focus-visible,
html body #cifal-main:focus-visible {
	outline: none !important;
	box-shadow: none !important;
}

/* A11Y-04 Skip link, visible when focused. */
.cifal-skip-link {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 2147483000;
	transform: translateY(-300%);
	padding: 12px 20px;
	border-radius: 6px;
	background: #0b1b33;
	color: #fff !important;
	font: 600 16px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	text-decoration: underline;
	transition: none !important; /* UiCore animates every <a>; the link must appear at once */
}

.cifal-skip-link:focus,
.cifal-skip-link:focus-visible {
	transform: none;
}

/* A11Y-02 Desktop dropdowns (UiCore reveals them on :hover only).
   Closed sub-menus leave the tab order (visibility: hidden) and open when keyboard focus enters
   their parent item. Transition values mirror UiCore's desktop rule so the pointer experience is unchanged. */
@media (min-width: 1025px) {
	html body #wrapper-navbar nav .sub-menu:not(.uicore-megamenu) {
		visibility: hidden;
		transition: opacity 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), transform 0.4s cubic-bezier(0.1, 0.76, 0.37, 1.19), visibility 0s linear 0.3s;
	}

	html body #wrapper-navbar nav .menu-item-has-children:hover > .sub-menu,
	html body #wrapper-navbar nav .menu-item-has-children:focus-within > .sub-menu,
	html body #wrapper-navbar nav .sub-menu:hover,
	html body #wrapper-navbar nav .ui-is-active > .sub-menu,
	html body #wrapper-navbar nav .uicore-simple-megamenu > .sub-menu .sub-menu {
		visibility: visible;
		transition-delay: 0s;
	}

	html body #wrapper-navbar nav .menu-item-has-children:focus-within > .sub-menu {
		opacity: 1;
		pointer-events: all;
		transform: none !important;
	}

	html body #wrapper-navbar nav .sub-menu .menu-item-has-children:focus-within > .sub-menu {
		display: table;
	}

	/* Escape dismisses an open sub-menu for keyboard and pointer users (WCAG 1.4.13). */
	html body #wrapper-navbar nav .menu-item-has-children.cifal-a11y-dismissed > .sub-menu {
		visibility: hidden !important;
		opacity: 0 !important;
		pointer-events: none !important;
	}
}

/* A11Y-07 Pause/play control for Elementor background videos (WCAG 2.2.2). */
.cifal-bgvideo-toggle {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: rgba(11, 27, 51, 0.75);
	color: #fff;
	line-height: 1;
	cursor: pointer;
}

.cifal-bgvideo-toggle:hover {
	background: rgba(11, 27, 51, 0.95);
}

.cifal-bgvideo-toggle svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.cifal-bgvideo-toggle .cifal-i-play,
.cifal-bgvideo-toggle.is-paused .cifal-i-pause {
	display: none;
}

.cifal-bgvideo-toggle.is-paused .cifal-i-play {
	display: block;
}

.cifal-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* A11Y-15 Links inside running text are underlined, not identified by colour alone (WCAG 1.4.1). */
html body main .elementor-widget-text-editor :is(p, li) a:not(.elementor-button) {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}
