/*
 * PanicParts A11y Toolkit — Frontend stylesheet
 *
 * Focus indicators, skip-link styling, and reinforcement of a few
 * WooCommerce/Storefront patterns that fall short of WCAG 2.1 AA.
 *
 * Color choices:
 *  - #ffbf00 amber for focus rings: 3.04:1 contrast against Storefront's
 *    purple (#7f54b3), 8.6:1 against white, 1.5:1 against black. The
 *    box-shadow halo doubles the perceived ring on dark backgrounds.
 *  - All `!important` declarations are scoped to focus states only,
 *    where overriding theme `outline:none` is the entire point.
 */

/* ---------- Focus indicators (WCAG 2.4.7) ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="menuitem"]:focus-visible,
[role="tab"]:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid #ffbf00 !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 5px rgba(255, 191, 0, 0.35) !important;
	border-radius: 2px;
}

/* WooCommerce form fields specifically — Storefront resets focus. */
.woocommerce form .form-row input.input-text:focus-visible,
.woocommerce form .form-row textarea:focus-visible,
.woocommerce form .form-row select:focus-visible,
.wc-block-components-text-input input:focus-visible,
.wc-block-components-textarea textarea:focus-visible {
	outline: 3px solid #ffbf00 !important;
	outline-offset: 1px !important;
}

/* ---------- Skip links (WCAG 2.4.1) ---------- */

a[href="#site-navigation"],
a[href="#content"],
.skip-link {
	background: #000;
	color: #fff !important;
	display: block;
	font-size: 1rem;
	font-weight: 700;
	left: -9999em;
	line-height: normal;
	padding: 1em 1.5em;
	position: absolute;
	text-decoration: none;
	top: 0;
	z-index: 100000;
}

a[href="#site-navigation"]:focus,
a[href="#content"]:focus,
.skip-link:focus {
	left: 0;
	clip: auto !important;
	clip-path: none;
	height: auto;
	width: auto;
	outline: 3px solid #ffbf00 !important;
}

/* ---------- Required field indicators ---------- */

.woocommerce form .form-row .required {
	color: #b32d2e;
	font-weight: 700;
	text-decoration: none;
}

/* ---------- Error / message visibility (WCAG 1.4.1 — color is not the only cue) ---------- */

.woocommerce-error,
.woocommerce-message,
.woocommerce-info,
.wc-block-components-notice-banner {
	border-left-width: 4px;
	border-left-style: solid;
}

.woocommerce-error {
	border-left-color: #b32d2e;
}

.woocommerce-message {
	border-left-color: #00a32a;
}

.woocommerce-info {
	border-left-color: #2271b1;
}

/* ---------- Mega-menu / sub-menu keyboard reachability ---------- */

.main-navigation ul li:focus-within > ul,
.main-navigation ul li.focus > ul,
.storefront-handheld-footer-bar ul li.cart .site-header-cart:focus-within > .widget_shopping_cart {
	left: auto;
	right: auto;
}

/* ---------- Quantity input label - keep visible if theme tries to hide ---------- */

.quantity > label.screen-reader-text,
.qty-label {
	/* Native screen-reader-text class is already present; this is just a safety
	   net for child themes that strip the label entirely. */
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}

/* ---------- Buttons that are <a> with role=button - cursor cue ---------- */

a[role="button"] {
	cursor: pointer;
}

/* ---------- Storefront-specific: header search form label visibility ---------- */

.site-search .widget_product_search label,
.storefront-product-search label {
	/* Visually hidden but available to AT */
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}
