/* ========================================
   MEDIA QUERIES ACCESSIBILITÀ - LISTA COMPLETA
   ======================================== */

/* 1. MOVIMENTO E ANIMAZIONI */
@media (prefers-reduced-motion: reduce) {
  /* Utente ha ridotto le animazioni nel sistema */
  *, *::before, *::after {
	animation-duration: 0.01ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.01ms !important;
	scroll-behavior: auto !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* Utente OK con animazioni normali */
  .animate-on-scroll {
	animation: slideIn 0.5s ease-out;
  }
}

/* 2. SCHEMA COLORI
@media (prefers-color-scheme: dark) {
  :root {
	--bg-color: #121212;
	--text-color: #e0e0e0;
	--link-color: #bb86fc;
	--e-global-color-primary: #bb86fc !important;
  }
}

@media (prefers-color-scheme: light) {
  :root {
	--bg-color: #ffffff;
	--text-color: #000000;
	--link-color: #0066cc;
	--e-global-color-primary: #0066cc;
  }
}
*/

/* 3. CONTRASTO */
@media (prefers-contrast: high) {
  /* Utente ha aumentato il contrasto nel sistema */
  :root {
	--bg-color: #000000 !important;
	--text-color: #ffffff !important;
	--border-color: #ffffff !important;
  }

  * {
	border-color: var(--border-color) !important;
  }

  button {
	border: 2px solid !important;
  }
}

@media (prefers-contrast: low) {
  /* Utente preferisce contrasto più basso */
  :root {
	--text-color: #666666;
	--border-color: #cccccc;
  }
}

@media (prefers-contrast: more) {
  /* Alias per high - utente vuole più contrasto */
  :root {
	  --bg-color: #000000 !important;
	  --text-color: #ffffff !important;
	  --border-color: #ffffff !important;
	  --link-color: #0066cc;
	  --e-global-color-primary:#000000 !important;
	}
}

@media (prefers-contrast: less) {
  /* Alias per low - utente vuole meno contrasto */
  body {
	background: #f5f5f5;
	color: #666;
  }
}

/* 4. TRASPARENZA */
@media (prefers-reduced-transparency: reduce) {
  /* Utente ha ridotto effetti trasparenza */
  * {
	backdrop-filter: none !important;
	opacity: 1 !important;
	background-color: solid !important;
  }

  .glass-effect {
	background: #ffffff !important;
	backdrop-filter: none !important;
  }

  .modal-backdrop {
	background: rgba(0,0,0,1) !important;
  }
}

@media (prefers-reduced-transparency: no-preference) {
  /* OK con trasparenze */
  .glass-effect {
	backdrop-filter: blur(10px);
	background: rgba(255,255,255,0.8);
  }
}

/* 5. MODALITÀ DATI (per dispositivi mobili) */
@media (prefers-reduced-data: reduce) {
  /* Utente ha attivato risparmio dati */
  img {
	display: none;
  }

  .data-heavy {
	display: none;
  }

  video {
	display: none;
  }

  /* Mostra versioni alternative più leggere */
  .low-data-version {
	display: block;
  }
}

/* 6. FORCED-COLORS (Windows High Contrast Mode) */
@media (forced-colors: active) {
  /* Windows modalità alto contrasto forzato */
  * {
	background-color: Canvas !important;
	color: CanvasText !important;
	border-color: CanvasText !important;
  }

  a {
	color: LinkText !important;
  }

  button {
	background-color: ButtonFace !important;
	color: ButtonText !important;
	border: 1px solid ButtonText !important;
  }
}

/* 7. INVERTED-COLORS (principalmente iOS) */
@media (inverted-colors: inverted) {
  /* Utente ha invertito i colori nel sistema */
  img, video {
	filter: invert(1);
  }
}

/* 8. COMBINAZIONI MULTIPLE */
@media (prefers-color-scheme: dark) and (prefers-contrast: high) {
  /* Tema scuro + alto contrasto */
  :root {
	--bg-color: #000000;
	--text-color: #ffffff;
	--accent-color: #ffff00;
  }
}

@media (prefers-reduced-motion: reduce) and (prefers-reduced-transparency: reduce) {
  /* Movimento ridotto + trasparenza ridotta */
  * {
	animation: none !important;
	transition: none !important;
	opacity: 1 !important;
	backdrop-filter: none !important;
  }
}

/* 9. DEVICE SPECIFICI PER ACCESSIBILITÀ */

/* iPhone/iOS con Voice Control */
@media screen and (-webkit-min-device-pixel-ratio: 2) and (prefers-reduced-motion: reduce) {
  .ios-voice-control {
	font-size: 18px;
	padding: 16px;
	min-height: 48px;
  }
}

/* Android TalkBack */
@media screen and (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .android-talkback {
	font-size: 16px;
	line-height: 1.5;
	padding: 12px;
  }
}

/* Windows Narrator */
@media (forced-colors: active) and (prefers-reduced-motion: reduce) {
  .windows-narrator {
	border: 2px solid ButtonText;
	padding: 16px;
  }
}

/* 10. BREAKPOINT + ACCESSIBILITÀ */
@media (max-width: 768px) and (prefers-contrast: high) {
  /* Mobile + alto contrasto */
  body {
	font-size: 18px;
	line-height: 1.6;
  }

  button {
	min-height: 48px;
	font-size: 16px;
  }
}

/* 11. MEDIA QUERY CUSTOM PER DEBUG */
@media screen and (min-width: 1px) {
  /* Sempre attiva - per testare */
  .accessibility-debug * {
	outline: 1px solid red;
  }

  .accessibility-debug [role] {
	outline: 2px solid blue;
  }

  .accessibility-debug [aria-label]:after {
	content: " [" attr(aria-label) "]";
	font-size: 10px;
	background: yellow;
	color: black;
  }
}

/* 12. SUPPORTO BROWSER */
/* Fallback per browser che non supportano certe media query */
@supports not (color: color(display-p3 1 1 1)) {
  .wide-gamut-colors {
	/* Colori fallback per browser più vecchi */
	color: #0066cc;
  }
}

/* 13. PRINT ACCESSIBILE */
@media print {
  * {
	background: transparent !important;
	color: black !important;
	box-shadow: none !important;
  }

  a[href]:after {
	content: " (" attr(href) ")";
  }

  .sr-only {
	position: static !important;
	width: auto !important;
	height: auto !important;
  }
}