/*
 * Stili applicati alla pagina quando l'utente attiva uno strumento.
 * Ogni regola dipende da una classe su <html>: senza quella il foglio non ha
 * effetto. Dimensione del testo e interlinea sono gestite dal JavaScript,
 * perché vanno calcolate sul valore reale di ogni elemento.
 */

/* allineamento */
html.dga-allinea-sinistra :is(p,li,dd,dt,h1,h2,h3,h4,h5,h6,blockquote,figcaption,td,th):not(#dga-root *) { text-align: left !important; }
html.dga-allinea-centro   :is(p,li,dd,dt,h1,h2,h3,h4,h5,h6,blockquote,figcaption,td,th):not(#dga-root *) { text-align: center !important; }
html.dga-allinea-giust    :is(p,li,dd,dt,blockquote,figcaption):not(#dga-root *) { text-align: justify !important; }

/* carattere leggibile */
/* font-family non si accumula per ereditarietà: si può applicare in modo esteso. */
html.dga-font body :not(#dga-root):not(#dga-root *):not(i):not(svg):not(svg *) {
	font-family: Verdana, "DejaVu Sans", Tahoma, "Trebuchet MS", sans-serif !important;
	letter-spacing: 0.012em !important;
	word-spacing: 0.05em !important;
}
/* Le icone a font vanno escluse, altrimenti al loro posto compaiono glifi
   mancanti. */
html.dga-font :is([class*="fa-"],[class*="icon"],[class*="eicon"],[class*="ast-icon"],[class*="dashicons"]):not(#dga-root *) {
	font-family: inherit !important;
}

/* alto contrasto */
html.dga-contrasto-alto body :not(#dga-root):not(#dga-root *) {
	background-color: #ffffff !important;
	background-image: none !important;
	color: #000000 !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
html.dga-contrasto-alto body { background: #ffffff !important; }
html.dga-contrasto-alto :is(a,a *):not(#dga-root *) { color: #00007a !important; text-decoration: underline !important; }
html.dga-contrasto-alto :is(button,[type="submit"],[type="button"],.wp-block-button__link):not(#dga-root *) {
	background-color: #000000 !important; color: #ffffff !important; border: 2px solid #000000 !important;
}
html.dga-contrasto-alto :is(input,select,textarea):not(#dga-root *) { border: 2px solid #000000 !important; }
html.dga-contrasto-alto :is(img,video,svg,canvas,iframe):not(#dga-root *) { background: transparent !important; }

/* contrasto scuro */
html.dga-contrasto-scuro body :not(#dga-root):not(#dga-root *) {
	background-color: #0e0e10 !important;
	background-image: none !important;
	color: #f2f2f2 !important;
	text-shadow: none !important;
	border-color: #6a6a72 !important;
}
html.dga-contrasto-scuro body { background: #0e0e10 !important; }
html.dga-contrasto-scuro :is(a,a *):not(#dga-root *) { color: #8ecbff !important; text-decoration: underline !important; }
html.dga-contrasto-scuro :is(button,[type="submit"],[type="button"],.wp-block-button__link):not(#dga-root *) {
	background-color: #f2f2f2 !important; color: #0e0e10 !important; border: 2px solid #f2f2f2 !important;
}
html.dga-contrasto-scuro :is(input,select,textarea):not(#dga-root *) {
	background-color: #1c1c20 !important; color: #f2f2f2 !important; border: 2px solid #8a8a94 !important;
}
html.dga-contrasto-scuro :is(img,video,iframe):not(#dga-root *) { opacity: .92; }

/* scala di grigi */
/* Filtro applicato a <html>: essendo l'elemento radice non introduce blocchi
   di contenimento per i position:fixed del tema. Il filtro interessa anche il
   pannello. */
html.dga-grigi { filter: grayscale(1) !important; }

/* nascondi immagini. La classe è ripetuta per alzare la specificità: alcuni
   plugin (loghi, preloader) forzano visibility:visible con !important. */
html.dga-no-immagini.dga-no-immagini body :is(img,picture,svg:not(#dga-root svg),video,[style*="background-image"]):not(#dga-root *) {
	visibility: hidden !important;
	/* Senza questo una transizione sulla visibility, avviata dal tema o da un
	   plugin, resterebbe sopra la regola: nella cascata le transizioni battono
	   anche le dichiarazioni !important. */
	transition-property: none !important;
}
html.dga-no-immagini :is(*):not(#dga-root):not(#dga-root *)::before,
html.dga-no-immagini :is(*):not(#dga-root):not(#dga-root *)::after {
	background-image: none !important;
}
html.dga-no-immagini :not(#dga-root):not(#dga-root *) { background-image: none !important; }
/* Le icone a font restano visibili: spesso sono l'unica etichetta di un pulsante. */
html.dga-no-immagini :is([class*="fa-"],[class*="eicon"],[class*="dashicons"]):not(#dga-root *) { visibility: visible !important; }

/* ferma le animazioni */
html.dga-no-anim :not(#dga-root):not(#dga-root *),
html.dga-no-anim :not(#dga-root):not(#dga-root *)::before,
html.dga-no-anim :not(#dga-root):not(#dga-root *)::after {
	animation-duration: 0.001ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	scroll-behavior: auto !important;
}
/* Caroselli Swiper e Slick: serve togliere la transizione al contenitore. */
html.dga-no-anim :is(.swiper-wrapper,.elementor-swiper,.slick-track):not(#dga-root *) {
	transform: none !important;
	transition: none !important;
}

/* evidenzia i link */
html.dga-link a:not(#dga-root *) {
	text-decoration: underline !important;
	text-underline-offset: 3px !important;
	text-decoration-thickness: 2px !important;
	outline: 2px solid currentColor !important;
	outline-offset: 2px !important;
}
html.dga-link a:not(#dga-root *):hover { background-color: #ffff00 !important; color: #000000 !important; }
/* Segnala i link che aprono una nuova finestra. */
html.dga-link a[target="_blank"]:not(#dga-root *)::after {
	content: " \2197" !important;
	font-size: .85em !important;
	speak: never;
}

/* contorno del fuoco */
/* Molti temi azzerano l'outline con outline:none. */
html.dga-fuoco :is(a,button,input,select,textarea,summary,[tabindex]):not(#dga-root *):focus,
html.dga-fuoco :is(a,button,input,select,textarea,summary,[tabindex]):not(#dga-root *):focus-visible {
	outline: 4px solid #ff6b00 !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 8px rgba(255, 107, 0, .28) !important;
	border-radius: 2px !important;
}

/* maschera di lettura */
#dga-maschera { position: fixed; inset: 0; pointer-events: none; z-index: 2147483000; }
#dga-maschera .dga-velo { position: absolute; left: 0; right: 0; background: rgba(0, 0, 0, .72); }
#dga-maschera .dga-sopra { top: 0; }
#dga-maschera .dga-sotto { bottom: 0; }

/* In stampa gli strumenti non vanno inclusi. */
@media print {
	#dga-root, #dga-maschera { display: none !important; }
}
