/**
 * Accessibility layer for MZW Access.
 *
 * These rules intentionally sit in their own file, separate from
 * whatever visual styling gets layered on top later (Elementor Theme
 * Style, page-level design), so the WCAG-required behaviors below are
 * never accidentally overridden by a later style change:
 * - skip link
 * - visible, high-contrast focus indicator on every interactive element
 * - accessible mobile/submenu toggles
 * - minimum touch target size
 * - respect for prefers-reduced-motion
 *
 * Color tokens below are taken from the current mzw.com.pl theme
 * (assets/reference/cesin-theme-notes.md has the full audit):
 * near-black #212020, white, and brand gold #feda7e. The gold is kept
 * as a background/surface token (12:1 contrast with the dark text
 * color) but NOT reused as a text-on-light color — on the live site
 * it is used for link/label text on white and measures ~1.35:1
 * contrast, badly failing WCAG 1.4.3 (needs 4.5:1). --mzw-color-link
 * below is a darkened, same-hue gold (~4.9:1 on white) so link text
 * keeps the brand color family while actually being readable.
 */

:root {
	--mzw-color-text: #212020;
	--mzw-color-bg: #ffffff;
	--mzw-color-gold-surface: #feda7e; /* brand gold — background/surface use only, paired with dark text (12:1) */
	--mzw-color-link: #8a6d13; /* darkened brand gold, 4.9:1 on white — safe for text/links on light backgrounds */
	--mzw-color-link-visited: #6b5510;
	--mzw-color-focus: #d4380d; /* ≥3:1 against white, dark navbar, and gold surface alike */
	--mzw-color-border: #6b6b6b;
	--mzw-font-body: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mzw-font-heading: 'Playfair Display', Georgia, serif;
	--mzw-font-size-base: 1.125rem; /* 18px, above the 16px minimum */
	--mzw-line-height-base: 1.6;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--mzw-font-heading);
	font-weight: 700;
}

/* Base readability: min body text size and line-height for low-vision users. */
body {
	color: var(--mzw-color-text);
	background: var(--mzw-color-bg);
	font-family: var(--mzw-font-body);
	font-size: var(--mzw-font-size-base);
	line-height: var(--mzw-line-height-base);
}

a {
	color: var(--mzw-color-link);
}

a:visited {
	color: var(--mzw-color-link-visited);
}

/* Screen-reader-only utility (WordPress core class name, kept for compatibility). */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* Skip link: hidden off-screen until keyboard-focused, then fully visible. */
.skip-link {
	left: -9999px;
	top: 0;
	z-index: 100000;
}

.skip-link:focus {
	background: var(--mzw-color-bg);
	color: var(--mzw-color-text);
	clip: auto !important;
	clip-path: none;
	display: block;
	height: auto;
	left: 0.5rem;
	top: 0.5rem;
	width: auto;
	padding: 0.75rem 1.25rem;
	border: 2px solid var(--mzw-color-focus);
	border-radius: 4px;
	font-weight: 700;
	text-decoration: none;
	position: fixed;
}

/*
 * Visible focus indicator — required for WCAG 2.4.7 (Focus Visible) and
 * 2.4.11 (Focus Appearance). Never remove this without replacing it with
 * something at least as visible; `outline: none` alone is an accessibility bug.
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid var(--mzw-color-focus);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Fallback for browsers without :focus-visible support. */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
	outline: 3px solid var(--mzw-color-focus);
	outline-offset: 2px;
}

/*
 * Minimum touch target size (WCAG 2.5.8, 24x24 CSS px; using 44px per
 * WCAG 2.5.5 best practice). `.menu-toggle` is deliberately left out of
 * this list — it has equal (0,1,0) specificity to its own later
 * `display: none` rule below, and having both in the cascade made the
 * winner depend on browser-internal rule-matching order rather than
 * source order, so the button rendered even outside the mobile media
 * query. Its min size is set directly in that rule instead.
 */
.main-navigation a,
.main-navigation button,
.submenu-toggle,
button,
input[type="submit"],
input[type="button"] {
	min-height: 44px;
	min-width: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/*
 * Site header / navigation skeleton — dark bar with gold accents,
 * matching the current mzw.com.pl navbar (near-black #212020 background,
 * brand gold #feda7e logo badge and active/hover state). White-on-dark
 * and gold-on-dark both measure well above 4.5:1 here.
 */
.site-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem;
	background: var(--mzw-color-text);
	color: #ffffff;
}

.site-header a {
	color: #ffffff;
}

.site-header .site-title a {
	font-family: var(--mzw-font-heading);
	font-size: 1.5rem;
	text-decoration: none;
}

.main-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.main-navigation .sub-menu {
	flex-direction: column;
	display: none;
	position: absolute;
	background: var(--mzw-color-text);
	border: 1px solid var(--mzw-color-gold-surface);
	padding: 0.5rem;
	z-index: 10;
}

.main-navigation li {
	position: relative;
}

.main-navigation li.menu-open > .sub-menu {
	display: flex;
}

.main-navigation [aria-current="page"] {
	font-weight: 700;
	color: var(--mzw-color-gold-surface);
	text-decoration: underline;
}

.main-navigation a:hover,
.main-navigation a:focus-visible {
	color: var(--mzw-color-gold-surface);
}

.submenu-toggle {
	background: transparent;
	color: #ffffff;
	border: 1px solid transparent;
	cursor: pointer;
}

/*
 * `.main-navigation .menu-toggle` (0,2,0) rather than plain `.menu-toggle`
 * (0,1,0): the touch-target rule above also matches this button via its
 * own `.main-navigation button` selector (0,1,1), which otherwise beats
 * a bare `.menu-toggle` regardless of source order and left the button
 * visible outside the mobile media query.
 */
.main-navigation .menu-toggle {
	display: none;
	min-height: 44px;
	min-width: 44px;
	align-items: center;
	justify-content: center;
	background: var(--mzw-color-text);
	color: #ffffff;
	border: 2px solid #ffffff;
	cursor: pointer;
}

@media (max-width: 782px) {
	.main-navigation .menu-toggle {
		display: inline-flex;
	}

	.main-navigation ul#primary-menu {
		display: none;
		flex-direction: column;
		width: 100%;
	}

	.main-navigation.is-open ul#primary-menu {
		display: flex;
	}
}

.site-footer {
	padding: 2rem 1rem;
	background: var(--mzw-color-text);
	color: #ffffff;
	text-align: center;
}

.site-footer a {
	color: #ffffff;
}

.site-footer nav ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.5rem;
	margin: 0 0 1rem;
	padding: 0;
}

/* Respect users who have requested less motion at the OS level. */
@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;
	}
}
