/**
 * Altback
 * Accessibility toolbar (js/accessibility.js) and the display modes it switches on.
 * Same toolbar as NewMetro, restyled with the Altback colours.
 */

.nm-a11y {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 50;
	font-family: var(--sans);
}

.nm-a11y .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;
}

.nm-a11y__toggle {
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	background: var(--teal);
	border: 1px solid rgba(216, 193, 148, 0.35);
	border-radius: 50%;
	color: var(--on-dark);
	font-family: var(--serif);
	font-size: 1.15rem;
	box-shadow: 0 12px 28px -12px rgba(17, 29, 31, 0.55);
	cursor: pointer;
	transition: transform 0.3s var(--ease-out);
}

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

.nm-a11y__panel {
	position: absolute;
	right: 0;
	bottom: 3.75rem;
	width: 15rem;
	padding: 1rem;
	background: var(--paper);
	border: 1px solid var(--hair-light);
	border-radius: 1rem;
	box-shadow: 0 24px 48px -24px rgba(17, 29, 31, 0.45);
	transform-origin: bottom right;
}

.nm-a11y__panel:not([hidden]) { animation: nm-a11y-in 0.18s 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: 0.65rem;
	font-size: 0.7rem;
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--gold-deep);
}

.nm-a11y__panel button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 2.75rem;
	margin-bottom: 0.4rem;
	padding: 0 0.85rem;
	background: var(--paper);
	border: 1px solid var(--hair-light);
	border-radius: 999px;
	color: var(--text);
	font-family: var(--sans);
	font-size: 0.95rem;
	text-align: left;
	cursor: pointer;
}

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

.nm-a11y__panel button[aria-pressed="true"]::after {
	content: "On";
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--gold-soft);
}

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

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

/* Tablets: sit above the bottom action bar. */
@media (max-width: 767px) {
	.nm-a11y { bottom: calc(5rem + env(safe-area-inset-bottom)); }
	.nm-a11y__panel { width: min(16rem, calc(100vw - 2rem)); }
}

/* 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: 1.5rem;
}

.nm-a11y--docked .nm-a11y__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	width: auto;
	height: 2.75rem;
	padding: 0 1.1rem;
	background: transparent;
	border-color: var(--hair-dark);
	border-radius: 999px;
	color: var(--on-dark);
	font-family: var(--sans);
	font-size: 0.95rem;
	box-shadow: none;
}

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

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

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


/* Larger text */

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

/* Larger text on desktop: the bar can't fit the links any more, so use the menu button instead (as on smaller screens) */
html.a11y-large-text .nav-links,
html.a11y-large-text #mega-menu-wrap-primary, /* WordPress: Max Mega Menu desktop bar */
html.a11y-large-text .mega,
html.a11y-large-text .nav-phone { display: none; }
html.a11y-large-text .nav-logo { margin-right: auto; }


/* High contrast: light areas turn pure white with black text, dark areas pure black with white text, gold turns bright yellow. */

html.a11y-high-contrast {
	--ink: #000;
	--teal: #000;
	--teal-2: #000;
	--teal-3: #000;
	--cream: #fff;
	--paper: #fff;
	--stone: #fff;
	--sand: #fff;
	--text: #000;
	--muted: #000;
	--gold: #ffd400;
	--gold-soft: #ffd400;
	--gold-deep: #000;
	--gold-head: #000;
	--on-dark: #fff;
	--on-dark-muted: #fff;
	--hair-dark: #fff;
	--hair-light: #000;
}

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;
	text-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;
	background-color: color-mix(in srgb, var(--gold-soft) 35%, transparent);
}


/* Reduce motion (also stops the scroll-in fades) */

html.a11y-reduce-motion { scroll-behavior: auto; }

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;
	transition-delay: 0s !important;
}

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