/**
 * Hero Grid Slider — stile componente.
 * Replica del look del modulo Joomla mod_sj_k2_gridslider:
 * overlay scuro dal basso, badge categoria assoluto in alto, titolo bianco,
 * estratto + autore che si espandono in hover.
 */

.hgs {
	--hgs-gap: 4px;
	--hgs-column-height: 420px;
	position: relative;
	width: 100%;
}

.hgs__viewport {
	width: 100%;
	overflow: hidden;
}

/* Layout strutturale dello slider: definito qui per non dipendere dalla CSS
   Swiper di Elementor (handle che cambia tra versioni). Se Swiper JS parte,
   sovrascrive width/transform inline; se NON parte, resta un fallback a scroll
   orizzontale leggibile (nessuna pagina vuota). */
.hgs .swiper-wrapper {
	display: flex;
	box-sizing: content-box;
}

/* NB: niente height:auto qui — la colonna (che e la slide) deve mantenere la
   sua altezza fissa var(--hgs-column-height). Con height:auto le card flex:1
   collasserebbero a zero e l'hero risulterebbe vuoto. */
.hgs .swiper-slide {
	flex-shrink: 0;
}

/* Fallback no-JS: senza Swiper le colonne non hanno width inline, quindi le
   dimensioniamo noi in base alle colonne desktop e abilitiamo lo scroll. */
.hgs:not(.hgs--swiper-ready) .swiper-wrapper {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
}

.hgs:not(.hgs--swiper-ready) .hgs__column {
	width: calc((100% - 3 * var(--hgs-gap)) / 4);
	margin-right: var(--hgs-gap);
	scroll-snap-align: start;
}

/* Ogni colonna e una slide Swiper.
   La colonna e contemporaneamente flex-item (dentro .swiper-wrapper) e
   flex-container (per le card). Come flex-item l'altezza "usata" puo collassare
   anche con height impostata: serve min-height per garantirla. Selettore
   .hgs .hgs__column (specificita 0,2,0) per vincere su eventuali regole
   .swiper-slide di terze parti. */
.hgs .hgs__column {
	display: flex;
	flex-direction: column;
	gap: var(--hgs-gap);
	height: var(--hgs-column-height);
	min-height: var(--hgs-column-height);
	box-sizing: border-box;
}

/* Colonna doppia: due card impilate, ognuna meta altezza. */
.hgs__column--double .hgs-card {
	flex: 1 1 0;
	min-height: 0;
}

/* Colonna singola: una card alta che occupa tutta la colonna. */
.hgs__column--single .hgs-card {
	flex: 1 1 100%;
	min-height: 0;
}

/* ---- Card ---- */
.hgs-card {
	position: relative;
	overflow: hidden;
	background: #2b2b2b;
}

.hgs-card__link {
	display: block;
	width: 100%;
	height: 100%;
	position: relative;
	text-decoration: none;
	color: inherit;
}

.hgs-card__media {
	position: absolute;
	inset: 0;
}

/* Selettore .hgs ... per vincere su `.elementor img{height:auto}` (0,1,1):
   senza questo l'immagine resta alla sua altezza naturale e le verticali
   sfondano lo slot, mostrandone solo una fetta ("tagliata a quadrato").
   Con height:100% + object-fit:cover ogni orientamento riempie lo slot con
   un crop pulito, come faceva il modulo Joomla generando crop per slot. */
.hgs .hgs-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.4s ease;
}

.hgs-card__img--placeholder {
	background: #3a3a3a;
}

.hgs-card:hover .hgs-card__img {
	transform: scale(1.05);
}

/* Overlay gradiente scuro dal basso. */
.hgs-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(61, 61, 61, 0.7), transparent);
	pointer-events: none;
}

/* ---- Corpo testuale ---- */
.hgs-card__body {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 15px 15px 12px;
	box-sizing: border-box;
}

.hgs-card__badge {
	position: absolute;
	top: 14px;
	left: 0;
	display: inline-block;
	padding: 4px 8px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	color: #fff;
	background-color: #61bd6d;
	line-height: 1.2;
}

.hgs-card__date {
	display: inline-block;
	margin-bottom: 6px;
	padding: 3px 5px;
	font-size: 11px;
	color: #000;
	background: rgba(239, 238, 238, 0.85);
}

.hgs-card__title {
	margin: 0;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
}

.hgs-card__title a,
.hgs-card__link:hover .hgs-card__title {
	color: #fff;
}

/* Estratto + autore: nascosti, si espandono in hover (come l'originale). */
.hgs-card__content {
	max-height: 0;
	overflow: hidden;
	color: #fff;
	transition: max-height 0.3s ease, margin-top 0.3s ease;
}

.hgs-card__link:hover .hgs-card__content {
	max-height: 200px;
	margin-top: 8px;
}

