/**
 * WCAG 2.1 AA — Accessibility Fixes
 * LUISS University Press (child theme di Flatsome)
 *
 * Fix per errori GRAVI dal report WCAG audit homepage.
 * Organizzato per criterio WCAG.
 */

/* ==========================================================================
   WCAG 1.4.3 — Contrasto Minimo (Contrast Minimum)
   Rapporto richiesto: 4.5:1 testo normale, 3:1 testo grande
   ========================================================================== */

/*
 * FIX: Testo #000000 su sfondo #0e0e0e (rapporto 1.08:1) — 38 elementi
 * FIX: Link #0000ee su sfondo #0e0e0e (rapporto 2.05:1) — 16 elementi
 * Target: Card prodotto con overlay scuro (.show-on-hover)
 * Elementi coinvolti: titoli, prezzi, link, pulsanti, screen-reader-text
 */
.box-text.show-on-hover,
.box-text.show-on-hover .product-title,
.box-text.show-on-hover .product-title a,
.box-text.show-on-hover .category,
.box-text.show-on-hover .category a,
.box-text.show-on-hover .price,
.box-text.show-on-hover .price del,
.box-text.show-on-hover .price ins,
.box-text.show-on-hover .price bdi,
.box-text.show-on-hover .price .woocommerce-Price-currencySymbol,
.box-text.show-on-hover .price .woocommerce-Price-amount,
.box-text.show-on-hover .screen-reader-text,
.box-text.show-on-hover .availability_date,
.box-text.show-on-hover .add_to_cart_button,
.box-text.show-on-hover .added_to_cart,
.box-text.show-on-hover .button,
.box-text.show-on-hover .star-rating,
.box-text.show-on-hover p {
	color: #ffffff !important;
}

.box-text.show-on-hover a,
.box-text.show-on-hover a:visited {
	color: #ffffff !important;
}

.box-text.show-on-hover a:hover,
.box-text.show-on-hover a:focus {
	color: #e0e0e0 !important;
	text-decoration: underline;
}

/* Pulsante "Aggiungi al carrello" su sfondo scuro */
.box-text.show-on-hover .add_to_cart_button,
.box-text.show-on-hover .button.add_to_cart_button {
	color: #ffffff !important;
	border-color: #ffffff !important;
}

.box-text.show-on-hover .add_to_cart_button:hover,
.box-text.show-on-hover .add_to_cart_button:focus {
	color: #0e0e0e !important;
	background-color: #ffffff !important;
}

/*
 * FIX: Testo #fcfcfc su sfondo #ffffff (rapporto 1.02:1) — 2 elementi
 * Target: Solo titoli sezione su sfondo CHIARO (bianco/light).
 * Problemi #70, #71: .section-title-main
 * NON applicare su sezioni con sfondo scuro (blu LUISS, nero, ecc.)
 * dove il testo chiaro è corretto.
 */
.section-title-container .section-title .section-title-main[style*="fcfcfc"] {
	color: #333333 !important;
}

/*
 * FIX: Counter carrello nel masthead — Problema #26
 * Target: #masthead strong (badge contatore)
 */
#masthead .header-nav .cart-icon strong,
#masthead .header-nav .cart-icon .cart-count {
	color: #ffffff !important;
	background-color: #1e1e1e !important;
}

/*
 * FIX: Testo #f1f1f1 su sfondo non determinabile — 12 problemi GRAVI
 * Problemi #4-#15 dal report 08/04/2026
 *
 * Il footer ha classe .dark (sfondo scuro visivamente) ma il tool di audit
 * non riesce a determinare il background-color e assume #ffffff.
 * Il colore testo #f1f1f1 su sfondo nero è ottimo (18.4:1) ma l'audit fallisce.
 *
 * Fix: impostare background-color ESPLICITO sugli elementi del footer
 * così il tool può calcolare il contrasto correttamente.
 * Bonus: portare testo da #f1f1f1 a #ffffff per contrasto massimo (21:1).
 */

