/* DQD YouTube — estilos
 * Base compartida bajo .dqd-yt; cada layout tiene sus reglas aisladas bajo
 * .dqd-yt-destacado, .dqd-yt-grilla y .dqd-yt-slider (nunca se pisan entre sí).
 * Las miniaturas usan el truco padding-bottom 56.25% (16:9) para no depender
 * de aspect-ratio ni de los estilos de imagen del tema.
 */

/* =====================================================================
 * Base compartida
 * ================================================================== */

.dqd-yt {
	--dqd-orange: #EE7200;
	--dqd-radius: 8px;
	--dqd-gap: 16px;
	display: block;
	margin: 0 0 24px;
	padding: 0;
	font-family: inherit;
}

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

.dqd-yt a.dqd-yt-link,
.dqd-yt a.dqd-yt-link:hover,
.dqd-yt a.dqd-yt-link:focus {
	display: block;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	border: 0;
	background: none;
}

.dqd-yt a.dqd-yt-link:focus-visible {
	outline: 2px solid var(--dqd-orange);
	outline-offset: 3px;
	border-radius: var(--dqd-radius);
}

.dqd-yt .dqd-yt-thumb {
	position: relative;
	display: block;
	width: 100%;
	height: 0;
	padding: 0 0 56.25%; /* 16:9 */
	margin: 0;
	overflow: hidden;
	border-radius: var(--dqd-radius);
	background: #111;
}

.dqd-yt .dqd-yt-thumb img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	min-width: 0;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform .5s ease;
}

/* Capa que oscurece al hover */
.dqd-yt .dqd-yt-thumb::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	background: rgba(0, 0, 0, 0);
	transition: background .25s ease;
	pointer-events: none;
}

.dqd-yt .dqd-yt-play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	margin: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .85);
	box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
	transform: translate(-50%, -50%);
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
}

.dqd-yt .dqd-yt-play svg {
	display: block;
	width: 26px;
	height: 26px;
	margin-left: 3px;
	fill: var(--dqd-orange);
}

.dqd-yt .dqd-yt-duration {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 3;
	padding: 4px 7px;
	border-radius: 4px;
	background: rgba(0, 0, 0, .78);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .02em;
}

.dqd-yt .dqd-yt-title {
	margin: 10px 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-family: inherit;
	font-size: 16px;
	font-style: normal;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	transition: color .2s ease;
}

.dqd-yt .dqd-yt-title::before,
.dqd-yt .dqd-yt-title::after {
	content: none;
}

.dqd-yt .dqd-yt-link:hover .dqd-yt-thumb::after,
.dqd-yt .dqd-yt-link:focus-visible .dqd-yt-thumb::after {
	background: rgba(0, 0, 0, .45);
}

.dqd-yt .dqd-yt-link:hover .dqd-yt-thumb img {
	transform: scale(1.04);
}

.dqd-yt .dqd-yt-link:hover .dqd-yt-title,
.dqd-yt .dqd-yt-link:focus-visible .dqd-yt-title {
	color: var(--dqd-orange);
}

/* =====================================================================
 * 1. Destacado — grande 16:9 (2/3) + 2 chicos apilados (1/3)
 * ================================================================== */

.dqd-yt.dqd-yt-destacado {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: var(--dqd-gap);
	align-items: stretch;
}

.dqd-yt.dqd-yt-destacado.dqd-yt-destacado--solo {
	grid-template-columns: minmax(0, 1fr);
}

/* El video grande define la altura del bloque (16:9 por padding). */
.dqd-yt-destacado .dqd-yt-main {
	min-width: 0;
}

/* La columna derecha no aporta altura: su contenido está posicionado
 * en absoluto y ocupa exactamente la altura del video grande. */
.dqd-yt-destacado .dqd-yt-side {
	position: relative;
	min-width: 0;
	min-height: 0;
}

.dqd-yt-destacado .dqd-yt-side-inner {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	gap: var(--dqd-gap);
}

.dqd-yt-destacado .dqd-yt-side .dqd-yt-item {
	flex: 1 1 0;
	min-height: 0;
	overflow: hidden;
	border-radius: var(--dqd-radius);
}

.dqd-yt-destacado .dqd-yt-side .dqd-yt-link {
	height: 100%;
}

.dqd-yt-destacado .dqd-yt-side .dqd-yt-thumb {
	height: 100%;
	padding-bottom: 0;
}

