/*!
 * AccesRO – Bară de accesibilitate
 * Version: 1.0.0
 * License: GPLv2 or later
 */

/* ------------------------------------------------------------------ *
 * Fontul OpenDyslexic (inclus local; licență SIL OFL)
 * ------------------------------------------------------------------ */

@font-face {
	font-family: 'OpenDyslexic';
	src: url('fonts/opendyslexic-regular.woff') format('woff');
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'OpenDyslexic';
	src: url('fonts/opendyslexic-bold.woff') format('woff');
	font-weight: bold;
	font-style: normal;
	font-display: swap;
}

/* ------------------------------------------------------------------ *
 * Butonul plutitor + panoul
 * ------------------------------------------------------------------ */

#accesro {
	--acr-blue: #002b7f;      /* albastrul drapelului României */
	--acr-blue-dark: #001f5c;
	--acr-yellow: #fcd116;
	--acr-focus: #ff8c00;
	position: fixed;
	top: 40%;
	z-index: 2147483000;
	font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
	text-align: left;
}

#accesro.acr-pos-right { right: 16px; }
#accesro.acr-pos-left  { left: 16px; }

#accesro-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--acr-blue);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
	padding: 0;
}

#accesro-toggle:hover { background: var(--acr-blue-dark); }

#accesro-toggle:focus-visible,
#accesro-panel .acr-item:focus-visible,
#accesro-skip:focus-visible {
	outline: 3px solid var(--acr-focus);
	outline-offset: 2px;
}

#accesro-panel {
	position: absolute;
	top: 0;
	width: 300px;
	background: #fff;
	border: 1px solid var(--acr-blue);
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

#accesro.acr-pos-right #accesro-panel { right: 62px; }
#accesro.acr-pos-left  #accesro-panel { left: 62px; }

.acr-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--acr-blue);
	color: #fff;
	padding: 10px 14px;
	font-weight: 700;
}

.acr-font-level {
	background: rgba(255, 255, 255, 0.18);
	border-radius: 5px;
	padding: 1px 8px;
	font-size: 13px;
	font-weight: 400;
}

.acr-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	padding: 10px;
	max-height: 60vh;
	overflow-y: auto;
}

#accesro-panel .acr-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	padding: 9px 10px;
	border: 1px solid #ccd3e0;
	border-radius: 7px;
	background: #f6f8fb;
	color: #1a2233;
	font: inherit;
	font-size: 13.5px;
	cursor: pointer;
	text-align: left;
}

#accesro-panel .acr-item:hover { border-color: var(--acr-blue); background: #eef2f9; }

#accesro-panel .acr-item.acr-on {
	background: var(--acr-blue);
	border-color: var(--acr-blue);
	color: #fff;
	font-weight: 600;
}

#accesro-panel .acr-reset {
	grid-column: 1 / -1;
	justify-content: center;
	background: #fff2f2;
	border-color: #d9a0a0;
	color: #8a1f1f;
	font-weight: 600;
}

#accesro-panel .acr-reset:hover { background: #ffe5e5; border-color: #8a1f1f; }

.acr-foot {
	display: flex;
	flex-direction: column;
	gap: 3px;
	padding: 9px 14px;
	background: #f0f3f8;
	border-top: 1px solid #dde3ee;
	font-size: 13px;
}

.acr-foot a { color: var(--acr-blue); font-weight: 600; text-decoration: underline; }
.acr-hint { color: #5a6478; }

.acr-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 * Sari la conținut (WCAG 2.4.1)
 * ------------------------------------------------------------------ */

#accesro-skip {
	position: fixed;
	top: -100px;
	left: 12px;
	z-index: 2147483001;
	background: #002b7f;
	color: #fff;
	padding: 12px 22px;
	border-radius: 0 0 8px 8px;
	font-family: system-ui, Arial, sans-serif;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
}

#accesro-skip:focus { top: 0; }

/* ------------------------------------------------------------------ *
 * Ghidul de citire
 * ------------------------------------------------------------------ */

#accesro-guide {
	display: none;
	position: fixed;
	left: 0;
	top: 50%;
	width: 100%;
	height: 9px;
	background: rgba(252, 209, 22, 0.8); /* galbenul drapelului */
	border-top: 1px solid #b08c00;
	border-bottom: 1px solid #b08c00;
	pointer-events: none;
	z-index: 2147482999;
}

/* ------------------------------------------------------------------ *
 * Efecte pe pagină (clase aplicate pe <html>)
 * ------------------------------------------------------------------ */

/*
 * Alb-negru / Culori inversate
 * Filtrul se aplică pe întreg <body> (inclusiv fundalul paginii). Pentru ca
 * panoul AccesRO să NU fie împins în afara ecranului — un element cu `filter`
 * devine bloc de referință pentru copiii position:fixed — toolbarul și ghidul
 * de citire sunt mutate în afara <body>, direct sub <html>, din JavaScript
 * (vezi relocateOutsideBody). Astfel filtrul de pe body nu îi afectează.
 */
html.acr-grayscale body { filter: grayscale(1); }

html.acr-invert body { filter: invert(1) hue-rotate(180deg); }
html.acr-invert body img,
html.acr-invert body video,
html.acr-invert body iframe { filter: invert(1) hue-rotate(180deg); }

/* Contrast ridicat */
html.acr-contrast body,
html.acr-contrast body *:not(#accesro):not(#accesro *) {
	background-color: #000 !important;
	background-image: none !important;
	color: #ffe94d !important;
	border-color: #ffe94d !important;
	text-shadow: none !important;
	box-shadow: none !important;
}

html.acr-contrast body a:not(#accesro a),
html.acr-contrast body a:not(#accesro a) * {
	color: #4dd8ff !important;
	text-decoration: underline !important;
}

html.acr-contrast body img,
html.acr-contrast body video,
html.acr-contrast body svg { filter: none !important; }

html.acr-contrast body input,
html.acr-contrast body textarea,
html.acr-contrast body select,
html.acr-contrast body button {
	background-color: #000 !important;
	color: #fff !important;
	border: 1px solid #ffe94d !important;
}

/* Subliniază linkurile */
html.acr-links body a { text-decoration: underline !important; }

/* Font pentru dislexie */
html.acr-dyslexic body,
html.acr-dyslexic body *:not(#accesro):not(#accesro *) {
	font-family: 'OpenDyslexic', 'Comic Sans MS', Verdana, Arial, sans-serif !important;
}

/* Spațiere text (WCAG 1.4.12) */
html.acr-spacing body,
html.acr-spacing body *:not(#accesro):not(#accesro *) {
	line-height: 1.5 !important;
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}

html.acr-spacing body p { margin-bottom: 2em !important; }

/* Oprește animațiile (WCAG 2.2.2, 2.3.3) */
html.acr-noMotion body *,
html.acr-noMotion body *::before,
html.acr-noMotion body *::after {
	animation: none !important;
	transition: none !important;
	scroll-behavior: auto !important;
}

/* Cursor mărit */
html.acr-cursor body,
html.acr-cursor body * {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.36Z' fill='%23002b7f' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 10 6, auto !important;
}

/* ------------------------------------------------------------------ *
 * Ecrane mici
 * ------------------------------------------------------------------ */

@media (max-width: 480px) {
	#accesro-panel {
		position: fixed;
		top: auto;
		bottom: 0;
		left: 0 !important;
		right: 0 !important;
		width: 100%;
		border-radius: 12px 12px 0 0;
	}

	#accesro { top: auto; bottom: 18px; }
}
