/* ==========================================================================
   Bloque: Videos — tarjetas con portada + modal reproductor.
   Reutiliza de portfolio-grid.css: encabezado (.ko-grid__*), filtros y el
   modal (.ko-work-modal), con el modificador --video.
   Home: N tarjetas en fila (carrusel horizontal en el celular).
   Página /videos/: grilla de 2 → 3 → 4 columnas.
   ========================================================================== */

.ko-videos {
	--ko-videos-cols: 3;
	--ko-videos-ratio: 4 / 5;
	padding-bottom: 0;
}

.ko-videos--vertical {
	--ko-videos-ratio: 9 / 16;
}

.ko-videos--page {
	padding-top: clamp(40px, 6vw, 80px);
	padding-bottom: clamp(64px, 8vw, 120px);
}

/* Home: fondo oscuro (cambio de capítulo después del portfolio) --------- */

.ko-videos--dark {
	--ko-videos-fg: var(--ko-cream);
	padding-bottom: clamp(64px, 8vw, 128px);
	background: var(--ko-ink);
	color: var(--ko-videos-fg);
}

.ko-videos--dark.ko-videos--bleed {
	padding-bottom: 0;
}

.ko-videos--dark .ko-grid__label {
	color: color-mix(in srgb, var(--ko-cream) 62%, transparent);
}

.ko-videos--dark .ko-grid__title,
.ko-videos--dark .ko-grid__more {
	color: var(--ko-videos-fg);
}

.ko-videos--dark .ko-vcard__button {
	background: #1a1a1a;
}

.ko-videos--dark .ko-vcard__button:focus-visible {
	outline-color: var(--ko-cream);
	outline-offset: 3px;
}

/* Home: tarjetas separadas dentro de los márgenes de la página. */
@media (min-width: 768px) {
	.ko-videos--inset .ko-videos__frame {
		width: 100%;
		max-width: calc(var(--ko-container) + 2 * var(--ko-gutter));
		margin-inline: auto;
		padding-inline: var(--ko-gutter);
	}

	.ko-videos--inset .ko-videos__items {
		gap: 8px;
	}
}

/* Tarjetas ---------------------------------------------------------------- */

.ko-videos__items {
	display: grid;
	grid-template-columns: repeat(var(--ko-videos-cols), minmax(0, 1fr));
}