/* Degradado oscuro de abajo hacia arriba */
.dqd-yt-destacado .dqd-yt-thumb::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .45) 35%, rgba(0, 0, 0, 0) 65%);
	pointer-events: none;
}

.dqd-yt-destacado .dqd-yt-link:hover .dqd-yt-thumb::after,
.dqd-yt-destacado .dqd-yt-link:focus-visible .dqd-yt-thumb::after {
	background: rgba(0, 0, 0, .2);
}

/* Títulos en blanco sobre la miniatura */
.dqd-yt.dqd-yt-destacado .dqd-yt-title,
.dqd-yt.dqd-yt-destacado .dqd-yt-link:hover .dqd-yt-title,
.dqd-yt.dqd-yt-destacado .dqd-yt-link:focus-visible .dqd-yt-title {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 3;
	margin: 0;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.dqd-yt.dqd-yt-destacado .dqd-yt-main .dqd-yt-title {
	padding: 24px;
	font-size: clamp(18px, 2.2vw, 28px);
	line-height: 1.25;
}

.dqd-yt.dqd-yt-destacado .dqd-yt-side .dqd-yt-title {
	display: -webkit-box;
	padding: 12px 14px;
	overflow: hidden;
	font-size: 15px;
	line-height: 1.3;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.dqd-yt-destacado .dqd-yt-main .dqd-yt-play {
	width: 80px;
	height: 80px;
}

.dqd-yt-destacado .dqd-yt-main .dqd-yt-play svg {
	width: 34px;
	height: 34px;
}

.dqd-yt-destacado .dqd-yt-main .dqd-yt-link:hover .dqd-yt-play {
	transform: translate(-50%, -50%) scale(1.08);
}

.dqd-yt-destacado .dqd-yt-side .dqd-yt-play {
	width: 48px;
	height: 48px;
	opacity: 0;
	transform: translate(-50%, -50%) scale(.8);
}

.dqd-yt-destacado .dqd-yt-side .dqd-yt-play svg {
	width: 20px;
	height: 20px;
}

.dqd-yt-destacado .dqd-yt-side .dqd-yt-link:hover .dqd-yt-play,
.dqd-yt-destacado .dqd-yt-side .dqd-yt-link:focus-visible .dqd-yt-play {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Mobile (< 768px): los 3 videos apilados en una sola columna, cada uno
 * al 100% del ancho y en 16:9. Sin grid ni posición absoluta en los
 * contenedores, y todo con height: auto, para que el bloque ocupe su
 * altura real y no se superponga con el contenido de abajo.
 * Los !important evitan que el tema o el constructor de páginas impongan
 * alturas fijas. Solo quedan en absoluto las capas internas de la
 * miniatura (imagen, degradado, play, título), que están contenidas en
 * su caja 16:9. */
@media (max-width: 767px) {
	.dqd-yt.dqd-yt-destacado,
	.dqd-yt.dqd-yt-destacado.dqd-yt-destacado--solo {
		display: flex !important;
		flex-direction: column;
		gap: var(--dqd-gap);
		position: static !important;
		width: 100%;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		overflow: visible !important;
	}

	.dqd-yt-destacado .dqd-yt-main,
	.dqd-yt-destacado .dqd-yt-side,
	.dqd-yt-destacado .dqd-yt-side-inner,
	.dqd-yt-destacado .dqd-yt-side .dqd-yt-item {
		position: static !important;
		top: auto;
		right: auto;
		bottom: auto;
		left: auto;
		flex: none;
		width: 100%;
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
	}

	.dqd-yt-destacado .dqd-yt-side-inner {
		display: flex !important;
		flex-direction: column;
		gap: var(--dqd-gap);
	}

	.dqd-yt-destacado .dqd-yt-side .dqd-yt-item {
		overflow: visible;
	}

	.dqd-yt-destacado .dqd-yt-link,
	.dqd-yt-destacado .dqd-yt-side .dqd-yt-link {
		height: auto !important;
	}

	/* 16:9 por padding, sin altura fija */
	.dqd-yt-destacado .dqd-yt-main .dqd-yt-thumb,
	.dqd-yt-destacado .dqd-yt-side .dqd-yt-thumb {
		position: relative !important;
		height: 0 !important;
		padding-bottom: 56.25% !important;
	}

	/* Los chicos ahora tienen el mismo ancho que el grande: mismos estilos */
	.dqd-yt.dqd-yt-destacado .dqd-yt-main .dqd-yt-title,
	.dqd-yt.dqd-yt-destacado .dqd-yt-side .dqd-yt-title {
		display: -webkit-box;
		padding: 16px;
		overflow: hidden;
		font-size: 18px;
		line-height: 1.25;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
	}

	.dqd-yt-destacado .dqd-yt-main .dqd-yt-play,
	.dqd-yt-destacado .dqd-yt-side .dqd-yt-play {
		width: 60px;
		height: 60px;
		opacity: 1;
		transform: translate(-50%, -50%);
	}

	.dqd-yt-destacado .dqd-yt-main .dqd-yt-play svg,
	.dqd-yt-destacado .dqd-yt-side .dqd-yt-play svg {
		width: 26px;
		height: 26px;
	}
}

/* Refuerzo mobile: el contenedor nunca toma altura fija */
@media (max-width: 767px) {
	.dqd-yt-destacado {
		display: flex !important;
		flex-direction: column !important;
		height: auto !important;
		min-height: unset !important;
		position: relative !important;
		overflow: visible !important;
	}

	.dqd-yt-destacado .dqd-yt-main,
	.dqd-yt-destacado .dqd-yt-side {
		width: 100% !important;
		height: auto !important;
		position: static !important;
		float: none !important;
	}

	.dqd-yt-destacado .dqd-yt-side {
		display: flex !important;
		flex-direction: column !important;
		gap: 12px !important;
	}
}

/* =====================================================================
 * 2. Grilla
 * ================================================================== */

.dqd-yt.dqd-yt-grilla {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: var(--dqd-gap);
	row-gap: 24px;
}

.dqd-yt.dqd-yt-grilla.dqd-yt-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dqd-yt.dqd-yt-grilla.dqd-yt-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.dqd-yt-grilla .dqd-yt-item {
	min-width: 0;
}

/* Play solo al hover */
.dqd-yt-grilla .dqd-yt-play {
	opacity: 0;
	transform: translate(-50%, -50%) scale(.8);
}

.dqd-yt-grilla .dqd-yt-link:hover .dqd-yt-play,
.dqd-yt-grilla .dqd-yt-link:focus-visible .dqd-yt-play {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

@media (hover: none) {
	.dqd-yt-grilla .dqd-yt-play {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
	}
}

@media (max-width: 1024px) {
	.dqd-yt.dqd-yt-grilla.dqd-yt-cols-3,
	.dqd-yt.dqd-yt-grilla.dqd-yt-cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.dqd-yt.dqd-yt-grilla.dqd-yt-cols-2,
	.dqd-yt.dqd-yt-grilla.dqd-yt-cols-3,
	.dqd-yt.dqd-yt-grilla.dqd-yt-cols-4 {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* =====================================================================
 * 3. Slider
 * ================================================================== */

.dqd-yt.dqd-yt-slider {
	--dqd-visible: 3;
	--dqd-arrow-top: 28%;
	position: relative;
}

.dqd-yt.dqd-yt-slider.dqd-yt-cols-2 { --dqd-visible: 2; }
.dqd-yt.dqd-yt-slider.dqd-yt-cols-4 { --dqd-visible: 4; }

@media (max-width: 1024px) {
	.dqd-yt.dqd-yt-slider.dqd-yt-cols-3,
	.dqd-yt.dqd-yt-slider.dqd-yt-cols-4 {
		--dqd-visible: 2;
	}
}

@media (max-width: 600px) {
	.dqd-yt.dqd-yt-slider.dqd-yt-cols-2,
	.dqd-yt.dqd-yt-slider.dqd-yt-cols-3,
	.dqd-yt.dqd-yt-slider.dqd-yt-cols-4 {
		--dqd-visible: 1;
	}
}

.dqd-yt-slider .dqd-yt-track {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--dqd-gap);
	margin: 0;
	padding: 2px 0 4px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

.dqd-yt-slider .dqd-yt-track::-webkit-scrollbar {
	display: none;
}

/* Título siempre visible debajo de la miniatura, con color propio
 * (no hereda el color de texto de la sección, que puede ser blanco). */
.dqd-yt.dqd-yt-slider .dqd-yt-title {
	position: static;
	display: block;
	visibility: visible;
	opacity: 1;
	max-height: none;
	overflow: visible;
	transform: none;
	margin: 10px 0 0;
	color: #3D3D3D;
}

.dqd-yt.dqd-yt-slider .dqd-yt-link:hover .dqd-yt-title,
.dqd-yt.dqd-yt-slider .dqd-yt-link:focus-visible .dqd-yt-title {
	color: #EE7200;
}

.dqd-yt-slider .dqd-yt-slide {
	flex: 0 0 calc((100% - (var(--dqd-visible) - 1) * var(--dqd-gap)) / var(--dqd-visible));
	min-width: 0;
	scroll-snap-align: start;
}

.dqd-yt-slider .dqd-yt-arrow,
.dqd-yt-slider .dqd-yt-arrow:hover,
.dqd-yt-slider .dqd-yt-arrow:focus {
	position: absolute;
	top: var(--dqd-arrow-top);
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 0;
	height: 44px;
	min-height: 0;
	margin: -22px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--dqd-orange);
	font-size: 0;
	line-height: 1;
	text-shadow: none;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
	cursor: pointer;
	transition: background .2s ease, color .2s ease, opacity .2s ease;
}

.dqd-yt-slider .dqd-yt-arrow svg {
	display: block;
	width: 24px;
	height: 24px;
	fill: currentColor;
}

.dqd-yt-slider .dqd-yt-arrow:hover,
.dqd-yt-slider .dqd-yt-arrow:focus-visible {
	background: var(--dqd-orange);
	color: #fff;
	outline: none;
}

.dqd-yt-slider .dqd-yt-arrow:disabled {
	opacity: 0;
	pointer-events: none;
}

.dqd-yt-slider .dqd-yt-prev { left: 8px; right: auto; }
.dqd-yt-slider .dqd-yt-next { right: 8px; left: auto; }
.dqd-yt-slider .dqd-yt-next svg { transform: rotate(180deg); }

.dqd-yt-slider.is-static .dqd-yt-arrow {
	display: none;
}

/* =====================================================================
 * Lightbox (fuera de .dqd-yt, se agrega al <body>)
 * ================================================================== */

body.dqd-yt-lb-open {
	overflow: hidden;
}

.dqd-yt-lb {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .88);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
	font-family: inherit;
}

.dqd-yt-lb.is-open {
	opacity: 1;
	visibility: visible;
}

.dqd-yt-lb .dqd-yt-lb-dialog {
	position: relative;
	width: min(90vw, calc((100vh - 140px) * 16 / 9));
	transform: scale(.96);
	transition: transform .25s ease;
}

.dqd-yt-lb.is-open .dqd-yt-lb-dialog {
	transform: scale(1);
}

.dqd-yt-lb .dqd-yt-lb-frame {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%;
	overflow: hidden;
	border-radius: 8px;
	background: #000;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.dqd-yt-lb .dqd-yt-lb-frame iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
}

.dqd-yt-lb .dqd-yt-lb-title {
	margin: 12px 0 0;
	padding: 0;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
}

.dqd-yt-lb .dqd-yt-lb-close,
.dqd-yt-lb .dqd-yt-lb-close:hover,
.dqd-yt-lb .dqd-yt-lb-close:focus {
	position: absolute;
	top: -52px;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	min-width: 0;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	font-size: 0;
	box-shadow: none;
	cursor: pointer;
	transition: background .2s ease;
}

.dqd-yt-lb .dqd-yt-lb-close:hover,
.dqd-yt-lb .dqd-yt-lb-close:focus-visible {
	background: #EE7200;
	outline: none;
}

.dqd-yt-lb .dqd-yt-lb-close svg {
	display: block;
	width: 22px;
	height: 22px;
	fill: currentColor;
}

@media (max-width: 767px) {
	.dqd-yt-lb .dqd-yt-lb-dialog {
		width: 100%;
	}

	.dqd-yt-lb .dqd-yt-lb-frame {
		border-radius: 0;
	}

	.dqd-yt-lb .dqd-yt-lb-title {
		padding: 0 16px;
	}

	.dqd-yt-lb .dqd-yt-lb-close,
	.dqd-yt-lb .dqd-yt-lb-close:hover,
	.dqd-yt-lb .dqd-yt-lb-close:focus {
		right: 12px;
	}
}

.dqd-yt-empty {
	padding: 12px 16px;
	border-left: 4px solid #EE7200;
	background: rgba(238, 114, 0, .08);
}

@media (prefers-reduced-motion: reduce) {
	.dqd-yt *,
	.dqd-yt-lb,
	.dqd-yt-lb * {
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
