/**
 * Accessibility menu (inc/a11y.php, assets/js/a11y.js). Reut chose direction B on 23/11/2026:
 * a "נגישות" button in the header next to "צור קשר" (an icon next to the burger on phones),
 * and a panel under the header.
 *
 * The settings are classes on <html>, set before the page paints by the small script in <head>:
 * a11y-t1 / a11y-t2 (text size), a11y-contrast, a11y-links, a11y-still.
 * The menu itself shows only when JavaScript runs (html.a11y-js), so it is never a dead button.
 */

/* ---------- Text size ---------- */

/* Every font size in the theme is in rem, so only the text grows and the layout keeps its width.
   --a11y-k grows the vw part of the fluid headings (clamp) as well. */
html.a11y-t1 {
	font-size: 112.5%;
	--a11y-k: 1.125;
}

html.a11y-t2 {
	font-size: 125%;
	--a11y-k: 1.25;
}

/* ---------- High contrast ---------- */

html.a11y-contrast {
	--ink: #000000;
	--muted: #1f2a2d;
	--line: #4a5a5e;
	--primary: #0b4a55;
	--primary-ink: #06343c;
	--primary-soft: #d6ecef;
	--accent-ink: #5c3005;
	--on-accent: #000000;
	--surface: #ffffff;
	--nav-bg: #ffffff;
	--hero-bg: #ffffff;
	--card-shadow: none;
}

html.a11y-contrast body {
	color: #000000;
}

html.a11y-contrast .card,
html.a11y-contrast .stat {
	border-color: var(--line);
}

/* ---------- Highlight links ---------- */

html.a11y-links a {
	text-decoration-line: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 3px !important;
}

html.a11y-links main :is(p, li, dd, td, h3, h4) > a:not(.btn) {
	background: #fff1a6;
	color: #111111 !important;
	box-shadow: 0 0 0 2px #fff1a6;
	border-radius: 3px;
}

html.a11y-links .btn,
html.a11y-links main a[class*="card"] {
	outline: 3px solid #111111;
	outline-offset: 3px;
}

/* ---------- Stop animations (the same final state as the system "reduce motion") ---------- */

html.a11y-still {
	scroll-behavior: auto;
}

html.a11y-still *,
html.a11y-still *::before,
html.a11y-still *::after {
	animation: none !important;
	transition: none !important;
}

html.a11y-still .hx .w {
	opacity: 1;
	transform: none;
}

html.a11y-still .btn:hover {
	transform: none;
}

/* ---------- The menu ---------- */

.a11y {
	display: none;
	flex: none;
	color: var(--ink);
}

html.a11y-js .a11y {
	display: block;
}

/* Icon only at every width (Reut 24/11/2026): the visible word made the top menu wrap to two lines on desktop.
   Screen readers still hear "תפריט נגישות" (aria-label), and a mouse hover shows "נגישות" (title). */
.a11y-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 42px;
	block-size: 42px;
	padding: 0;
	border-radius: 50%;
	border: 1.5px solid var(--line);
	background: transparent;
	color: var(--primary-ink);
	cursor: pointer;
}

.a11y-btn .i {
	font-size: 1.5rem;
}

.a11y-btn-t {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.a11y-btn:hover,
.a11y-btn[aria-expanded="true"] {
	border-color: var(--primary);
	background: var(--primary-soft);
}

.a11y-panel {
	position: absolute;
	inset-block-start: calc(100% + 8px);
	inset-inline-end: max(16px, calc((100% - 1200px) / 2));
	z-index: 60;
	inline-size: 340px;
	max-inline-size: calc(100vw - 24px);
	max-block-size: calc(100vh - var(--hdr-h) - var(--top-offset) - 24px);
	overflow-y: auto;
	padding: 18px;
	background: #ffffff;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 18px 50px rgba(20, 50, 60, 0.22);
	font-size: 1rem;
	line-height: 1.4;
}

.a11y-panel[hidden] {
	display: none;
}

.a11y-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-block-end: 14px;
}

