/*!
 * FAV — Eventi | carousel CSS
 * Namespace: .fav-eventi-* e .fav-card-*
 * Stile identico al prototipo Dreamcatcher ma estratto in CSS per manutenibilità
 */

/* ============================================================
   Variabili
   ============================================================ */
:root {
	--fav-color-primary: #01718A;
	--fav-color-primary-dark: #016075;
	--fav-color-text: #364451;
	--fav-color-text-light: #60697B;
	--fav-color-bg-soft: #F0F8FA;
	--fav-color-border: #EAEAEA;
	--fav-color-tag-bg: #D8ECF1;
	--fav-color-white: #ffffff;
	--fav-card-w: 349px;
	--fav-card-gap: 36px;
	--fav-transition: 450ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Section
   ============================================================ */
.fav-eventi-section {
	box-sizing: border-box;
}
.fav-eventi-section *,
.fav-eventi-section *::before,
.fav-eventi-section *::after {
	box-sizing: border-box;
}

/* ============================================================
   Viewport + track
   ============================================================ */
.fav-eventi-viewport {
	position: relative;
}
.fav-eventi-track {
	display: flex;
	gap: var(--fav-card-gap);
	transition: transform var(--fav-transition);
	will-change: transform;
}

/* Quando JS fa il loop infinito, disabilita transizione sul reset */
.fav-eventi-track.is-resetting {
	transition: none !important;
}

/* ============================================================
   Card comune
   ============================================================ */
.fav-card {
	width: var(--fav-card-w);
	flex: 0 0 var(--fav-card-w);
	background: var(--fav-color-white);
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px var(--fav-color-border);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	user-select: none;
}

/* ============================================================
   Bottoni prev/next
   ============================================================ */
.fav-eventi-section button {
	transition: background 200ms ease, transform 200ms ease;
}
.fav-eventi-section button:focus-visible {
	outline: 3px solid var(--fav-color-primary);
	outline-offset: 2px;
}
.fav-eventi-section button:hover {
	transform: translateY(-1px);
}
.fav-eventi-section .fav-eventi-prev:hover {
	background: var(--fav-color-bg-soft) !important;
}
.fav-eventi-section .fav-eventi-next:hover {
	background: var(--fav-color-primary-dark) !important;
}
.fav-eventi-section .fav-eventi-prev:disabled,
.fav-eventi-section .fav-eventi-next:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
}

/* ============================================================
   Card Variante: data-foto
   ============================================================ */
.fav-card--data-foto .fav-card__image {
	position: relative;
	height: 200px;
	margin: 1px 1px 0 1px;
	border-radius: 6px 6px 0 0;
	background-color: var(--fav-color-bg-soft);
	background-size: cover;
	background-position: center;
}
.fav-card--data-foto .fav-card__date-badge {
	position: absolute;
	left: 16px;
	top: 16px;
	background: var(--fav-color-white);
	border-radius: 8px;
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	box-shadow: 0 2px 8px rgba(1, 96, 117, 0.18);
	z-index: 5; /* sopra l'overlay scuro di hover */
}
.fav-card--data-foto .fav-card__body {
	padding: 22px 24px 26px 24px;
	display: flex;
	flex-direction: column;
	gap: 11px;
	flex: 1;
	position: relative;
	z-index: 4; /* sopra l'overlay scuro di hover */
}

/* ============================================================
   Card Variante: foto-overlay
   ============================================================ */
.fav-card--foto-overlay .fav-card__image {
	position: relative;
	height: 420px;
	border-radius: 6px;
	background-color: #01323E;
	background-size: cover;
	background-position: center;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 24px;
}
.fav-card--foto-overlay .fav-card__date-badge {
	position: absolute;
	left: 16px;
	top: 16px;
	background: var(--fav-color-white);
	border-radius: 8px;
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	z-index: 5; /* sopra l'overlay scuro di hover */
}
.fav-card--foto-overlay .fav-card__overlay {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ============================================================
   Hover state "text-to-white": overlay scuro + scritte bianche
   Si applica a ENTRAMBE le varianti (data_foto e foto_overlay).
   - data_foto: overlay gradient scuro copre l'intera card
   - foto_overlay: leggero rinforzo del gradient esistente
   Le scritte passano al bianco con transizione smooth.
   ============================================================ */

.fav-card {
	position: relative;
}

/* data_foto: overlay scuro posizionato ASSOLUTO su tutta la card (foto + body) */
.fav-card--data-foto::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(1, 20, 26, 0.45) 0%, rgba(1, 20, 26, 0.75) 100%);
	opacity: 0;
	transition: opacity 120ms ease;
	pointer-events: none;
	z-index: 3;
	border-radius: 6px;
}

/* foto_overlay: gradient rinforzato che copre solo la foto */
.fav-card--foto-overlay .fav-card__image::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 6px;
	background: linear-gradient(180deg, rgba(0, 10, 14, 0.35) 0%, rgba(0, 10, 14, 0.7) 100%);
	opacity: 0;
	transition: opacity 120ms ease;
	pointer-events: none;
	z-index: 1;
}

/* Transizioni colore per tutti i testi (rapide: 100ms) */
.fav-card__title,
.fav-card__luogo,
.fav-card__tag,
.fav-card__cta {
	transition: color 100ms ease, background-color 100ms ease, border-color 100ms ease, text-shadow 100ms ease, font-weight 0ms;
}

