/**
 * Carrusel de Noticias - estilos estructurales.
 *
 * Idea clave: el widget vive en un contenedor de 100 % del ancho de pantalla.
 * El encabezado y la primera tarjeta se alinean al "ancho del contenido"
 * (variable --cn-content-width) y el resto de tarjetas sobresale cortado por el
 * borde derecho de la pantalla (efecto peek).
 */

/* Asegura que el widget use todo el ancho disponible en contenedores flex. */
.elementor-widget-carrusel_noticias,
.elementor-widget-carrusel_noticias > .elementor-widget-container {
	width: 100%;
	max-width: 100%;
}

.cn-wrapper {
	--cn-content-width: 1140px;
	--cn-gutter: 20px;
	/* Distancia del borde de pantalla al inicio del contenido. */
	/* --cn-vw lo publica el JS en píxeles (ancho real del wrapper); 100 % es el respaldo. */
	--cn-edge: max(var(--cn-gutter), calc((var(--cn-vw, 100%) - var(--cn-content-width)) / 2));

	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	overflow-x: hidden; /* Respaldo para navegadores sin overflow: clip. */
}

@supports (overflow: clip) {
	.cn-wrapper {
		overflow-x: clip;
		overflow-y: visible;
	}
}

/* Respaldo en CSS; el JS lo afina con el ancho exacto sin la barra de scroll. */
.cn-wrapper.cn-fullbleed {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
}

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

/* ---------------------------------------------------------------
 * Encabezado
 * ------------------------------------------------------------- */
.cn-header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	padding-left: var(--cn-edge);
	padding-right: var(--cn-edge);
	margin-bottom: 32px;
}

.cn-header--nav-only {
	justify-content: flex-end;
}

.cn-header__text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

.cn-section-title {
	margin: 0 0 12px;
	font-size: clamp(2rem, 4vw, 3.5rem);
	font-weight: 700;
	line-height: 1.1;
	color: inherit;
}

.cn-section-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	font-size: 1.125rem;
	font-weight: 500;
	text-decoration: none;
	color: inherit;
	transition: color 0.25s ease, opacity 0.25s ease;
}

a.cn-section-link:hover,
a.cn-section-link:focus-visible {
	opacity: 0.75;
}

/* ---------------------------------------------------------------
 * Flechas
 * ------------------------------------------------------------- */
.cn-nav {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 8px;
}

.cn-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	font-size: 16px;
	line-height: 1;
	color: #fff;
	background-color: transparent;
	border: 1px solid currentColor;
	border-radius: 50%;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.cn-arrow svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.cn-arrow i {
	line-height: 1;
}

.cn-arrow img {
	width: 1em;
	height: 1em;
	object-fit: contain;
}

.cn-arrow:hover {
	transform: scale(1.05);
}

.cn-arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.cn-arrow.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

/* ---------------------------------------------------------------
 * Slider (efecto peek)
 * ------------------------------------------------------------- */
.cn-slider {
	/* El contenedor Swiper mide exactamente el ancho del contenido. */
	padding-left: var(--cn-edge);
	padding-right: var(--cn-edge);
}

/* overflow: visible para que las tarjetas sobresalgan por ambos lados del
 * contenido; el borde de la pantalla las recorta (wrapper con overflow-x: clip).
 * Al partir, el clip-path mantiene vacío el margen izquierdo; al primer
 * movimiento el JS agrega .cn-moved y ese margen se libera. */
.cn-wrapper .cn-swiper.swiper,
.cn-wrapper .cn-swiper.swiper-container {
	overflow: visible;
	clip-path: inset(-80px -100vw -80px 0);
	-webkit-user-select: none;
	user-select: none;
}

.cn-wrapper.cn-moved .cn-swiper.swiper,
.cn-wrapper.cn-moved .cn-swiper.swiper-container {
	clip-path: none;
}

.cn-swiper .swiper-wrapper {
	align-items: stretch;
}

.cn-swiper .swiper-slide {
	display: flex;
	height: auto;
	transition-property: opacity, transform;
	transition-duration: 0.5s;
	transition-timing-function: ease;
}

/* Tarjetas fuera de las centrales (asoman cortadas a los lados). */
.cn-swiper .swiper-slide.cn-faded {
	opacity: 0.35;
}

/* ---------------------------------------------------------------
 * Tarjeta
 * ------------------------------------------------------------- */
.cn-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	background-color: transparent;
	transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.cn-image {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	margin-bottom: 20px;
	overflow: hidden;
	border-radius: 16px;
	text-decoration: none;
}

.cn-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.cn-card:hover .cn-image img {
	transform: scale(1.05);
}

.cn-image--placeholder {
	background-color: rgba(128, 128, 128, 0.25);
}

.cn-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 0.5em;
	margin-bottom: 8px;
	font-size: 0.9375rem;
	line-height: 1.4;
}

.cn-category + .cn-date::before {
	content: "\00B7";
	margin-right: 0.5em;
}

.cn-title {
	margin: 0 0 14px;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.25;
}

.cn-title a {
	position: relative;
	z-index: 2;
	color: inherit;
	text-decoration: none;
	transition: color 0.25s ease, opacity 0.25s ease;
}

.cn-card:hover .cn-title a,
.cn-title a:focus-visible {
	opacity: 0.8;
}

.cn-excerpt {
	margin: 0 0 16px;
	font-size: 1rem;
	line-height: 1.6;
}

.cn-button-wrap {
	position: relative;
	z-index: 2;
	margin-top: auto;
}

/* Toda la tarjeta es clicable: un enlace transparente la cubre por completo. */
.cn-card-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
}

.cn-card a,
.cn-card img {
	-webkit-user-drag: none;
}

.cn-button {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	font-weight: 600;
	line-height: 1.4;
	color: inherit;
	text-decoration: none;
	background-color: transparent;
	transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}

.cn-button:hover,
.cn-button:focus-visible {
	opacity: 0.85;
}

/* Mensaje de ayuda en el editor cuando la query no devuelve entradas. */
.cn-empty {
	padding: 24px;
	text-align: center;
	border: 1px dashed currentColor;
	opacity: 0.7;
}

/* Texto solo para lectores de pantalla (por si el tema no lo define). */
.cn-wrapper .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.cn-wrapper *,
	.cn-wrapper *::before,
	.cn-wrapper *::after {
		transition-duration: 0.01ms !important;
	}
}
