/**
 * NewMetro
 * Accessibility toolbar and the display modes it switches on.
 */

.nm-a11y {
	position: fixed;
	right: 24px;
	bottom: 84px;
	z-index: 60;
	font-family: var(--sans);
}

.nm-a11y__toggle {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	background: var(--paper);
	border: 1px solid var(--mist-deep);
	border-radius: 50%;
	color: var(--fascia);
	font-family: var(--serif);
	font-size: 1.0625rem;
	box-shadow: 0 12px 24px -12px rgba(12, 39, 31, 0.35);
	cursor: pointer;
	transition: transform 160ms var(--ease-out);
}

.nm-a11y__toggle:active {
	transform: scale(0.97);
}

.nm-a11y__panel {
	position: absolute;
	right: 0;
	bottom: 60px;
	width: 240px;
	padding: 16px;
	background: var(--paper);
	border: 1px solid var(--mist-deep);
	border-radius: 8px;
	box-shadow: 0 24px 48px -24px rgba(12, 39, 31, 0.4);
	transform-origin: bottom right;
}

.nm-a11y__panel:not([hidden]) {
	animation: nm-a11y-in 160ms var(--ease-out);
}

@keyframes nm-a11y-in {
	from { opacity: 0; transform: scale(0.97); }
	to   { opacity: 1; transform: none; }
}

.nm-a11y__title {
	display: block;
	margin-bottom: 10px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ink);
}

.nm-a11y__panel button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 44px;
	margin-bottom: 6px;
	padding: 0 12px;
	background: var(--paper);
	border: 1px solid var(--mist-deep);
	border-radius: var(--radius);
	color: var(--ink);
	font-size: 0.9375rem;
	text-align: left;
	cursor: pointer;
}

.nm-a11y__panel button[aria-pressed="true"] {
	background: var(--fascia);
	border-color: var(--fascia);
	color: var(--on-fascia);
}

.nm-a11y__panel button[aria-pressed="true"]::after {
	content: "On";
	font-size: 0.8125rem;
	font-weight: 600;
}

.nm-a11y__panel .nm-a11y__reset {
	margin: 10px 0 0;
	justify-content: center;
	border-style: dashed;
}

@media (hover: hover) and (pointer: fine) {
	.nm-a11y__panel button:hover { border-color: var(--fascia); }
}

/* Phones: docked in the footer (accessibility.js), a labelled button in the footer's colours. */
.nm-a11y.nm-a11y--docked {
	position: relative;
	right: auto;
	bottom: auto;
	z-index: auto;
	margin-top: 24px;
}

.nm-a11y--docked .nm-a11y__toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	width: auto;
	height: 44px;
	padding: 0 18px;
	background: transparent;
	border-color: var(--fascia-line);
	border-radius: 22px;
	color: var(--on-fascia);
	font-family: var(--sans);
	font-size: 0.9375rem;
	font-weight: 600;
	box-shadow: none;
}

.nm-a11y--docked .nm-a11y__toggle [aria-hidden] {
	font-family: var(--serif);
	font-weight: 400;
}

.nm-a11y--docked .nm-a11y__toggle .screen-reader-text {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	overflow: visible;
	clip: auto;
	clip-path: none;
	white-space: nowrap;
}

.nm-a11y--docked .nm-a11y__panel {
	right: auto;
	left: 0;
	bottom: 56px;
	transform-origin: bottom left;
}

@media (max-width: 640px) {
	.nm-a11y {
		right: 16px;
		bottom: 80px;
	}

	.nm-a11y__panel {
		width: min(260px, calc(100vw - 32px));
	}
}


/* ==========================
   Larger text
========================== */

html.a11y-large-text {
	font-size: 118%;
}


/* ==========================
   High contrast
   The whole theme runs on tokens, so inverting them turns every block
   to white-on-black, with white bands carrying black lettering.
========================== */

html.a11y-high-contrast {
	--ground: #000;
	--paper: #000;
	--ink: #fff;
	--ink-soft: #fff;
	--mist: #fff;
	--mist-deep: #fff;
	--fascia: #fff;
	--fascia-deep: #fff;
	--fascia-lift: #fff;
	--fascia-line: #000;
	--on-fascia: #000;
	--on-fascia-soft: #000;
	--gold: #FFD400;
	--gold-hover: #fff;
}

html.a11y-high-contrast :where(.btn--gold) {
	outline: 2px solid #000;
	outline-offset: -4px;
}

html.a11y-high-contrast a:not(.btn) {
	text-decoration: underline;
	text-decoration-thickness: 2px;
}

html.a11y-high-contrast *,
html.a11y-high-contrast *::before,
html.a11y-high-contrast *::after {
	box-shadow: none !important;
}


/* ==========================
   Highlight links
========================== */

html.a11y-highlight-links a:not(.btn) {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 3px !important;
}

html.a11y-highlight-links a:not(.btn) {
	background-color: color-mix(in srgb, var(--gold) 28%, transparent);
}


/* ==========================
   Reduced motion
========================== */

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

@media (prefers-reduced-motion: reduce) {
	.nm-a11y__panel:not([hidden]) { animation: none; }
	.nm-a11y__toggle:active { transform: none; }
}
