/* Ejemplos IA (30/10/2026): piezas propias de los casos de inteligencia artificial.
   Vídeo de apertura con sonido, mosaico ampliable, antes y después, tira de diapositivas,
   película y vídeos verticales. Sobre el sistema de casos del tema (jl-caso). Lo carga
   mu-plugins/jl-ia-casos.php solo en las páginas que usan estas piezas. */

.jl-caso .jl-grid > .jl-ia-lead,
.jl-caso .jl-grid > .jl-ia-mos,
.jl-caso .jl-grid > .jl-ia-cmpw,
.jl-caso .jl-grid > .jl-ia-film,
.jl-caso .jl-grid > .jl-ia-strip,
.jl-caso .jl-grid > .jl-ia-vert,
.jl-caso .jl-grid > .jl-caso__pair,
.jl-caso .jl-grid > .jl-caso__trio {
	grid-column: 1 / -1;
	min-width: 0;
}

/* Vídeo de apertura y película */
.jl-ia-lead,
.jl-ia-film {
	position: relative;
}

.jl-ia-lead video,
.jl-ia-film video,
.jl-caso__trio video.jl-ia-loop {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: #0b0b0a;
}

.jl-ia-pill {
	position: absolute;
	top: clamp(12px, 1.4vw, 20px);
	right: clamp(12px, 1.4vw, 20px);
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.55em 1em 0.55em 0.85em;
	border: 1px solid rgb(242 239 232 / 0.22);
	border-radius: 999px;
	background: rgb(11 11 10 / 0.55);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: #f2efe8;
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background-color 300ms var(--jl-ease);
}

.jl-ia-pill:hover {
	background: rgb(11 11 10 / 0.8);
}

.jl-ia-pill::before {
	content: "";
	width: 0.5em;
	height: 0.5em;
	border-radius: 50%;
	background: var(--jl-muted);
	transition: background-color 300ms;
}

.jl-ia-pill[aria-pressed="true"]::before {
	background: var(--jl-accent);
}

.jl-ia-play {
	position: absolute;
	inset: 0 0 auto;
	width: 100%;
	aspect-ratio: 16 / 9;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background: rgb(11 11 10 / 0.15);
	color: #f2efe8;
	font: inherit;
	cursor: pointer;
}

.jl-ia-play span {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.8em 1.4em;
	border: 1px solid rgb(242 239 232 / 0.3);
	border-radius: 999px;
	background: rgb(11 11 10 / 0.5);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.jl-ia-play span::before {
	content: "";
	width: 0;
	height: 0;
	border-left: 0.6em solid currentColor;
	border-top: 0.38em solid transparent;
	border-bottom: 0.38em solid transparent;
}

.jl-ia-film.is-on .jl-ia-play {
	opacity: 0;
	pointer-events: none;
}

/* Mosaico de escenas */
.jl-ia-mos {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-auto-flow: dense;
	gap: clamp(4px, 0.5vw, 8px);
}

.jl-ia-mos button {
	position: relative;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: #1a1917;
	cursor: zoom-in;
}

.jl-ia-mos button.xl {
	grid-column: span 2;
}

.jl-ia-mos img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 1.1s var(--jl-ease);
}

.jl-ia-mos button:hover img {
	transform: scale(1.035);
}

.jl-ia-mos span {
	position: absolute;
	left: 0.75rem;
	bottom: 0.6rem;
	font-size: 0.8125rem;
	color: #f2efe8;
	text-shadow: 0 1px 8px rgb(0 0 0 / 0.6);
	opacity: 0;
	transition: opacity 300ms;
}

.jl-ia-mos button:hover span,
.jl-ia-mos button:focus-visible span {
	opacity: 1;
}

@media (min-width: 900px) {
	.jl-ia-mos {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}

	.jl-ia-mos--4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.jl-ia-mos button.xl {
		grid-column: span 2;
		grid-row: span 2;
		aspect-ratio: auto;
	}

	/* Posiciones fijas de las piezas grandes: el mosaico cierra sin huecos. */
	.jl-ia-mos--30 button.xl-a { grid-column: 1 / 3; grid-row: 1 / 3; }
	.jl-ia-mos--30 button.xl-b { grid-column: 5 / 7; grid-row: 2 / 4; }
	.jl-ia-mos--30 button.xl-c { grid-column: 3 / 5; grid-row: 4 / 6; }
	.jl-ia-mos--30 button.xl-d { grid-column: 1 / 3; grid-row: 6 / 8; }
	.jl-ia-mos--4 button.xl-e { grid-column: 1 / 3; grid-row: 1 / 3; }
	.jl-ia-mos--4 button.xl-f { grid-column: 3 / 5; grid-row: 4 / 6; }
}

/* Visor */
dialog.jl-ia-lb {
	width: 100vw;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #f2efe8;
}

