/*! BD Blocks 0.10.0 - blocco Cast: temi Netflix e Prime Video, scorrevole o griglia */

/* ------------------------------------------------------------------ Base */
.bd-cast {
	--bdc-bg: #141414;
	--bdc-text: #ffffff;
	--bdc-muted: #b3b3b3;
	--bdc-accent: #e50914;
	--bdc-gap: .9rem;
	--bdc-w: 9.5rem;
	--bdc-ar: 2 / 3;
	--bdc-ratio: 1.5;
	--bdc-radius: 6px;
	--bdc-name: .92rem;
	box-sizing: border-box;
	margin: 1.75em 0;
	color: var(--bdc-text);
}
.bd-cast *, .bd-cast *::before, .bd-cast *::after { box-sizing: border-box; }

.bd-cast--t-netflix { --bdc-bg: #141414; --bdc-muted: #b3b3b3; --bdc-accent: #e50914; --bdc-ar: 2 / 3; --bdc-ratio: 1.5; --bdc-radius: 6px; --bdc-w: 9.5rem; }
.bd-cast--t-prime { --bdc-bg: #0f171e; --bdc-muted: #8197a4; --bdc-accent: #1a98ff; --bdc-ar: 1 / 1; --bdc-ratio: 1; --bdc-radius: 50%; --bdc-w: 8rem; }

/* Forma delle foto: sostituisce quella predefinita del tema */
.bd-cast--shape-portrait { --bdc-ar: 2 / 3; --bdc-ratio: 1.5; --bdc-radius: 6px; --bdc-w: 9.5rem; }
.bd-cast--shape-square { --bdc-ar: 1 / 1; --bdc-ratio: 1; --bdc-radius: 8px; --bdc-w: 8.5rem; }
.bd-cast--shape-round { --bdc-ar: 1 / 1; --bdc-ratio: 1; --bdc-radius: 50%; --bdc-w: 8rem; }

/* Sfondo: pannello del tema (scuro) oppure trasparente con i colori del sito */
.bd-cast--bg-theme, .bd-cast--bg-auto { padding: 1.25rem 1.25rem 1.1rem; background: var(--bdc-bg); border-radius: 12px; }
.bd-cast--bg-transparent { color: inherit; }
.bd-cast--bg-transparent .bd-cast__role { color: inherit; opacity: .7; }

@media (max-width: 700px) {
	.bd-cast { --bdc-w: clamp(6rem, 38vw, 8.5rem); --bdc-gap: .75rem; }
	.bd-cast--bg-theme, .bd-cast--bg-auto { padding: 1rem .9rem .9rem; border-radius: 10px; }
}

/* ---------------------------------------------------------------- Titolo */
.bd-cast__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 .85rem; }
.bd-cast .bd-cast__title { margin: 0; font-size: 1.3rem; font-weight: 800; line-height: 1.2; color: inherit; }
.bd-cast--t-netflix .bd-cast__title { padding-left: .7rem; border-left: 4px solid var(--bdc-accent); letter-spacing: -.01em; }
.bd-cast--t-prime .bd-cast__title { font-weight: 700; }
.bd-cast--t-prime .bd-cast__title::after { content: ""; display: block; width: 2.2rem; height: 3px; margin-top: .35rem; background: var(--bdc-accent); border-radius: 2px; }
.bd-cast__nav { display: flex; gap: .45rem; flex: 0 0 auto; }

/* --------------------------------------------------- Striscia scorrevole */
.bd-cast__viewport { position: relative; }
.bd-cast__track {
	display: flex;
	gap: var(--bdc-gap);
	padding: var(--bdc-pt, .3rem) .25rem var(--bdc-pb, .5rem);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding: 0 .25rem;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.bd-cast__track::-webkit-scrollbar { display: none; }
.bd-cast__track:focus-visible { outline: 2px solid var(--bdc-accent); outline-offset: 2px; border-radius: 6px; }

.bd-cast .bd-cast__item { flex: 0 0 var(--bdc-w); width: var(--bdc-w); min-width: 0; margin: 0; scroll-snap-align: start; }

/* ------------------------------------------------------------ Scheda attore */
.bd-cast__photo {
	position: relative;
	aspect-ratio: var(--bdc-ar);
	overflow: hidden;
	border-radius: var(--bdc-radius);
	background: linear-gradient(135deg, #2a2a2e, #18181b);
	transition: transform .2s, box-shadow .2s;
}
.bd-cast .bd-cast__img { display: block; width: 100%; height: 100%; margin: 0; object-fit: cover; object-position: center top; }
.bd-cast__initials {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font: 800 1.7rem/1 system-ui, sans-serif;
	color: #ffffff;
	opacity: .85;
}
.bd-cast__item:hover .bd-cast__photo { transform: scale(1.04); }
.bd-cast--t-netflix .bd-cast__item:hover .bd-cast__photo { box-shadow: 0 0 0 2px var(--bdc-accent), 0 8px 20px rgba(0, 0, 0, .45); }
.bd-cast--t-prime .bd-cast__item:hover .bd-cast__photo { box-shadow: 0 0 0 3px var(--bdc-accent); }

.bd-cast__cap { display: block; margin-top: .55rem; }
.bd-cast--t-prime .bd-cast__cap, .bd-cast--shape-round .bd-cast__cap { text-align: center; }
.bd-cast .bd-cast__name { display: block; font-size: var(--bdc-name); font-weight: 700; line-height: 1.25; color: inherit; }
.bd-cast .bd-cast__role { display: block; margin-top: .15rem; font-size: calc(var(--bdc-name) * .87); line-height: 1.25; color: var(--bdc-muted); }

/* Browser senza aspect-ratio: stesso rapporto con il riempimento in percentuale */
@supports not (aspect-ratio: 1 / 1) {
	.bd-cast__photo::before { content: ""; display: block; padding-top: calc(var(--bdc-ratio) * 100%); }
	.bd-cast .bd-cast__img { position: absolute; top: 0; left: 0; }
}

/* ------------------------------------------------------------------ Frecce */
.bd-cast__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	color: #ffffff;
	background: rgba(0, 0, 0, .72);
	border: 1px solid rgba(255, 255, 255, .28);
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
	cursor: pointer;
	transition: background .15s, border-color .15s, opacity .15s;
}
.bd-cast__arrow:hover:not(:disabled), .bd-cast__arrow:focus-visible { background: var(--bdc-accent); border-color: var(--bdc-accent); }
.bd-cast__arrow:disabled { opacity: .25; cursor: default; }
.bd-cast__arrow svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.bd-cast .bd-cast__arrow[hidden] { display: none !important; }

/* Frecce ai lati delle foto: centrate sull'altezza della foto */
.bd-cast--arrows-sides .bd-cast__viewport > .bd-cast__arrow {
	position: absolute;
	top: calc(var(--bdc-w) * var(--bdc-ratio) / 2 + var(--bdc-pt, .3rem));
	z-index: 2;
	transform: translateY(-50%);
}
.bd-cast--arrows-sides .bd-cast__arrow--prev { left: .15rem; }
.bd-cast--arrows-sides .bd-cast__arrow--next { right: .15rem; }

/* Su smartphone le frecce sono nascoste (basta scorrere col dito), salvo scelta contraria */
@media (max-width: 700px) {
	.bd-cast .bd-cast__arrow, .bd-cast .bd-cast__nav { display: none; }
	.bd-cast--arrows-m .bd-cast__arrow { display: inline-flex; }
	.bd-cast--arrows-m .bd-cast__nav { display: flex; }
}

/* ----------------------------------------------------------------- Griglia */
@media (min-width: 701px) {
	.bd-cast--d-grid .bd-cast__track {
		display: grid;
		grid-template-columns: repeat(var(--bdc-cols-d, 6), minmax(0, 1fr));
		row-gap: 1.1rem;
		overflow: visible;
		scroll-snap-type: none;
	}
	.bd-cast--d-grid .bd-cast__item { width: auto; }
	.bd-cast--d-grid .bd-cast__arrow, .bd-cast--d-grid .bd-cast__nav { display: none; }
}
@media (max-width: 700px) {
	.bd-cast--m-grid .bd-cast__track {
		display: grid;
		grid-template-columns: repeat(var(--bdc-cols-m, 2), minmax(0, 1fr));
		row-gap: 1rem;
		overflow: visible;
		scroll-snap-type: none;
	}
	.bd-cast--m-grid .bd-cast__item { width: auto; }
	.bd-cast--m-grid .bd-cast__arrow, .bd-cast--m-grid .bd-cast__nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.bd-cast__photo, .bd-cast__arrow { transition: none; }
	.bd-cast__item:hover .bd-cast__photo { transform: none; }
}

/* ------------------------------------------------------------------ Editor
   Nell'editor le schede vanno a capo (si vedono tutte e si modificano); le frecce non servono. */
.editor-styles-wrapper .bd-cast .bd-cast__track { flex-wrap: wrap; overflow: visible; }
.editor-styles-wrapper .bd-cast .bd-cast__item { margin: 0; }
.editor-styles-wrapper .bd-cast .bd-cast__arrow { pointer-events: none; }
.bd-cast__ph .components-placeholder { min-height: 0; padding: .6rem; }
.bd-cast__ph .components-placeholder__label { font-size: 11px; }
.bd-cast__ph .components-placeholder__instructions { display: none; }
.bd-cast__ph .components-placeholder__fieldset { flex-direction: column; gap: 6px; }

.bd-cast__photo.bd-cast__ph { aspect-ratio: auto; min-height: 7rem; overflow: visible; border-radius: 6px; }
.editor-styles-wrapper .bd-cast .bd-cast__head .bd-cast__arrow { font-size: 1.3rem; line-height: 1; }

/* ------------------------------------------- Anteprima: segnaposto per le schede incomplete
   Compaiono solo nell'anteprima di WordPress, mai sul sito pubblicato. */
.bd-cast__name--ph, .bd-cast__role--ph { font-style: italic; font-weight: 500; opacity: .6; }
.bd-cast__item--incomplete .bd-cast__photo { border: 2px dashed rgba(255, 255, 255, .5); }
.bd-cast--bg-transparent .bd-cast__item--incomplete .bd-cast__photo { border-color: rgba(127, 127, 127, .75); }
.bd-cast__flag {
	position: absolute;
	bottom: .55rem;
	left: 50%;
	z-index: 1;
	max-width: 92%;
	padding: .18rem .5rem;
	overflow: hidden;
	font: 700 .66rem/1.25 system-ui, sans-serif;
	color: #1f2937;
	white-space: nowrap;
	text-overflow: ellipsis;
	background: #fbbf24;
	border-radius: 999px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
	transform: translateX(-50%);
}
.bd-cast--t-prime .bd-cast__flag, .bd-cast--shape-round .bd-cast__flag { bottom: 1rem; }
.bd-cast--t-prime.bd-cast--shape-portrait .bd-cast__flag, .bd-cast--t-prime.bd-cast--shape-square .bd-cast__flag { bottom: .55rem; }
.bd-cast__note, .bd-cast__empty { margin: .7rem 0 0; font-size: .78rem; line-height: 1.4; opacity: .75; }
.bd-cast__empty { padding: 1rem; font-size: .9rem; border: 2px dashed rgba(127, 127, 127, .6); border-radius: 8px; }

/* ----------------------------------------- Editor: il "+" per aggiungere un attore si vede anche sul nero
   Prima era un contorno grigio scuro su fondo scuro; ora e' una scheda tratteggiata chiara con la scritta. */
.editor-styles-wrapper .bd-cast .block-list-appender { flex: 0 0 var(--bdc-w); width: var(--bdc-w); margin: 0; }
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .35rem;
	width: 100%;
	height: auto;
	min-height: 7rem;
	aspect-ratio: var(--bdc-ar);
	padding: .5rem;
	color: #ffffff;
	background: rgba(255, 255, 255, .12);
	border: 2px dashed rgba(255, 255, 255, .75);
	border-radius: var(--bdc-radius);
	box-shadow: none;
	cursor: pointer;
}
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender svg,
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender svg path { width: 2.4rem; height: 2.4rem; fill: currentColor; }
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender svg path { width: auto; height: auto; }
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender::after { content: "Aggiungi attore"; font: 600 .78rem/1.2 system-ui, sans-serif; }
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender:hover,
.editor-styles-wrapper .bd-cast .block-editor-button-block-appender:focus {
	color: #ffffff;
	background: var(--bdc-accent);
	border-color: var(--bdc-accent);
	box-shadow: none;
}
/* Sfondo trasparente: nell'editor la pagina e' chiara, quindi il "+" torna scuro */
.editor-styles-wrapper .bd-cast--bg-transparent .block-editor-button-block-appender {
	color: #1e1e1e;
	background: rgba(0, 0, 0, .05);
	border-color: rgba(0, 0, 0, .5);
}
.editor-styles-wrapper .bd-cast--bg-transparent .block-editor-button-block-appender:hover,
.editor-styles-wrapper .bd-cast--bg-transparent .block-editor-button-block-appender:focus { color: #ffffff; background: var(--bdc-accent); border-color: var(--bdc-accent); }


/* ------------------------------------------------ Sfondo automatico (chiaro / .custom-dark)
   Pannello chiaro sul sito normale; con la classe .custom-dark (tema dark del sito) torna scuro. */
.bd-cast--t-netflix.bd-cast--bg-auto { --bdc-bg: #f4f4f5; --bdc-text: #141414; --bdc-muted: #5f5f66; }
.bd-cast--t-prime.bd-cast--bg-auto { --bdc-bg: #eaf1f6; --bdc-text: #0f171e; --bdc-muted: #52697a; }
.custom-dark .bd-cast--t-netflix.bd-cast--bg-auto { --bdc-bg: #141414; --bdc-text: #ffffff; --bdc-muted: #b3b3b3; }
.custom-dark .bd-cast--t-prime.bd-cast--bg-auto { --bdc-bg: #0f171e; --bdc-text: #ffffff; --bdc-muted: #8197a4; }
.bd-cast--bg-auto .bd-cast__item--incomplete .bd-cast__photo { border-color: rgba(127, 127, 127, .75); }
/* Nell'editor la pagina e' chiara: il "+" per aggiungere un attore torna scuro */
.editor-styles-wrapper .bd-cast--bg-auto .block-editor-button-block-appender {
	color: #1e1e1e;
	background: rgba(0, 0, 0, .05);
	border-color: rgba(0, 0, 0, .5);
}
.editor-styles-wrapper .bd-cast--bg-auto .block-editor-button-block-appender:hover,
.editor-styles-wrapper .bd-cast--bg-auto .block-editor-button-block-appender:focus { color: #ffffff; background: var(--bdc-accent); border-color: var(--bdc-accent); }

/* ------------------------------------------------------------- Logo del tema */
.bd-cast__brand { margin: 0 0 .7rem; line-height: 0; color: inherit; }
.bd-cast .bd-cast__logo-svg { display: block; width: auto; max-width: 100%; height: 1.35rem; overflow: visible; }
.bd-cast .bd-cast__logo-img { display: block; width: auto; max-width: 100%; height: 1.6rem; margin: 0; object-fit: contain; object-position: left center; }
.bd-cast .bd-cast__logo-a { fill: var(--bdc-accent); }
.bd-cast .bd-cast__logo-s { fill: none; stroke: var(--bdc-accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.bd-cast--t-prime .bd-cast__logo-svg { height: 1.6rem; }
@media (max-width: 700px) {
	.bd-cast .bd-cast__logo-svg { height: 1.15rem; }
	.bd-cast--t-prime .bd-cast__logo-svg { height: 1.4rem; }
	.bd-cast .bd-cast__logo-img { height: 1.4rem; }
}

/* ------------------------------------------- Effetti allo scorrimento
   Li attiva cast.js (classe bd-cast--fx-on) solo se la striscia scorre davvero, e scrive su ogni
   scheda --bdc-k (1 = al centro, 0 = lontana) e --bdc-s (posizione rispetto al centro, da -1 a 1). */
.bd-cast--fx-on { --bdc-pt: 1.5rem; --bdc-pb: 1.6rem; }
.bd-cast--fx-on .bd-cast__item {
	position: relative;
	z-index: calc(1 + var(--bdc-k, 0) * 10);
	will-change: transform;
}
/* Dock: la scheda al centro si ingrandisce e si alza, le vicine un po' meno (come il dock di macOS) */
.bd-cast--fx-dock.bd-cast--fx-on .bd-cast__item { transform: translateY(calc(var(--bdc-k, 0) * -.5rem)) scale(calc(1 + .2 * var(--bdc-k, 0))); }
/* Focus: al centro nitida e piena, ai lati piu' piccole e sfumate */
.bd-cast--fx-focus.bd-cast--fx-on .bd-cast__item { transform: scale(calc(.86 + .14 * var(--bdc-k, 0))); opacity: calc(.4 + .6 * var(--bdc-k, 0)); }
/* Carosello 3D: le schede ai lati sono inclinate verso il centro */
.bd-cast--fx-cover.bd-cast--fx-on .bd-cast__item {
	transform: perspective(60rem) rotateY(calc(var(--bdc-s, 0) * 38deg)) scale(calc(.86 + .14 * var(--bdc-k, 0)));
	opacity: calc(.55 + .45 * var(--bdc-k, 0));
}
@media (prefers-reduced-motion: reduce) {
	.bd-cast--fx-on .bd-cast__item { transform: none !important; opacity: 1 !important; }
}

/* ------------------------------------------- Grandezza del nome dell'attore (il personaggio la segue) */
.bd-cast--name-sm { --bdc-name: .8rem; }
.bd-cast--name-lg { --bdc-name: 1.08rem; }
.bd-cast--name-xl { --bdc-name: 1.25rem; }

/* ------------------------------------------------- Pulsante "Guarda la serie" (facoltativo) */
.bd-cast__cta { margin-top: .95rem; }
.bd-cast__cta .bd-btn-wrap { margin: 0; }
.bd-cast__cta--ed { pointer-events: none; }

/* Introduzione sotto il titolo */
.bd-cast .bd-cast__intro { margin: -.35rem 0 .9rem; font-size: .92rem; line-height: 1.45; opacity: .78; color: inherit; }

/* ------------------------------------------------------------- Tema Rai
   Blu Rai (#000099), testo bianco, accento azzurro; foto verticali come Netflix. */
.bd-cast--t-rai { --bdc-bg: #00006b; --bdc-muted: #b9c3ff; --bdc-accent: #4f7cff; --bdc-ar: 2 / 3; --bdc-ratio: 1.5; --bdc-radius: 8px; --bdc-w: 9.5rem; }
.bd-cast--t-rai.bd-cast--bg-theme { background: linear-gradient(135deg, #000099 0%, #00006b 60%, #000045 100%); }
.bd-cast--t-rai .bd-cast__title { font-weight: 800; }
.bd-cast--t-rai .bd-cast__title::after { content: ""; display: block; width: 2.4rem; height: 3px; margin-top: .35rem; background: #ffffff; border-radius: 2px; }
.bd-cast--t-rai .bd-cast__item:hover .bd-cast__photo { box-shadow: 0 0 0 2px #ffffff, 0 8px 20px rgba(0, 0, 40, .5); }
.bd-cast--t-rai.bd-cast--bg-auto { --bdc-bg: #eef1ff; --bdc-text: #00006b; --bdc-muted: #3d4a8f; --bdc-accent: #000099; }
.bd-cast--t-rai.bd-cast--bg-auto .bd-cast__title::after { background: #000099; }
.custom-dark .bd-cast--t-rai.bd-cast--bg-auto { --bdc-bg: #00006b; --bdc-text: #ffffff; --bdc-muted: #b9c3ff; --bdc-accent: #4f7cff; }
.custom-dark .bd-cast--t-rai.bd-cast--bg-auto .bd-cast__title::after { background: #ffffff; }
.bd-cast .bd-cast__logo-img--rai { height: 2.4rem; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .45); }
@media (max-width: 700px) { .bd-cast .bd-cast__logo-img--rai { height: 2.1rem; } }
