html.oeds-a11y-invert {
	filter: invert(1);
}

html.oeds-a11y-invert .oeds-a11y {
	filter: invert(1);
}

html.oeds-a11y-mono {
	filter: grayscale(1);
}

html.oeds-a11y-lowsat {
	filter: saturate(.5);
}

html.oeds-a11y-highsat {
	filter: saturate(2);
}

html.oeds-a11y-links a[href]:where(:not(.oeds-a11y, .oeds-a11y *)) {
	outline: 2px solid #d82127 !important;
	outline-offset: 2px !important;
}

/* The highlight must not hide the keyboard focus: the focused link gets a thicker navy ring with a white halo. */
html.oeds-a11y-links a[href]:focus-visible:where(:not(.oeds-a11y, .oeds-a11y *)) {
	outline: 3px solid #2e388d !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 6px #fff !important;
}

html.oeds-a11y-headings :is(h1, h2, h3, h4, h5, h6):where(:not(.oeds-a11y, .oeds-a11y *)) {
	outline: 2px dashed #2e388d !important;
	outline-offset: 3px !important;
}

html :is(body, body *).oeds-a11y-speaking:not(.oeds-a11y, .oeds-a11y *) {
	outline: 3px solid #d82127 !important;
	outline-offset: 2px !important;
}

/* px, never rem: a theme may set `html { font-size: 0 }` (ancilab.it does, at every breakpoint), and 42rem became 0 px. */
html.oeds-a11y-read body:not(.oeds-a11y, .oeds-a11y *) {
	display: block !important;
	box-sizing: border-box !important;
	width: auto !important;
	max-width: 680px !important;
	margin: 0 auto !important;
	padding: 32px 20px !important;
	background: #fff !important;
	color: #1a1a1a !important;
	font-size: 18px !important;
	line-height: 1.6 !important;
}

html.oeds-a11y-read body :not(.oeds-a11y, .oeds-a11y *):not(:where(
	[class*=screen-reader], [class*=screen-reader] *,
	[class*=sr-only], [class*=sr-only] *,
	[class*=visually-hidden], [class*=visually-hidden] *
)) {
	position: static !important;
	float: none !important;
	width: auto !important;
	max-width: 100% !important;
	min-width: 0 !important;
	height: auto !important;
	min-height: 0 !important;
	transform: none !important;
	columns: auto !important;
	background: transparent !important;
	box-shadow: none !important;
	/* One column of dark text: a theme's white titles over pictures would be white on white here (ancilab.it's home
	   tiles), and its layout padding, negative grid margins and aspect-ratio boxes would leave empty bands. */
	color: #1a1a1a !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding: 0 !important;
	aspect-ratio: auto !important;
}

html.oeds-a11y-read body :is(ul, ol):not(.oeds-a11y, .oeds-a11y *) {
	padding-left: 24px !important;
}

/* Rows and grids become one column without touching `display`, so whatever the page hides or shows later (an
   accordion, a menu) keeps working: the properties below change nothing on elements that are not flex or grid. */
html.oeds-a11y-read body :not(.oeds-a11y, .oeds-a11y *) {
	flex-direction: column !important;
	flex-wrap: nowrap !important;
	grid-template-columns: minmax(0, 1fr) !important;
	grid-auto-flow: row !important;
	grid-column: auto !important;
	grid-row: auto !important;
}

html.oeds-a11y-read :is(
	nav, header, footer, aside, iframe, canvas, video, audio, img, picture, svg, form,
	[role=navigation], [role=banner], [role=contentinfo], [role=complementary]
):not(.oeds-a11y, .oeds-a11y *) {
	display: none !important;
}

html.oeds-a11y-read a:not(.oeds-a11y, .oeds-a11y *) {
	color: #2e388d !important;
	text-decoration: underline !important;
}

/* Contrast follows read mode so that both modes can be used together. */
html.oeds-a11y-dark {
	--oeds-a11y-background: #000;
	--oeds-a11y-foreground: #fff;
	--oeds-a11y-heading: #50d0a0;
	--oeds-a11y-link: #fcff3c;
}

html.oeds-a11y-light {
	--oeds-a11y-background: #fff;
	--oeds-a11y-foreground: #000;
	--oeds-a11y-heading: #2e388d;
	--oeds-a11y-link: #2e388d;
}

html:is(.oeds-a11y-dark, .oeds-a11y-light),
html:is(.oeds-a11y-dark, .oeds-a11y-light) body:not(.oeds-a11y, .oeds-a11y *),
html:is(.oeds-a11y-dark, .oeds-a11y-light) body :not(.oeds-a11y, .oeds-a11y *) {
	background-color: var(--oeds-a11y-background) !important;
	background-image: none !important;
	color: var(--oeds-a11y-foreground) !important;
	border-color: var(--oeds-a11y-foreground) !important;
	box-shadow: none !important;
	text-shadow: none !important;
}

/* An empty element keeps a transparent background: painted, a theme's empty full-cover link (a card's click area) hid the
   card's title and icon under a solid plate (measured on ancilab.it's home: 5 of 6 tile titles at 1440). */
