/* ====================================================================
 * ACCFIN BSc — Accessibility Toolbar
 * Toolbar UI (.accfinbsc-a11y-*) + feature-effect classes (.a11y-*)
 * ================================================================== */

/* -------- OpenDyslexic font (self-hosted, only downloaded when used) -------- */
@font-face {
	font-family: 'OpenDyslexic';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('fonts/OpenDyslexic-Regular.woff2') format('woff2');
}
@font-face {
	font-family: 'OpenDyslexic';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('fonts/OpenDyslexic-Bold.woff2') format('woff2');
}

/* =========================================================================
 * TOOLBAR UI
 * ========================================================================= */

.accfinbsc-a11y-root,
.accfinbsc-a11y-root * {
	box-sizing: border-box;
}

.accfinbsc-a11y-root {
	font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	color: #111;
}

/* --- Floating Action Button (FAB), bottom-left --- */
.accfinbsc-a11y-fab {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 1000001;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 2px solid #ffffff;
	background: #0d1b4a;
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.accfinbsc-a11y-fab:hover,
.accfinbsc-a11y-fab:focus,
.accfinbsc-a11y-fab:focus-visible {
	transform: scale(1.06);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
	background: #0d1b4a;
	color: #ffffff;
	border-color: #ffffff;
}
.accfinbsc-a11y-fab:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}
.accfinbsc-a11y-fab-icon {
	width: 28px;
	height: 28px;
	color: #ffffff;
}

/* --- Backdrop --- */
.accfinbsc-a11y-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 1000002;
}
.accfinbsc-a11y-backdrop[hidden] {
	display: none;
}

/* --- Panel --- */
.accfinbsc-a11y-panel {
	position: fixed;
	bottom: 88px;
	left: 20px;
	width: min(340px, calc(100vw - 40px));
	max-height: calc(100vh - 120px);
	overflow-y: auto;
	z-index: 1000003;
	background: #ffffff;
	color: #111;
	border: 1px solid #d0d5dd;
	border-radius: 12px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
	padding: 16px;
}
.accfinbsc-a11y-panel[hidden] {
	display: none;
}

.accfinbsc-a11y-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 12px;
	padding: 0 0 10px;
	border-bottom: 1px solid #e3e6ec;
}
.accfinbsc-a11y-title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: #0d1b4a;
}
.accfinbsc-a11y-close {
	min-width: 44px;
	min-height: 44px;
	border: none;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #111;
	border-radius: 6px;
}
.accfinbsc-a11y-close:hover,
.accfinbsc-a11y-close:focus,
.accfinbsc-a11y-close:focus-visible {
	background: #f1f3f7;
	color: #111;
}
.accfinbsc-a11y-close:focus-visible {
	outline: 2px solid #0d1b4a;
	outline-offset: 2px;
}