.a11y-head h2 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 1.1875rem;
	font-weight: 800;
	color: var(--ink);
}

.a11y-head h2 .i {
	color: var(--primary);
	font-size: 1.375rem;
}

.a11y-x {
	display: grid;
	place-items: center;
	inline-size: 40px;
	block-size: 40px;
	border-radius: 50%;
	border: 1px solid var(--line);
	background: #ffffff;
	color: var(--ink);
	font-size: 1.25rem;
	cursor: pointer;
}

.a11y-l {
	margin-block-end: 8px;
	font-size: 0.9375rem;
	font-weight: 700;
}

.a11y-seg {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	margin-block-end: 14px;
}

.a11y-seg button {
	display: grid;
	place-items: center;
	min-block-size: 56px;
	padding: 6px 4px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #ffffff;
	color: var(--ink);
	font: inherit;
	line-height: 1.1;
	cursor: pointer;
}

.a11y-seg b {
	font-weight: 800;
	line-height: 1;
}

.a11y-seg [data-t="0"] b {
	font-size: 1rem;
}

.a11y-seg [data-t="1"] b {
	font-size: 1.25rem;
}

.a11y-seg [data-t="2"] b {
	font-size: 1.5625rem;
}

.a11y-seg small {
	font-size: 0.78125rem;
	color: var(--muted);
}

.a11y-seg button[aria-pressed="true"] {
	background: var(--primary);
	border-color: var(--primary);
	color: var(--on-primary);
}

.a11y-seg button[aria-pressed="true"] small {
	color: var(--on-primary);
}

.a11y-sw {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	inline-size: 100%;
	margin-block-end: 8px;
	padding: 11px 12px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #ffffff;
	color: var(--ink);
	font: inherit;
	text-align: start;
	cursor: pointer;
}

.a11y-sw-t {
	display: grid;
	gap: 1px;
}

.a11y-sw-t b {
	font-size: 0.96875rem;
	font-weight: 700;
}

.a11y-sw-t small {
	font-size: 0.8125rem;
	color: var(--muted);
}

.a11y-knob {
	position: relative;
	flex: none;
	inline-size: 44px;
	block-size: 26px;
	border-radius: 999px;
	background: #c9d5d7;
	transition: background 0.15s;
}

.a11y-knob::after {
	content: "";
	position: absolute;
	inset-block-start: 3px;
	inset-inline-start: 3px;
	inline-size: 20px;
	block-size: 20px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: inset-inline-start 0.15s;
}

.a11y-sw[aria-checked="true"] {
	border-color: var(--primary);
	background: var(--surface);
}

.a11y-sw[aria-checked="true"] .a11y-knob {
	background: var(--primary);
}

.a11y-sw[aria-checked="true"] .a11y-knob::after {
	inset-inline-start: 21px;
}

.a11y-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-block-start: 6px;
}

.a11y-reset {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: 1px solid var(--line);
	border-radius: var(--btn-radius);
	background: #ffffff;
	color: var(--ink);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.a11y-foot a {
	color: var(--primary-ink);
	font-weight: 700;
}

.a11y-note {
	margin: 12px 0 0;
	font-size: 0.78125rem;
	color: var(--muted);
}

.a11y-btn:focus-visible,
.a11y-panel button:focus-visible,
.a11y-panel a:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

/* Tablet and phone: icon only, next to the burger. */
@media (max-width: 1080px) {
	.nav .a11y {
		margin-inline-start: auto;
	}

	.nav .a11y ~ .burger {
		margin-inline-start: 2px;
	}

	.a11y-btn {
		inline-size: 44px;
		block-size: 44px;
		padding: 0;
		border-color: transparent;
	}

	.a11y-btn .i {
		font-size: 1.625rem;
	}
}

@media (max-width: 600px) {
	.a11y-panel {
		inset-inline: 8px;
		inline-size: auto;
		max-inline-size: none;
	}
}