/* data_foto: overlay visibile al hover del link interno + scritte bianche */
.fav-card--data-foto:has(.fav-card__link:hover)::before,
.fav-card--data-foto:has(.fav-card__link:focus-visible)::before {
	opacity: 1;
}
.fav-card--data-foto:has(.fav-card__link:hover) .fav-card__title,
.fav-card--data-foto:has(.fav-card__link:focus-visible) .fav-card__title {
	color: #ffffff !important; /* override inline-style */
	font-weight: 800 !important;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.fav-card--data-foto:has(.fav-card__link:hover) .fav-card__luogo,
.fav-card--data-foto:has(.fav-card__link:focus-visible) .fav-card__luogo {
	color: #ffffff !important; /* bianco puro, non più azzurro */
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.fav-card--data-foto:has(.fav-card__link:hover) .fav-card__cta,
.fav-card--data-foto:has(.fav-card__link:focus-visible) .fav-card__cta {
	color: #ffffff !important; /* override inline-style */
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.fav-card--data-foto:has(.fav-card__link:hover) .fav-card__tag,
.fav-card--data-foto:has(.fav-card__link:focus-visible) .fav-card__tag {
	background-color: rgba(255, 255, 255, 0.28) !important;
	color: #ffffff !important;
}

/* foto_overlay: gradient rinforzato al hover + scritte restano bianche (già bianche inline) */
.fav-card--foto-overlay:has(.fav-card__link:hover) .fav-card__image::after,
.fav-card--foto-overlay:has(.fav-card__link:focus-visible) .fav-card__image::after {
	opacity: 1;
}

/* ============================================================
   Hover state "text-to-white" — FALLBACK UNIVERSALE (no :has)
   Triggered dalla classe .is-hovered che JS aggiunge/rimuove.
   Funziona su TUTTI i browser (anche senza supporto :has).
   ============================================================ */

.fav-card--data-foto.is-hovered::before {
	opacity: 1;
}
.fav-card--data-foto.is-hovered .fav-card__title {
	color: #ffffff !important;
	font-weight: 800 !important;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.fav-card--data-foto.is-hovered .fav-card__luogo {
	color: #ffffff !important;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.fav-card--data-foto.is-hovered .fav-card__cta {
	color: #ffffff !important;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.fav-card--data-foto.is-hovered .fav-card__tag {
	background-color: rgba(255, 255, 255, 0.28) !important;
	color: #ffffff !important;
}

.fav-card--foto-overlay.is-hovered .fav-card__image::after {
	opacity: 1;
}

/* ============================================================
   Tipografia e atom condivisi (richiamati dai template inline,
   mantenuti qui come hook per eventuali override)
   ============================================================ */
.fav-card__title {
	margin: 0;
	font-weight: 700;
	letter-spacing: -0.2px;
}
.fav-card__tag {
	align-self: flex-start;
	border-radius: 1000px;
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.4px;
	text-transform: uppercase;
}
.fav-card__luogo {
	font-weight: 600;
	font-size: 14px;
}

/* ============================================================
   Card-as-link: card intera cliccabile
   Effetto: leggera elevazione + box-shadow teal al hover/focus
   ============================================================ */
.fav-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
	transition: transform 200ms ease, box-shadow 200ms ease;
	outline: none;
}
.fav-card__link:hover,
.fav-card__link:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 4px 16px rgba(1, 96, 117, 0.12);
}
.fav-card__link:focus-visible {
	outline: 3px solid var(--fav-color-primary);
	outline-offset: 2px;
}

/* ============================================================
   "Scopri di più" — micro-interazione tipografica
   Spostamento verso l'alto (3px) al hover/focus della card.
   NESSUN background colorato, NESSUN cambio colore testo.
   Identico all'effetto translateY dei bottoni prev/next.
   ============================================================ */
.fav-card__cta {
	display: inline-block;
	background: transparent !important;
	background-color: transparent !important;
	color: var(--fav-color-primary);
	transition: transform 200ms ease;
	will-change: transform;
}
.fav-card__link:hover .fav-card__cta,
.fav-card__link:focus-visible .fav-card__cta {
	transform: translateY(-3px);
}

/* ============================================================
   Bottone "Vedi tutti gli eventi"
   ============================================================ */
.fav-eventi-section a[href$="/eventi/"],
.fav-eventi-section a[href*="/eventi/"] {
	transition: background 200ms ease;
}
.fav-eventi-section a[href$="/eventi/"]:hover,
.fav-eventi-section a[href*="/eventi/"]:hover {
	background: var(--fav-color-primary-dark) !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
	.fav-card,
	.fav-card--data-foto,
	.fav-card--foto-overlay {
		--fav-card-w: 300px;
	}
}
@media (max-width: 768px) {
	.fav-card,
	.fav-card--data-foto,
	.fav-card--foto-overlay {
		--fav-card-w: 260px;
	}
	.fav-card--foto-overlay .fav-card__image {
		height: 360px;
	}
}
@media (max-width: 480px) {
	.fav-card,
	.fav-card--data-foto,
	.fav-card--foto-overlay {
		--fav-card-w: 84vw;
	}
	.fav-card--foto-overlay .fav-card__image {
		height: 320px;
	}
}

/* ============================================================
   prefers-reduced-motion: niente animazioni
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
	.fav-eventi-track {
		transition: none !important;
		transform: none !important;
	}
	.fav-card {
		scroll-snap-type: x mandatory;
	}
	.fav-eventi-viewport {
		overflow-x: auto;
		scroll-snap-type: x mandatory;
	}
}

/* ============================================================
   Screen reader text (utility)
   ============================================================ */
.fav-eventi-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