dialog.jl-ia-lb::backdrop {
	background: rgb(11 11 10 / 0.95);
}

.jl-ia-lb__st {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3.5rem 1rem 4.5rem;
}

.jl-ia-lb img {
	max-width: min(1600px, 100%);
	max-height: 100%;
	object-fit: contain;
}

.jl-ia-lb__cap {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 1.5rem;
	margin: 0;
	text-align: center;
	font-size: 0.875rem;
	color: var(--jl-muted);
}

.jl-ia-lb button {
	position: absolute;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid rgb(242 239 232 / 0.25);
	border-radius: 999px;
	background: rgb(11 11 10 / 0.6);
	color: #f2efe8;
	font: inherit;
	font-size: 1.1rem;
	cursor: pointer;
}

.jl-ia-lb__x {
	top: 1rem;
	right: 1rem;
}

.jl-ia-lb__pv {
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
}

.jl-ia-lb__nx {
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
}

/* Antes y después */
.jl-ia-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.jl-ia-tabs button {
	padding: 0.55em 1.05em;
	border: 1px solid var(--jl-rule-strong);
	border-radius: 999px;
	background: transparent;
	color: var(--jl-muted);
	font: inherit;
	font-size: 0.875rem;
	cursor: pointer;
	transition: all 300ms;
}

.jl-ia-tabs button[aria-selected="true"] {
	border-color: #f2efe8;
	background: #f2efe8;
	color: #0b0b0a;
}

.jl-ia-cmp {
	--p: 50%;
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #1a1917;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
}

.jl-ia-cmp img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.jl-ia-cmp .jl-ia-cmp__a {
	clip-path: inset(0 calc(100% - var(--p)) 0 0);
}

.jl-ia-cmp__h {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--p);
	width: 1px;
	background: #f2efe8;
	pointer-events: none;
}

.jl-ia-cmp__h::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid rgb(242 239 232 / 0.75);
	border-radius: 50%;
	background: rgb(242 239 232 / 0.14);
	transform: translate(-50%, -50%);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.jl-ia-cmp input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: ew-resize;
}

.jl-ia-cmp__tag {
	position: absolute;
	bottom: 0.875rem;
	padding: 0.35em 0.8em;
	border-radius: 999px;
	background: rgb(11 11 10 / 0.6);
	color: #f2efe8;
	font-size: 0.8125rem;
	pointer-events: none;
}

.jl-ia-cmp__tag--a {
	left: 0.875rem;
}

.jl-ia-cmp__tag--b {
	right: 0.875rem;
}

/* Tira de diapositivas: avanza sola y se arrastra */
.jl-ia-strip {
	display: flex;
	gap: var(--jl-gutter);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	cursor: grab;
}

.jl-ia-strip::-webkit-scrollbar {
	display: none;
}

.jl-ia-strip.is-drag {
	cursor: grabbing;
	scroll-snap-type: none;
}

.jl-ia-strip img {
	flex: 0 0 min(82%, 64rem);
	aspect-ratio: 16 / 9;
	object-fit: cover;
	scroll-snap-align: start;
	background: #1a1917;
	pointer-events: none;
	-webkit-user-drag: none;
}

/* Vídeos verticales, centrados */
.jl-ia-vert {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--jl-gutter);
}

.jl-ia-vert figure {
	margin: 0;
	width: min(100%, 22rem);
}

.jl-ia-vert video {
	display: block;
	width: 100%;
	aspect-ratio: 9 / 16;
	object-fit: cover;
	background: #0b0b0a;
}

.jl-ia-vert figcaption {
	margin-top: 0.875rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--jl-muted);
}

/* Vídeo cuadrado junto al texto */
.jl-caso__split > .jl-ia-square {
	position: relative;
	margin: 0;
	aspect-ratio: 1;
	overflow: hidden;
	background: #0b0b0a;
}

.jl-ia-square video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (min-width: 900px) {
	.jl-caso__split > .jl-ia-square {
		grid-column: 1 / span 5;
	}
}

/* Reparto IA / personas, dentro de la columna de texto */
:root .jl-caso__text > .jl-ia-k {
	font-size: var(--wp--preset--font-size--pequeno);
	color: var(--jl-muted);
}

.jl-caso__text > .jl-caso__list.jl-ia-list {
	grid-template-columns: minmax(0, 1fr);
}

:root .jl-caso__text > .jl-ia-k + .jl-ia-list {
	margin-block-start: 0.5rem;
}

@media (max-width: 640px) {
	.jl-ia-lb__pv,
	.jl-ia-lb__nx {
		top: auto;
		bottom: 1rem;
		transform: none;
	}

	.jl-ia-pill {
		top: 10px;
		right: 10px;
		font-size: 0.8125rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jl-ia-mos img {
		transition: none;
	}
}
