/* CS Accessibility Preferences
   Themes adjust these through the documented hooks (readme): --cs-a11y-font-scale and html[data-cs-*]. */

/* ---- Button --------------------------------------------------------------------------------- */
.cs-a11y-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	min-width: 44px;
	min-height: 44px;
	padding: 0.5em 0.9em;
	border: 2px solid #fff;
	border-radius: 999px;
	background: #1a1a1a;
	color: #fff;
	font: 600 1rem/1.2 system-ui, sans-serif;
	cursor: pointer;
}
.cs-a11y-button:hover { background: #000; }
.cs-a11y-button:focus-visible { outline: 3px solid #1a1a1a; outline-offset: 3px; box-shadow: 0 0 0 3px #fff; }
.cs-a11y-button__icon { flex: none; width: 1.5em; height: 1.5em; }
.cs-a11y-button--corner { position: fixed; z-index: 99990; bottom: 1rem; }
.cs-a11y-button--bottom-right { right: 1rem; }
.cs-a11y-button--bottom-left { left: 1rem; }
@media print { .cs-a11y-button { display: none; } }

/* ---- Dialog --------------------------------------------------------------------------------- */
.cs-a11y-dialog {
	box-sizing: border-box;
	width: min(28rem, calc(100vw - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 1.25rem 1.5rem 1.5rem;
	border: 2px solid #1a1a1a;
	border-radius: 12px;
	background: #fff;
	color: #1a1a1a;
	font: 400 1rem/1.5 system-ui, sans-serif;
	letter-spacing: normal;
	word-spacing: normal;
	overflow: auto;
}
.cs-a11y-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.cs-a11y-dialog *, .cs-a11y-dialog *::before { box-sizing: border-box; }
.cs-a11y-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cs-a11y-dialog__title { margin: 0; font: 700 1.25rem/1.3 system-ui, sans-serif; color: inherit; }
.cs-a11y-dialog__close {
	flex: none;
	width: 44px;
	height: 44px;
	border: 2px solid currentColor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}
.cs-a11y-dialog__intro { margin: 0.5rem 0 1rem; font-size: 0.9375rem; }
.cs-a11y-dialog fieldset { margin: 0 0 1rem; padding: 0; border: 0; }
.cs-a11y-dialog legend { padding: 0; margin-bottom: 0.5rem; font-weight: 700; }
.cs-a11y-choice { display: inline-flex; align-items: center; gap: 0.4em; min-height: 44px; margin-right: 1rem; cursor: pointer; }
/* Native controls whatever the theme does to inputs (themes often restyle every checkbox and radio). */
.cs-a11y-dialog input[type="checkbox"],
.cs-a11y-dialog input[type="radio"] {
	all: revert;
	flex: none;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	accent-color: #1a1a1a;
	cursor: pointer;
}
.cs-a11y-dialog .cs-a11y-switch input { order: 2; } /* after "all: revert", which resets order */
.cs-a11y-dialog input[type="checkbox"]::before,
.cs-a11y-dialog input[type="checkbox"]::after,
.cs-a11y-dialog input[type="radio"]::before,
.cs-a11y-dialog input[type="radio"]::after { content: none !important; display: none !important; }
.cs-a11y-switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 44px; border-top: 1px solid #ccc; cursor: pointer; font-weight: 600; }

.cs-a11y-dialog__actions { margin: 1rem 0 0; }
.cs-a11y-dialog__reset {
	min-height: 44px;
	padding: 0.5em 1em;
	border: 2px solid #1a1a1a;
	border-radius: 999px;
	background: #fff;
	color: #1a1a1a;
	font: 600 1rem/1.2 system-ui, sans-serif;
	cursor: pointer;
}
.cs-a11y-dialog__statement { margin: 1rem 0 0; }
.cs-a11y-dialog a { color: inherit; text-decoration: underline; }
.cs-a11y-dialog :focus-visible { outline: 3px solid #1a1a1a; outline-offset: 2px; }
.cs-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;
}

/* ---- Options -------------------------------------------------------------------------------- */

/* Text size. For themes that leave the root size alone; themes that set html { font-size } should
   multiply it by var(--cs-a11y-font-scale, 1) themselves (zero specificity here, so theirs wins). */
:where(html[data-cs-text]) { font-size: calc(100% * var(--cs-a11y-font-scale, 1)); }

/* Reduce motion: no CSS animation or transition, no smooth scrolling. Themes also listen for the
   cs-a11y:motion event to pause JavaScript carousels and animations. */
html[data-cs-motion="reduce"] *,
html[data-cs-motion="reduce"] *::before,
html[data-cs-motion="reduce"] *::after {
	animation-duration: 0.01ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.01ms !important;
	scroll-behavior: auto !important;
}

/* Underline all links */
html[data-cs-links="underline"] a:not(.cs-a11y-dialog *) {
	text-decoration-line: underline !important;
	text-decoration-thickness: max(1px, 0.0625em);
	text-underline-offset: 0.15em;
}

/* Text spacing, WCAG 1.4.12 values */
html[data-cs-spacing="increased"] body *:not(.cs-a11y-dialog, .cs-a11y-dialog *) {
	line-height: 1.5 !important;
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}
html[data-cs-spacing="increased"] body p:not(.cs-a11y-dialog *) { margin-bottom: 2em !important; }

/* High contrast: the theme supplies the colours (see readme); a strong focus ring everywhere. */
html[data-cs-contrast="high"] :focus-visible { outline: 3px solid currentColor !important; outline-offset: 3px !important; }

/* Readable font: Atkinson Hyperlegible (SIL OFL 1.1), served from the plugin. Downloaded only when used. */
@font-face {
	font-family: "Atkinson Hyperlegible";
	src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Atkinson Hyperlegible";
	src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}
html[data-cs-font="readable"] body,
html[data-cs-font="readable"] body *:not(svg, svg *, [class*="icon"], .cs-a11y-dialog *) {
	font-family: "Atkinson Hyperlegible", system-ui, sans-serif !important;
}
