/* =========================================================================
   Lista de YouTube — estilos
   Personalizable con variables CSS en .ytpl (o con el atributo color="").
   ========================================================================= */

.ytpl {
	--ytpl-accent: #e62117;
	--ytpl-gap: clamp(16px, 2.2vw, 28px);
	--ytpl-radius: 14px;
	--ytpl-card-bg: #fff;
	--ytpl-text: inherit;
	--ytpl-muted: rgba(0, 0, 0, .55);
	--ytpl-border: rgba(0, 0, 0, .07);
	--ytpl-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px -6px rgba(16, 24, 40, .12);
	--ytpl-shadow-hover: 0 2px 4px rgba(16, 24, 40, .06), 0 22px 40px -14px rgba(16, 24, 40, .28);
	--ytpl-ease: cubic-bezier(.2, .7, .2, 1);

	margin: 0 0 2.5em;
	color: var(--ytpl-text);
}

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

/* Título opcional -------------------------------------------------------- */
.ytpl h3.ytpl__heading {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 1.1em;
	padding: 0;
	font-size: clamp(1.25em, 2.2vw, 1.6em);
	line-height: 1.2;
	letter-spacing: -.01em;
}

.ytpl h3.ytpl__heading::after {
	content: "";
	flex: 1;
	height: 1px;
	background: linear-gradient(90deg, var(--ytpl-border), transparent);
}

/* Botones sin estilos del tema ------------------------------------------- */
.ytpl button.ytpl__poster,
.ytpl button.ytpl__card {
	all: unset;
	box-sizing: border-box;
	display: block;
	width: 100%;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* Reproductor grande (layout="player") ----------------------------------- */
.ytpl__player,
.ytpl__ratio {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #0b0b0c;
	border-radius: var(--ytpl-radius);
	box-shadow: var(--ytpl-shadow-hover);
}

.ytpl__player iframe,
.ytpl__ratio iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.ytpl button.ytpl__poster {
	position: absolute;
	inset: 0;
	height: 100%;
}

.ytpl__poster img,
.ytpl__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	transition: transform .7s var(--ytpl-ease), filter .7s var(--ytpl-ease);
}

.ytpl__poster::after,
.ytpl__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgba(0, 0, 0, .18) 0%, transparent 28%),
		linear-gradient(0deg, rgba(0, 0, 0, .38) 0%, transparent 45%);
	transition: opacity .4s var(--ytpl-ease);
	pointer-events: none;
}

.ytpl__poster:hover img,
.ytpl__card:hover .ytpl__thumb img {
	transform: scale(1.045);
}

p.ytpl__now {
	margin: .9em 0 1.6em;
	padding: 0 0 0 14px;
	border-left: 3px solid var(--ytpl-accent);
	font-size: 1.05em;
	font-weight: 600;
	line-height: 1.35;
}

/* Botón de play ---------------------------------------------------------- */
.ytpl__play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	background: rgba(255, 255, 255, .22);
	border: 1px solid rgba(255, 255, 255, .45);
	-webkit-backdrop-filter: blur(8px) saturate(140%);
	backdrop-filter: blur(8px) saturate(140%);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
	transition: transform .45s var(--ytpl-ease), background-color .3s, border-color .3s;
	pointer-events: none;
}

.ytpl__play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin-left: 2px;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
}

.ytpl__thumb .ytpl__play {
	width: 50px;
	height: 50px;
}

.ytpl__thumb .ytpl__play::after {
	border-width: 8px 0 8px 13px;
}

.ytpl__poster:hover .ytpl__play,
.ytpl__poster:focus-visible .ytpl__play,
.ytpl__card:hover .ytpl__play,
.ytpl__card:focus-visible .ytpl__play {
	background: var(--ytpl-accent);
	border-color: var(--ytpl-accent);
	transform: translate(-50%, -50%) scale(1.08);
}

