/* =====================================================================
 * San Giorgio – News Overview widget (v2)
 * Struttura a BLOCCHI ripetibili: divider + [titolo/sottotitolo] + carosello
 * di card verticali. Tutte le classi sono namespaced con prefisso "sg-news-".
 * Riproduce il layout Figma "Overview articoli".
 *
 * MONKEY LAB di Michele Gigantino — © 2026
 * ===================================================================== */

.sg-news-overview {
	--sg-news-bg: #f5efe3;
	--sg-news-title: #a58b6e;
	--sg-news-link: #80674e;
	--sg-news-gap: 80px;         /* gap orizzontale tra card (Figma: 80px) */
	--sg-news-block-gap: 80px;   /* gap verticale tra blocchi */
	--sg-news-max: 1113px;
	--sg-news-card-w: 516.5px;   /* larghezza card desktop (Figma) */
	--sg-news-card-h: 400px;     /* altezza immagine card (Figma) */

	background-color: var(--sg-news-bg);
	color: var(--sg-news-title);
	font-family: "EB Garamond", Georgia, serif;
	width: 100%;
	box-sizing: border-box;
}

.sg-news-overview *,
.sg-news-overview *::before,
.sg-news-overview *::after {
	box-sizing: border-box;
}

.sg-news-overview__inner {
	max-width: var(--sg-news-max);
	margin: 0 auto;
	padding: 80px 24px;
	display: flex;
	flex-direction: column;
	gap: var(--sg-news-block-gap);
}

/* ---------- Heading di pagina (opzionale) ---------- */
.sg-news-overview__heading {
	margin: 0;
	color: var(--sg-news-title);
	font-weight: 400;
	font-size: clamp(48px, 8vw, 96px);
	line-height: 1;
	word-break: break-word;
}

.sg-news-overview__heading-prefix {
	font-style: normal;
}

.sg-news-overview__heading-text {
	font-style: italic;
}

/* =====================================================================
 * BLOCCO
 * ===================================================================== */
.sg-news-block {
	display: flex;
	flex-direction: column;
	gap: 40px; /* Figma: divider→header e header→carosello ~40px */
}

.sg-news-block__divider {
	border: 0;
	border-top: 2px solid rgba(165, 139, 110, 0.45);
	margin: 0;
	width: 100%;
}

/* ---- Header: titolo/sottotitolo a sinistra, frecce a destra ---- */
.sg-news-block__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
}

.sg-news-block__heading {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-width: var(--sg-news-card-w);
	min-width: 0;
}

/* Titolo di blocco: EB Garamond Regular 48px / lh 48px (Figma). */
.sg-news-block__title {
	margin: 0;
	font-weight: 400;
	font-size: 48px;
	line-height: 48px;
	color: var(--sg-news-title);
	word-break: break-word;
}

/* Sottotitolo di blocco: EB Garamond Regular 32px / lh 1.1 (Figma). */
.sg-news-block__subtitle {
	margin: 0;
	font-weight: 400;
	font-size: 32px;
	line-height: 1.1;
	color: var(--sg-news-title);
	word-break: break-word;
}

/* ---- Frecce di navigazione (Figma: cerchi ~41px accanto al titolo) ---- */
.sg-news-block__nav {
	display: flex;
	gap: 12px;
	flex-shrink: 0;
}

.sg-news-block__arrow {
	width: 41px;
	height: 41px;
	border-radius: 50%;
	border: 1px solid var(--sg-news-link);
	background: transparent;
	color: var(--sg-news-link);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}

.sg-news-block__arrow:hover:not(:disabled) {
	background: var(--sg-news-link);
	color: var(--sg-news-bg);
}

.sg-news-block__arrow:disabled {
	opacity: .3;
	cursor: default;
}

.sg-news-block__arrow-icon {
	pointer-events: none;
	display: block;
}

/* =====================================================================
 * CAROSELLO
 * ===================================================================== */
.sg-news-carousel {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.sg-news-carousel__viewport {
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
	scrollbar-width: none; /* Firefox: barra nativa sostituita dal progress custom */
	outline: none;
}

.sg-news-carousel__viewport::-webkit-scrollbar {
	display: none;
}

.sg-news-carousel__viewport.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	scroll-behavior: auto;
	user-select: none;
}

.sg-news-carousel__viewport:focus-visible {
	box-shadow: 0 0 0 2px rgba(128, 103, 78, 0.45);
	border-radius: 2px;
}

.sg-news-carousel__track {
	display: flex;
	gap: var(--sg-news-gap);
	padding-bottom: 4px;
}

/* Blocco statico (≤2 card): niente scroll, niente frecce/progress/dots. */
.sg-news-block--static .sg-news-carousel__viewport {
	overflow-x: visible;
	scroll-snap-type: none;
	cursor: default;
}