.hgs-card__excerpt {
	margin: 0;
	font-size: 13px;
	line-height: 1.4;
}

.hgs-card__author {
	margin: 6px 0 0;
	font-size: 13px;
	font-weight: 700;
}

/* ---- Navigazione ---- */
.hgs__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	width: 38px;
	height: 60px;
	border: 0;
	cursor: pointer;
	color: #fff;
	background-color: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.hgs:hover .hgs__nav {
	opacity: 1;
}

.hgs__nav::before {
	content: "";
	display: block;
	width: 10px;
	height: 10px;
	margin: 0 auto;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.hgs__nav--prev {
	left: 0;
}

.hgs__nav--prev::before {
	transform: rotate(-135deg);
}

.hgs__nav--next {
	right: 0;
}

.hgs__nav--next::before {
	transform: rotate(45deg);
}

.hgs__nav.swiper-button-disabled {
	opacity: 0;
	cursor: default;
}

/* ---- Paginazione ---- */
.hgs__pagination {
	position: static;
	margin-top: 10px;
	text-align: center;
}

/* =====================================================================
   Latest Ticker ("Ultime") — striscia orizzontale auto-scorrevole.
   Pensata per stare in una barra a altezza fissa (es. 40px nera).
   ===================================================================== */
.hgt {
	--hgt-height: 40px;
	position: relative;
	width: 100%;
	height: var(--hgt-height);
}

.hgt__viewport {
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.hgt .swiper-wrapper {
	display: flex;
	box-sizing: content-box;
	height: 100%;
}

.hgt .swiper-slide {
	flex-shrink: 0;
}

/* Fallback no-JS: scroll orizzontale anziche grid che va a capo. */
.hgt:not(.hgt--swiper-ready) .swiper-wrapper {
	overflow-x: auto;
}

.hgt:not(.hgt--swiper-ready) .hgt__item {
	width: calc(100% / 4);
}

.hgt__item {
	display: flex;
	align-items: center;
	gap: 8px;
	height: var(--hgt-height);
	padding: 0 16px 0 0;
	overflow: hidden;
	text-decoration: none;
	box-sizing: border-box;
}

.hgt__thumb {
	flex: 0 0 auto;
	width: calc(var(--hgt-height) - 12px);
	height: calc(var(--hgt-height) - 12px);
	overflow: hidden;
	border-radius: 2px;
}

.hgt .hgt__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hgt__dot {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #e03a2f;
}

.hgt__title {
	flex: 1 1 auto;
	min-width: 0;
	color: #fff;
	font-size: 13px;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.2s ease;
}

.hgt__item:hover .hgt__title {
	color: #e03a2f;
}

.hgt__nav {
	position: absolute;
	top: 0;
	height: 100%;
	width: 24px;
	z-index: 5;
	border: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.hgt__nav:hover {
	opacity: 1;
}

.hgt__nav::before {
	content: "";
	display: block;
	width: 8px;
	height: 8px;
	margin: 0 auto;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.hgt__nav--prev {
	left: 0;
}

.hgt__nav--prev::before {
	transform: rotate(-135deg);
}

.hgt__nav--next {
	right: 0;
}

.hgt__nav--next::before {
	transform: rotate(45deg);
}

.hgt__nav.swiper-button-disabled {
	opacity: 0.25;
	cursor: default;
}

/* =====================================================================
   Category Section ("world" / "trending") — header categoria colorato +
   lead con titolo in overlay + lista articoli minori.
   Replica mod_sj_k2_meganews (layout world & trending).
   ===================================================================== */
.hcs {
	--hcs-color: #e03a2f;
	--hcs-lead-height: 300px;
	width: 100%;
}

/* Header categoria: etichetta colorata + linea inferiore del colore categoria. */
.hcs__head {
	border-bottom: 2px solid var(--hcs-color);
	margin-bottom: 12px;
	line-height: 0;
}

.hcs__cat {
	display: inline-block;
	padding: 6px 12px;
	background-color: var(--hcs-color);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
	line-height: 1.2;
}

/* ---- Lead: immagine con titolo bianco in overlay (come il modulo Joomla) ---- */
.hcs__lead {
	position: relative;
	display: block;
	margin-bottom: 14px;
	height: var(--hcs-lead-height);
	overflow: hidden;
}

.hcs__lead-link {
	display: block;
	width: 100%;
	height: 100%;
	position: relative;
	text-decoration: none;
}

.hcs__lead-media {
	position: absolute;
	inset: 0;
	display: block;
}

.hcs .hcs__lead-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.hcs__lead:hover .hcs__lead-img {
	transform: scale(1.04);
}

.hcs__lead-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(61, 61, 61, 0.85), transparent);
	pointer-events: none;
}

.hcs__lead-body {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 15px 15px 12px;
}

.hcs__lead-title {
	margin: 0;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
}

.hcs__lead-link:hover .hcs__lead-title {
	color: #fff;
}

.hcs__lead-desc {
	display: block;
	max-height: 0;
	overflow: hidden;
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
	transition: max-height 0.3s ease, margin-top 0.3s ease;
}

.hcs__lead-link:hover .hcs__lead-desc {
	max-height: 80px;
	margin-top: 8px;
}

/* ---- Lista articoli minori: thumb 65px + titolo + data ---- */
.hcs__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.hcs__item {
	display: flex;
	gap: 14px;
	padding: 10px 0;
	border-bottom: 1px solid #ececec;
}

.hcs__item:last-child {
	border-bottom: 0;
}

.hcs__thumb {
	flex: 0 0 auto;
	width: 65px;
	height: 50px;
	overflow: hidden;
	display: block;
}

.hcs .hcs__thumb-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.hcs__item:hover .hcs__thumb-img {
	transform: scale(1.06);
}

.hcs__item-body {
	flex: 1 1 auto;
	min-width: 0;
}

.hcs__item-title {
	display: block;
	color: #111;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.25;
	text-decoration: none;
}

.hcs__item-title:hover {
	color: var(--hcs-color);
}

.hcs__date {
	display: block;
	margin-top: 4px;
	color: #999;
	font-size: 11px;
}

.hcs__img--placeholder {
	background: #e4e4e4;
}

/* Variante world (colonna principale): DUE colonne affiancate —
   lead grande a sinistra (52%), lista di 4 news impilate a destra (48%),
   come l'originale theme2 di mod_sj_k2_meganews. */
.hcs--world {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	column-gap: 4%;
}

.hcs--world .hcs__head {
	flex: 0 0 100%;
}

.hcs--world .hcs__lead {
	flex: 0 0 52%;
	max-width: 52%;
	margin-bottom: 0;
	height: var(--hcs-lead-height);
}

.hcs--world .hcs__list {
	flex: 0 0 44%;
	max-width: 44%;
}

/* Su mobile il world torna impilato (lead sopra, lista sotto). */
@media (max-width: 767px) {
	.hcs--world .hcs__lead,
	.hcs--world .hcs__list {
		flex: 0 0 100%;
		max-width: 100%;
	}
	.hcs--world .hcs__lead {
		margin-bottom: 14px;
	}
}

/* Variante trending (sidebar): lead piu basso, header etichetta semplice. */
.hcs--trending {
	--hcs-lead-height: 200px;
}

.hcs--trending .hcs__head {
	border-bottom: 0;
	margin-bottom: 8px;
}

.hcs--trending .hcs__lead-title {
	font-size: 15px;
}

/* =====================================================================
   Archive Grid — griglia categoria in stile overlay-card (vista K2 category).
   Immagine + titolo/data in overlay su gradiente scuro, 2 colonne.
   ===================================================================== */
.hag__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px;
}

.hag-card {
	--hag-card-height: 230px;
	position: relative;
	height: var(--hag-card-height);
	overflow: hidden;
	background: #2b2b2b;
}

.hag-card__link {
	display: block;
	width: 100%;
	height: 100%;
	position: relative;
	text-decoration: none;
}

.hag-card__media {
	position: absolute;
	inset: 0;
	display: block;
}

.hag .hag-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.hag-card:hover .hag-card__img {
	transform: scale(1.05);
}

.hag-card__img--placeholder {
	background: #3a3a3a;
}

.hag-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(61, 61, 61, 0.9), transparent 60%);
	pointer-events: none;
}

.hag-card__body {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	padding: 14px 14px 12px;
}

.hag-card__badge {
	display: inline-block;
	margin-bottom: 6px;
	padding: 3px 8px;
	background-color: #e03a2f;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1.2;
}

.hag-card__title {
	margin: 0;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
}

.hag-card__date {
	display: block;
	margin-top: 6px;
	color: #e0e0e0;
	font-size: 11px;
}

/* Paginazione */
.hag__pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 24px;
	justify-content: center;
}

.hag__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	background: #f1f1f1;
	color: #333;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	transition: background 0.2s ease, color 0.2s ease;
}

.hag__pagination .page-numbers:hover {
	background: #e03a2f;
	color: #fff;
}

.hag__pagination .page-numbers.current {
	background: #e03a2f;
	color: #fff;
}

.hag__pagination .page-numbers.dots {
	background: transparent;
}

@media (max-width: 600px) {
	.hag__grid {
		grid-template-columns: 1fr;
	}
}

/* ---- Stati editor ---- */
.hgs-empty {
	padding: 20px;
	background: #f5f5f5;
	color: #777;
	text-align: center;
	font-style: italic;
}
