/*
 * MS Accessibility Panel. Colours come from the settings as custom
 * properties on :root (--ms-a11y-button, --ms-a11y-ring, --ms-a11y-accent);
 * everything else is set here so the panel looks the same on any theme.
 * Logical properties keep it right for RTL and LTR alike.
 */

.ms-a11y {
	--ms-a11y-gap: 16px;
	--ms-a11y-size: 48px;
	--ms-a11y-ink: #1a1a1a;
	--ms-a11y-muted: #5e5e5e;
	--ms-a11y-line: #cfcfcf;
	--ms-a11y-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
}

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

/* The round button: the ring shows it on dark pages, the outer line on light. */
.ms-a11y__trigger {
	position: fixed;
	inset-block-end: calc(var(--ms-a11y-gap) + env(safe-area-inset-bottom));
	z-index: 99990;
	display: grid;
	place-items: center;
	width: var(--ms-a11y-size);
	height: var(--ms-a11y-size);
	padding: 0;
	margin: 0;
	color: var(--ms-a11y-ring);
	cursor: pointer;
	background: var(--ms-a11y-button);
	border: 2px solid var(--ms-a11y-ring);
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--ms-a11y-line), var(--ms-a11y-shadow);
}

.ms-a11y__trigger svg {
	width: 55%;
	height: 55%;
}

.ms-a11y--start .ms-a11y__trigger,
.ms-a11y--start .ms-a11y__panel {
	inset-inline-start: var(--ms-a11y-gap);
}

.ms-a11y--end .ms-a11y__trigger,
.ms-a11y--end .ms-a11y__panel {
	inset-inline-end: var(--ms-a11y-gap);
}

.ms-a11y :focus-visible {
	outline: 3px solid var(--ms-a11y-accent);
	outline-offset: 2px;
}

.ms-a11y__panel {
	position: fixed;
	inset-block-end: calc(var(--ms-a11y-gap) * 1.75 + var(--ms-a11y-size) + env(safe-area-inset-bottom));
	z-index: 99991;
	box-sizing: border-box;
	display: grid;
	gap: 16px;
	width: min(352px, calc(100vw - var(--ms-a11y-gap) * 2));
	max-height: calc(100svh - var(--ms-a11y-size) - var(--ms-a11y-gap) * 3);
	padding: 24px;
	overflow-y: auto;
	color: var(--ms-a11y-ink);
	text-align: start;
	background: #fff;
	border: 1px solid var(--ms-a11y-line);
	border-radius: 12px;
	box-shadow: var(--ms-a11y-shadow);
}

.ms-a11y__panel[hidden] {
	display: none;
}

.ms-a11y__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ms-a11y__title {
	margin: 0;
	font-family: inherit;
	font-size: 1.375rem;
	font-weight: 800;
	line-height: 1.2;
	color: var(--ms-a11y-ink);
}

.ms-a11y__close {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--ms-a11y-ink);
	cursor: pointer;
	background: transparent;
	border: 0;
	border-radius: 50%;
}

.ms-a11y__close:hover {
	background: #f5f5f5;
}

.ms-a11y__close svg {
	width: 22px;
	height: 22px;
}

.ms-a11y__list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 0;
	margin: 0;
	list-style: none;
}

.ms-a11y__list li {
	margin: 0;
}

.ms-a11y__option {
	box-sizing: border-box;
	display: grid;
	gap: 4px;
	align-content: start;
	width: 100%;
	height: 100%;
	min-height: 72px;
	padding: 12px;
	font: inherit;
	font-size: 0.875rem;
	color: var(--ms-a11y-ink);
	text-align: start;
	cursor: pointer;
	background: #fff;
	border: 1px solid var(--ms-a11y-line);
	border-radius: 6px;
}

.ms-a11y__option:hover {
	border-color: var(--ms-a11y-ink);
}

.ms-a11y__option[aria-pressed="true"],
.ms-a11y__option.is-active {
	color: #fff;
	background: var(--ms-a11y-ink);
	border-color: var(--ms-a11y-ink);
}

.ms-a11y__label {
	font-weight: 700;
}

.ms-a11y__value {
	opacity: 0.8;
}

.ms-a11y__check {
	display: none;
}

.ms-a11y__option[aria-pressed="true"] .ms-a11y__check {
	display: block;
}

.ms-a11y__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block-start: 16px;
	border-block-start: 1px solid #e8e8e8;
}

.ms-a11y__reset {
	min-height: 44px;
	padding: 0 16px;
	font: inherit;
	font-weight: 700;
	color: var(--ms-a11y-ink);
	cursor: pointer;
	background: transparent;
	border: 2px solid var(--ms-a11y-ink);
	border-radius: 999px;
}

.ms-a11y__statement {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ms-a11y-ink);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* ----- The visitor's choices, as classes on <html> ----- */

html.a11y-text-115 { font-size: 115%; }
html.a11y-text-130 { font-size: 130%; }
html.a11y-text-150 { font-size: 150%; }

/* On the page's top-level blocks, not on <html>: a filter there would pin the
   fixed button to the page instead of the screen. */
html.a11y-contrast-high body > :not(.ms-a11y) { filter: contrast(1.4); }
html.a11y-contrast-mono body > :not(.ms-a11y) { filter: grayscale(1); }

html.a11y-lines-16 body :where(p, li, dd, dt, td, th, label, a, span) { line-height: 1.6 !important; }
html.a11y-lines-20 body :where(p, li, dd, dt, td, th, label, a, span) { line-height: 2 !important; }

/* Readable font: the operating system's plain sans, which covers Hebrew. */
html.a11y-readable body,
html.a11y-readable body :where(*:not(svg, svg *)) {
	font-family: Arial, "Segoe UI", Helvetica, sans-serif !important;
	letter-spacing: 0 !important;
}

html.a11y-links body a {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	outline: 2px solid var(--ms-a11y-accent);
	outline-offset: 2px;
}

html.a11y-headings body :where(h1, h2, h3, h4, h5, h6) {
	outline: 2px dashed var(--ms-a11y-accent);
	outline-offset: 4px;
}

html.a11y-cursor,
html.a11y-cursor * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l15 9-6.5 1.5L16 20l-3 1.5-3.5-7.5L4 18z' fill='%23000' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
}

html.a11y-motion,
html.a11y-motion *,
html.a11y-motion *::before,
html.a11y-motion *::after {
	scroll-behavior: auto !important;
	transition: none !important;
	animation: none !important;
}