.accfinbsc-a11y-group {
	border: 0;
	margin: 0 0 14px;
	padding: 0;
}
.accfinbsc-a11y-group > legend {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #4a5365;
	padding: 0;
	margin-bottom: 6px;
}
.accfinbsc-a11y-group--toggles {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.accfinbsc-a11y-row {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.accfinbsc-a11y-row--steps {
	align-items: center;
}
.accfinbsc-a11y-row--steps .accfinbsc-a11y-btn {
	flex: 1 1 auto;
}
.accfinbsc-a11y-row--contrast {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 6px;
}

.accfinbsc-a11y-font-display {
	min-width: 36px;
	text-align: center;
	font-weight: 700;
	font-size: 15px;
	color: #0d1b4a;
}

.accfinbsc-a11y-btn {
	min-height: 44px;
	padding: 8px 12px;
	background: #ffffff;
	color: #111;
	border: 2px solid #c7cdd8;
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}
.accfinbsc-a11y-btn:hover,
.accfinbsc-a11y-btn:focus,
.accfinbsc-a11y-btn:focus-visible {
	border-color: #0d1b4a;
	background: #f4f6fb;
	color: #111;
}
.accfinbsc-a11y-btn:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}
.accfinbsc-a11y-btn[aria-pressed="true"],
.accfinbsc-a11y-btn[aria-pressed="true"]:hover,
.accfinbsc-a11y-btn[aria-pressed="true"]:focus,
.accfinbsc-a11y-btn[aria-pressed="true"]:focus-visible,
.accfinbsc-a11y-btn[aria-checked="true"],
.accfinbsc-a11y-btn[aria-checked="true"]:hover,
.accfinbsc-a11y-btn[aria-checked="true"]:focus,
.accfinbsc-a11y-btn[aria-checked="true"]:focus-visible {
	background: #0d1b4a;
	border-color: #0d1b4a;
	color: #ffffff;
}
.accfinbsc-a11y-btn--secondary {
	background: #f4f6fb;
}
.accfinbsc-a11y-btn--toggle {
	text-align: left;
}
.accfinbsc-a11y-btn--toggle::before {
	content: "○";
	display: inline-block;
	width: 1.2em;
	color: #7a8397;
	font-size: 18px;
	line-height: 1;
	vertical-align: middle;
}
.accfinbsc-a11y-btn--toggle[aria-pressed="true"]::before {
	content: "●";
	color: #ffffff;
}
.accfinbsc-a11y-btn--reset {
	width: 100%;
	background: #fff2f2;
	border-color: #e28c8c;
	color: #8a1f1f;
}
.accfinbsc-a11y-btn--reset:hover,
.accfinbsc-a11y-btn--reset:focus,
.accfinbsc-a11y-btn--reset:focus-visible {
	background: #ffe3e3;
	border-color: #8a1f1f;
	color: #8a1f1f;
}

.accfinbsc-a11y-panel-footer {
	margin-top: 14px;
	padding-top: 10px;
	border-top: 1px solid #e3e6ec;
}

/* --- Reading guide --- */
.accfinbsc-a11y-reading-guide {
	position: fixed;
	left: 0;
	right: 0;
	height: 40px;
	background: rgba(255, 235, 59, 0.25);
	border-top: 2px solid rgba(0, 0, 0, 0.6);
	border-bottom: 2px solid rgba(0, 0, 0, 0.6);
	pointer-events: none;
	z-index: 1000000;
}
.accfinbsc-a11y-reading-guide[hidden] {
	display: none;
}

/* =========================================================================
 * FEATURE EFFECTS — body-class based overrides
 * Anchored on html.a11y-* for maximum specificity over mu-plugin inline CSS.
 * ========================================================================= */

/* --- Font size scaling (affects rem-based typography) --- */
html.a11y-font-small-1 { font-size: 93.75% !important; }
html.a11y-font-large-1 { font-size: 112.5% !important; }
html.a11y-font-large-2 { font-size: 125%   !important; }
html.a11y-font-large-3 { font-size: 137.5% !important; }

/* --- Contrast: DARK --- */
body.a11y-contrast-dark,
body.a11y-contrast-dark #page,
body.a11y-contrast-dark main,
body.a11y-contrast-dark .ast-container,
body.a11y-contrast-dark .elementor-section,
body.a11y-contrast-dark .e-con,
body.a11y-contrast-dark .entry-content {
	background: #000 !important;
	color: #fff !important;
}
body.a11y-contrast-dark *:not(.accfinbsc-a11y-root):not(.accfinbsc-a11y-root *) {
	background-color: transparent !important;
	color: #fff !important;
	border-color: #fff !important;
}
body.a11y-contrast-dark a,
body.a11y-contrast-dark a:visited {
	color: #ffeb3b !important;
	text-decoration: underline !important;
}
body.a11y-contrast-dark button:not(.accfinbsc-a11y-btn):not(.accfinbsc-a11y-fab):not(.accfinbsc-a11y-close),
body.a11y-contrast-dark input,
body.a11y-contrast-dark select,
body.a11y-contrast-dark textarea {
	background-color: #000 !important;
	color: #fff !important;
	border: 2px solid #fff !important;
}
/* Keep toolbar in its own palette */
body.a11y-contrast-dark .accfinbsc-a11y-root,
body.a11y-contrast-dark .accfinbsc-a11y-root * {
	background-color: unset;
	color: unset;
	border-color: unset;
}

/* --- Contrast: LIGHT (pure black on pure white) --- */
body.a11y-contrast-light,
body.a11y-contrast-light #page,
body.a11y-contrast-light main,
body.a11y-contrast-light .ast-container,
body.a11y-contrast-light .elementor-section,
body.a11y-contrast-light .e-con,
body.a11y-contrast-light .entry-content {
	background: #fff !important;
	color: #000 !important;
}
body.a11y-contrast-light *:not(.accfinbsc-a11y-root):not(.accfinbsc-a11y-root *) {
	background-color: #fff !important;
	color: #000 !important;
	border-color: #000 !important;
}
body.a11y-contrast-light a,
body.a11y-contrast-light a:visited {
	color: #0000ee !important;
	text-decoration: underline !important;
}
body.a11y-contrast-light .accfinbsc-a11y-root,
body.a11y-contrast-light .accfinbsc-a11y-root * {
	background-color: unset;
	color: unset;
	border-color: unset;
}

/* --- Contrast: INVERTED (CSS filter on <html>) --- */
html.a11y-contrast-inverted {
	filter: invert(1) hue-rotate(180deg);
	background: #fff;
}
/* Counter-invert media so images aren't flipped to negatives */
html.a11y-contrast-inverted img,
html.a11y-contrast-inverted video,
html.a11y-contrast-inverted iframe,
html.a11y-contrast-inverted svg:not(.accfinbsc-a11y-fab-icon),
html.a11y-contrast-inverted [style*="background-image"] {
	filter: invert(1) hue-rotate(180deg);
}
/* Keep the toolbar visually normal by counter-inverting it */
html.a11y-contrast-inverted .accfinbsc-a11y-root {
	filter: invert(1) hue-rotate(180deg);
}

/* --- Dyslexia-friendly font --- */
html.a11y-dyslexia,
html.a11y-dyslexia * {
	font-family: 'OpenDyslexic', 'Comic Sans MS', Verdana, sans-serif !important;
	letter-spacing: 0.03em !important;
	word-spacing: 0.12em !important;
	line-height: 1.6 !important;
}
/* Don't warp our own UI */
html.a11y-dyslexia .accfinbsc-a11y-root,
html.a11y-dyslexia .accfinbsc-a11y-root * {
	font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	line-height: 1.4 !important;
}

/* --- Pause animations --- */
html.a11y-pause-animations *,
html.a11y-pause-animations *::before,
html.a11y-pause-animations *::after {
	animation-duration: 0s !important;
	animation-delay: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0s !important;
	transition-delay: 0s !important;
	scroll-behavior: auto !important;
}
/* Homepage-redesign mu-plugin uses `hp-*` classes with inline keyframes */
html.a11y-pause-animations [class*="hp-"],
html.a11y-pause-animations [class^="hp-"] {
	animation: none !important;
	transition: none !important;
}

/* --- Highlight links --- */
html.a11y-highlight-links a,
html.a11y-highlight-links a:visited {
	text-decoration: underline solid 2px !important;
	text-underline-offset: 3px !important;
	font-weight: 700 !important;
	outline: 2px dashed currentColor !important;
	outline-offset: 2px !important;
}
/* Don't outline the toolbar's internal links/buttons */
html.a11y-highlight-links .accfinbsc-a11y-root a,
html.a11y-highlight-links .accfinbsc-a11y-root button {
	outline: none !important;
	text-decoration: none !important;
	font-weight: inherit !important;
}

/* --- Larger cursor --- */
html.a11y-big-cursor,
html.a11y-big-cursor * {
	cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='black' stroke='white' stroke-width='1.5' stroke-linejoin='round' d='M4 2 L4 22 L9 17 L12 22 L15 20.5 L12 14.5 L18 14.5 Z'/></svg>") 2 2, auto !important;
}
html.a11y-big-cursor a,
html.a11y-big-cursor button,
html.a11y-big-cursor [role="button"] {
	cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='black' stroke='white' stroke-width='1.5' stroke-linejoin='round' d='M8 2 L8 14 L5 13 L5 18 L9 22 L18 22 L18 13 L16 13 L16 10 L14 10 L14 8 L12 8 L12 6 L10 6 L10 4 L8 4 Z'/></svg>") 8 2, pointer !important;
}

/* --- Reading guide visibility --- */
html.a11y-reading-guide .accfinbsc-a11y-reading-guide {
	display: block;
}

/* =========================================================================
 * OS-preference defaults (applied regardless of toolbar state)
 * ========================================================================= */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

@media (prefers-contrast: more) {
	body {
		color: #000 !important;
		background: #fff !important;
	}
	a {
		text-decoration: underline !important;
	}
}

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

/* Small screens — keep FAB visible but nudge panel to fit better */
@media (max-width: 480px) {
	.accfinbsc-a11y-panel {
		left: 10px;
		right: 10px;
		width: auto;
		bottom: 84px;
	}
	.accfinbsc-a11y-fab {
		left: 14px;
		bottom: 14px;
	}
}