.ko-videos--page .ko-videos__items {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 768px) {
	.ko-videos--page .ko-videos__items {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1200px) {
	.ko-videos--page .ko-videos__items {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Home en celular: carrusel horizontal con snap (3 verticales apilados son eternos). */
@media (max-width: 767px) {
	.ko-videos--home .ko-videos__items {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 78%;
		gap: 6px;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: var(--ko-gutter);
		padding-inline: var(--ko-gutter);
		scrollbar-width: none;
	}

	.ko-videos--home .ko-videos__items::-webkit-scrollbar {
		display: none;
	}

	.ko-videos--home .ko-vcard {
		scroll-snap-align: start;
	}

	/* Página en 2 columnas: play y título más chicos para que no se toquen. */
	.ko-videos--page .ko-vcard__play {
		width: 46px;
		top: 42%;
	}

	.ko-videos--page .ko-vcard__overlay {
		padding: 12px;
	}

	.ko-videos--page .ko-vcard__title {
		font-size: 15px;
	}

	.ko-videos--page .ko-vcard__styles {
		font-size: 12px;
	}
}

.ko-vcard[hidden] {
	display: none;
}

.ko-vcard.is-entering {
	animation: ko-tile-in 0.5s var(--ko-ease-out) both;
}

.ko-vcard__button {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--ko-videos-ratio);
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	background: #111;
	color: var(--ko-cream);
	text-align: left;
	cursor: pointer;
}

.ko-vcard__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform: scale(1.01);
	transition: transform 0.3s cubic-bezier(0.05, 0.43, 0.15, 0.89);
}

/* Duración arriba a la izquierda: señal clara de que es un video. */
.ko-vcard__duration {
	position: absolute;
	z-index: 1;
	top: 12px;
	left: 12px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 9px 5px 8px;
	background: rgb(0 0 0 / 0.55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	color: var(--ko-cream);
	font-family: var(--ko-font-display);
	font-weight: 700;
	font-size: 12px;
	line-height: 1;
	letter-spacing: 0.06em;
	pointer-events: none;
}

.ko-vcard__duration .ko-icon {
	width: 9px;
	height: 9px;
}

/* Botón de play: círculo con borde fino, se rellena al pasar el mouse. */
.ko-vcard__play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: grid;
	place-items: center;
	width: clamp(56px, 5vw, 76px);
	aspect-ratio: 1;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	background: rgb(0 0 0 / 0.28);
	color: var(--ko-cream);
	transform: translate(-50%, -50%);
	transition: background-color 0.25s ease, color 0.25s ease, transform 0.45s var(--ko-ease-out);
}

.ko-vcard__play .ko-icon {
	width: 38%;
	height: 38%;
	margin-left: 6%; /* El triángulo se ve centrado ópticamente. */
}

.ko-vcard__overlay {
	position: absolute;
	inset: auto 0 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: clamp(16px, 2vw, 28px);
	background: linear-gradient(to top, rgb(0 0 0 / 0.78), transparent);
	pointer-events: none;
}

.ko-vcard__title {
	font-family: var(--ko-font-display);
	font-weight: 700;
	font-size: clamp(17px, 1.5vw, 24px);
	line-height: 1.05;
	text-transform: uppercase;
}

.ko-vcard__styles {
	font-size: 13px;
	font-style: italic;
	opacity: 0.8;
}

.ko-videos--no-titles .ko-vcard__overlay {
	display: none;
}

.ko-vcard__button:focus-visible {
	outline: 2px solid var(--ko-ink);
	outline-offset: -2px;
}

.ko-vcard__button:focus-visible .ko-vcard__play {
	background: var(--ko-cream);
	color: var(--ko-ink);
}

@media (hover: hover) {
	.ko-vcard__button:hover .ko-vcard__img {
		transform: scale(1.06);
		transition-duration: 0.5s;
		transition-timing-function: cubic-bezier(0.05, 0.43, 0.04, 0.87);
	}

	.ko-vcard__button:hover .ko-vcard__play {
		background: var(--ko-cream);
		color: var(--ko-ink);
		transform: translate(-50%, -50%) scale(1.08);
	}
}

/* Modal reproductor -------------------------------------------------------- */

.ko-work-modal--video .ko-work-modal__panel {
	grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
	width: min(100%, 1100px);
}

.ko-work-modal--video .ko-work-modal__figure {
	background: #000;
}

.ko-work-modal--video video {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.ko-work-modal--video .ko-work-modal__actions a {
	text-align: center;
}

@media (max-width: 900px) {
	/* En el celular el video ocupa casi toda la pantalla, como un Reel. */
	.ko-work-modal--video .ko-work-modal__panel {
		grid-template-columns: minmax(0, 1fr);
		height: 100svh;
		max-height: 100svh;
	}

	.ko-work-modal--video .ko-work-modal__figure {
		min-height: 0;
	}

	.ko-work-modal--video .ko-work-modal__copy {
		gap: 8px;
		max-height: none;
		padding: 14px 16px 16px;
	}

	.ko-work-modal--video .ko-work-modal__title {
		font-size: clamp(24px, 7vw, 36px);
	}

	.ko-work-modal--video .ko-work-modal__actions {
		margin-top: 6px;
	}

	.ko-work-modal--video .ko-work-modal__actions a,
	.ko-work-modal--video .ko-work-modal__actions button {
		min-height: 48px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ko-vcard__img,
	.ko-vcard__play {
		transition-duration: 0.01ms !important;
	}

	.ko-vcard__button:hover .ko-vcard__img {
		transform: scale(1.01);
	}

	.ko-vcard.is-entering {
		animation: none;
	}
}