html:is(.oeds-a11y-dark, .oeds-a11y-light) body :empty:not(.oeds-a11y, .oeds-a11y *) {
	background-color: transparent !important;
}

html:is(.oeds-a11y-dark, .oeds-a11y-light) body :is(h1, h2, h3, h4, h5, h6):not(.oeds-a11y, .oeds-a11y *) {
	color: var(--oeds-a11y-heading) !important;
}

html:is(.oeds-a11y-dark, .oeds-a11y-light) body a:not(.oeds-a11y, .oeds-a11y *) {
	color: var(--oeds-a11y-link) !important;
	text-decoration: underline !important;
}

html:is(.oeds-a11y-dark, .oeds-a11y-light) body :is(button, input[type=button], input[type=submit]):not(.oeds-a11y, .oeds-a11y *) {
	background-color: var(--oeds-a11y-foreground) !important;
	color: var(--oeds-a11y-background) !important;
}

/* Text nested inside a heading, a link or a button (`<a><span>…</span></a>`) takes its parent's colour, not the blanket
   one: without these, dark contrast showed such links white instead of yellow, and a button's label black on black. */
html:is(.oeds-a11y-dark, .oeds-a11y-light) body :is(h1, h2, h3, h4, h5, h6) :not(.oeds-a11y, .oeds-a11y *) {
	color: var(--oeds-a11y-heading) !important;
}

html:is(.oeds-a11y-dark, .oeds-a11y-light) body a :not(.oeds-a11y, .oeds-a11y *) {
	color: var(--oeds-a11y-link) !important;
}

html:is(.oeds-a11y-dark, .oeds-a11y-light) body :is(button, input[type=button], input[type=submit]) :not(.oeds-a11y, .oeds-a11y *) {
	background-color: transparent !important;
	color: var(--oeds-a11y-background) !important;
}

html.oeds-a11y-zoom body > :not(.oeds-a11y, .oeds-a11y *) {
	zoom: var(--oeds-a11y-zoom);
}

.oeds-a11y,
.oeds-a11y * {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font-family: "Barlow", system-ui, sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}

.oeds-a11y {
	--oeds-a11y-navy: #2e388d;
	--oeds-a11y-control: #3a459d;
	--oeds-a11y-red: #d82127;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	color: #fff;
}

.oeds-a11y [hidden] {
	display: none !important;
}

/* The container is fixed and has no in-flow content, so it is 0 px wide: a theme's `button { max-width: 100% }` would
   squeeze every control to its border (measured on ancilab.it: the open button 2 px wide). */
.oeds-a11y button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	max-width: none;
	min-height: 0;
	border: 0;
	border-radius: 6px;
	background: var(--oeds-a11y-control);
	color: #fff;
	box-shadow: none;
	cursor: pointer;
}

.oeds-a11y button:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--oeds-a11y-red);
}

.oeds-a11y svg {
	display: block;
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	pointer-events: none;
}

.oeds-a11y .oeds-a11y__open,
.oeds-a11y .oeds-a11y__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	background: var(--oeds-a11y-navy);
	color: #fff;
}

.oeds-a11y .oeds-a11y__open {
	width: 48px;
	height: 48px;
	border: 1px solid #fff;
	border-radius: 50%;
}

.oeds-a11y .oeds-a11y__panel {
	z-index: 1;
	width: 440px;
	max-width: calc(100vw - 40px);
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	overflow: auto;
	overscroll-behavior: contain;
	padding: 16px;
	border-radius: 12px;
}

.oeds-a11y .oeds-a11y__head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 40px 40px;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
}

.oeds-a11y .oeds-a11y__title {
	color: #fff;
	font-size: 20px;
	font-weight: 700;
}

.oeds-a11y .oeds-a11y__head button,
.oeds-a11y .oeds-a11y__stepper button {
	width: 40px;
	height: 40px;
}

.oeds-a11y ul,
.oeds-a11y li {
	list-style: none;
}

.oeds-a11y .oeds-a11y__toggles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin-bottom: 16px;
}

.oeds-a11y .oeds-a11y__toggle {
	justify-content: flex-start;
	gap: 8px;
	width: 100%;
	height: 100%;
	min-height: 48px;
	padding: 8px 10px;
	text-align: left;
}

.oeds-a11y .oeds-a11y__toggle[aria-pressed=true] {
	background: var(--oeds-a11y-red);
}

.oeds-a11y .oeds-a11y__steppers {
	display: grid;
	gap: 8px;
}

.oeds-a11y .oeds-a11y__stepper {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto 40px 40px;
	align-items: center;
	gap: 8px;
}

.oeds-a11y output {
	min-width: 46px;
	color: #fff;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.oeds-a11y button[aria-disabled=true] {
	background: #252e75;
	color: #dddfff;
	cursor: default;
}

@media (max-width: 480px) {
	.oeds-a11y .oeds-a11y__panel {
		width: calc(100vw - 40px);
	}

	.oeds-a11y .oeds-a11y__toggle {
		flex-direction: column;
		justify-content: center;
		text-align: center;
		overflow-wrap: anywhere;
	}
}

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