.sg-news-block--static .sg-news-carousel__progress,
.sg-news-block--static .sg-news-carousel__dots {
	display: none;
}

/* ---------- Card (verticale) ---------- */
.sg-news-card {
	flex: 0 0 var(--sg-news-card-w);
	max-width: var(--sg-news-card-w);
	scroll-snap-align: start;
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 32px; /* Figma: gruppo immagine+titolo → CTA = 32px */
	color: var(--sg-news-title);
}

.sg-news-card__inner {
	display: flex;
	flex-direction: column;
	gap: 16px; /* Figma: immagine → titolo = 16px */
}

.sg-news-card__media {
	width: 100%;
	height: var(--sg-news-card-h);
	overflow: hidden;
}

.sg-news-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

/* Titolo card: EB Garamond ITALIC 32px / lh 1.1 (Figma). */
.sg-news-card__title {
	margin: 0;
	font-weight: 400;
	font-style: italic;
	font-size: 32px;
	line-height: 1.1;
	color: var(--sg-news-title);
	word-break: break-word;
}

.sg-news-card__cta {
	display: inline-block;
	font-family: "Balthazar", Georgia, serif;
	font-size: 16px;
	line-height: 1.2;
	text-transform: uppercase;
	text-decoration: underline;
	text-underline-position: from-font;
	color: var(--sg-news-link);
	width: max-content;
}

.sg-news-card__cta:hover,
.sg-news-card__cta:focus {
	color: var(--sg-news-title);
}

/* ---------- Progress bar (desktop) ---------- */
.sg-news-carousel__progress {
	position: relative;
	height: 4px;
	background: rgba(165, 139, 110, 0.25);
	border-radius: 4px;
	cursor: pointer;
	overflow: hidden;
}

.sg-news-carousel__progress-bar {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 30%;
	background: var(--sg-news-link);
	border-radius: 4px;
	transition: transform .15s ease, width .15s ease;
	will-change: transform, width;
}

/* ---------- Dots (mobile) ---------- */
.sg-news-carousel__dots {
	display: none; /* visibili solo su mobile via media query */
	justify-content: center;
	align-items: center;
	gap: 12px;
}

.sg-news-carousel__dot {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	background: rgba(165, 139, 110, 0.4);
	cursor: pointer;
	transition: background-color .2s ease, transform .2s ease;
}

.sg-news-carousel__dot.is-active {
	background: var(--sg-news-link);
	width: 20px;
	height: 20px;
}

/* =====================================================================
 * RESPONSIVE
 * ===================================================================== */

/* Tablet */
@media (max-width: 1024px) {
	.sg-news-overview {
		--sg-news-gap: 48px;
		--sg-news-block-gap: 56px;
		--sg-news-card-h: 320px;
	}

	.sg-news-block__title {
		font-size: 36px;
		line-height: 40px;
	}

	.sg-news-block__subtitle,
	.sg-news-card__title {
		font-size: 24px;
		line-height: 1.15;
	}
}

/* Mobile */
@media (max-width: 767px) {
	.sg-news-overview {
		--sg-news-gap: 24px;
		--sg-news-block-gap: 48px;
		--sg-news-card-h: 400px;
	}

	.sg-news-overview__inner {
		padding: 48px 16px;
	}

	.sg-news-block {
		gap: 24px;
	}

	/* Mobile: header impilato, frecce nascoste (navigazione via dots/swipe). */
	.sg-news-block__header {
		flex-direction: column;
		align-items: flex-start;
	}

	.sg-news-block__nav {
		display: none;
	}

	.sg-news-block__title {
		font-size: 32px;
		line-height: 36px;
	}

	.sg-news-block__subtitle,
	.sg-news-card__title {
		font-size: 20px;
		line-height: 1.2;
	}

	/* Card a larghezza schermo (Figma mobile: 358px su viewport 390px). */
	.sg-news-card {
		flex-basis: calc(100vw - 32px);
		max-width: 358px;
	}

	.sg-news-block--static .sg-news-card {
		max-width: 100%;
	}

	/* Su mobile: progress bar nascosta, dots visibili. */
	.sg-news-carousel__progress {
		display: none;
	}

	.sg-news-carousel__dots {
		display: flex;
	}
}

/* =====================================================================
 * Stato "non pubblicato" — visibile SOLO nell'editor Elementor.
 * Nel front-end pubblico queste card non vengono proprio renderizzate.
 * MONKEY LAB di Michele Gigantino — © 2026
 * ===================================================================== */
.sg-news-card--unpublished {
	opacity: .55;
	filter: grayscale(35%);
}

.sg-news-draft-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 5;
	display: inline-block;
	padding: 4px 10px;
	background: #80674e;
	color: #f5efe3;
	font-family: "Balthazar", Georgia, serif;
	font-size: 13px;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: .04em;
	border-radius: 3px;
	pointer-events: none;
}
