/**
 * EMPIST Accessibility panel.
 * Colours come from settings. Layout follows the observed side-panel pattern.
 */

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.empist-a11y {
	--empist-a11y-primary: #1b1b1b;
	--empist-a11y-background: #ffffff;
	--empist-a11y-text: #1b1b1b;
	--empist-a11y-accent: #7edaff;
	--empist-a11y-on: #ffffff;
	--empist-a11y-hover: #333333;
	--empist-a11y-soft: #f4f4f4;
	--empist-a11y-line: #d5d5d5;
	font-family: "Segoe UI", system-ui, sans-serif;
	font-size: 16px;
	line-height: 1.4;
	color: var(--empist-a11y-text);
}

.empist-a11y__trigger {
	position: fixed;
	z-index: 90;
	bottom: 1.25rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	margin: 0;
	padding: 0;
	border: 2px solid var(--empist-a11y-primary);
	border-radius: 50%;
	background: var(--empist-a11y-primary);
	color: var(--empist-a11y-on);
	cursor: pointer;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
	touch-action: manipulation;
}

.empist-a11y--right .empist-a11y__trigger { right: 1rem; }
.empist-a11y--left .empist-a11y__trigger { left: 1rem; }
.empist-a11y__trigger[hidden] { display: none; }

.empist-a11y__layer {
	position: fixed;
	z-index: 190;
	top: var(--empist-a11y-admin, 0px);
	right: 0;
	bottom: 0;
	left: 0;
	background: rgb(6 22 32 / 0.48);
}

.empist-a11y__layer[hidden] { display: none; }

.empist-a11y__panel {
	position: absolute;
	top: 0;
	display: flex;
	flex-direction: column;
	width: min(100%, 32.5rem);
	height: 100%;
	overflow: hidden;
	background: var(--empist-a11y-background);
	color: var(--empist-a11y-text);
	box-shadow: 0 0 28px rgb(0 0 0 / 0.22);
	transition: transform 0.22s ease;
}

.empist-a11y--right .empist-a11y__panel { right: 0; transform: translateX(100%); }
.empist-a11y--left .empist-a11y__panel { left: 0; transform: translateX(-100%); }
.empist-a11y.is-wide .empist-a11y__panel { width: min(100%, 40rem); }
.empist-a11y__layer.is-open .empist-a11y__panel { transform: translateX(0); }

.empist-a11y__head {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	padding: 0.55rem 0.7rem 0.45rem;
	background: var(--empist-a11y-primary);
	color: var(--empist-a11y-on);
	border-bottom: 4px solid var(--empist-a11y-accent);
}

.empist-a11y__title {
	flex: 1 1 100%;
	order: -1;
	margin: 0 0 0.15rem;
	color: var(--empist-a11y-on);
	font-size: 1.05rem;
	font-weight: 700;
}

.empist-a11y__icon-btn[data-empist-a11y-close] {
	margin-left: auto;
	background: #fff;
	color: var(--empist-a11y-primary);
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1;
}

