/**
 * Survias X Feed - estilos del carrusel.
 *
 * La pista es un contenedor con scroll nativo y scroll-snap: el gesto tactil,
 * la inercia y el foco de teclado los resuelve el navegador. Las columnas se
 * controlan con variables que inyecta el shortcode.
 */

.survias-x {
	--sx-gap: 20px;
	--sx-radio: 16px;
	--sx-cols: 3;
	--sx-cols-tablet: 2;
	--sx-cols-movil: 1;
	--sx-accent: #1d9bf0;

	--sx-fondo: #ffffff;
	--sx-fondo-hover: #f7f9fa;
	--sx-borde: #e2e8f0;
	--sx-texto: #0f172a;
	--sx-suave: #64748b;
	--sx-sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
	--sx-sombra-hover: 0 2px 4px rgba(15, 23, 42, .06), 0 16px 40px rgba(15, 23, 42, .1);

	position: relative;
	box-sizing: border-box;
	color: var(--sx-texto);
}

.survias-x *,
.survias-x *::before,
.survias-x *::after {
	box-sizing: inherit;
}

/* --- Tema oscuro ---------------------------------------------------------- */

.survias-x[data-theme="oscuro"] {
	--sx-fondo: #16181c;
	--sx-fondo-hover: #1d1f23;
	--sx-borde: #2f3336;
	--sx-texto: #e7e9ea;
	--sx-suave: #71767b;
	--sx-sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
	--sx-sombra-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
	.survias-x[data-theme="auto"] {
		--sx-fondo: #16181c;
		--sx-fondo-hover: #1d1f23;
		--sx-borde: #2f3336;
		--sx-texto: #e7e9ea;
		--sx-suave: #71767b;
		--sx-sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
		--sx-sombra-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
	}
}

/* --- Estructura ----------------------------------------------------------- */

.survias-x__titulo {
	margin: 0 0 1.25rem;
	font-size: clamp(1.25rem, 2.5vw, 1.75rem);
	line-height: 1.25;
	color: inherit;
}

.survias-x__marco {
	position: relative;
}

.survias-x__pista {
	display: flex;
	gap: var(--sx-gap);
	margin: 0;
	padding: 6px 2px 8px;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.survias-x__pista::-webkit-scrollbar {
	display: none;
}

.survias-x__pista:focus-visible {
	outline: 2px solid var(--sx-accent);
	outline-offset: 4px;
	border-radius: var(--sx-radio);
}

.survias-x__slide {
	flex: 0 0 calc((100% - (var(--sx-cols) - 1) * var(--sx-gap)) / var(--sx-cols));
	display: flex;
	scroll-snap-align: start;
	margin: 0;
	padding: 0;
}

@media (max-width: 1024px) {
	.survias-x__slide {
		flex-basis: calc((100% - (var(--sx-cols-tablet) - 1) * var(--sx-gap)) / var(--sx-cols-tablet));
	}
}

@media (max-width: 640px) {
	.survias-x {
		--sx-gap: 14px;
	}

	.survias-x__slide {
		flex-basis: calc((100% - (var(--sx-cols-movil) - 1) * var(--sx-gap)) / var(--sx-cols-movil));
	}
}

/* --- Tarjeta -------------------------------------------------------------- */

.sx-tarjeta {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: .875rem;
	width: 100%;
	padding: 1.125rem 1.25rem 1rem;
	background: var(--sx-fondo);
	border: 1px solid var(--sx-borde);
	border-radius: var(--sx-radio);
	box-shadow: var(--sx-sombra);
	transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease;
}

.sx-tarjeta:hover,
.sx-tarjeta:focus-within {
	background: var(--sx-fondo-hover);
	box-shadow: var(--sx-sombra-hover);
	transform: translateY(-3px);
}

.sx-tarjeta__cabecera {
	display: flex;
	align-items: center;
	gap: .75rem;
}

.sx-tarjeta__avatar {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--sx-borde);
}

.sx-tarjeta__avatar--inicial {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1.125rem;
	color: #fff;
	background: var(--sx-accent);
}

