/* ============================================================================
 * medvise-a11y.css — systemic accessibility corrections (UI/UX audit 2026-07-20)
 *
 * Two audit findings live in the theme layer rather than in the catalog app, so
 * they are fixed here in one isolated, fully revertible file:
 *   [P2] «Регистрация» brand teal on white measures 2.35:1 (WCAG 1.4.3 needs 4.5).
 *   [P2] No visible focus on the global navigation — the theme carries ~43
 *        `outline:none` rules and its own :focus-visible styles are scoped to
 *        #mvuc-app only, so Tab through the header shows nothing.
 *
 * Revert = drop this file and its wp_enqueue_style() call in functions.php.
 * ========================================================================== */

/* --- Contrast -------------------------------------------------------------
 * Keep the brand teal for filled buttons (white text on teal already passes)
 * and darken it only where it is used as text/link colour on a light surface.
 * #33b9cb → #0e6d93 = 5.79:1 on white, same hue family.
 *
 * The theme sets this from a customizer option through a high-specificity
 * selector (`#header.header--buttons-column .header-wrap .header-ct-right
 * a.button-register`), so !important is what actually wins here. */
a.button-register,
a.button-register:visited {
	color: #0e6d93 !important;
}

a.button-register:hover,
a.button-register:focus {
	color: #0b5f80 !important; /* 7.09:1 */
}

/* --- Visible focus (WCAG 2.4.7) -------------------------------------------
 * !important is required: the theme resets `outline:none` on a long list of
 * selectors. Scoped to :focus-visible, so pointer users never see a ring —
 * only keyboard/AT navigation does. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
/* `[tabindex="-1"]` is excluded on purpose: those are scroll/announce targets
   (e.g. the Mini App's <main>), and ringing a whole region reads as a bug. */
[tabindex]:not([tabindex="-1"]):focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible {
	outline: 2px solid #0f7ea8 !important;
	outline-offset: 2px !important;
}

/* The header sits on a white bar; on the dark footer the same ring would sink
 * into the background, so lift it there. */
.footer :focus-visible,
.bottom :focus-visible,
[class*="footer"] :focus-visible {
	outline-color: #7fd3ea !important;
}

/* Windows High Contrast / forced colours: let the OS own the indicator. */
@media (forced-colors: active) {
	a:focus-visible,
	button:focus-visible,
	input:focus-visible,
	select:focus-visible,
	textarea:focus-visible,
	summary:focus-visible,
	[tabindex]:focus-visible {
		outline: 2px solid Highlight !important;
	}
}

/* --- Exception: the catalog's composite search controls --------------------
 * Reported 2026-07-20 (Рамиш, п.4): «строгий агрессивный прямоугольник» around
 * the search field, with the ⌘K badges colliding with it.
 *
 * `#mvuc-app` builds both of its search fields as a composite control — a
 * rounded wrapper (`.search-row`, `.atx-search`) around a deliberately
 * borderless input. Each wrapper already shows focus through `:focus-within`
 * (blue border + a 3px ring) and, unlike an `outline` on the inner input, that
 * ring follows the wrapper's own border-radius.
 *
 * The blanket `input:focus-visible` rule above therefore added a *second*,
 * hard-cornered ring inside the pill, and `outline-offset:2px` pushed it out
 * over the neighbouring ⌘/K badges. The catalog's own `outline:0` could not win
 * because the rule above is `!important`, so the opt-out has to be too.
 *
 * Focus stays visible — it just lives on the wrapper, which is the control the
 * user actually perceives. WCAG 2.4.7 is still satisfied. */
#mvuc-app .search-row input:focus-visible,
#mvuc-app .atx-search input:focus-visible {
	outline: none !important;
}