/*
 * FIX: Card blog archivio — WCAG 1.4.3 contrasto insufficiente
 * Problemi GRAVI #1-#11 dall'audit blog 08/04/2026
 *
 * ===== CAUSA RADICE (trovata dopo 3 iterazioni) =====
 * Flatsome ha: [data-animate]{opacity:0!important}
 * Le card blog hanno data-animate="bounceIn" sull'intero .post-item
 * Lo scanner WCAG analizza PRIMA che il JS aggiunga data-animated="true"
 * Quindi l'INTERO .col.post-item è opacity:0 o in transizione (~0.15)
 *
 * Il nero #000 del box-text × opacity 0.15 + bianco sottostante = grigio
 * #d7d7d7 (o #a1a1a1 o #8c8c8c a seconda del timing dello scanner)
 *
 * SOLUZIONE: forzare opacity:1 sulle card blog CON animazione,
 * senza aspettare il JavaScript di Flatsome.
 * L'animazione visiva è sacrificata per la conformità WCAG.
 * =====================================================
 */

/* --- FIX PRINCIPALE: forzare opacity:1 sempre sulle card blog ---
 *
 * L'animazione bounceIn di Flatsome usa:
 *   [data-animate]{opacity:0!important} → inizia invisibile
 *   [data-animated=true]{opacity:1!important; transition:opacity .3s}
 *
 * Lo scanner WCAG cattura la pagina DURANTE la transizione opacity 0→1
 * e calcola un background grigio composto (nero×opacity + bianco sotto).
 * Ogni scan dà un valore diverso (#8c, #a1, #d7, #e1, #ca) perché
 * dipende dal frame catturato.
 *
 * FIX: opacity:1 sempre. Le card mantengono l'animazione transform
 * (bounce/scale) ma sono sempre visibili — niente fade-in.
 */
.post-item[data-animate] {
	opacity: 1 !important;
	transform: none !important;
}

/* --- Testo bianco pieno dentro le card blog con tema scuro --- */
.box-blog-post .box-text.dark,
.box-blog-post .box-text.dark div,
.box-blog-post .box-text.dark p,
.box-blog-post .box-text.dark a,
.box-blog-post .box-text.dark span,
.box-blog-post .box-text.dark h5,
.box-blog-post .box-text.dark .post-title,
.box-blog-post .box-text.dark .post-title a,
.box-blog-post .box-text.dark .post-title a.plain,
.box-blog-post .box-text.dark .from_the_blog_excerpt,
.box-blog-post .box-text.dark .post-meta,
.box-blog-post .box-text.dark .cat-label,
.box-blog-post .box-text.dark .tag-label,
.box-blog-post .box-text.dark .button,
.box-blog-post .box-text.dark .button.is-outline {
	color: #ffffff !important;
	opacity: 1 !important;
}

/* --- Rimuovere sfondo semi-trasparente da .tag-label --- */
.box-blog-post .box-text.dark .tag-label,
.box-blog-post .box-text.dark .cat-label.tag-label {
	background-color: transparent !important;
}

/* --- Pulsante outline: bordo bianco --- */
.box-blog-post .box-text.dark .button.is-outline {
	border-color: #ffffff !important;
}

/* --- Hover/focus states --- */
.box-blog-post .box-text.dark .post-title a:hover,
.box-blog-post .box-text.dark .post-title a:focus {
	color: #e0e0e0 !important;
}

.box-blog-post .box-text.dark .button.is-outline:hover,
.box-blog-post .box-text.dark .button.is-outline:focus {
	background-color: #ffffff !important;
	color: #000000 !important;
}
/*
 * FIX: Titoli prodotto #919191 su #ffffff (rapporto 3.15:1) — Problemi blog single
 * Target: .product-title a dentro card prodotto WooCommerce
 * Il colore grigio chiaro non raggiunge 4.5:1 su sfondo bianco.
 */
.product-small .box-text-products .product-title a,
.product-small .box-text-products .woocommerce-loop-product__link {
	color: #333333 !important;
}

.product-small .box-text-products .product-title a:hover,
.product-small .box-text-products .product-title a:focus,
.product-small .box-text-products .woocommerce-loop-product__link:hover,
.product-small .box-text-products .woocommerce-loop-product__link:focus {
	color: #000000 !important;
}

/* Background esplicito sul footer-1 e absolute-footer */
#footer .footer-1,
#footer .footer-widgets.dark {
	background-color: #000000 !important;
}

#footer .absolute-footer.dark {
	background-color: #000000 !important;
}

/* #4: .widget-title — portare a bianco pieno per contrasto 21:1 su nero */
#footer .widget-title {
	color: #ffffff !important;
}

