/*
 * Accessibility utility layer.
 *
 * Most a11y rules ship in main.css (skip-link, screen-reader-text)
 * because they must be available on every page. This file holds
 * OPTIONAL helpers used by individual components or niche modules.
 */

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

.rw-focus-ring:focus-visible {
	outline: 2px solid var(--rw-color-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

/* ----------------------------------------------------------------- */
/*  Stronger focus-visible defaults                                  */
/*                                                                   */
/*  WP-core admin tends to ship aggressive focus rings; we match     */
/*  that strength on the frontend so keyboard users can always see   */
/*  where they are. The `:focus-visible` selector only triggers on   */
/*  keyboard navigation, leaving mouse clicks ring-free.             */
/* ----------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: 3px solid var(--rw-color-primary, #1f6feb);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Fallback for browsers without :focus-visible support — applies
 * a softer focus ring so non-keyboard interactions don't get
 * ugly outlines while keyboard users still see something. */
@supports not selector(:focus-visible) {
	a:focus,
	button:focus,
	input:focus,
	select:focus,
	textarea:focus {
		outline: 2px solid var(--rw-color-primary, #1f6feb);
		outline-offset: 2px;
	}
}

/* ----------------------------------------------------------------- */
/*  prefers-contrast: more                                            */
/*                                                                   */
/*  Visitors who request higher contrast get sharper borders,        */
/*  darker text, and a guaranteed underline on every link.           */
/* ----------------------------------------------------------------- */
@media (prefers-contrast: more) {
	:root {
		--rw-color-text: #000;
		--rw-color-text-muted: #333;
		--rw-color-border: #000;
	}
	a, .rw-card__title a, .rw-eeat-meta a {
		text-decoration: underline !important;
	}
	.rw-card,
	.rw-info-box,
	.rw-notice,
	.rw-table-wrap > table th,
	.rw-table-wrap > table td {
		border-width: 2px !important;
	}
}

/* ----------------------------------------------------------------- */
/*  Windows High Contrast Mode / forced-colors                        */
/*                                                                   */
/*  When the user has forced-colors active (e.g. Windows HCM), the   */
/*  system overrides our palette. We hint where colour conveys       */
/*  meaning so the system can substitute its own semantic colours.   */
/* ----------------------------------------------------------------- */
@media (forced-colors: active) {
	.rw-button {
		border: 1px solid ButtonText;
		background: ButtonFace;
		color: ButtonText;
		forced-color-adjust: none;
	}
	.rw-button:hover,
	.rw-button:focus-visible {
		background: Highlight;
		color: HighlightText;
		border-color: Highlight;
	}
	.rw-info-box,
	.rw-notice,
	.rw-ad-slot {
		border: 1px solid CanvasText;
	}
	.rw-back-to-top {
		background: ButtonFace;
		color: ButtonText;
		border: 1px solid ButtonText;
	}
}

/* ----------------------------------------------------------------- */
/*  Skip-link emphasis                                                */
/* ----------------------------------------------------------------- */
.skip-link:focus-visible {
	outline: 3px solid #fff !important;
	outline-offset: 2px;
}