/* Rejilla ---------------------------------------------------------------- */
.ytpl ul.ytpl__grid {
	display: grid;
	grid-template-columns: repeat(var(--ytpl-cols, 3), minmax(0, 1fr));
	gap: var(--ytpl-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ytpl ul.ytpl__grid li.ytpl__item {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ytpl__item::before,
.ytpl__item::marker {
	content: none;
}

/* Tarjeta */
.ytpl button.ytpl__card,
.ytpl div.ytpl__card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: var(--ytpl-card-bg);
	border: 1px solid var(--ytpl-border);
	border-radius: var(--ytpl-radius);
	box-shadow: var(--ytpl-shadow);
	transition: transform .45s var(--ytpl-ease), box-shadow .45s var(--ytpl-ease), border-color .3s;
}

.ytpl button.ytpl__card:hover {
	transform: translateY(-4px);
	box-shadow: var(--ytpl-shadow-hover);
}

.ytpl button.ytpl__card:focus-visible {
	outline: 2px solid var(--ytpl-accent);
	outline-offset: 3px;
}

.ytpl__thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #0b0b0c;
}

/* En la tarjeta que se está reproduciendo, el vídeo ocupa el lugar de la miniatura */
.ytpl div.ytpl__card.is-playing {
	box-shadow: var(--ytpl-shadow-hover);
}

.ytpl__card.is-playing .ytpl__ratio {
	border-radius: 0;
	box-shadow: none;
}

.ytpl__meta {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 16px 18px 18px;
}

.ytpl__title {
	display: -webkit-box;
	overflow: hidden;
	font-size: 1em;
	font-weight: 600;
	line-height: 1.4;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	transition: color .3s;
}

.ytpl button.ytpl__card:hover .ytpl__title {
	color: var(--ytpl-accent);
}

.ytpl__date {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin-top: auto;
	font-size: .78em;
	font-weight: 500;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ytpl-muted);
}

.ytpl__date::before {
	content: "";
	width: 18px;
	height: 1px;
	background: currentColor;
	opacity: .6;
}

/* Vídeo activo (layout="player") */
.ytpl .ytpl__item.is-active button.ytpl__card {
	border-color: var(--ytpl-accent);
	box-shadow: 0 0 0 1px var(--ytpl-accent), var(--ytpl-shadow);
}

.ytpl__item.is-active .ytpl__play {
	background: var(--ytpl-accent);
	border-color: var(--ytpl-accent);
}

/* Etiquetas de directo --------------------------------------------------- */
.ytpl__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px;
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: #fff;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
	pointer-events: none;
}

.ytpl__badge--live {
	background: #e62117;
}

.ytpl__badge--live::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #fff;
	animation: ytpl-pulse 1.6s ease-in-out infinite;
}

.ytpl__badge--upcoming {
	background: rgba(15, 15, 18, .62);
	border: 1px solid rgba(255, 255, 255, .25);
}

@keyframes ytpl-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
	50%      { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0); }
}

/* Enlace a YouTube ------------------------------------------------------- */

.ytpl a.ytpl__more {
	display: flex;
	width: fit-content;
	align-items: center;
	gap: 10px;
	margin: 2em auto 0;
	padding: 12px 24px;
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: .9em;
	font-weight: 600;
	letter-spacing: .02em;
	text-decoration: none;
	color: var(--ytpl-accent);
	transition: background-color .3s, color .3s, gap .3s var(--ytpl-ease);
}

.ytpl a.ytpl__more:hover,
.ytpl a.ytpl__more:focus-visible {
	gap: 14px;
	background: var(--ytpl-accent);
	border-color: var(--ytpl-accent);
	color: #fff;
}

.ytpl a.ytpl__more svg {
	flex: none;
}

/* Responsive ------------------------------------------------------------- */
@media (max-width: 980px) {
	.ytpl ul.ytpl__grid {
		grid-template-columns: repeat(min(var(--ytpl-cols, 3), 2), minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.ytpl {
		--ytpl-radius: 12px;
	}
	.ytpl--grid ul.ytpl__grid {
		grid-template-columns: 1fr;
	}
	.ytpl--player ul.ytpl__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
	.ytpl--player .ytpl__meta {
		padding: 10px 12px 12px;
	}
	.ytpl--player .ytpl__title {
		font-size: .88em;
	}
	.ytpl--player .ytpl__date {
		display: none;
	}
	.ytpl__play {
		width: 56px;
		height: 56px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ytpl *,
	.ytpl *::before,
	.ytpl *::after {
		animation: none !important;
		transition: none !important;
	}
	.ytpl button.ytpl__card:hover {
		transform: none;
	}
}