/* #5-#10: Link menu footer */
#footer .menu li a,
#footer .footer-wrapper .menu li a {
	color: #ffffff !important;
}

#footer .menu li a:hover,
#footer .menu li a:focus {
	color: #e0e0e0 !important;
	text-decoration: underline;
}

/* #11-#13: Testo paragrafi e strong nel custom_html widget */
#footer .textwidget,
#footer .textwidget p,
#footer .textwidget strong {
	color: #ffffff !important;
}

/* #14-#15: Link nel widget testo footer (Privacy policy, T&C) */
#footer .textwidget a {
	color: #ffffff !important;
}

#footer .textwidget a:hover,
#footer .textwidget a:focus {
	color: #e0e0e0 !important;
	text-decoration: underline;
}

/* Copyright / absolute-footer */
#footer .absolute-footer .copyright-footer,
#footer .absolute-footer .copyright-footer strong {
	color: #ffffff !important;
}

/* #16-#18: reCAPTCHA invisible — contrasto #000 su #4d4d4d (2.48:1)
 * Il widget reCAPTCHA invisible è iniettato da Google nel DOM.
 * Override: testo bianco per contrasto >4.5:1 su sfondo #4d4d4d.
 */
.rc-anchor.rc-anchor-invisible .rc-anchor-aria-status,
.rc-anchor.rc-anchor-invisible .rc-anchor-invisible-text,
.rc-anchor.rc-anchor-invisible .rc-anchor-invisible-text span,
.rc-anchor.rc-anchor-invisible .rc-anchor-invisible-text strong {
	color: #ffffff !important;
}

/*
 * FIX: Noscript lazy-load fallback — 22+ elementi
 * L'audit tool rileva il contrasto anche sui <noscript>.
 * Nascondiamo le noscript via CSS quando JS è attivo
 * (la classe .js viene aggiunta al <html> quando JS è abilitato).
 */
html.js noscript {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
}

/* ==========================================================================
   WCAG 2.4.4 — Scopo del link (Link Purpose in Context)
   Fix visivi: focus indicator per link banner (il fix dell'aria-label è via PHP)
   ========================================================================== */

/*
 * FIX: Link banner (.fill) senza indicatore di focus visibile
 * Problemi #74-#84: <a class="fill"> nei banner
 */
.banner a.fill:focus,
.banner a.fill:focus-visible {
	outline: 3px solid #ffffff !important;
	outline-offset: -3px;
	box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   WCAG 4.1.2 — Nome, Ruolo, Valore (Name, Role, Value)
   Fix visivi (il fix dell'aria-label è via PHP/JS)
   ========================================================================== */

/*
 * Focus indicator globale per elementi interattivi
 * Garantisce che ogni elemento interattivo abbia un indicatore visibile.
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
	outline: 2px solid #005fcc;
	outline-offset: 2px;
}

/* ==========================================================================
   Screen Reader Text — Tecnica di nascondimento accessibile
   Sovrascrive l'implementazione di Flatsome con la versione W3C raccomandata
   per evitare falsi positivi di contrasto dall'audit tool.
   ========================================================================== */

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px) !important;
	clip-path: inset(50%) !important;
	height: 1px !important;
	width: 1px !important;
	margin: -1px !important;
	overflow: hidden !important;
	padding: 0 !important;
	position: absolute !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.screen-reader-text:focus {
	clip: auto !important;
	clip-path: none !important;
	display: block !important;
	height: auto !important;
	width: auto !important;
	margin: 0 !important;
	left: 5px;
	top: 5px;
	z-index: 100000;
	background-color: #ffffff;
	color: #000000;
	padding: 15px 23px;
	font-size: 0.875rem;
	text-decoration: none;
	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   WCAG 1.4.10 — Reflow
   Fix collaterali per position: fixed e overflow a zoom 200%
   (Problemi moderati, ma utile per non peggiorare il reflow)
   ========================================================================== */

@media (max-width: 320px) {
	#top-link.back-to-top {
		right: 5px !important;
		bottom: 5px !important;
		width: 40px !important;
		height: 40px !important;
	}
}

.grecaptcha-badge { visibility: hidden; }
/*
@media (min-width: 767px) {
	#top-link.back-to-top {
		right: 80px !important;
	}
}*/