.sx-tarjeta__identidad {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.sx-tarjeta__nombre {
	display: flex;
	align-items: center;
	gap: .25rem;
	font-weight: 700;
	font-size: .95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sx-tarjeta__nombre .sx-icono--verificado {
	flex: 0 0 auto;
	color: var(--sx-accent);
}

.sx-tarjeta__handle {
	font-size: .85rem;
	color: var(--sx-suave);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sx-tarjeta__logo {
	margin-left: auto;
	color: var(--sx-texto);
	opacity: .75;
	line-height: 0;
}

.sx-tarjeta__logo .sx-icono {
	width: 18px;
	height: 18px;
}

.sx-tarjeta__cuerpo {
	display: flex;
	flex-direction: column;
	gap: .875rem;
	flex: 1 1 auto;
}

.sx-tarjeta__texto {
	margin: 0;
	font-size: .975rem;
	line-height: 1.5;
	overflow-wrap: anywhere;

	/* Recorte a 6 lineas para que todas las tarjetas midan parecido. */
	display: -webkit-box;
	-webkit-line-clamp: 6;
	line-clamp: 6;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sx-tarjeta__texto a {
	position: relative;
	z-index: 2;
	color: var(--sx-accent);
	text-decoration: none;
}

.sx-tarjeta__texto a:hover,
.sx-tarjeta__texto a:focus {
	text-decoration: underline;
}

.sx-tarjeta__medio {
	margin: 0;
	border-radius: calc(var(--sx-radio) - 6px);
	overflow: hidden;
	border: 1px solid var(--sx-borde);
	aspect-ratio: 16 / 9;
	background: var(--sx-borde);
}

.sx-tarjeta__medio img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sx-tarjeta__pie {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-top: .75rem;
	border-top: 1px solid var(--sx-borde);
	font-size: .8125rem;
	color: var(--sx-suave);
}

.sx-tarjeta__metricas {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sx-tarjeta__metricas li {
	display: flex;
	align-items: center;
	gap: .3rem;
	margin: 0;
}

.sx-tarjeta__metricas .sx-icono {
	width: 14px;
	height: 14px;
	opacity: .8;
}

/* Capa invisible que hace clicable toda la tarjeta sin anidar enlaces. */
.sx-tarjeta__enlace {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--sx-radio);
	text-decoration: none;
}

.sx-tarjeta__enlace:focus-visible {
	outline: 2px solid var(--sx-accent);
	outline-offset: 3px;
}

/* --- Flechas -------------------------------------------------------------- */

.survias-x__flecha {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	color: var(--sx-texto);
	background: var(--sx-fondo);
	border: 1px solid var(--sx-borde);
	border-radius: 50%;
	box-shadow: var(--sx-sombra);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}

.survias-x__flecha:hover:not(:disabled) {
	color: #fff;
	background: var(--sx-accent);
	border-color: var(--sx-accent);
}

.survias-x__flecha:focus-visible {
	outline: 2px solid var(--sx-accent);
	outline-offset: 2px;
}

.survias-x__flecha:disabled {
	opacity: .35;
	cursor: default;
}

.survias-x__flecha .sx-icono {
	width: 22px;
	height: 22px;
}

.survias-x__flecha--prev {
	left: -21px;
}

.survias-x__flecha--next {
	right: -21px;
}

/* Sin espacio lateral suficiente, las flechas se meten sobre la pista. */
@media (max-width: 1280px) {
	.survias-x__flecha--prev {
		left: 6px;
	}

	.survias-x__flecha--next {
		right: 6px;
	}
}

@media (max-width: 640px) {
	.survias-x__flecha {
		display: none;
	}
}

/* --- Puntos --------------------------------------------------------------- */

.survias-x__puntos {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	margin-top: 1.125rem;
}

.survias-x__punto {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sx-borde);
	cursor: pointer;
	transition: width .25s ease, background-color .25s ease;
}

.survias-x__punto[aria-selected="true"] {
	width: 24px;
	border-radius: 999px;
	background: var(--sx-accent);
}

.survias-x__punto:focus-visible {
	outline: 2px solid var(--sx-accent);
	outline-offset: 3px;
}

/* --- Accesibilidad -------------------------------------------------------- */

.survias-x .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) {
	.survias-x__pista {
		scroll-behavior: auto;
	}

	.sx-tarjeta,
	.survias-x__punto,
	.survias-x__flecha {
		transition: none;
	}

	.sx-tarjeta:hover,
	.sx-tarjeta:focus-within {
		transform: none;
	}
}
