/**
 * CV Videoteca — stili front-end.
 *
 * A bassa specificità e senza !important: ereditano font e colori del tema e
 * si lasciano sovrascrivere. I toni di grigio derivano da currentColor, così
 * l'aspetto regge sia su fondo chiaro sia su fondo scuro senza doppie regole.
 */

.cv-vt,
.cv-vt-single,
.cv-vt-related,
.cv-vt-archive {
	--cv-vt-accent: #5b2fd6;
	--cv-vt-gap: 1.1rem;
	--cv-vt-radius: 3px;
	--cv-vt-muted: rgba( 0, 0, 0, 0.55 );
	--cv-vt-border: rgba( 0, 0, 0, 0.12 );
	--cv-vt-shade: rgba( 0, 0, 0, 0.04 );
	--cv-vt-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@supports ( color: color-mix( in srgb, red, blue ) ) {
	.cv-vt,
	.cv-vt-single,
	.cv-vt-related,
	.cv-vt-archive {
		--cv-vt-muted: color-mix( in srgb, currentColor 62%, transparent );
		--cv-vt-border: color-mix( in srgb, currentColor 16%, transparent );
		--cv-vt-shade: color-mix( in srgb, currentColor 6%, transparent );
	}
}

.cv-vt { margin: 0 0 4rem; }

.cv-vt--serif .cv-vt-section__title,
.cv-vt--serif .cv-vt-card--lead .cv-vt-card__title,
.cv-vt-single.cv-vt--serif .cv-vt-single__title {
	font-family: var( --cv-vt-serif );
	font-weight: 400;
	letter-spacing: -0.01em;
}

/* ---------- Etichette minute ---------- */

.cv-vt__filter-label,
.cv-vt-card__type,
.cv-vt-section__count,
.cv-vt-single__eyebrow,
.cv-vt-pager__label {
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

/* ---------- Filtri ---------- */

.cv-vt__filters {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.4rem 1.6rem;
	margin: 0 0 1.5rem;
	padding: 0.7rem 0;
	border-top: 1px solid currentColor;
	border-bottom: 1px solid var( --cv-vt-border );
}

/* Con cinquanta video la barra deve restare a portata di mano mentre si
   scorre, altrimenti filtrare vuol dire prima risalire in cima. */
.cv-vt--sticky .cv-vt__filters {
	position: sticky;
	top: var( --cv-vt-sticky-top, 0px );
	z-index: 20;
	background: var( --cv-vt-sticky-bg, #fff );
}

.cv-vt__filter {
	display: flex;
	flex-direction: row;
	align-items: baseline;
	gap: 0.5rem;
	min-width: 0;
}

.cv-vt__filter--search { flex: 1 1 18rem; }
.cv-vt__filter--search input[type="search"] { width: 100%; }

.cv-vt__filter-label { color: var( --cv-vt-muted ); }

.cv-vt__filters select,
.cv-vt__filters input[type="search"] {
	width: auto;
	max-width: 100%;
	padding: 0.25rem 0;
	font: inherit;
	font-size: 0.85rem;
	color: inherit;
	background: transparent;
	border: 0;
	border-bottom: 1px solid transparent;
	border-radius: 0;
	outline-offset: 3px;
	transition: border-color 0.2s ease;
}

.cv-vt__filters select:hover,
.cv-vt__filters input[type="search"]:hover,
.cv-vt__filters select:focus,
.cv-vt__filters input[type="search"]:focus {
	border-bottom-color: var( --cv-vt-accent );
}

.cv-vt__reset {
	padding: 0.4rem 0;
	font: inherit;
	font-size: 0.85rem;
	color: var( --cv-vt-muted );
	cursor: pointer;
	background: transparent;
	border: 0;
	border-bottom: 1px solid transparent;
}

.cv-vt__reset:hover { color: inherit; border-bottom-color: currentColor; }

.cv-vt__status {
	margin: 0 0 0.9rem;
	font-size: 0.8rem;
	color: var( --cv-vt-muted );
}

/* Da vuota non deve occupare nulla: altrimenti fra i filtri e la prima riga
   resta un buco che sembra un errore di impaginazione. */
.cv-vt__status:empty { display: none; margin: 0; }

/* ---------- Griglia ---------- */

.cv-vt__grid {
	display: grid;
	grid-template-columns: repeat( var( --cv-vt-columns, 3 ), minmax( 0, 1fr ) );
	gap: 2rem var( --cv-vt-gap );
}

.cv-vt__grid[data-columns="1"] { --cv-vt-columns: 1; }
.cv-vt__grid[data-columns="2"] { --cv-vt-columns: 2; }
.cv-vt__grid[data-columns="3"] { --cv-vt-columns: 3; }
.cv-vt__grid[data-columns="4"] { --cv-vt-columns: 4; }
.cv-vt__grid[data-columns="5"] { --cv-vt-columns: 5; }
.cv-vt__grid[data-columns="6"] { --cv-vt-columns: 6; }

.cv-vt.is-loading .cv-vt__grid {
	opacity: 0.4;
	transition: opacity 0.2s ease;
}

.cv-vt__empty {
	grid-column: 1 / -1;
	padding: 3rem 0;
	color: var( --cv-vt-muted );
	text-align: center;
}

/* ---------- Card ---------- */

.cv-vt-card {
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
	min-width: 0;
}

.cv-vt-card__media {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var( --cv-vt-shade );
	border-radius: 2px;
}

.cv-vt-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cv-vt-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient( 135deg, #1a1a1f, #33333c );
}

.cv-vt-card__body { display: flex; flex-direction: column; gap: 0.15rem; }

.cv-vt-card__type { font-size: 0.6rem; color: var( --cv-vt-accent ); }

.cv-vt-card__title {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: -0.005em;
}

/* Titoli tagliati a due righe: con titoli lunghi come quelli dell'archivio,
   lasciarli liberi sfalserebbe l'altezza di ogni card della riga. */
.cv-vt .cv-vt-card .cv-vt-card__title a,
.cv-vt-related .cv-vt-card .cv-vt-card__title a {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var( --cv-vt-title, inherit );
	text-decoration: none;
	background-image: linear-gradient( currentColor, currentColor );
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0 1px;
	transition: background-size 0.3s cubic-bezier( 0.2, 0.6, 0.2, 1 );
}

.cv-vt .cv-vt-card .cv-vt-card__title a:hover,
.cv-vt .cv-vt-card .cv-vt-card__title a:focus-visible { background-size: 100% 1px; }

/* Stesso trattamento per il resto dei link della card: molti temi colorano
   di blu qualunque <a> dentro l'area di contenuto. */
.cv-vt .cv-vt-card__link,
.cv-vt .cv-vt-section__title a,
.cv-vt-related .cv-vt-related__all { color: inherit; text-decoration: none; }

.cv-vt-card__meta {
	margin: 0.1rem 0 0;
	font-size: 0.74rem;
	font-variant-numeric: tabular-nums;
	color: var( --cv-vt-muted );
}

.cv-vt-card__excerpt {
	max-width: 58ch;
	margin: 0.5rem 0 0;
	font-size: 0.95rem;
	line-height: 1.6;
	color: var( --cv-vt-muted );
}

/* ---------- Facciata del player ---------- */

.cv-vt-facade {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	cursor: pointer;
	background: #0d0d10;
	border: 0;
	border-radius: inherit;
	overflow: hidden;
}

.cv-vt-facade img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s cubic-bezier( 0.2, 0.6, 0.2, 1 ), opacity 0.3s ease;
}

.cv-vt-facade:hover img { transform: scale( 1.035 ); opacity: 0.92; }

.cv-vt-facade:focus-visible {
	outline: 2px solid var( --cv-vt-accent );
	outline-offset: 3px;
}

.cv-vt-facade__icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 2.1rem;
	height: 2.1rem;
	transform: translate( -50%, -50% );
	background: rgba( 0, 0, 0, 0.42 );
	border: 1px solid rgba( 255, 255, 255, 0.9 );
	border-radius: 50%;
	opacity: 0.9;
	pointer-events: none;
	transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.cv-vt-facade__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 55%;
	transform: translate( -50%, -50% );
	border-style: solid;
	border-width: 0.3rem 0 0.3rem 0.48rem;
	border-color: transparent transparent transparent #fff;
}

.cv-vt-facade:hover .cv-vt-facade__icon {
	background: var( --cv-vt-accent );
	border-color: var( --cv-vt-accent );
	opacity: 1;
	transform: translate( -50%, -50% ) scale( 1.1 );
}

.cv-vt-facade__duration {
	position: absolute;
	right: 0.55rem;
	bottom: 0.55rem;
	padding: 0.12rem 0.4rem;
	font-size: 0.72rem;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
	color: #fff;
	background: rgba( 0, 0, 0, 0.78 );
	border-radius: 2px;
	pointer-events: none;
}

/* ---------- Embed attivo ---------- */

.cv-vt-embed {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var( --cv-vt-radius );
	overflow: hidden;
}

.cv-vt-embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---------- Carica altri ---------- */

.cv-vt__more { margin-top: 3rem; text-align: center; }

.cv-vt__more[hidden] { display: none; }

.cv-vt__more-btn {
	padding: 0.75rem 2rem;
	font: inherit;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: inherit;
	cursor: pointer;
	background: transparent;
	border: 1px solid var( --cv-vt-border );
	border-radius: 999px;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.cv-vt__more-btn:hover {
	color: var( --cv-vt-accent );
	border-color: var( --cv-vt-accent );
}

/* ---------- Sezioni ---------- */

.cv-vt-section { margin: 0 0 4.5rem; }

.cv-vt-section__header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.6rem 1.25rem;
	margin: 0 0 1.75rem;
	padding-bottom: 0.7rem;
	border-bottom: 1px solid var( --cv-vt-border );
}

.cv-vt-section__heading {
	display: flex;
	align-items: baseline;
	gap: 0.9rem;
	min-width: 0;
}

.cv-vt-section__cover {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	overflow: hidden;
	border-radius: 2px;
	align-self: center;
}

.cv-vt-section__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cv-vt-section__num {
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	color: var( --cv-vt-accent );
}

.cv-vt-section__title {
	margin: 0;
	font-size: 1.5rem;
	line-height: 1.2;
}

.cv-vt-section__title a { color: inherit; text-decoration: none; }
.cv-vt-section__title a:hover { color: var( --cv-vt-accent ); }

.cv-vt-section__count {
	margin-left: auto;
	color: var( --cv-vt-muted );
	white-space: nowrap;
	text-decoration: none;
}

a.cv-vt-section__count:hover { color: var( --cv-vt-accent ); }

.cv-vt-section__description {
	max-width: 68ch;
	margin: -0.75rem 0 1.75rem;
	font-size: 0.95rem;
	line-height: 1.6;
	color: var( --cv-vt-muted );
}

.cv-vt-section__more { margin: 1.5rem 0 0; font-size: 0.9rem; }

.cv-vt-section__more a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid var( --cv-vt-border );
	padding-bottom: 2px;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.cv-vt-section__more a:hover {
	color: var( --cv-vt-accent );
	border-bottom-color: var( --cv-vt-accent );
}

/* ---------- Sezione editoriale ---------- */

.cv-vt-ed {
	display: grid;
	grid-template-columns: repeat( var( --cv-vt-columns, 3 ), minmax( 0, 1fr ) );
	gap: 2.75rem var( --cv-vt-gap );
}

.cv-vt-ed[data-columns="1"] { --cv-vt-columns: 1; }
.cv-vt-ed[data-columns="2"] { --cv-vt-columns: 2; }
.cv-vt-ed[data-columns="3"] { --cv-vt-columns: 3; }
.cv-vt-ed[data-columns="4"] { --cv-vt-columns: 4; }
.cv-vt-ed[data-columns="5"] { --cv-vt-columns: 5; }
.cv-vt-ed[data-columns="6"] { --cv-vt-columns: 6; }

.cv-vt-ed .cv-vt-card--lead { grid-column: span 2; }
.cv-vt-ed[data-columns="1"] .cv-vt-card--lead { grid-column: span 1; }

.cv-vt-card--lead .cv-vt-card__title { font-size: 1.9rem; font-weight: 400; line-height: 1.14; }
.cv-vt-card--lead .cv-vt-card__title a { display: inline; -webkit-line-clamp: none; overflow: visible; }

/* ---------- Archivio di tassonomia ---------- */

.cv-vt-archive__header {
	max-width: 68ch;
	margin: 0 0 2.5rem;
}

.cv-vt-archive__title {
	margin: 0;
	font-size: clamp( 1.8rem, 4vw, 2.6rem );
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.cv-vt-archive__description {
	margin: 1rem 0 0;
	font-size: 1rem;
	line-height: 1.6;
	color: var( --cv-vt-muted );
}

.cv-vt-card__link { display: block; height: 100%; }

/* ---------- Scheda singola ---------- */

.cv-vt-single { padding-bottom: 5rem; }

.cv-vt-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45rem;
	margin: 0 0 1.4rem;
	font-size: 0.74rem;
	color: var( --cv-vt-muted );
}

.cv-vt-breadcrumb a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.cv-vt-breadcrumb a:hover {
	color: var( --cv-vt-accent );
	border-bottom-color: currentColor;
}

/* Fascia a tutta larghezza col player centrato dentro.
   Il calc esce dal contenitore del tema senza doverlo modificare; se il tema
   ha già una gabbia a tutta larghezza basta azzerare --cv-vt-bleed. */
.cv-vt-stage {
	width: var( --cv-vt-bleed-width, 100vw );
	margin-left: var( --cv-vt-bleed, calc( 50% - 50vw ) );
	padding: 2.5rem 0;
	background: var( --cv-vt-stage-bg, #0b0b0d );
}

.cv-vt-stage__inner {
	max-width: var( --cv-vt-stage-max, 1180px );
	margin: 0 auto;
	padding: 0 2rem;
}

.cv-vt-stage .cv-vt-player { margin: 0; }

.cv-vt-stage .cv-vt-facade {
	aspect-ratio: 16 / 9;
	height: auto;
	border-radius: var( --cv-vt-radius );
	box-shadow: 0 30px 70px rgba( 0, 0, 0, 0.45 );
}

.cv-vt-stage .cv-vt-facade img { opacity: 0.88; }
.cv-vt-stage .cv-vt-facade:hover img { opacity: 1; transform: scale( 1.012 ); }

.cv-vt-stage .cv-vt-facade__icon { width: 4.6rem; height: 4.6rem; }
.cv-vt-stage .cv-vt-facade__icon::after { border-width: 0.68rem 0 0.68rem 1.1rem; }

.cv-vt-stage .cv-vt-embed { border-radius: var( --cv-vt-radius ); }

/* ---------- Testata centrata ---------- */

.cv-vt-single__header {
	max-width: 760px;
	margin: 0 auto;
	padding: 3rem 0 0;
	text-align: center;
}

.cv-vt-single__eyebrow { margin: 0 0 0.6rem; color: var( --cv-vt-accent ); }

.cv-vt-single__title {
	margin: 0;
	font-size: clamp( 1.8rem, 3.6vw, 2.7rem );
	line-height: 1.12;
	text-wrap: balance;
}

.cv-vt-single__terms {
	margin: 1rem 0 0;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var( --cv-vt-muted );
}

.cv-vt-single__lead {
	max-width: 62ch;
	margin: 1.5rem auto 0;
	font-size: 1.08rem;
	line-height: 1.6;
	color: var( --cv-vt-muted );
}

/* Misura di lettura stretta: una descrizione larga quanto lo schermo non si
   legge, e larga quanto il video sembra un errore di impaginazione. */
.cv-vt-single__content {
	max-width: 680px;
	margin: 2.5rem auto 0;
	line-height: 1.75;
}

/* ---------- Crediti e note ---------- */

.cv-vt-single__credits,
.cv-vt-single__note {
	max-width: 900px;
	margin: 3rem auto 0;
	padding: 2rem 0 0;
	border-top: 1px solid var( --cv-vt-border );
}

.cv-vt-single__credits h2,
.cv-vt-single__note h2,
.cv-vt-related__title {
	margin: 0 0 1.2rem;
	font-size: 0.64rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var( --cv-vt-muted );
}

.cv-vt-single__credits h2 { text-align: center; }

.cv-vt-single__credits dl {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 190px, 1fr ) );
	gap: 1.1rem 2rem;
	margin: 0;
}