.empist-a11y__icon-btn,
.empist-a11y__lang {
	min-width: 2.25rem;
	min-height: 2.25rem;
	margin: 0;
	border: 1px solid transparent;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.empist-a11y__lang { max-width: 7rem; background: #fff; color: #111; }

.empist-a11y__search {
	flex: 1 1 100%;
	min-height: 2.25rem;
	border: 0;
	border-radius: 6px;
	padding: 0.35rem 0.6rem;
	font: inherit;
}

.empist-a11y__search[hidden] { display: none; }

.empist-a11y__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	padding: 0.75rem;
}

.empist-a11y__section { margin: 0 0 0.75rem; border: 1px solid var(--empist-a11y-line); border-radius: 10px; background: #fff; }
.empist-a11y__section[hidden] { display: none; }

.empist-a11y__section-toggle {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	min-height: 2.75rem;
	margin: 0;
	padding: 0.55rem 0.75rem;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}

.empist-a11y__section-body { padding: 0 0.65rem 0.75rem; }
.empist-a11y__section-body[hidden] { display: none; }

.empist-a11y__profile {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	min-height: 2.5rem;
	margin: 0 0 0.35rem;
	padding: 0.25rem 0.2rem;
	border: 0;
	border-bottom: 1px solid #eee;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.empist-a11y__switch {
	flex: 0 0 auto;
	display: inline-flex;
	border: 1px solid #bbb;
	border-radius: 999px;
	overflow: hidden;
	font-size: 0.72rem;
	font-weight: 700;
}

.empist-a11y__switch span { padding: 0.2rem 0.45rem; }
.empist-a11y__profile[aria-checked="true"] .empist-a11y__switch-on,
.empist-a11y__profile[aria-checked="false"] .empist-a11y__switch-off { background: var(--empist-a11y-primary); color: var(--empist-a11y-on); }

.empist-a11y__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.5rem;
}

.empist-a11y__tile {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	min-height: 5.6rem;
	margin: 0;
	padding: 0.45rem;
	border: 1px solid var(--empist-a11y-line);
	border-radius: 10px;
	background: #fff;
	color: inherit;
	font: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.empist-a11y__tile[aria-pressed="true"] {
	border-color: var(--empist-a11y-primary);
	box-shadow: inset 0 0 0 1px var(--empist-a11y-primary);
}

.empist-a11y__tile[aria-pressed="true"]::after {
	content: "";
	position: absolute;
	top: 0.35rem;
	right: 0.35rem;
	width: 0.7rem;
	height: 0.4rem;
	border-left: 2px solid var(--empist-a11y-primary);
	border-bottom: 2px solid var(--empist-a11y-primary);
	transform: rotate(-45deg);
}

.empist-a11y__tile[hidden],
.empist-a11y__card[hidden],
.empist-a11y__profile[hidden] { display: none; }

.empist-a11y__card {
	margin: 0 0 0.65rem;
	padding: 0.7rem;
	border: 1px solid var(--empist-a11y-line);
	border-radius: 10px;
}

.empist-a11y__card h3 { margin: 0 0 0.45rem; font-size: 0.95rem; }

.empist-a11y__font-row,
.empist-a11y__cursor-row,
.empist-a11y__color-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: center;
}

.empist-a11y__pill {
	min-height: 2.25rem;
	margin: 0;
	padding: 0.3rem 0.7rem;
	border: 1px solid var(--empist-a11y-line);
	border-radius: 999px;
	background: #fff;
	color: inherit;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

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

.empist-a11y__range { width: 100%; margin-top: 0.55rem; }

.empist-a11y__status {
	min-height: 1.25rem;
	margin: 0.35rem 0 0;
	font-size: 0.8rem;
}

.empist-a11y__foot {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	padding: 0.7rem 0.85rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
	background: var(--empist-a11y-primary);
	color: var(--empist-a11y-on);
}

.empist-a11y__foot a,
.empist-a11y__foot button {
	color: inherit;
	font: inherit;
	font-weight: 700;
	background: transparent;
	border: 0;
	padding: 0.35rem 0;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.empist-a11y__brand { margin: 0 0 0 auto; font-size: 0.75rem; font-weight: 700; }

.empist-a11y__trigger:focus,
.empist-a11y__trigger:focus-visible,
.empist-a11y button:focus,
.empist-a11y button:focus-visible,
.empist-a11y a:focus,
.empist-a11y a:focus-visible,
.empist-a11y select:focus,
.empist-a11y input:focus {
	outline: 3px solid var(--empist-a11y-accent);
	outline-offset: 2px;
}

.empist-a11y__map,
.empist-a11y__readable {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	background: #fff;
	color: #111;
}

.empist-a11y__map[hidden],
.empist-a11y__readable[hidden] { display: none; }

.empist-a11y__map-body,
.empist-a11y__readable-body { overflow: auto; padding: 1rem; }

.empist-a11y__guide {
	position: fixed;
	z-index: 80;
	left: 0;
	right: 0;
	height: 0.45rem;
	margin-top: -0.22rem;
	background: rgb(255 214 0 / 0.85);
	pointer-events: none;
	border-radius: 4px;
}

.empist-a11y__guide[hidden] { display: none; }

.empist-a11y__tip {
	position: fixed;
	z-index: 85;
	max-width: min(24rem, 80vw);
	padding: 0.7rem 0.8rem;
	border-radius: 8px;
	background: #111;
	color: #fff;
	font-size: 1.35rem;
	line-height: 1.35;
	pointer-events: none;
}

.empist-a11y__tip[hidden] { display: none; }

.empist-a11y__toast {
	position: sticky;
	bottom: 0.5rem;
	margin: 0.5rem 1rem 0;
	padding: 0.55rem 0.75rem;
	border-radius: 0.5rem;
	background: var(--empist-a11y-primary);
	color: var(--empist-a11y-on, #fff);
	font-size: 0.875rem;
}

.empist-a11y__toast[hidden] { display: none; }

.empist-a11y__control-tip {
	margin: 0 1rem 0.75rem;
	padding: 0.55rem 0.75rem;
	border-radius: 0.5rem;
	background: #111;
	color: #fff;
	font-size: 0.8125rem;
	line-height: 1.4;
}

.empist-a11y__control-tip[hidden] { display: none; }

.empist-a11y__note {
	margin: 0.25rem 0 0.75rem;
	color: var(--empist-a11y-text);
	font-size: 0.8125rem;
	line-height: 1.4;
}

#empist-a11y-summary-note {
	margin: 0;
	padding: 0.75rem 1rem 0;
}

.empist-a11y__grid-overlay {
	position: fixed;
	z-index: 80;
	inset: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: repeat(3, 1fr);
	pointer-events: none;
}

.empist-a11y__grid-overlay[hidden] { display: none; }

.empist-a11y__grid-cell {
	display: flex;
	align-items: flex-start;
	justify-content: flex-start;
	border: 2px solid rgb(0 82 130 / 0.45);
	background: rgb(255 255 255 / 0.08);
	color: #111;
	font-size: 1.5rem;
	font-weight: 800;
	padding: 0.35rem 0.5rem;
	pointer-events: auto;
	cursor: pointer;
}

.empist-a11y__keys {
	position: fixed;
	z-index: 200;
	left: 0;
	right: 0;
	bottom: 0;
	display: grid;
	gap: 0.35rem;
	padding: 0.5rem;
	background: #1b1b1b;
	color: #fff;
}

.empist-a11y__keys[hidden] { display: none; }
.empist-a11y__keys-row { display: flex; justify-content: center; gap: 0.3rem; }
.empist-a11y__keys button {
	min-width: 2rem;
	min-height: 2.5rem;
	border: 0;
	border-radius: 6px;
	background: #fff;
	color: #111;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.empist-a11y__badge {
	position: absolute;
	z-index: 70;
	min-width: 1.25rem;
	height: 1.25rem;
	padding: 0 0.2rem;
	border-radius: 999px;
	background: #111;
	color: #fff;
	font-size: 0.75rem;
	font-weight: 800;
	line-height: 1.25rem;
	text-align: center;
	pointer-events: none;
}

html.empist-a11y-locked,
html.empist-a11y-locked body {
	overflow: hidden !important;
	overscroll-behavior: none;
}

@media (max-width: 480px) {
	.empist-a11y__panel { width: calc(100% - 2.75rem); }
	.empist-a11y__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
	.empist-a11y__panel { transition: none; }
}

html.empist-a11y-reduce-motion .empist-a11y__panel { transition: none; }

html.empist-a11y-font-0 { font-size: 80%; }
html.empist-a11y-font-1 { font-size: 90%; }
html.empist-a11y-font-3 { font-size: 112.5%; }
html.empist-a11y-font-4 { font-size: 125%; }
html.empist-a11y-font-5 { font-size: 150%; }
html.empist-a11y-font-6 { font-size: 175%; }
html.empist-a11y-font-7 { font-size: 200%; }

html.empist-a11y-mono body > :not(.empist-a11y) { filter: grayscale(1); }
html.empist-a11y-low-sat body > :not(.empist-a11y) { filter: saturate(0.4); }
html.empist-a11y-high-sat body > :not(.empist-a11y) { filter: saturate(2); }
html.empist-a11y-magnify body > :not(.empist-a11y) {
	transform: scale(1.6) !important;
	transform-origin: var(--empist-mag-x, 50%) var(--empist-mag-y, 40%);
}

html.empist-a11y-dark body { background-color: #000 !important; color: #fff !important; }
html.empist-a11y-dark body :where(p, li, td, th, dd, span, a, label, figcaption):not(.empist-a11y *):not(svg *) { color: #fff !important; }
html.empist-a11y-dark body :where(h1, h2, h3, h4, h5, h6):not(.empist-a11y *):not(svg *) { color: #ffe14a !important; }

html.empist-a11y-light body { background-color: #fff !important; color: #191970 !important; }
html.empist-a11y-light body :where(p, li, td, th, dd, span, a, label, h1, h2, h3, h4, h5, h6, figcaption):not(.empist-a11y *):not(svg *) { color: #191970 !important; }

html.empist-a11y-custom body { background-color: var(--empist-custom-bg, canvas) !important; }
html.empist-a11y-custom-text body :where(p, li, td, th, dd, span, a, label):not(.empist-a11y *):not(svg *) { color: var(--empist-custom-text) !important; }
html.empist-a11y-custom-heading body :where(h1, h2, h3, h4, h5, h6):not(.empist-a11y *):not(svg *) { color: var(--empist-custom-heading) !important; }

html.empist-a11y-readable-font body :where(p, li, a, h1, h2, h3, h4, h5, h6, td, label):not(.empist-a11y *) {
	font-family: "Segoe UI", system-ui, sans-serif !important;
}

html.empist-a11y-links body :where(main, article, [role="main"], footer) a[href]:not(.empist-a11y *) {
	outline: 3px solid #005282 !important;
	outline-offset: 2px !important;
	text-decoration: underline !important;
	background: #fff4a8 !important;
	color: #111 !important;
}

html.empist-a11y-headings body :where(h1, h2, h3, h4, h5, h6):not(.empist-a11y *) {
	outline: 3px solid #005282 !important;
	outline-offset: 3px !important;
	background: #fff4a8 !important;
	color: #111 !important;
}

html.empist-a11y-hover body :where(a, button, summary, [role="button"]):not(.empist-a11y *):hover {
	outline: 3px solid #c45c00 !important;
	background: #fff4a8 !important;
	color: #111 !important;
}

html.empist-a11y-keyboard :focus-visible {
	outline: 3px solid #005282 !important;
	outline-offset: 3px !important;
}

html.empist-a11y-big-buttons body :where(button, [role="button"], input[type="submit"], input[type="button"]):not(.empist-a11y *) {
	min-height: 2.75rem !important;
	min-width: 2.75rem !important;
	font-size: 1.05em !important;
}

html.empist-a11y-spacing body :where(main, article, [role="main"], footer) :where(p, li, dd, h1, h2, h3, h4, h5, h6):not(.empist-a11y *),
html.empist-a11y-line body :where(main, article, [role="main"], footer) :where(p, li, dd, h1, h2, h3, h4, h5, h6):not(.empist-a11y *) {
	line-height: var(--empist-line, 1.9) !important;
}

html.empist-a11y-spacing body :where(main, article, [role="main"], footer) :where(p, li, dd, h1, h2, h3, h4, h5, h6):not(.empist-a11y *),
html.empist-a11y-word body :where(main, article, [role="main"], footer) :where(p, li, dd, h1, h2, h3, h4, h5, h6):not(.empist-a11y *) {
	word-spacing: var(--empist-word, 0.16em) !important;
}

html.empist-a11y-spacing body :where(main, article, [role="main"], footer) :where(p, li, dd, h1, h2, h3, h4, h5, h6):not(.empist-a11y *),
html.empist-a11y-letter body :where(main, article, [role="main"], footer) :where(p, li, dd, h1, h2, h3, h4, h5, h6):not(.empist-a11y *) {
	letter-spacing: var(--empist-letter, 0.06em) !important;
}

.empist-a11y__targets {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin-bottom: 0.6rem;
}

html.empist-a11y-reduce-motion *,
html.empist-a11y-reduce-motion *::before,
html.empist-a11y-reduce-motion *::after {
	animation-duration: 0.001ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	scroll-behavior: auto !important;
}

html.empist-a11y-cursor-black,
html.empist-a11y-cursor-black * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M4 2 L4 26 L10 20 L16 30 L20 28 L14 18 L22 18 Z' fill='%23000' stroke='%23fff' stroke-width='1'/%3E%3C/svg%3E") 4 2, auto !important;
}

html.empist-a11y-cursor-white,
html.empist-a11y-cursor-white * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M4 2 L4 26 L10 20 L16 30 L20 28 L14 18 L22 18 Z' fill='%23fff' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E") 4 2, auto !important;
}

html.empist-a11y-read-focus .empist-a11y-dim { opacity: 0.28; }

@media (forced-colors: active) {
	.empist-a11y__panel,
	.empist-a11y__tile,
	.empist-a11y__trigger { border: 1px solid ButtonText; }
}

@media print {
	.empist-a11y { display: none !important; }
}
