.brxe-shortcode:has(> .af-video),
.brxe-code:has(> .af-video) {
	width: 100%;
	align-self: stretch;
}

.af-video {
	--af-video-crop: 1.12;
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #000;
}

/* Base (mobile / iOS): iframe a tamaño real, recortado para ocultar la UI */
.af-video__frame {
	position: absolute;
	top: 50%;
	left: 50%;
	width: calc(100% * var(--af-video-crop));
	height: calc(100% * var(--af-video-crop));
	transform: translate(-50%, -50%);
	pointer-events: none;
}

/* Desktop: player de 3840×2160 escalado para que YouTube elija 4K */
.af-video--4k .af-video__frame {
	width: 3840px;
	height: 2160px;
	transform: translate(-50%, -50%) scale(var(--af-video-scale, 0.1));
	transform-origin: center;
}

.af-video__frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.af-video__cover {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	pointer-events: none;
	transition: opacity 0.4s;
}

.af-video.is-playing .af-video__cover {
	opacity: 0;
}

/* Botón de sonido: abajo a la derecha, negro con verde, barras que bailan con el audio. */
.af-video__sonido {
	--af-son-verde: var(--verde, #79d100);
	position: absolute;
	right: 140px; /* deja libre el botón flotante de WhatsApp, que va fijo en esa esquina */
	bottom: 20px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 46px;
	margin: 0;
	padding: 0 18px;
	border: 1px solid var(--af-son-verde);
	border-radius: 999px;
	background: #000;
	color: var(--af-son-verde);
	font-family: 'DM Sans', sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: 1;
	text-transform: uppercase;
	cursor: pointer;
	pointer-events: auto;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

/* Mientras está silenciado, un aro verde late para llamar la atención. */
.af-video__sonido::after {
	content: '';
	position: absolute;
	inset: -1px;
	border: 1px solid var(--af-son-verde);
	border-radius: inherit;
	opacity: 0;
	pointer-events: none;
	animation: af-sonido-aro 2.4s ease-out infinite;
}

.af-video__sonido[aria-pressed="true"]::after {
	display: none;
}

.af-video__sonido-icono {
	flex: none;
	overflow: visible;
}

.af-video__sonido-onda {
	opacity: 0;
	transform-origin: 11px 12px;
	transform: scale(0.6);
	transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.af-video__sonido-x {
	transition: opacity 0.2s ease;
}

.af-video__sonido[aria-pressed="true"] .af-video__sonido-onda {
	opacity: 1;
	transform: none;
}

.af-video__sonido[aria-pressed="true"] .af-video__sonido-x {
	opacity: 0;
}

.af-video__sonido-barras {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	height: 18px;
}

.af-video__sonido-barras i {
	display: block;
	width: 3px;
	height: 3px;
	border-radius: 2px;
	background: currentColor;
	transition: height 0.3s ease;
}

.af-video__sonido[aria-pressed="true"] .af-video__sonido-barras i {
	height: 16px;
	animation: af-sonido-barra 0.9s ease-in-out infinite;
}

.af-video__sonido[aria-pressed="true"] .af-video__sonido-barras i:nth-child(2) { animation-delay: -0.3s; animation-duration: 0.75s; }
.af-video__sonido[aria-pressed="true"] .af-video__sonido-barras i:nth-child(3) { animation-delay: -0.6s; animation-duration: 1.05s; }
.af-video__sonido[aria-pressed="true"] .af-video__sonido-barras i:nth-child(4) { animation-delay: -0.15s; animation-duration: 0.85s; }

@media (hover: hover) {
	.af-video__sonido:hover {
		background: var(--af-son-verde);
		color: #000;
		transform: translateY(-2px);
	}
}

.af-video__sonido:active {
	transform: scale(0.96);
}

.af-video__sonido:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

@keyframes af-sonido-aro {
	0% { opacity: 0.7; transform: scale(1); }
	70%, 100% { opacity: 0; transform: scale(1.35, 1.7); }
}

@keyframes af-sonido-barra {
	0%, 100% { height: 4px; }
	50% { height: 16px; }
}

@media (min-width: 721px) and (max-width: 1366px) {
	.af-video__sonido {
		right: 90px;
	}
}

@media (max-width: 720px) {
	.af-video__sonido {
		right: 12px;
		bottom: 10px;
		height: 40px;
		padding: 0 13px;
		gap: 8px;
	}

	.af-video__sonido-texto {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.af-video__sonido::after,
	.af-video__sonido-barras i {
		animation: none !important;
	}
}

.af-video-aviso {
	width: 100%;
	padding: 1rem;
	background: #fff3cd;
	color: #000;
	font-size: 14px;
}