.cv-vt-single__credit dt {
	font-size: 0.62rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var( --cv-vt-muted );
}

.cv-vt-single__credit dd { margin: 0.2rem 0 0; font-size: 0.94rem; }

.cv-vt-single__note { text-align: center; }
.cv-vt-single__note p { max-width: 62ch; margin: 0 auto; font-size: 0.95rem; line-height: 1.7; }

.cv-vt-single__tags {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.45rem;
	max-width: 900px;
	margin: 2rem auto 0;
}

.cv-vt-tag {
	padding: 0.24rem 0.75rem;
	font-size: 0.74rem;
	color: inherit;
	text-decoration: none;
	border: 1px solid var( --cv-vt-border );
	border-radius: 999px;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.cv-vt-tag:hover { color: var( --cv-vt-accent ); border-color: var( --cv-vt-accent ); }

/* ---------- Precedente / successivo ---------- */

.cv-vt-pager {
	display: flex;
	justify-content: space-between;
	gap: 2rem;
	max-width: 900px;
	margin: 3.5rem auto 0;
	padding: 1.5rem 0 0;
	border-top: 1px solid var( --cv-vt-border );
	font-size: 0.85rem;
}

.cv-vt-pager__link {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	max-width: 46%;
	color: inherit;
	text-decoration: none;
}

/* Il margine automatico tiene "successivo" a destra anche quando il
   precedente non esiste, senza bisogno di un segnaposto vuoto. */
.cv-vt-pager__link--next { margin-left: auto; text-align: right; }

.cv-vt-pager__label { color: var( --cv-vt-muted ); }

.cv-vt-pager__title { line-height: 1.35; }

.cv-vt-pager__link:hover .cv-vt-pager__title { color: var( --cv-vt-accent ); }

/* ---------- Correlati: piccoli e contenuti ---------- */

.cv-vt-related {
	max-width: 1180px;
	margin: 4rem auto 0;
	padding: 2rem 0 0;
	border-top: 1px solid var( --cv-vt-border );
}

.cv-vt-related__header {
	display: flex;
	align-items: baseline;
	gap: 1rem;
	margin-bottom: 1.2rem;
}

.cv-vt-related__title { margin: 0; }

.cv-vt-related__all {
	margin-left: auto;
	font-size: 0.74rem;
	color: var( --cv-vt-muted );
	text-decoration: none;
	white-space: nowrap;
}

.cv-vt-related__all:hover { color: var( --cv-vt-accent ); }

.cv-vt-related .cv-vt__grid { gap: 1.2rem 1rem; }
.cv-vt-related .cv-vt-card__title { font-size: 0.8rem; }
.cv-vt-related .cv-vt-card__type { font-size: 0.56rem; }
.cv-vt-related .cv-vt-card__meta { font-size: 0.7rem; }
.cv-vt-related .cv-vt-facade__icon { width: 2rem; height: 2rem; }
.cv-vt-related .cv-vt-facade__icon::after { border-width: 0.28rem 0 0.28rem 0.45rem; }

/* ---------- Responsive ---------- */

/* I selettori ripetono [data-columns] per pareggiare la specificità delle
   regole per singola colonna: le media query non ne aggiungono, e senza questo
   una griglia a 4 colonne resterebbe a 4 colonne anche su telefono. */

@media ( max-width: 1024px ) {
	.cv-vt__grid[data-columns],
	.cv-vt-ed[data-columns] { --cv-vt-columns: 2; }
}

@media ( max-width: 680px ) {
	.cv-vt__grid[data-columns],
	.cv-vt-ed[data-columns] { --cv-vt-columns: 1; }

	.cv-vt-ed .cv-vt-card--lead { grid-column: span 1; }
	.cv-vt-card--lead .cv-vt-card__title { font-size: 1.35rem; }

	.cv-vt__filters { gap: 1rem; }
	.cv-vt__filter { min-width: 100%; }

	.cv-vt-section__count { margin-left: 0; }

	.cv-vt-single__credits dl { grid-template-columns: 1fr; gap: 0.9rem; }

	.cv-vt-stage { padding: 0; }
	.cv-vt-stage__inner { padding: 0; }
	.cv-vt-stage .cv-vt-facade { border-radius: 0; box-shadow: none; }

	.cv-vt-pager { flex-direction: column; gap: 1.25rem; }
	.cv-vt-pager__link { max-width: 100%; }
	.cv-vt-pager__link--next { margin-left: 0; text-align: left; }

	.cv-vt-related .cv-vt__grid[data-columns] { --cv-vt-columns: 2; }
}

@media ( prefers-reduced-motion: reduce ) {
	.cv-vt-facade img,
	.cv-vt-facade__icon,
	.cv-vt-pager__thumb img,
	.cv-vt-card__title a {
		transition: none;
	}
}
