/* ==========================================================
 * Widget accessibilità — self-contained
 * ==========================================================
 */

/* --- Skip-link: visibile solo al focus da tastiera --- */
.a11y-skip {
	position: absolute;
	left: 0;
	top: 0;
	transform: translateY(-120%);
	background: #000;
	color: #fff;
	padding: 12px 20px;
	z-index: 100000;
	text-decoration: none;
	font-weight: 600;
	font-size: .9rem;
	border-radius: 0 0 4px 0;
	transition: transform .2s ease;
}
.a11y-skip:focus {
	transform: translateY(0);
	outline: 2px solid #B5101D;
	outline-offset: 2px;
	color: #fff;
}

/* --- Trigger: bottone flottante --- */
.a11y-trigger {
	position: fixed;
	left: 20px;
	bottom: 20px;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: #000;
	color: #fff;
	border: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
	z-index: 9998;
	transition: transform .2s ease, background .2s ease;
}
.a11y-trigger:hover { transform: scale(1.08); background: #B5101D; }
.a11y-trigger:focus-visible { outline: 3px solid #B5101D; outline-offset: 3px; }
.a11y-trigger svg { width: 26px; height: 26px; fill: #fff; }

/* --- Pannello --- */
.a11y-panel {
	position: fixed;
	left: 20px;
	bottom: 84px;
	width: 320px;
	max-width: calc(100vw - 40px);
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
	z-index: 9999;
	overflow: hidden;
	display: none;
	flex-direction: column;
	font-family: Arial, Helvetica, sans-serif;
}
.a11y-panel[data-open="true"] { display: flex; }

.a11y-panel-header {
	background: #000;
	color: #fff;
	padding: 14px 18px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.a11y-panel-header h3 {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: .3px;
}
.a11y-panel-close {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 6px;
}
.a11y-panel-close:hover { color: #B5101D; }

.a11y-panel-body {
	padding: 14px;
	overflow-y: auto;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.a11y-btn {
	background: #f6f2ec;
	border: 1px solid transparent;
	padding: 10px 8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: .78rem;
	color: #4B4B4B;
	text-align: center;
	line-height: 1.3;
	transition: all .15s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	min-height: 68px;
}
.a11y-btn:hover { background: #ece5d8; }
.a11y-btn:focus-visible { outline: 2px solid #B5101D; outline-offset: 2px; }
.a11y-btn[aria-pressed="true"] {
	background: #B5101D;
	color: #fff;
	border-color: #B5101D;
}
.a11y-btn svg { width: 20px; height: 20px; fill: currentColor; }
.a11y-btn strong { font-weight: 600; font-size: .82rem; }

.a11y-panel-footer {
	padding: 10px 14px 14px;
	border-top: 1px solid #f6f2ec;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.a11y-reset {
	background: #000;
	color: #fff;
	border: 0;
	padding: 10px;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
	font-size: .82rem;
	letter-spacing: .3px;
}
.a11y-reset:hover { background: #B5101D; }
.a11y-statement {
	font-size: .72rem;
	color: #6D6D6D;
	text-align: center;
	text-decoration: none;
}
.a11y-statement:hover { color: #B5101D; text-decoration: underline; }

/* --- Modificatori applicati al body --- */

/* Font size: tre step progressivi */
body.a11y-font-1 { font-size: 110% !important; }
body.a11y-font-2 { font-size: 120% !important; }
body.a11y-font-3 { font-size: 135% !important; }
body[class*="a11y-font-"] h1 { font-size: 2.2em !important; }
body[class*="a11y-font-"] h2 { font-size: 1.8em !important; }
body[class*="a11y-font-"] h3 { font-size: 1.5em !important; }
body[class*="a11y-font-"] p,
body[class*="a11y-font-"] li,
body[class*="a11y-font-"] label,
body[class*="a11y-font-"] a { font-size: 1em !important; line-height: 1.6 !important; }

/* Alto contrasto: bianco su nero */
body.a11y-contrast,
body.a11y-contrast * {
	background: #000 !important;
	color: #fff !important;
	border-color: #fff !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
body.a11y-contrast a,
body.a11y-contrast a * { color: #ffd400 !important; text-decoration: underline !important; }
body.a11y-contrast img,
body.a11y-contrast video,
body.a11y-contrast iframe { filter: grayscale(100%) contrast(110%); }
body.a11y-contrast .a11y-trigger,
body.a11y-contrast .a11y-panel,
body.a11y-contrast .a11y-panel * { background: #fff !important; color: #000 !important; }
body.a11y-contrast .a11y-trigger svg { fill: #000 !important; }
body.a11y-contrast .a11y-panel-header,
body.a11y-contrast .a11y-reset { background: #000 !important; color: #fff !important; }
body.a11y-contrast .a11y-panel-header * { background: #000 !important; color: #fff !important; }
body.a11y-contrast .a11y-btn[aria-pressed="true"] { background: #B5101D !important; color: #fff !important; }

/* Scala di grigi */
body.a11y-grayscale { filter: grayscale(100%); }
body.a11y-grayscale .a11y-trigger,
body.a11y-grayscale .a11y-panel { filter: none; }

/* Sottolinea link */
body.a11y-links a { text-decoration: underline !important; text-underline-offset: 3px !important; }

/* Font per dislessia */
body.a11y-dyslexia,
body.a11y-dyslexia * {
	font-family: 'Comic Sans MS', 'Trebuchet MS', Verdana, sans-serif !important;
	letter-spacing: .08em !important;
	word-spacing: .15em !important;
	line-height: 1.7 !important;
}

/* Cursore ingrandito */
body.a11y-big-cursor,
body.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 48 48'><path d='M8 4 L8 40 L18 30 L24 44 L30 42 L24 28 L38 28 Z' fill='%23fff' stroke='%23000' stroke-width='2' stroke-linejoin='round'/></svg>") 4 4, auto !important;
}

/* Stop animazioni */
body.a11y-no-animation,
body.a11y-no-animation *,
body.a11y-no-animation *::before,
body.a11y-no-animation *::after {
	animation-duration: 0s !important;
	animation-delay: 0s !important;
	transition-duration: 0s !important;
	transition-delay: 0s !important;
	scroll-behavior: auto !important;
}

/* Responsive */
@media (max-width: 480px) {
	.a11y-panel { width: calc(100vw - 40px); bottom: 80px; }
	.a11y-trigger { width: 48px; height: 48px; }
}

/* Print: nascondi widget */
@media print {
	.a11y-trigger, .a11y-panel, .a11y-skip { display: none !important; }
}
