/* Carosello articoli del blog – E-2 Lab
   I colori e il font si cambiano dalle variabili qui sotto. */

.cbc {
	--cbc-red: #5f0000;
	--cbc-red-soft: #f5ecea;
	--cbc-green: #407749;
	--cbc-ink: #221d1d;
	--cbc-muted: #5b5454;
	--cbc-line: #e6dedb;
	--cbc-paper: #ffffff;
	--cbc-display: "Oswald", "Arial Narrow", Arial, sans-serif;
	--cbc-card: clamp(260px, 82vw, 340px);
	--cbc-gap: clamp(16px, 2vw, 28px);

	color: var(--cbc-ink);
	margin-block: clamp(40px, 6vw, 80px);
}

.cbc *,
.cbc *::before,
.cbc *::after {
	box-sizing: border-box;
}

/* Intestazione ----------------------------------------------------------- */
.cbc .cbc__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px 24px;
	margin: 0 0 28px;
	padding: 0 0 14px;
	border-bottom: 3px solid var(--cbc-red);
}

.cbc .cbc__title {
	margin: 0;
	padding: 0;
	font-family: var(--cbc-display);
	font-weight: 600;
	font-size: clamp(1.75rem, 3vw, 2.5rem);
	line-height: 1.1;
	color: var(--cbc-red);
}

.cbc .cbc__all {
	font-weight: 600;
	color: var(--cbc-green);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
}

.cbc .cbc__all:hover {
	color: var(--cbc-red);
}

/* Area scorrevole -------------------------------------------------------- */
.cbc .cbc__viewport {
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: 4px;
	scrollbar-width: none;
	margin-inline: -4px;
	padding: 4px 4px 8px;
}

.cbc .cbc__viewport::-webkit-scrollbar {
	display: none;
}

.cbc .cbc__viewport:focus-visible {
	outline: 3px solid var(--cbc-green);
	outline-offset: 4px;
}

.cbc ul.cbc__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: var(--cbc-card);
	gap: var(--cbc-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cbc li.cbc__slide {
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

/* Scheda ----------------------------------------------------------------- */
.cbc .cbc-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--cbc-paper);
	border: 1px solid var(--cbc-line);
	border-radius: 6px;
	overflow: hidden;
	transition: border-color 0.2s ease;
}

.cbc .cbc-card:hover,
.cbc .cbc-card:focus-within {
	border-color: var(--cbc-red);
}

.cbc .cbc-card__media {
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--cbc-red-soft);
}

.cbc .cbc-card__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.6s ease;
}

.cbc .cbc-card:hover .cbc-card__img {
	transform: scale(1.04);
}

/* Segnaposto per articoli senza immagine in evidenza */
.cbc .cbc-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background:
		repeating-linear-gradient(135deg, transparent 0 14px, rgba(95, 0, 0, 0.06) 14px 15px),
		var(--cbc-red-soft);
}

.cbc .cbc-card__body {
	position: relative;
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 44px 22px 20px;
}

/* Il "timbro" con la data: l'elemento distintivo della scheda */
.cbc .cbc-card__stamp {
	position: absolute;
	top: -30px;
	left: 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 64px;
	padding: 8px 10px 7px;
	font-family: var(--cbc-display);
	color: #fff;
	background: var(--cbc-red);
	border-radius: 4px;
	box-shadow: 0 0 0 4px var(--cbc-paper);
}

.cbc .cbc-card__day {
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1;
}

.cbc .cbc-card__month {
	margin-top: 3px;
	font-size: 0.78rem;
	line-height: 1;
	letter-spacing: 0.03em;
}

.cbc .cbc-card__cat {
	margin: 0 0 8px;
	padding: 0;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--cbc-green);
}

.cbc .cbc-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0 0 10px;
	padding: 0;
	font-family: var(--cbc-display);
	font-weight: 500;
	font-size: 1.3rem;
	line-height: 1.25;
	color: var(--cbc-ink);
}

.cbc .cbc-card__title a {
	color: inherit;
	text-decoration: none;
}

/* Tutta la scheda è cliccabile, ma il link resta uno solo (meglio per screen reader e SEO) */
.cbc .cbc-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: 6px;
}

.cbc .cbc-card__title a:focus {
	outline: none;
}

.cbc .cbc-card__title a:focus-visible::after {
	outline: 3px solid var(--cbc-green);
	outline-offset: -3px;
}

.cbc .cbc-card:hover .cbc-card__title a {
	text-decoration: underline;
	text-decoration-color: var(--cbc-red);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.cbc .cbc-card__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0 0 18px;
	padding: 0;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--cbc-muted);
}

.cbc .cbc-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: auto 0 0;
	padding: 14px 0 0;
	border-top: 1px solid var(--cbc-line);
	font-size: 0.85rem;
	color: var(--cbc-muted);
}

.cbc .cbc-card__cta {
	font-weight: 600;
	color: var(--cbc-red);
}

/* Piede: pulsante "Leggi di più" + controlli ------------------------------ */
.cbc .cbc__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 28px;
	margin-top: 24px;
}

.cbc a.cbc__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 28px;
	font-family: var(--cbc-display);
	font-weight: 500;
	font-size: 1.1rem;
	line-height: 1.2;
	color: #fff;
	text-decoration: none;
	background: var(--cbc-red);
	border-radius: 4px;
	transition: background-color 0.2s ease;
}

.cbc a.cbc__cta:hover {
	color: #fff;
	background: var(--cbc-green);
}

.cbc a.cbc__cta:focus-visible {
	outline: 3px solid var(--cbc-green);
	outline-offset: 3px;
}

.cbc .cbc__controls {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 10px;
	min-width: 220px;
}

@media (max-width: 600px) {
	.cbc a.cbc__cta {
		order: 2;
		flex: 1 1 100%;
	}
}

.cbc .cbc__progress {
	position: relative;
	flex: 1;
	height: 3px;
	margin-right: 10px;
	overflow: hidden;
	background: var(--cbc-line);
	border-radius: 2px;
}

.cbc .cbc__progress-bar {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: var(--cbc-red);
	transition: width 0.25s ease;
}

.cbc button.cbc__btn {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	font: inherit;
	line-height: 1;
	color: var(--cbc-red);
	background: transparent;
	border: 1.5px solid var(--cbc-red);
	border-radius: 4px;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.cbc button.cbc__btn:hover {
	color: #fff;
	background: var(--cbc-red);
}

.cbc button.cbc__btn:focus-visible {
	outline: 3px solid var(--cbc-green);
	outline-offset: 2px;
}

.cbc .cbc__btn svg {
	width: 20px;
	height: 20px;
}

.cbc .cbc__icon-play,
.cbc .cbc__btn--pause.is-paused .cbc__icon-pause {
	display: none;
}

.cbc .cbc__btn--pause.is-paused .cbc__icon-play {
	display: block;
}

/* Con pochi articoli che stanno tutti a schermo, i controlli spariscono */
.cbc.cbc--static .cbc__controls {
	display: none;
}

/* Testo per screen reader */
.cbc .cbc-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.cbc-notice {
	padding: 12px 16px;
	border-left: 4px solid #5f0000;
	background: #f5ecea;
}

/* Rispetto della preferenza "riduci movimento" del sistema */
@media (prefers-reduced-motion: reduce) {
	.cbc .cbc-card,
	.cbc .cbc-card__img,
	.cbc .cbc__progress-bar,
	.cbc button.cbc__btn,
	.cbc a.cbc__cta {
		transition: none;
	}

	.cbc .cbc-card:hover .cbc-card__img {
		transform: none;
	}
}
